From 7014096d67a1e410047af5e1c291559f8517b9fb Mon Sep 17 00:00:00 2001 From: Sloth Date: Thu, 25 Aug 2011 20:54:59 +0000 Subject: [PATCH] - Converted Favor of the Mighty to script. --- res/cardsfolder/f/favor_of_the_mighty.txt | 3 +- src/main/java/forge/Card.java | 7 ++++ src/main/java/forge/GameActionUtil.java | 44 +---------------------- src/main/java/forge/StaticEffects.java | 2 -- 4 files changed, 10 insertions(+), 46 deletions(-) diff --git a/res/cardsfolder/f/favor_of_the_mighty.txt b/res/cardsfolder/f/favor_of_the_mighty.txt index 6d0eb7a81fb..d48458c08db 100644 --- a/res/cardsfolder/f/favor_of_the_mighty.txt +++ b/res/cardsfolder/f/favor_of_the_mighty.txt @@ -1,7 +1,8 @@ Name:Favor of the Mighty ManaCost:1 W Types:Tribal Enchantment Giant -Text:Each creature with the highest converted mana cost has protection from all colors. +Text:no text +S:Mode$ Continuous | Affected$ Creature.greatestCMC | AddKeyword$ Protection from white & Protection from blue & Protection from black & Protection from red & Protection from green | Description$ Each creature with the highest converted mana cost has protection from all colors. SVar:RemRandomDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/favor_of_the_mighty.jpg diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index ac2e81528e5..deeac74bcdc 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -4844,6 +4844,13 @@ public class Card extends MyObservable implements Comparable { return false; } } + } else if (Property.startsWith("greatestCMC")) { + CardList list = AllZoneUtil.getCreaturesInPlay(); + for (Card crd : list) { + if (crd.getCMC() > getCMC()) { + return false; + } + } } else if (Property.startsWith("enchanted")) { if (!isEnchanted()) return false; } else if (Property.startsWith("unenchanted")) { diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 0870ce4504c..3c837600aee 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -1599,47 +1599,7 @@ public class GameActionUtil { } }// execute() }; - - /** Constant Favor_of_the_Mighty */ - public static Command Favor_of_the_Mighty = new Command() { - private static final long serialVersionUID = 2920036758177137722L; - private CardList pumped = new CardList(); - - public void execute() { - //Reset old cards - for (Card c : pumped) { - c.removeIntrinsicKeyword("Protection from white"); - c.removeIntrinsicKeyword("Protection from blue"); - c.removeIntrinsicKeyword("Protection from black"); - c.removeIntrinsicKeyword("Protection from red"); - c.removeIntrinsicKeyword("Protection from green"); - } - pumped.clear(); - - //Find creature(s) with highest cmc - int maxCMC = -1; - //boolean keepLooping = true; - CardList creats = AllZoneUtil.getCreaturesInPlay(); - for (Card c : creats) { - if (c.getCMC() > maxCMC) { - pumped.clear(); - pumped.add(c); - maxCMC = c.getCMC(); - } else if (c.getCMC() == maxCMC) { - pumped.add(c); - } - } - - //Pump new cards - for (Card c : pumped) { - c.addIntrinsicKeyword("Protection from white"); - c.addIntrinsicKeyword("Protection from blue"); - c.addIntrinsicKeyword("Protection from black"); - c.addIntrinsicKeyword("Protection from red"); - c.addIntrinsicKeyword("Protection from green"); - } - } - }; + /** Constant Koth_Emblem */ public static Command Koth_Emblem = new Command() { @@ -2430,9 +2390,7 @@ public class GameActionUtil { commands.put("Ajani_Avatar_Token", Ajani_Avatar_Token); commands.put("Coat_of_Arms", Coat_of_Arms); - //commands.put("Conspiracy", Conspiracy); commands.put("Elspeth_Emblem", Elspeth_Emblem); - commands.put("Favor_of_the_Mighty", Favor_of_the_Mighty); commands.put("Gaddock_Teeg", Gaddock_Teeg); commands.put("Homarid", Homarid); commands.put("Iona_Shield_of_Emeria", Iona_Shield_of_Emeria); diff --git a/src/main/java/forge/StaticEffects.java b/src/main/java/forge/StaticEffects.java index caa33225655..893f883f748 100644 --- a/src/main/java/forge/StaticEffects.java +++ b/src/main/java/forge/StaticEffects.java @@ -135,8 +135,6 @@ public class StaticEffects { cardToEffectsList.put("Avatar", new String[]{"Ajani_Avatar_Token"}); cardToEffectsList.put("Coat of Arms", new String[]{"Coat_of_Arms"}); - //cardToEffectsList.put("Conspiracy", new String[]{"Conspiracy"}); - cardToEffectsList.put("Favor of the Mighty", new String[]{"Favor_of_the_Mighty"}); cardToEffectsList.put("Gaddock Teeg", new String[]{"Gaddock_Teeg"}); cardToEffectsList.put("Homarid", new String[]{"Homarid"});