use of com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method die.
@Override
public void die(Object cause) {
curAction = null;
Ankh ankh = null;
// look for ankhs in player inventory, prioritize ones which are blessed.
for (Item item : belongings) {
if (item instanceof Ankh) {
if (ankh == null || ((Ankh) item).isBlessed()) {
ankh = (Ankh) item;
}
}
}
if (ankh != null && ankh.isBlessed()) {
this.HP = HT / 4;
// ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
Buff.detach(this, Paralysis.class);
spend(-cooldown());
new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
ankh.detach(belongings.backpack);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.w(Messages.get(this, "revive"));
Statistics.ankhsUsed++;
return;
}
Actor.fixTime();
super.die(cause);
if (ankh == null) {
reallyDie(cause);
} else {
Dungeon.deleteGame(GamesInProgress.curSlot, false);
GameScene.show(new WndResurrect(ankh, cause));
}
}
Aggregations