diff options
author | SatoMew <SatoMew@users.noreply.github.com> | 2021-09-13 00:00:00 +0100 |
---|---|---|
committer | SatoMew <SatoMew@users.noreply.github.com> | 2021-09-13 00:00:00 +0100 |
commit | 55326ea422997d8229d44adf9300a0d363f3e6e9 (patch) | |
tree | d927add9cf096da432a55cc4f47c71f719b5731f | |
parent | d50b32afe77d10843554fe95480efc9e8058cbc6 (diff) |
Add fix to disallow negative current HP values
-rw-r--r-- | src/pokemon_1.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pokemon_1.c b/src/pokemon_1.c index 4670f188f..76f5f3dfe 100644 --- a/src/pokemon_1.c +++ b/src/pokemon_1.c @@ -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; } |