* UI: added cancel button for all target definition abilities;

This commit is contained in:
Oleg Agafonov 2019-03-10 23:31:11 +04:00
parent 904660e624
commit dab481ee17
3 changed files with 24 additions and 8 deletions

View file

@ -325,11 +325,16 @@ public abstract class AbilityImpl implements Ability {
}
if (!getTargets().isEmpty()) {
Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome();
if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) {
if ((variableManaCost != null || announceString != null)) {
// can be cancel by user
if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game, true) == false) {
/*
if ((variableManaCost != null) || (announceString != null && !announceString.isEmpty())) {
// ?debug message?
game.informPlayer(controller, (sourceObject != null ? sourceObject.getIdName() : "") + ": no valid targets");
}
return false; // when activation of ability is canceled during target selection
*/
// when activation of ability is canceled during target selection
return false;
}
}
} // end modes