From cd5c3bfa69cf97b89ac2163d7000ee9cd4ecd263 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 3 Mar 2013 11:54:53 +0000 Subject: [PATCH] - Added the condition "AllTargetsLegal" (untested). --- .../spellability/SpellAbilityCondition.java | 11 +++++++++++ .../spellability/SpellAbilityVariables.java | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index e6634dfa608..17eeb328e66 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -81,6 +81,9 @@ public class SpellAbilityCondition extends SpellAbilityVariables { if (value.equals("Kicked")) { this.setKicked(true); } + if (value.equals("AllTargetsLegal")) { + this.setAllTargetsLegal(true); + } } if (params.containsKey("ConditionZone")) { @@ -196,6 +199,14 @@ public class SpellAbilityCondition extends SpellAbilityVariables { 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()) { return false; diff --git a/src/main/java/forge/card/spellability/SpellAbilityVariables.java b/src/main/java/forge/card/spellability/SpellAbilityVariables.java index 2a980244160..023d0a1e3f0 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityVariables.java +++ b/src/main/java/forge/card/spellability/SpellAbilityVariables.java @@ -69,6 +69,7 @@ public class SpellAbilityVariables { this.threshold = sav.isThreshold(); this.metalcraft = sav.isThreshold(); this.hellbent = sav.isHellbent(); + this.allTargetsLegal = sav.isAllTargetsLegal(); this.prowl = new ArrayList(sav.getProwl()); this.isPresent = sav.getIsPresent(); this.presentCompare = sav.getPresentCompare(); @@ -136,6 +137,8 @@ public class SpellAbilityVariables { /** The Kicked. */ private boolean kicked = false; + + private boolean allTargetsLegal = false; /** The prowl. */ private ArrayList prowl = new ArrayList(); @@ -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; + } + + /** *

* Setter for the field prowl.