Usage of BATTLE_OPPOSITE

This commit is contained in:
Eduardo Quezada
2022-08-27 01:44:39 -04:00
parent 15d611ba65
commit 1f0a952546
6 changed files with 35 additions and 35 deletions

View File

@@ -5108,7 +5108,7 @@ static void Cmd_openpartyscreen(void)
}
else
{
gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_SIDE);
gActiveBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battlerId)));
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
gActiveBattler ^= BIT_FLANK;
@@ -6233,7 +6233,7 @@ static void Cmd_hpthresholds(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBattler = gActiveBattler ^ BIT_SIDE;
opposingBattler = BATTLE_OPPOSITE(gActiveBattler);
result = gBattleMons[opposingBattler].hp * 100 / gBattleMons[opposingBattler].maxHP;
if (result == 0)
@@ -6261,7 +6261,7 @@ static void Cmd_hpthresholds2(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
opposingBattler = gActiveBattler ^ BIT_SIDE;
opposingBattler = BATTLE_OPPOSITE(gActiveBattler);
hpSwitchout = *(gBattleStruct->hpOnSwitchout + GetBattlerSide(opposingBattler));
result = (hpSwitchout - gBattleMons[opposingBattler].hp) * 100 / hpSwitchout;
@@ -6299,7 +6299,7 @@ static void Cmd_various(void)
break;
case VARIOUS_SET_MAGIC_COAT_TARGET:
gBattlerAttacker = gBattlerTarget;
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (gSideTimers[side].followmeTimer != 0 && gBattleMons[gSideTimers[side].followmeTarget].hp != 0)
gBattlerTarget = gSideTimers[side].followmeTarget;
else
@@ -8399,7 +8399,7 @@ static void Cmd_cursetarget(void)
static void Cmd_trysetspikes(void)
{
u8 targetSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
u8 targetSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (gSideTimers[targetSide].spikesAmount == 3)
{
@@ -9781,7 +9781,7 @@ static void Cmd_snatchsetbattlers(void)
// Brick Break
static void Cmd_removelightscreenreflect(void)
{
u8 opposingSide = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
u8 opposingSide = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (gSideTimers[opposingSide].reflectTimer || gSideTimers[opposingSide].lightscreenTimer)
{
@@ -9809,7 +9809,7 @@ static void Cmd_handleballthrow(void)
return;
gActiveBattler = gBattlerAttacker;
gBattlerTarget = gBattlerAttacker ^ BIT_SIDE;
gBattlerTarget = BATTLE_OPPOSITE(gBattlerAttacker);
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{
@@ -9951,18 +9951,18 @@ static void Cmd_handleballthrow(void)
static void Cmd_givecaughtmon(void)
{
if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]]) != MON_GIVEN_TO_PARTY)
if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]]) != MON_GIVEN_TO_PARTY)
{
if (!ShouldShowBoxWasFullMessage())
{
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SENT_SOMEONES_PC;
StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON)));
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2);
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gStringVar2);
}
else
{
StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); // box the mon was sent to
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2);
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gStringVar2);
StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); //box the mon was going to be sent to
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SOMEONES_BOX_FULL;
}
@@ -9972,9 +9972,9 @@ static void Cmd_givecaughtmon(void)
gBattleCommunication[MULTISTRING_CHOOSER]++;
}
gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_SPECIES, NULL);
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick);
gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_POKEBALL, NULL);
gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_SPECIES, NULL);
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick);
gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_POKEBALL, NULL);
gBattlescriptCurrInstr++;
}
@@ -10162,13 +10162,13 @@ static void Cmd_trygivecaughtmonnick(void)
case 2:
if (!gPaletteFade.active)
{
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick);
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick);
FreeAllWindowBuffers();
DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick,
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_SPECIES),
GetMonGender(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]]),
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_PERSONALITY, NULL),
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_SPECIES),
GetMonGender(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]]),
GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_PERSONALITY, NULL),
BattleMainCB2);
gBattleCommunication[MULTIUSE_STATE]++;
@@ -10177,7 +10177,7 @@ static void Cmd_trygivecaughtmonnick(void)
case 3:
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{
SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick);
SetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_OPPOSITE(gBattlerAttacker)]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick);
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
break;