Capped Exp from Daycare to level cap (#6622)
Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
parent
3b05d7934f
commit
747bf4b7f6
@ -336,6 +336,11 @@ static void ApplyDaycareExperience(struct Pokemon *mon)
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
static u32 GetExpAtLevelCap(struct Pokemon *mon)
|
||||
{
|
||||
return gExperienceTables[gSpeciesInfo[GetMonData(mon, MON_DATA_SPECIES)].growthRate][GetCurrentLevelCap()];
|
||||
}
|
||||
|
||||
static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u32 species;
|
||||
@ -358,6 +363,9 @@ static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
|
||||
if (GetMonData(&pokemon, MON_DATA_LEVEL) < GetCurrentLevelCap())
|
||||
{
|
||||
experience = GetMonData(&pokemon, MON_DATA_EXP) + daycareMon->steps;
|
||||
u32 maxExp = GetExpAtLevelCap(&pokemon);
|
||||
if (experience > maxExp)
|
||||
experience = maxExp;
|
||||
SetMonData(&pokemon, MON_DATA_EXP, &experience);
|
||||
ApplyDaycareExperience(&pokemon);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user