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 3547119c6..74675b668 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -632,12 +632,14 @@ public abstract class Char extends Actor { destroy(); if (src != Chasm.class) sprite.die(); } + + //we cache this info to prevent having to call buff(...) in isAlive. + //This is relevant because we call isAlive during drawing, which has both performance + //and thread coordination implications + public boolean deathMarked = false; public boolean isAlive() { - if (buff(DeathMark.DeathMarkTracker.class) != null){ - return true; - } - return HP > 0; + return HP > 0 || deathMarked; } @Override 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 e8f82dca2..5e9fbdab4 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 @@ -1719,9 +1719,9 @@ public class Hero extends Char { Dungeon.deleteGame( GamesInProgress.curSlot, true ); } - //effectively cache this buff to prevent having to call buff(Berserk.class) a bunch. + //effectively cache this buff to prevent having to call buff(...) a bunch. //This is relevant because we call isAlive during drawing, which has both performance - //and concurrent modification implications if that method calls buff(Berserk.class) + //and thread coordination implications if that method calls buff(...) frequently private Berserk berserk; @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/DeathMark.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/DeathMark.java index 920dcd52b..470a753cb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/DeathMark.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/DeathMark.java @@ -163,9 +163,20 @@ public class DeathMark extends ArmorAbility { } } + @Override + public boolean attachTo(Char target) { + if (super.attachTo(target)){ + target.deathMarked = true; + return true; + } else { + return false; + } + } + @Override public void detach() { super.detach(); + target.deathMarked = false; if (!target.isAlive()){ target.sprite.flash(); target.sprite.bloodBurstA(target.sprite.center(), target.HT*2);