Add fix to disallow negative current HP values

This commit is contained in:
SatoMew
2021-09-13 00:00:00 +01:00
parent d50b32afe7
commit 55326ea422

View File

@@ -1754,8 +1754,14 @@ void CalculateMonStats(struct Pokemon *mon)
{
if (currentHP == 0 && oldMaxHP == 0)
currentHP = newMaxHP;
else if (currentHP != 0)
else if (currentHP != 0) {
// BUG: currentHP is unintentionally able to become <= 0 after the instruction below.
currentHP += newMaxHP - oldMaxHP;
#ifdef BUGFIX
if (currentHP <= 0)
currentHP = 1;
#endif
}
else
return;
}