summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-09-12 19:50:43 -0400
committerGitHub <noreply@github.com>2021-09-12 19:50:43 -0400
commit7166bee48240481cc9842d9e844eab873c3c6223 (patch)
treed927add9cf096da432a55cc4f47c71f719b5731f
parentd50b32afe77d10843554fe95480efc9e8058cbc6 (diff)
parent55326ea422997d8229d44adf9300a0d363f3e6e9 (diff)
Merge pull request #837 from SatoMew/minushp
Add fix to disallow negative current HP values
-rw-r--r--src/pokemon_1.c8
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;
}