From dd08be8d9758a4b57dd117c6d00ed918ee1a04b8 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 25 Mar 2016 17:25:10 -0400 Subject: [PATCH] v0.3.5: various logic fixes to accommodate chars that are 0 hp, but not dead. --- .../shatteredpixel/shatteredpixeldungeon/actors/Char.java | 5 ++++- .../shatteredpixeldungeon/actors/buffs/Regeneration.java | 2 +- .../shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index c98482a0d..54beb33d0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -274,7 +274,10 @@ public abstract class Char extends Actor { CharSprite.NEGATIVE, Integer.toString( dmg ) ); } - if (HP <= 0) { + + if (HP < 0) HP = 0; + + if (!isAlive()) { die( src ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java index 0cf34664a..f4786639d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java @@ -34,7 +34,7 @@ public class Regeneration extends Buff { if (target.HP < target.HT && !((Hero)target).isStarving()) { LockedFloor lock = target.buff(LockedFloor.class); - if (lock == null || lock.regenOn()) { + if (target.HP > 0 && (lock == null || lock.regenOn())) { target.HP += 1; if (target.HP == target.HT) { ((Hero) target).resting = false; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 391a3b731..88e57711a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -176,7 +176,7 @@ public class StatusPane extends Component { float shield = Dungeon.hero.SHLD; float max = Math.max(health+shield, Dungeon.hero.HT); - if (health == 0) { + if (!Dungeon.hero.isAlive()) { avatar.tint( 0x000000, 0.6f ); blood.on = false; } else if ((health/Dungeon.hero.HT) < 0.25f) {