Merge pull request #1616 from LOuroboros/statCalcs

Added configs for modern post-battle stat calcs
This commit is contained in:
Eduardo Quezada D'Ottone 2021-10-23 13:35:21 -03:00 committed by GitHub
commit abb8a97d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -101,6 +101,8 @@
#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing.
#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect.
#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats.
#define B_MAX_LEVEL_EV_GAINS GEN_7 // In Gen5+, Lv100 Pokémon can obtain Effort Values normally.
#define B_RECALCULATE_STATS GEN_7 // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle.
// Move data settings
#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.

View File

@ -4978,6 +4978,17 @@ static void HandleEndTurn_FinishBattle(void)
UndoFormChange(i, B_SIDE_PLAYER, FALSE);
DoBurmyFormChange(i);
}
#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

@ -3841,6 +3841,9 @@ static void Cmd_getexp(void)
*(&gBattleStruct->sentInPokes) >>= 1;
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
#if B_MAX_LEVEL_EV_GAINS >= GEN_5
MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBattlerFainted].species);
#endif
}
else
{