Moved stat recalculation to HandleEndTurn_FinishBattle

This commit is contained in:
LOuroboros 2021-09-06 07:40:21 -03:00
parent 46fb92c4da
commit 3113e4fa12
2 changed files with 11 additions and 12 deletions

View file

@ -4880,6 +4880,17 @@ static void HandleEndTurn_FinishBattle(void)
UndoMegaEvolution(i);
UndoFormChange(i, B_SIDE_PLAYER, FALSE);
}
#if B_RECALCULATE_STATS >= GEN_5
// Recalculate the stats of every party member before the end
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG)
{
CalculateMonStats(&gPlayerParty[i]);
}
}
#endif
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
gCB2_AfterEvolution = BattleMainCB2;
}

View file

@ -3961,18 +3961,6 @@ static void Cmd_getexp(void)
case 6: // increment instruction
if (gBattleControllerExecFlags == 0)
{
#if B_RECALCULATE_STATS >= GEN_5
// Recalculate the stats of every party member before the end
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG)
{
CalculateMonStats(&gPlayerParty[i]);
}
}
#endif
// not sure why gf clears the item and ability here
gBattleMons[gBattlerFainted].item = 0;
gBattleMons[gBattlerFainted].ability = 0;