v0.9.3a: fixed deadlock issues caused by death mark
This commit is contained in:
parent
2706ed0fdf
commit
0a9d0ba919
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user