v1.2.0: fixed various further issues with dragon's breath potion

This commit is contained in:
Evan Debenham 2022-02-24 13:49:51 -05:00
parent 9d988f11e5
commit 264742d467
3 changed files with 22 additions and 11 deletions

View File

@ -74,17 +74,22 @@ public class PotionOfDragonsBreath extends ExoticPotion {
private CellSelector.Listener targeter = new CellSelector.Listener() { private CellSelector.Listener targeter = new CellSelector.Listener() {
private boolean optionSelected = false; private boolean showingWindow = false;
private boolean potionAlreadyUsed = false;
@Override @Override
public void onSelect(final Integer cell) { public void onSelect(final Integer cell) {
if (optionSelected){ if (showingWindow){
return;
}
if (potionAlreadyUsed){
potionAlreadyUsed = false;
return; return;
} }
if (cell == null && identifiedByUse){ if (cell == null && identifiedByUse){
optionSelected = 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()),
Messages.get(ExoticPotion.class, "warning"), Messages.get(ExoticPotion.class, "warning"),
@ -92,7 +97,7 @@ public class PotionOfDragonsBreath extends ExoticPotion {
Messages.get(ExoticPotion.class, "no") ) { Messages.get(ExoticPotion.class, "no") ) {
@Override @Override
protected void onSelect( int index ) { protected void onSelect( int index ) {
optionSelected = false; showingWindow = false;
switch (index) { switch (index) {
case 0: case 0:
curUser.spendAndNext(1f); curUser.spendAndNext(1f);
@ -108,7 +113,7 @@ public class PotionOfDragonsBreath extends ExoticPotion {
} else if (cell == null && !anonymous){ } else if (cell == null && !anonymous){
curItem.collect( curUser.belongings.backpack ); curItem.collect( curUser.belongings.backpack );
} else if (cell != null) { } else if (cell != null) {
optionSelected = true; potionAlreadyUsed = true;
identifiedByUse = false; identifiedByUse = false;
curUser.busy(); curUser.busy();
Sample.INSTANCE.play( Assets.Sounds.DRINK ); Sample.INSTANCE.play( Assets.Sounds.DRINK );

View File

@ -94,7 +94,7 @@ public class QuickSlotButton extends Button {
} }
} else { } else {
Item item = select(slotNum); Item item = select(slotNum);
if (Dungeon.hero.belongings.contains(item)) { if (Dungeon.hero.belongings.contains(item) && !GameScene.cancel()) {
GameScene.centerNextWndOnInvPane(); GameScene.centerNextWndOnInvPane();
item.execute(Dungeon.hero); item.execute(Dungeon.hero);
if (item.usesTargeting) { if (item.usesTargeting) {
@ -191,12 +191,16 @@ public class QuickSlotButton extends Button {
@Override @Override
protected void onClick() { protected void onClick() {
if (Dungeon.hero.ready && !GameScene.cancel()) {
GameScene.selectItem(itemSelector); GameScene.selectItem(itemSelector);
} }
}
@Override @Override
protected boolean onLongClick() { protected boolean onLongClick() {
if (Dungeon.hero.ready && !GameScene.cancel()) {
GameScene.selectItem(itemSelector); GameScene.selectItem(itemSelector);
}
return true; return true;
} }

View File

@ -120,7 +120,7 @@ public class Toolbar extends Component {
add(new Button(){ add(new Button(){
@Override @Override
protected void onClick() { protected void onClick() {
if (Dungeon.hero.ready) { if (Dungeon.hero.ready && !GameScene.cancel()) {
examining = false; examining = false;
Dungeon.hero.rest(true); Dungeon.hero.rest(true);
} }
@ -136,7 +136,7 @@ public class Toolbar extends Component {
add(btnSearch = new Tool(44, 0, 20, 26) { add(btnSearch = new Tool(44, 0, 20, 26) {
@Override @Override
protected void onClick() { protected void onClick() {
if (Dungeon.hero.ready) { if (Dungeon.hero.ready && !GameScene.cancel()) {
if (!examining) { if (!examining) {
GameScene.selectCell(informer); GameScene.selectCell(informer);
examining = true; examining = true;
@ -175,10 +175,12 @@ public class Toolbar extends Component {
if (SPDSettings.interfaceSize() == 2) { if (SPDSettings.interfaceSize() == 2) {
GameScene.toggleInvPane(); GameScene.toggleInvPane();
} else { } else {
if (!GameScene.cancel()) {
GameScene.show(new WndBag(Dungeon.hero.belongings.backpack)); GameScene.show(new WndBag(Dungeon.hero.belongings.backpack));
} }
} }
} }
}
@Override @Override
public GameAction keyAction() { public GameAction keyAction() {