Level command now also sets experience to avoid losing level upon form changes

This commit is contained in:
Eduardo Quezada 2023-03-24 09:36:33 -03:00
parent 168ed1cc55
commit 52011804b9

View File

@ -933,9 +933,11 @@ void Ability_(u32 sourceLine, u32 ability)
void Level_(u32 sourceLine, u32 level)
{
// TODO: Preserve any explicitly-set stats.
u32 species = GetMonData(DATA.currentMon, MON_DATA_SPECIES);
INVALID_IF(!DATA.currentMon, "Level outside of PLAYER/OPPONENT");
INVALID_IF(level == 0 || level > MAX_LEVEL, "Illegal level: %d", level);
SetMonData(DATA.currentMon, MON_DATA_LEVEL, &level);
SetMonData(DATA.currentMon, MON_DATA_EXP, &gExperienceTables[gSpeciesInfo[species].growthRate][level]);
}
void MaxHP_(u32 sourceLine, u32 maxHP)