mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Abilities with sacrifice cost - added cancel button to sacrifice target dialog;
This commit is contained in:
parent
b432b4b431
commit
9d5fade2fb
1 changed files with 2 additions and 0 deletions
|
@ -26,6 +26,7 @@ public class SacrificeTargetCost extends CostImpl {
|
||||||
public SacrificeTargetCost(TargetControlledPermanent target) {
|
public SacrificeTargetCost(TargetControlledPermanent target) {
|
||||||
this.addTarget(target);
|
this.addTarget(target);
|
||||||
target.setNotTarget(true); // sacrifice is never targeted
|
target.setNotTarget(true); // sacrifice is never targeted
|
||||||
|
target.setRequired(false); // can be canceled
|
||||||
this.text = "sacrifice "
|
this.text = "sacrifice "
|
||||||
+ ((target.getNumberOfTargets() != 1
|
+ ((target.getNumberOfTargets() != 1
|
||||||
|| (target.getTargetName().startsWith("an")
|
|| (target.getTargetName().startsWith("an")
|
||||||
|
@ -55,6 +56,7 @@ public class SacrificeTargetCost extends CostImpl {
|
||||||
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
|
||||||
activator = ((ActivatedAbilityImpl) ability).getActivatorId();
|
activator = ((ActivatedAbilityImpl) ability).getActivatorId();
|
||||||
}
|
}
|
||||||
|
// can be cancel by user
|
||||||
if (targets.choose(Outcome.Sacrifice, activator, sourceId, game)) {
|
if (targets.choose(Outcome.Sacrifice, activator, sourceId, game)) {
|
||||||
for (UUID targetId : targets.get(0).getTargets()) {
|
for (UUID targetId : targets.get(0).getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
|
|
Loading…
Reference in a new issue