Capped Exp from Daycare to level cap (#6622)

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2025-04-15 23:53:46 +02:00 committed by GitHub
parent 3b05d7934f
commit 747bf4b7f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}