v2.4.0: added a missing item warning to WndResurrect

This commit is contained in:
Evan Debenham
2024-02-24 14:07:32 -05:00
parent 38332aa207
commit 8630dafd99
2 changed files with 38 additions and 14 deletions

View File

@@ -217,6 +217,10 @@ windows.wndresurrect.title=Resurrection
windows.wndresurrect.message=As you perish you can feel your ankh guiding your spirit back toward this world. It's giving you another chance to conquer the dungeon!\n\nYou can bring two of your items with you, but the rest will be left where you perished. Which items will you choose?
windows.wndresurrect.prompt=Select an item
windows.wndresurrect.confirm=Preserve these items
windows.wndresurrect.warn_title=Missing Items
windows.wndresurrect.warn_body=You haven't selected two items. Are you sure you want to resurrect without two items?
windows.wndresurrect.warn_yes=Yes, I'm sure
windows.wndresurrect.warn_no=No, let me reconsider
windows.wndsadghost.rat_title=DEFEATED FETID RAT
windows.wndsadghost.gnoll_title=DEFEATED GNOLL TRICKSTER

View File

@@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
@@ -96,21 +97,22 @@ public class WndResurrect extends Window {
btnContinue = new RedButton( Messages.get(this, "confirm") ) {
@Override
protected void onClick() {
hide();
Statistics.ankhsUsed++;
ankh.detach(Dungeon.hero.belongings.backpack);
if (btnItem1.item() != null){
btnItem1.item().keptThoughLostInvent = true;
if (btnItem1.item() == null || btnItem2.item() == null){
GameScene.show(new WndOptions(Icons.WARNING.get(),
Messages.get(WndResurrect.class, "warn_title"),
Messages.get(WndResurrect.class, "warn_body"),
Messages.get(WndResurrect.class, "warn_yes"),
Messages.get(WndResurrect.class, "warn_no")){
@Override
protected void onSelect(int index) {
if (index == 0){
resurrect(ankh);
}
}
});
} else {
resurrect( ankh );
}
if (btnItem2.item() != null){
btnItem2.item().keptThoughLostInvent = true;
}
InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
Game.switchScene( InterlevelScene.class );
}
};
btnContinue.setRect( 0, btnItem1.bottom() + BTN_GAP, WIDTH, BTN_HEIGHT );
@@ -119,6 +121,24 @@ public class WndResurrect extends Window {
resize( WIDTH, (int)btnContinue.bottom() );
}
private void resurrect( final Ankh ankh ){
hide();
Statistics.ankhsUsed++;
ankh.detach(Dungeon.hero.belongings.backpack);
if (btnItem1.item() != null){
btnItem1.item().keptThoughLostInvent = true;
}
if (btnItem2.item() != null){
btnItem2.item().keptThoughLostInvent = true;
}
InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
Game.switchScene( InterlevelScene.class );
}
protected WndBag.ItemSelector itemSelector = new WndBag.ItemSelector() {
@Override