From e13a99717b44f361f3937bcd997fd6cfc102c5a5 Mon Sep 17 00:00:00 2001 From: SatoMew Date: Mon, 13 Sep 2021 21:51:56 +0100 Subject: Add fix to disallow negative current HP values --- src/pokemon.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pokemon.c b/src/pokemon.c index 39cc2f636..6e43aff85 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2112,8 +2112,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; } -- cgit v1.2.3