Applied remaining instances of BATTLE_OPPOSITE and BATTLE_PARTNER

This commit is contained in:
Eduardo Quezada 2022-09-02 23:57:43 -04:00
parent 5403cd036e
commit 03498d7240
8 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@
#define AI_IS_FASTER 0
#define AI_IS_SLOWER 1
#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE)
#define FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE)
bool32 AI_RandLessThan(u8 val);
void RecordLastUsedMoveByTarget(void);

View File

@ -486,7 +486,7 @@ static u8 ChooseMoveOrAction_Doubles(void)
bestMovePointsForTarget[i] = mostViableMovesScores[0];
// Don't use a move against ally if it has less than 100 points.
if (i == (sBattler_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100)
if (i == BATTLE_PARTNER(sBattler_AI) && bestMovePointsForTarget[i] < 100)
{
bestMovePointsForTarget[i] = -1;
mostViableMovesScores[0] = mostViableMovesScores[0]; // Needed to match.

View File

@ -3248,7 +3248,7 @@ s32 CountUsablePartyMons(u8 battlerId)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
battlerOnField1 = gBattlerPartyIndexes[battlerId];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(GetBattlerPosition(battlerId) ^ BIT_FLANK)];
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(battlerId)))];
}
else // In singles there's only one battlerId by side.
{

View File

@ -6523,7 +6523,7 @@ const struct SpriteTemplate gSoulStealZStarSpriteTemplate =
//general
void AnimTask_IsTargetPartner(u8 taskId)
{
if (gBattleAnimTarget == (gBattleAnimAttacker ^ BIT_FLANK))
if (gBattleAnimTarget == BATTLE_PARTNER(gBattleAnimAttacker))
gBattleAnimArgs[0] = 1;
else
gBattleAnimArgs[0] = 0;

View File

@ -226,7 +226,7 @@ static void Intro_DelayAndEnd(void)
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active.
{
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId ^ BIT_FLANK]]));
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]));
}
static void Intro_WaitForShinyAnimAndHealthbox(void)

View File

@ -2703,7 +2703,7 @@ void BufferStringBattle(u16 stringID)
{
if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
stringPtr = sText_LegendaryPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]])) // interesting, looks like they had something planned for wild double battles
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]])) // interesting, looks like they had something planned for wild double battles
stringPtr = sText_TwoWildPkmnAppeared;
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
stringPtr = sText_WildPkmnAppearedPause;
@ -2714,7 +2714,7 @@ void BufferStringBattle(u16 stringID)
case STRINGID_INTROSENDOUT: // poke first send-out
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]))
{
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
stringPtr = sText_InGamePartnerSentOutZGoN;
@ -2732,7 +2732,7 @@ void BufferStringBattle(u16 stringID)
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]))
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]]))
{
if (BATTLE_TWO_VS_ONE_OPPONENT)
stringPtr = sText_Trainer1SentOutTwoPkmn;

View File

@ -10730,7 +10730,7 @@ static void Cmd_forcerandomswitch(void)
monsCount = 6;
minNeeded = 2;
battler2PartyId = gBattlerPartyIndexes[gBattlerTarget];
battler1PartyId = gBattlerPartyIndexes[gBattlerTarget ^ BIT_FLANK];
battler1PartyId = gBattlerPartyIndexes[BATTLE_PARTNER(gBattlerTarget)];
}
else if ((gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)

View File

@ -5817,7 +5817,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
{
if (gBattleMons[i].ability == ABILITY_TRACE && (gBattleResources->flags->flags[i] & RESOURCE_FLAG_TRACED))
{
u8 side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon
u8 side = (BATTLE_OPPOSITE(GetBattlerPosition(i))) & BIT_SIDE; // side of the opposing pokemon
u8 target1 = GetBattlerAtPosition(side);
u8 target2 = GetBattlerAtPosition(side + BIT_FLANK);