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;
}
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() {

View File

@ -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);