v0.9.3a: fixed deadlock issues caused by death mark
This commit is contained in:
parent
2706ed0fdf
commit
0a9d0ba919
|
@ -632,12 +632,14 @@ public abstract class Char extends Actor {
|
||||||
destroy();
|
destroy();
|
||||||
if (src != Chasm.class) sprite.die();
|
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() {
|
public boolean isAlive() {
|
||||||
if (buff(DeathMark.DeathMarkTracker.class) != null){
|
return HP > 0 || deathMarked;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return HP > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1719,9 +1719,9 @@ public class Hero extends Char {
|
||||||
Dungeon.deleteGame( GamesInProgress.curSlot, true );
|
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
|
//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;
|
private Berserk berserk;
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
super.detach();
|
super.detach();
|
||||||
|
target.deathMarked = false;
|
||||||
if (!target.isAlive()){
|
if (!target.isAlive()){
|
||||||
target.sprite.flash();
|
target.sprite.flash();
|
||||||
target.sprite.bloodBurstA(target.sprite.center(), target.HT*2);
|
target.sprite.bloodBurstA(target.sprite.center(), target.HT*2);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user