v1.1.0: fixed ankh windows not re-appearing if game is closed

This commit is contained in:
Evan Debenham 2021-09-20 22:50:02 -04:00
parent 14ee498967
commit f4ca0c4234
3 changed files with 9 additions and 8 deletions

View File

@ -1619,7 +1619,6 @@ public class Hero extends Char {
}
if (ankh != null) {
ankh.detach(belongings.backpack);
interrupt();
resting = false;
@ -1635,6 +1634,8 @@ public class Hero extends Char {
GLog.w(Messages.get(this, "revive"));
Statistics.ankhsUsed++;
ankh.detach(belongings.backpack);
for (Char ch : Actor.chars()) {
if (ch instanceof DriedRose.GhostHero) {
((DriedRose.GhostHero) ch).sayAnhk();

View File

@ -549,14 +549,14 @@ public class GameScene extends PixelScene {
//re-show WndResurrect if needed
if (!Dungeon.hero.isAlive()){
//check if hero has an unblessed ankh
boolean hasAnkh = false;
Ankh ankh = null;
for (Ankh i : Dungeon.hero.belongings.getAllItems(Ankh.class)){
if (!i.isBlessed()){
hasAnkh = true;
ankh = i;
}
}
if (hasAnkh) {
add(new WndResurrect());
if (ankh != null) {
add(new WndResurrect(ankh));
}
}

View File

@ -56,14 +56,12 @@ public class WndResurrect extends Window {
RedButton btnContinue;
public WndResurrect() {
public WndResurrect( final Ankh ankh ) {
super();
instance = this;
Ankh ankh = new Ankh();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( ankh.image(), null ) );
titlebar.label( Messages.titleCase(Messages.get(this, "title")) );
@ -104,6 +102,8 @@ public class WndResurrect extends Window {
Statistics.ankhsUsed++;
ankh.detach(Dungeon.hero.belongings.backpack);
if (btnItem1.item != null){
btnItem1.item.keptThoughLostInvent = true;
}