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
+2 -2
View File
@@ -351,14 +351,14 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
// Decide a random target battlerId in doubles.
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
gBattlerTarget = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE);
gBattlerTarget = (Random() & BIT_FLANK) + (BATTLE_OPPOSITE(GetBattlerSide(gActiveBattler)));
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
gBattlerTarget ^= BIT_FLANK;
}
// There's only one choice in single battles.
else
{
gBattlerTarget = sBattler_AI ^ BIT_SIDE;
gBattlerTarget = BATTLE_OPPOSITE(sBattler_AI);
}
// Choose proper trainer ai scripts.