v0.9.3a: fixed deadlock issues caused by death mark

This commit is contained in:
Evan Debenham 2021-06-11 20:48:23 -04:00
parent 2706ed0fdf
commit 0a9d0ba919
3 changed files with 19 additions and 6 deletions
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors

View File

@ -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

View File

@ -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

View File

@ -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);