diff --git a/res/cardsfolder/c/crown_of_empires.txt b/res/cardsfolder/c/crown_of_empires.txt index c5ec1a4da99..1d822e7ebad 100644 --- a/res/cardsfolder/c/crown_of_empires.txt +++ b/res/cardsfolder/c/crown_of_empires.txt @@ -1,10 +1,11 @@ Name:Crown of Empires ManaCost:2 Types:Artifact -A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionNotAllM12Empires$ True | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires. -SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionAllM12Empires$ True +A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionCheckSVar$ M12Complete | ConditionSVarCompare$ EQ0 | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires. +SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionCheckSVar$ M12Complete SVar:RemRandomDeck:True DeckHints:Name$Scepter of Empires|Throne of Empires +SVar:M12Complete:Count$AllM12Empires.1.0 SVar:Picture:http://www.wizards.com/global/images/magic/general/crown_of_empires.jpg Oracle:{3}, {T}: Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires. SetInfo:M12 Uncommon \ No newline at end of file diff --git a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java index b18d35e7947..bfd3c17939e 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java @@ -1452,9 +1452,7 @@ public class CardFactoryUtil { // Count$M12Empires.. if (sq[0].contains("AllM12Empires")) { - boolean has = c.getController().isCardInPlay("Crown of Empires"); - has &= c.getController().isCardInPlay("Scepter of Empires"); - has &= c.getController().isCardInPlay("Throne of Empires"); + boolean has = cc.isCardInPlay("Crown of Empires") && cc.isCardInPlay("Scepter of Empires") && cc.isCardInPlay("Throne of Empires"); return doXMath(Integer.parseInt(sq[has ? 1 : 2]), m, c); } diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index 0110d28c6e6..16449830767 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -116,13 +116,6 @@ public class SpellAbilityCondition extends SpellAbilityVariables { this.setPhases(PhaseType.parseRange(params.get("ConditionPhases"))); } - if (params.containsKey("ConditionAllM12Empires")) { - this.setAllM12Empires(true); - } - if (params.containsKey("ConditionNotAllM12Empires")) { - this.setNotAllM12Empires(true); - } - if (params.containsKey("ConditionChosenColor")) { this.setColorToCheck(params.get("ConditionChosenColor")); } @@ -233,25 +226,6 @@ public class SpellAbilityCondition extends SpellAbilityVariables { } } - if (this.isAllM12Empires()) { - final Player p = sa.getSourceCard().getController(); - boolean has = p.isCardInPlay("Crown of Empires"); - has &= p.isCardInPlay("Scepter of Empires"); - has &= p.isCardInPlay("Throne of Empires"); - if (!has) { - return false; - } - } - if (this.isNotAllM12Empires()) { - final Player p = sa.getSourceCard().getController(); - boolean has = p.isCardInPlay("Crown of Empires"); - has &= p.isCardInPlay("Scepter of Empires"); - has &= p.isCardInPlay("Throne of Empires"); - if (has) { - return false; - } - } - if (this.getCardsInHand() != -1) { // Can handle Library of Alexandria, or Hellbent if (activator.getCardsIn(ZoneType.Hand).size() != this.getCardsInHand()) { diff --git a/src/main/java/forge/card/spellability/SpellAbilityVariables.java b/src/main/java/forge/card/spellability/SpellAbilityVariables.java index 1ad64556f2c..3f957806062 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityVariables.java +++ b/src/main/java/forge/card/spellability/SpellAbilityVariables.java @@ -82,8 +82,6 @@ public class SpellAbilityVariables { this.lifeAmount = sav.getLifeAmount(); this.manaSpent = sav.getManaSpent(); this.pwAbility = sav.isPwAbility(); - this.allM12Empires = sav.isAllM12Empires(); - this.notAllM12Empires = sav.isNotAllM12Empires(); } // default values for Sorcery speed abilities @@ -174,63 +172,10 @@ public class SpellAbilityVariables { /** The pw ability. */ private boolean pwAbility = false; - /** The all m12 empires. */ - private boolean allM12Empires = false; - - /** The not all m12 empires. */ - private boolean notAllM12Empires = false; - /** The chosen colors string. */ private String chosenColors = null; - - /** - *

- * Setter for the field notAllM12Empires. - *

- * - * @param b - * a boolean - */ - public final void setNotAllM12Empires(final boolean b) { - this.notAllM12Empires = b; - } - - /** - *

- * Getter for the field notAllM12Empires. - *

- * - * @return a boolean - */ - public final boolean getNotAllM12Empires() { - return this.isNotAllM12Empires(); - } - - /** - *

- * Setter for the field allM12Empires. - *

- * - * @param b - * a boolean - */ - public final void setAllM12Empires(final boolean b) { - this.allM12Empires = b; - } - - /** - *

- * Getter for the field allM12Empires. - *

- * - * @return a boolean - */ - public final boolean getAllM12Empires() { - return this.isAllM12Empires(); - } - /** *

* Setter for the field manaSpent. @@ -819,25 +764,6 @@ public class SpellAbilityVariables { public final String getPresentDefined() { return this.presentDefined; } - - /** - * Checks if is all m12 empires. - * - * @return the allM12Empires - */ - public final boolean isAllM12Empires() { - return this.allM12Empires; - } - - /** - * Checks if is not all m12 empires. - * - * @return the notAllM12Empires - */ - public final boolean isNotAllM12Empires() { - return this.notAllM12Empires; - } - /** * Gets the s var operand. * diff --git a/src/main/java/forge/game/ai/AiController.java b/src/main/java/forge/game/ai/AiController.java index a470e0cb53a..90eda0d837d 100644 --- a/src/main/java/forge/game/ai/AiController.java +++ b/src/main/java/forge/game/ai/AiController.java @@ -84,7 +84,7 @@ public class AiController { game = game0; } - public final SpellAbility getSpellAbilityToPlay() { + private final SpellAbility getSpellAbilityToPlay() { // if top of stack is owned by me if (!game.getStack().isEmpty() && game.getStack().peekAbility().getActivatingPlayer().equals(player)) { // probably should let my stuff resolve diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index 74d2df10957..ae625bc1998 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -2771,11 +2771,11 @@ public class Player extends GameEntity implements Comparable { return CardLists.filter(getCardsIn(ZoneType.Battlefield), Presets.LANDS); } public boolean isCardInPlay(final String cardName) { - return Iterables.any(getZone(ZoneType.Battlefield), CardPredicates.nameEquals(cardName)); + return getZone(ZoneType.Battlefield).contains(CardPredicates.nameEquals(cardName)); } public boolean isCardInCommand(final String cardName) { - return Iterables.any(getZone(ZoneType.Command), CardPredicates.nameEquals(cardName)); + return getZone(ZoneType.Command).contains(CardPredicates.nameEquals(cardName)); } public List getColoredCardsInPlay(final String color) { diff --git a/src/main/java/forge/game/zone/IZone.java b/src/main/java/forge/game/zone/IZone.java index c537e03fa56..e3876cd0974 100644 --- a/src/main/java/forge/game/zone/IZone.java +++ b/src/main/java/forge/game/zone/IZone.java @@ -19,6 +19,8 @@ package forge.game.zone; import java.util.List; +import com.google.common.base.Predicate; + import forge.Card; /** @@ -121,6 +123,7 @@ interface IZone { * @return true, if successful */ boolean contains(Card c); + boolean contains(final Predicate condition); /** * isEmpty returns true if given zone contains no cards. * diff --git a/src/main/java/forge/game/zone/Zone.java b/src/main/java/forge/game/zone/Zone.java index cdfccb39635..4ce40e7e548 100644 --- a/src/main/java/forge/game/zone/Zone.java +++ b/src/main/java/forge/game/zone/Zone.java @@ -25,6 +25,9 @@ import java.util.Observable; import java.util.Observer; import java.util.concurrent.CopyOnWriteArrayList; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + import forge.Card; import forge.game.player.Player; import forge.util.MyObservable; @@ -170,6 +173,10 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria public final boolean contains(final Card c) { return this.cardList.contains(c); } + + public final boolean contains(final Predicate condition) { + return Iterables.any(this.cardList, condition); + } public final int getPosition(final Card c) { return this.cardList.indexOf(c); diff --git a/src/main/java/forge/gui/GuiDisplayUtil.java b/src/main/java/forge/gui/GuiDisplayUtil.java index 02fb9327b40..571958db03c 100644 --- a/src/main/java/forge/gui/GuiDisplayUtil.java +++ b/src/main/java/forge/gui/GuiDisplayUtil.java @@ -412,7 +412,7 @@ public final class GuiDisplayUtil { * a {@link forge.game.player.Player} object. * @return a {@link forge.CardList} object. */ - public static List devProcessCardsForZone(final String[] data, final Player player) { + private static List devProcessCardsForZone(final String[] data, final Player player) { final List cl = new ArrayList(); for (final String element : data) { final String[] cardinfo = element.trim().split("\\|"); diff --git a/src/main/java/forge/util/MyRandom.java b/src/main/java/forge/util/MyRandom.java index 9fc91f85491..c4a7f971e8b 100644 --- a/src/main/java/forge/util/MyRandom.java +++ b/src/main/java/forge/util/MyRandom.java @@ -54,14 +54,4 @@ public class MyRandom { public static Random getRandom() { return MyRandom.random; } - - /** - * Sets the random. - * - * @param random0 - * the random to set - */ - public static void setRandom(final Random random0) { - MyRandom.random = random0; - } }