Skip to content

Commit

Permalink
Put back set/restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawkkie committed Jan 15, 2025
1 parent c5dec7e commit 2a0367a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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)
Expand Down

0 comments on commit 2a0367a

Please sign in to comment.