From cd5c3bfa69cf97b89ac2163d7000ee9cd4ecd263 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 3 Mar 2013 11:54:53 +0000 Subject: [PATCH 1/4] - 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. From 9bd3cd6bcb6232c74be70a5216df806c617fec0f Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 3 Mar 2013 12:41:22 +0000 Subject: [PATCH 2/4] - Fixed "Defined$ TriggeredCard" returning the LKI copy of the card. --- src/main/java/forge/card/ability/AbilityUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/forge/card/ability/AbilityUtils.java b/src/main/java/forge/card/ability/AbilityUtils.java index 3a2cec6b930..94115041100 100644 --- a/src/main/java/forge/card/ability/AbilityUtils.java +++ b/src/main/java/forge/card/ability/AbilityUtils.java @@ -143,7 +143,6 @@ public class AbilityUtils { final Object crd = root.getTriggeringObject(defined.substring(9)); if (crd instanceof Card) { c = Singletons.getModel().getGame().getCardState((Card) crd); - c = (Card) crd; } else if (crd instanceof List) { for (final Card cardItem : (List) crd) { cards.add(cardItem); From 3c9ee0f01284563a97901e83f0121a4377f96ff3 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 3 Mar 2013 12:55:30 +0000 Subject: [PATCH 3/4] - Fixed Skullclamp not working on tokens. --- src/main/java/forge/game/GameAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/forge/game/GameAction.java b/src/main/java/forge/game/GameAction.java index 97385a0180e..d91fe8c86ca 100644 --- a/src/main/java/forge/game/GameAction.java +++ b/src/main/java/forge/game/GameAction.java @@ -248,7 +248,7 @@ public class GameAction { copied.getCharacteristics().resetCardColor(); } - if (zoneFrom.is(ZoneType.Battlefield)) { + if (zoneFrom.is(ZoneType.Battlefield) && !c.isToken()) { copied.setSuspendCast(false); copied.setState(CardCharacteristicName.Original); // Soulbond unpairing From cb74a3b60e236e10d6a97d1859a7b074c4bf0692 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 3 Mar 2013 13:33:31 +0000 Subject: [PATCH 4/4] - The AI can now use Spirit Guides. --- res/cardsfolder/e/elvish_spirit_guide.txt | 1 - res/cardsfolder/s/shardless_agent.txt | 1 + res/cardsfolder/s/simian_spirit_guide.txt | 1 - src/main/java/forge/game/ai/ComputerUtilMana.java | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/cardsfolder/e/elvish_spirit_guide.txt b/res/cardsfolder/e/elvish_spirit_guide.txt index 14ea0b282ca..c32d4badb8f 100644 --- a/res/cardsfolder/e/elvish_spirit_guide.txt +++ b/res/cardsfolder/e/elvish_spirit_guide.txt @@ -3,7 +3,6 @@ ManaCost:2 G Types:Creature Elf Spirit PT:2/2 A:AB$ Mana | Cost$ ExileFromHand<1/CARDNAME> | Produced$ G | ActivationZone$ Hand | SpellDescription$ Add G to your mana pool. -SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/elvish_spirit_guide.jpg SetInfo:ALL|Uncommon|http://magiccards.info/scans/en/ai/69.jpg diff --git a/res/cardsfolder/s/shardless_agent.txt b/res/cardsfolder/s/shardless_agent.txt index 296e93183ed..54a004c6c8e 100644 --- a/res/cardsfolder/s/shardless_agent.txt +++ b/res/cardsfolder/s/shardless_agent.txt @@ -3,6 +3,7 @@ ManaCost:1 G U Types:Artifact Creature Human Rogue PT:2/2 K:Cascade +SVar:PlayMain1:TRUE SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/shardless_agent.jpg SetInfo:PC2|Uncommon|http://magiccards.info/scans/en/pc2/104.jpg diff --git a/res/cardsfolder/s/simian_spirit_guide.txt b/res/cardsfolder/s/simian_spirit_guide.txt index 54aae9e2426..1f8721c8584 100644 --- a/res/cardsfolder/s/simian_spirit_guide.txt +++ b/res/cardsfolder/s/simian_spirit_guide.txt @@ -3,7 +3,6 @@ ManaCost:2 R Types:Creature Ape Spirit PT:2/2 A:AB$ Mana | Cost$ ExileFromHand<1/CARDNAME> | Produced$ R | ActivationZone$ Hand | SpellDescription$ Add R to your mana pool. -SVar:RemAIDeck:True SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/simian_spirit_guide.jpg SetInfo:PLC|Common|http://magiccards.info/scans/en/pc/122.jpg diff --git a/src/main/java/forge/game/ai/ComputerUtilMana.java b/src/main/java/forge/game/ai/ComputerUtilMana.java index ef3de857485..c7f4542b3d1 100644 --- a/src/main/java/forge/game/ai/ComputerUtilMana.java +++ b/src/main/java/forge/game/ai/ComputerUtilMana.java @@ -460,6 +460,7 @@ public class ComputerUtilMana { private static List getAvailableMana(final Player ai, final boolean checkPlayable) { final GameState game = Singletons.getModel().getGame(); final List list = ai.getCardsIn(ZoneType.Battlefield); + list.addAll(ai.getCardsIn(ZoneType.Hand)); final List manaSources = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) {