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

View File

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

View File

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