From c4d0017ff760161f9295487d42c8832cb77a6904 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 30 Dec 2021 13:27:54 -0500 Subject: [PATCH] v1.1.2: potion of dragon's breath and mastery are now IDed if cancelled --- .../potions/exotic/PotionOfDragonsBreath.java | 15 ++++++++++++--- .../items/potions/exotic/PotionOfMastery.java | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java index ea5aa69ff..54ea40dc7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java @@ -54,12 +54,21 @@ public class PotionOfDragonsBreath extends ExoticPotion { icon = ItemSpriteSheet.Icons.POTION_DRGBREATH; } + protected static boolean identifiedByUse = false; + @Override //need to override drink so that time isn't spent right away protected void drink(final Hero hero) { curUser = hero; curItem = this; - + + if (!isKnown()) { + identify(); + identifiedByUse = true; + } else { + identifiedByUse = false; + } + GameScene.selectCell(targeter); } @@ -74,7 +83,7 @@ public class PotionOfDragonsBreath extends ExoticPotion { return; } - if (cell == null && !isKnown()){ + if (cell == null && identifiedByUse){ showingWindow = true; GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this), Messages.titleCase(name()), @@ -97,7 +106,7 @@ public class PotionOfDragonsBreath extends ExoticPotion { public void onBackPressed() {} } ); } else if (cell != null) { - identify(); + identifiedByUse = false; curUser.busy(); Sample.INSTANCE.play( Assets.Sounds.DRINK ); curUser.sprite.operate(curUser.pos, new Callback() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java index f48481afa..56266efb0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java @@ -44,12 +44,21 @@ public class PotionOfMastery extends ExoticPotion { unique = true; } + protected static boolean identifiedByUse = false; + @Override //need to override drink so that time isn't spent right away protected void drink(final Hero hero) { curUser = hero; curItem = this; + if (!isKnown()) { + identify(); + identifiedByUse = true; + } else { + identifiedByUse = false; + } + GameScene.selectItem(itemSelector); } @@ -70,7 +79,7 @@ public class PotionOfMastery extends ExoticPotion { @Override public void onSelect(Item item) { - if (item == null && !isKnown()){ + if (item == null && identifiedByUse){ GameScene.show( new WndOptions(new ItemSprite(PotionOfMastery.this), Messages.titleCase(name()), Messages.get(ExoticPotion.class, "warning"), @@ -101,7 +110,6 @@ public class PotionOfMastery extends ExoticPotion { } updateQuickslot(); - identify(); Sample.INSTANCE.play( Assets.Sounds.DRINK ); curUser.sprite.operate(curUser.pos); curItem.detach(curUser.belongings.backpack);