From 2a0367a7dd467b752381c1b8457e0a44c43e7836 Mon Sep 17 00:00:00 2001 From: KyleLaporte Date: Wed, 15 Jan 2025 17:18:34 -0500 Subject: [PATCH] Put back set/restore --- src/battle_ai_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index ebec1edac4e..cb8b4917318 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -412,14 +412,19 @@ static void SetBattlerAiMovesData(struct AiLogicData *aiData, u32 battlerAtk, u3 u16 *moves; u32 battlerDef, moveIndex, move; u32 rollType = GetDmgRollType(battlerAtk); + SaveBattlerData(battlerAtk); moves = GetMovesArray(battlerAtk); + SetBattlerData(battlerAtk); + // Simulate dmg for both ai controlled mons and for player controlled mons. for (battlerDef = 0; battlerDef < battlersCount; battlerDef++) { if (battlerAtk == battlerDef || !IsBattlerAlive(battlerDef)) continue; + SaveBattlerData(battlerDef); + SetBattlerData(battlerDef); for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { struct SimulatedDamage dmg = {0}; @@ -437,7 +442,9 @@ static void SetBattlerAiMovesData(struct AiLogicData *aiData, u32 battlerAtk, u3 aiData->simulatedDmg[battlerAtk][battlerDef][moveIndex] = dmg; aiData->effectiveness[battlerAtk][battlerDef][moveIndex] = effectiveness; } + RestoreBattlerData(battlerDef); } + RestoreBattlerData(battlerAtk); } void SetAiLogicDataForTurn(struct AiLogicData *aiData)