From 00dc15811253c1d4f045b8c3cc648ceb1e10390b Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:58:00 +0100 Subject: [PATCH] Follow up for #5570 (#5625) --- include/battle_ai_util.h | 4 ++-- src/battle_ai_main.c | 2 +- src/battle_ai_switch_items.c | 2 +- src/battle_ai_util.c | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 581f4727640e..37303227507e 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -100,8 +100,8 @@ bool32 ShouldLowerEvasion(u32 battlerAtk, u32 battlerDef, u32 defAbility); bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect); bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category); s32 AI_WhichMoveBetter(u32 move1, u32 move2, u32 battlerAtk, u32 battlerDef, s32 noOfHitsToKo); -struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType); -struct SimulatedDamage AI_CalcDamage(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType); +struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType); +struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType); bool32 AI_IsDamagedByRecoil(u32 battler); u32 GetNoOfHitsToKO(u32 dmg, s32 hp); u32 GetNoOfHitsToKOBattlerDmg(u32 dmg, u32 battlerDef); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index b17ee12b5d9b..29cf82669e18 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -433,7 +433,7 @@ static void SetBattlerAiMovesData(struct AiLogicData *aiData, u32 battlerAtk, u3 //&& gMovesInfo[move].power != 0 /* we want to get effectiveness and accuracy of status moves */ && !(aiData->moveLimitations[battlerAtk] & (1u << moveIndex))) { - dmg = AI_CalcDamage(battlerAtk, battlerDef, move, &effectiveness, TRUE, weather, rollType); + dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, TRUE, weather, rollType); aiData->moveAccuracy[battlerAtk][battlerDef][moveIndex] = Ai_SetMoveAccuracy(aiData, battlerAtk, battlerDef, move); } aiData->simulatedDmg[battlerAtk][battlerDef][moveIndex] = dmg; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 9a16716195fa..b72ed4e852a3 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -154,7 +154,7 @@ static bool32 ShouldSwitchIfHasBadOdds(u32 battler) playerMove = gBattleMons[opposingBattler].moves[i]; if (playerMove != MOVE_NONE && gMovesInfo[playerMove].power != 0) { - damageTaken = AI_CalcDamage(opposingBattler, battler, playerMove, &effectiveness, FALSE, weather, DMG_ROLL_HIGHEST).expected; + damageTaken = AI_CalcDamage(playerMove, opposingBattler, battler, &effectiveness, FALSE, weather, DMG_ROLL_HIGHEST).expected; if (damageTaken > maxDamageTaken) maxDamageTaken = damageTaken; } diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index ad26fb7c462d..2594ae4fa997 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -374,7 +374,7 @@ bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category) } // To save computation time this function has 2 variants. One saves, sets and restores battlers, while the other doesn't. -struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType) +struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType) { struct SimulatedDamage dmg; @@ -382,7 +382,7 @@ struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef, SaveBattlerData(battlerDef); SetBattlerData(battlerAtk); SetBattlerData(battlerDef); - dmg = AI_CalcDamage(battlerAtk, battlerDef, move, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA), rollType); + dmg = AI_CalcDamage(move, battlerAtk, battlerDef, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA), rollType); RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); return dmg; @@ -498,7 +498,7 @@ static inline s32 GetDamageByRollType(s32 dmg, enum DamageRollType rollType) return DmgRoll(dmg); } -struct SimulatedDamage AI_CalcDamage(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType) +struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType) { struct SimulatedDamage simDamage; s32 moveType; @@ -3438,7 +3438,7 @@ s32 AI_CalcPartyMonDamage(u32 move, u32 battlerAtk, u32 battlerDef, struct Battl AI_THINKING_STRUCT->saved[battlerAtk].saved = FALSE; } - dmg = AI_CalcDamage(battlerAtk, battlerDef, move, &effectiveness, FALSE, AI_GetWeather(AI_DATA), rollType); + dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, FALSE, AI_GetWeather(AI_DATA), rollType); // restores original gBattleMon struct FreeRestoreBattleMons(savedBattleMons);