v1.1.2: potion of dragon's breath and mastery are now IDed if cancelled

This commit is contained in:
Evan Debenham 2021-12-30 13:27:54 -05:00
parent 41576ebb7a
commit c4d0017ff7
2 changed files with 22 additions and 5 deletions

View File

@ -54,12 +54,21 @@ public class PotionOfDragonsBreath extends ExoticPotion {
icon = ItemSpriteSheet.Icons.POTION_DRGBREATH; icon = ItemSpriteSheet.Icons.POTION_DRGBREATH;
} }
protected static boolean identifiedByUse = false;
@Override @Override
//need to override drink so that time isn't spent right away //need to override drink so that time isn't spent right away
protected void drink(final Hero hero) { protected void drink(final Hero hero) {
curUser = hero; curUser = hero;
curItem = this; curItem = this;
if (!isKnown()) {
identify();
identifiedByUse = true;
} else {
identifiedByUse = false;
}
GameScene.selectCell(targeter); GameScene.selectCell(targeter);
} }
@ -74,7 +83,7 @@ public class PotionOfDragonsBreath extends ExoticPotion {
return; return;
} }
if (cell == null && !isKnown()){ if (cell == null && identifiedByUse){
showingWindow = true; showingWindow = true;
GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this), GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this),
Messages.titleCase(name()), Messages.titleCase(name()),
@ -97,7 +106,7 @@ public class PotionOfDragonsBreath extends ExoticPotion {
public void onBackPressed() {} public void onBackPressed() {}
} ); } );
} else if (cell != null) { } else if (cell != null) {
identify(); identifiedByUse = false;
curUser.busy(); curUser.busy();
Sample.INSTANCE.play( Assets.Sounds.DRINK ); Sample.INSTANCE.play( Assets.Sounds.DRINK );
curUser.sprite.operate(curUser.pos, new Callback() { curUser.sprite.operate(curUser.pos, new Callback() {

View File

@ -44,12 +44,21 @@ public class PotionOfMastery extends ExoticPotion {
unique = true; unique = true;
} }
protected static boolean identifiedByUse = false;
@Override @Override
//need to override drink so that time isn't spent right away //need to override drink so that time isn't spent right away
protected void drink(final Hero hero) { protected void drink(final Hero hero) {
curUser = hero; curUser = hero;
curItem = this; curItem = this;
if (!isKnown()) {
identify();
identifiedByUse = true;
} else {
identifiedByUse = false;
}
GameScene.selectItem(itemSelector); GameScene.selectItem(itemSelector);
} }
@ -70,7 +79,7 @@ public class PotionOfMastery extends ExoticPotion {
@Override @Override
public void onSelect(Item item) { public void onSelect(Item item) {
if (item == null && !isKnown()){ if (item == null && identifiedByUse){
GameScene.show( new WndOptions(new ItemSprite(PotionOfMastery.this), GameScene.show( new WndOptions(new ItemSprite(PotionOfMastery.this),
Messages.titleCase(name()), Messages.titleCase(name()),
Messages.get(ExoticPotion.class, "warning"), Messages.get(ExoticPotion.class, "warning"),
@ -101,7 +110,6 @@ public class PotionOfMastery extends ExoticPotion {
} }
updateQuickslot(); updateQuickslot();
identify();
Sample.INSTANCE.play( Assets.Sounds.DRINK ); Sample.INSTANCE.play( Assets.Sounds.DRINK );
curUser.sprite.operate(curUser.pos); curUser.sprite.operate(curUser.pos);
curItem.detach(curUser.belongings.backpack); curItem.detach(curUser.belongings.backpack);