- Added the condition "AllTargetsLegal" (untested).

This commit is contained in:
Sloth
2013-03-03 11:54:53 +00:00
parent f409a66f01
commit cd5c3bfa69
2 changed files with 29 additions and 0 deletions

View File

@@ -81,6 +81,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (value.equals("Kicked")) { if (value.equals("Kicked")) {
this.setKicked(true); this.setKicked(true);
} }
if (value.equals("AllTargetsLegal")) {
this.setAllTargetsLegal(true);
}
} }
if (params.containsKey("ConditionZone")) { if (params.containsKey("ConditionZone")) {
@@ -196,6 +199,14 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
return false; return false;
} }
} }
if (this.isAllTargetsLegal()) {
SpellAbility root = sa.getRootAbility();
for (Card c : root.getTarget().getTargetCards()) {
if (!CardFactoryUtil.isTargetStillValid(sa, c)) {
return false;
}
}
}
if (this.isSorcerySpeed() && !activator.canCastSorcery()) { if (this.isSorcerySpeed() && !activator.canCastSorcery()) {
return false; return false;

View File

@@ -69,6 +69,7 @@ public class SpellAbilityVariables {
this.threshold = sav.isThreshold(); this.threshold = sav.isThreshold();
this.metalcraft = sav.isThreshold(); this.metalcraft = sav.isThreshold();
this.hellbent = sav.isHellbent(); this.hellbent = sav.isHellbent();
this.allTargetsLegal = sav.isAllTargetsLegal();
this.prowl = new ArrayList<String>(sav.getProwl()); this.prowl = new ArrayList<String>(sav.getProwl());
this.isPresent = sav.getIsPresent(); this.isPresent = sav.getIsPresent();
this.presentCompare = sav.getPresentCompare(); this.presentCompare = sav.getPresentCompare();
@@ -136,6 +137,8 @@ public class SpellAbilityVariables {
/** The Kicked. */ /** The Kicked. */
private boolean kicked = false; private boolean kicked = false;
private boolean allTargetsLegal = false;
/** The prowl. */ /** The prowl. */
private ArrayList<String> prowl = new ArrayList<String>(); private ArrayList<String> prowl = new ArrayList<String>();
@@ -519,6 +522,21 @@ public class SpellAbilityVariables {
} }
/**
* @return the allTargetsLegal
*/
public boolean isAllTargetsLegal() {
return allTargetsLegal;
}
/**
* @param allTargetsLegal0 the allTargetsLegal to set
*/
public void setAllTargetsLegal(boolean allTargets) {
this.allTargetsLegal = allTargets;
}
/** /**
* <p> * <p>
* Setter for the field <code>prowl</code>. * Setter for the field <code>prowl</code>.