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

View File

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

View File

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