diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index a4df32657..28dac55ae 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -740,6 +740,10 @@ public abstract class Char extends Actor { return HP > 0 || deathMarked; } + public boolean isActive() { + return isAlive(); + } + @Override protected void spendConstant(float time) { TimekeepersHourglass.timeFreeze freeze = buff(TimekeepersHourglass.timeFreeze.class); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index fe654e5b5..30e94280f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1343,7 +1343,7 @@ public class Hero extends Char { Char lastTarget = QuickSlotButton.lastTarget; if (target != null && (lastTarget == null || - !lastTarget.isAlive() || + !lastTarget.isAlive() || !lastTarget.isActive() || lastTarget.alignment == Alignment.ALLY || !fieldOfView[lastTarget.pos])){ QuickSlotButton.target(target); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java index 8c4f8296d..29b5f015e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Ghoul.java @@ -155,7 +155,6 @@ public class Ghoul extends Mob { timesDowned++; Buff.append(nearby, GhoulLifeLink.class).set(timesDowned*5, this); ((GhoulSprite)sprite).crumple(); - beingLifeLinked = false; return; } } @@ -163,6 +162,16 @@ public class Ghoul extends Mob { super.die(cause); } + @Override + public boolean isAlive() { + return super.isAlive() || beingLifeLinked; + } + + @Override + public boolean isActive() { + return !beingLifeLinked && isAlive(); + } + @Override protected synchronized void onRemove() { if (beingLifeLinked) { @@ -269,6 +278,7 @@ public class Ghoul extends Mob { } } ghoul.HP = Math.round(ghoul.HT/10f); + ghoul.beingLifeLinked = false; Actor.add(ghoul); ghoul.timeToNow(); Dungeon.level.mobs.add(ghoul); @@ -321,6 +331,7 @@ public class Ghoul extends Mob { public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); ghoul = (Ghoul) bundle.get(GHOUL); + ghoul.beingLifeLinked = true; turnsToRevive = bundle.getInt(LEFT); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/CharHealthIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/CharHealthIndicator.java index e914c1d58..f2d27fdf6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/CharHealthIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/CharHealthIndicator.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Ghoul; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; @@ -46,7 +47,7 @@ public class CharHealthIndicator extends HealthBar { public void update() { super.update(); - if (target != null && target.isAlive() && target.sprite.visible) { + if (target != null && target.isAlive() && target.isActive() && target.sprite.visible) { CharSprite sprite = target.sprite; width = sprite.width()*(4/6f); x = sprite.x + sprite.width()/6f; @@ -59,7 +60,7 @@ public class CharHealthIndicator extends HealthBar { } public void target( Char ch ) { - if (ch != null && ch.isAlive()) { + if (ch != null && ch.isAlive() && ch.isActive()) { target = ch; } else { target = null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TargetHealthIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TargetHealthIndicator.java index 096ceebe7..85370104d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TargetHealthIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TargetHealthIndicator.java @@ -40,7 +40,7 @@ public class TargetHealthIndicator extends HealthBar { public void update() { super.update(); - if (target != null && target.isAlive() && target.sprite.visible) { + if (target != null && target.isAlive() && target.isActive() && target.sprite.visible) { CharSprite sprite = target.sprite; width = sprite.width(); x = sprite.x; @@ -53,7 +53,7 @@ public class TargetHealthIndicator extends HealthBar { } public void target( Char ch ) { - if (ch != null && ch.isAlive()) { + if (ch != null && ch.isAlive() && ch.isActive()) { target = ch; } else { target = null;