From e8cf6d0a0b7f6d503edb557bd95be63a3312d62b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 23 Aug 2024 10:44:24 -0400 Subject: [PATCH] v2.5.0: cleaning tipped darts now doesn't show 'clean all' if there is 1 --- .../weapon/missiles/darts/TippedDart.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java index 330535257..1a8816018 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java @@ -77,13 +77,25 @@ public abstract class TippedDart extends Dart { public void execute(final Hero hero, String action) { super.execute(hero, action); if (action.equals( AC_CLEAN )){ + + String[] options; + if (quantity() > 1){ + options = new String[]{ + Messages.get(this, "clean_all"), + Messages.get(this, "clean_one"), + Messages.get(this, "cancel") + }; + } else { + options = new String[]{ + Messages.get(this, "clean_one"), + Messages.get(this, "cancel") + }; + } GameScene.show(new WndOptions(new ItemSprite(this), Messages.titleCase(name()), Messages.get(this, "clean_desc"), - Messages.get(this, "clean_all"), - Messages.get(this, "clean_one"), - Messages.get(this, "cancel")){ + options){ @Override protected void onSelect(int index) { if (index == 0){ @@ -93,7 +105,7 @@ public abstract class TippedDart extends Dart { hero.spend( 1f ); hero.busy(); hero.sprite.operate(hero.pos); - } else if (index == 1){ + } else if (index == 1 && quantity() > 1){ detach(hero.belongings.backpack); if (!new Dart().collect()) Dungeon.level.drop(new Dart(), hero.pos).sprite.drop();