From aae163f7a318cde8b0a07c21038b56604cdc1b2a Mon Sep 17 00:00:00 2001 From: moomarc Date: Thu, 6 Dec 2012 06:40:23 +0000 Subject: [PATCH] - Converted Sarpadian Empires, Vol. VII --- .../s/sarpadian_empires_vol_vii.txt | 8 ++ .../cardfactory/CardFactoryArtifacts.java | 112 +----------------- .../spellability/SpellAbilityCondition.java | 10 ++ .../spellability/SpellAbilityRestriction.java | 20 ++++ .../spellability/SpellAbilityVariables.java | 31 ++++- 5 files changed, 68 insertions(+), 113 deletions(-) diff --git a/res/cardsfolder/s/sarpadian_empires_vol_vii.txt b/res/cardsfolder/s/sarpadian_empires_vol_vii.txt index 3a6c97b0889..b7c07ad9d7b 100644 --- a/res/cardsfolder/s/sarpadian_empires_vol_vii.txt +++ b/res/cardsfolder/s/sarpadian_empires_vol_vii.txt @@ -2,6 +2,14 @@ Name:Sarpadian Empires, Vol. VII ManaCost:3 Types:Artifact Text:no text +T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ ChooseColor | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling. +SVar:ChooseColor:DB$ ChooseColor | Defined$ You | AILogic$ MostProminentInGame +# Went for MostProminentInGame logic to give the AI a possible out for situations where it might be locked down based on its colors +A:AB$ Token | Cost$ 3 T | TokenAmount$ 1 | TokenName$ Citizen | TokenTypes$ Creature,Citizen | TokenOwner$ You | TokenColors$ white | TokenPower$ 1 | TokenToughness$ 1 | ConditionChosenColor$ white | SubAbility$ ChoseBlue | SpellDescription$ Put a 1/1 creature token of the chosen color and type onto the battlefield. +SVar:ChoseBlue:DB$ Token | TokenAmount$ 1 | TokenName$ Camarid | TokenTypes$ Creature,Camarid | TokenOwner$ You | TokenColors$ blue | TokenPower$ 1 | TokenToughness$ 1 | ConditionChosenColor$ blue | SubAbility$ ChoseBlack +SVar:ChoseBlack:DB$ Token | TokenAmount$ 1 | TokenName$ Thrull | TokenTypes$ Creature,Thrull | TokenOwner$ You | TokenColors$ black | TokenPower$ 1 | TokenToughness$ 1 | ConditionChosenColor$ black | SubAbility$ ChoseRed +SVar:ChoseRed:DB$ Token | TokenAmount$ 1 | TokenName$ Goblin | TokenTypes$ Creature,Goblin | TokenOwner$ You | TokenColors$ red | TokenPower$ 1 | TokenToughness$ 1 | ConditionChosenColor$ red | SubAbility$ ChoseGreen +SVar:ChoseGreen:DB$ Token | TokenAmount$ 1 | TokenName$ Saproling | TokenTypes$ Creature,Saproling | TokenOwner$ You | TokenColors$ green | TokenPower$ 1 | TokenToughness$ 1 | ConditionChosenColor$ green SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/sarpadian_empires_vol_vii.jpg SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/263.jpg diff --git a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java index 3c1ec0b1db0..9d34bf20aed 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java @@ -39,118 +39,8 @@ class CardFactoryArtifacts { */ public static void buildCard(final Card card, final String cardName) { - if (cardName.equals("Sarpadian Empires, Vol. VII")) { - - final String[] choices = { "Citizen", "Camarid", "Thrull", "Goblin", "Saproling" }; - final Player player = card.getController(); - class SarpadianEmpiresVolVIIETB extends Ability { - public SarpadianEmpiresVolVIIETB(final Card c, final String s) { - super(c, s); - } - @Override - public void resolve() { - String type = ""; - String imageName = ""; - String color = ""; - - if (player.isComputer()) { - type = "Thrull"; - imageName = "B 1 1 Thrull"; - color = "B"; - } else if (player.isHuman()) { - final Object q = GuiChoose.oneOrNone("Select type of creature", choices); - if (q != null) { - if (q.equals("Citizen")) { - type = "Citizen"; - imageName = "W 1 1 Citizen"; - color = "W"; - } else if (q.equals("Camarid")) { - type = "Camarid"; - imageName = "U 1 1 Camarid"; - color = "U"; - } else if (q.equals("Thrull")) { - type = "Thrull"; - imageName = "B 1 1 Thrull"; - color = "B"; - } else if (q.equals("Goblin")) { - type = "Goblin"; - imageName = "R 1 1 Goblin"; - color = "R"; - } else if (q.equals("Saproling")) { - type = "Saproling"; - imageName = "G 1 1 Saproling"; - color = "G"; - } - } - } - getSourceCard().setChosenType(type); - - final String t = type; - final String in = imageName; - final String col = color; - // card.setChosenType(input[0]); - - class AbilitySarpadianEmpiresVolVII extends AbilityActivated { - - private static final long serialVersionUID = -2114111483117171609L; - - public AbilitySarpadianEmpiresVolVII(Card ca, Cost co, Target t) { - super(ca, co, t); - } - - @Override - public AbilityActivated getCopy() { - AbilityActivated res = new AbilitySarpadianEmpiresVolVII(getSourceCard(), - getPayCosts(), getTarget() == null ? null : new Target(getTarget())); - CardFactoryUtil.copySpellAbility(this, res); - return res; - } - - @Override - public void resolve() { - CardFactoryUtil.makeToken(t, in, getSourceCard().getController(), col, new String[] { "Creature", t }, - 1, 1, new String[] { "" }); - } - } - final Cost a1Cost = new Cost(getSourceCard(), "3 T", true); - final AbilityActivated a1 = new AbilitySarpadianEmpiresVolVII(card, a1Cost, null); - final StringBuilder sb = new StringBuilder(); - sb.append(card.getName()).append(" - ").append(card.getController()); - sb.append(" puts a 1/1 ").append(t).append(" token onto the battlefield"); - a1.setStackDescription(sb.toString()); - - card.addSpellAbility(a1); - } - } // ability - final SpellAbility ability = new SarpadianEmpiresVolVIIETB(card, "0"); - final Command intoPlay = new Command() { - private static final long serialVersionUID = 7202704600935499188L; - - @Override - public void execute() { - final StringBuilder sb = new StringBuilder(); - sb.append("As Sarpadian Empires, Vol. VII enters the battlefield, "); - sb.append("choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling."); - ability.setStackDescription(sb.toString()); - - Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability); - - } - }; - final StringBuilder sb = new StringBuilder(); - sb.append("As Sarpadian Empires, Vol. VII enters the battlefield, "); - sb.append("choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.\r\n"); - sb.append("3, Tap: Put a 1/1 creature token of the chosen color and type onto the battlefield.\r\n"); - sb.append(card.getText()); // In the slight chance that there may be - // a need to add a note to this card. - card.setText(sb.toString()); - - card.addComesIntoPlayCommand(intoPlay); - - } // *************** END ************ END ************************** - // *************** START *********** START ************************** - else if (cardName.equals("Grindstone")) { + if (cardName.equals("Grindstone")) { class AbilityGrindstone extends AbilityActivated { public AbilityGrindstone(final Card ca, final Cost co, final Target t) { diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index 2a7ec8d5376..5ee97898496 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -114,6 +114,10 @@ public class SpellAbilityCondition extends SpellAbilityVariables { this.setActivateCardsInHand(Integer.parseInt(params.get("ConditionCardsInHand"))); } + if (params.containsKey("ConditionChosenColor")) { + this.setColorToCheck(params.get("ConditionChosenColor")); + } + // Condition version of IsPresent stuff if (params.containsKey("ConditionPresent")) { this.setIsPresent(params.get("ConditionPresent")); @@ -250,6 +254,12 @@ public class SpellAbilityCondition extends SpellAbilityVariables { } } + if (this.getColorToCheck() != null) { + if (!sa.getSourceCard().getChosenColor().contains(this.getColorToCheck())) { + return false; + } + } + if (this.getIsPresent() != null) { List list = new ArrayList(); if (this.getPresentDefined() != null) { diff --git a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java index 86506ec52e8..a72bf7f90cb 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java +++ b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java @@ -134,6 +134,10 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { this.setActivateCardsInHand(Integer.parseInt(params.get("ActivationCardsInHand"))); } + if (params.containsKey("ActivationChosenColor")) { + this.setColorToCheck(params.get("ActivationChosenColor")); + } + if (params.containsKey("Planeswalker")) { this.setPlaneswalker(true); this.setSorcerySpeed(true); @@ -325,6 +329,12 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { return false; } } + + if (this.getColorToCheck() != null) { + if (!sa.getSourceCard().getChosenColor().contains(this.getColorToCheck())) { + return false; + } + } if (this.isHellbent()) { if (!activator.hasHellbent()) { return false; @@ -416,6 +426,16 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { } + if (this.getsVarToCheck() != null) { + final int svarValue = AbilityFactory.calculateAmount(sa.getSourceCard(), this.getsVarToCheck(), sa); + final int operandValue = AbilityFactory.calculateAmount(sa.getSourceCard(), this.getsVarOperand(), sa); + + if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) { + return false; + } + + } + return true; } // canPlay() diff --git a/src/main/java/forge/card/spellability/SpellAbilityVariables.java b/src/main/java/forge/card/spellability/SpellAbilityVariables.java index 699d5b5e124..2a980244160 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityVariables.java +++ b/src/main/java/forge/card/spellability/SpellAbilityVariables.java @@ -65,6 +65,7 @@ public class SpellAbilityVariables { this.numberTurnActivations = sav.getNumberTurnActivations(); this.activationNumberSacrifice = sav.getActivationNumberSacrifice(); this.cardsInHand = sav.getCardsInHand(); + this.chosenColors = sav.getColorToCheck(); this.threshold = sav.isThreshold(); this.metalcraft = sav.isThreshold(); this.hellbent = sav.isHellbent(); @@ -179,6 +180,9 @@ public class SpellAbilityVariables { /** The not all m12 empires. */ private boolean notAllM12Empires = false; + /** The chosen colors string. */ + private String chosenColors = null; + /** *

* Setter for the field notAllM12Empires. @@ -444,7 +448,7 @@ public class SpellAbilityVariables { * Setter for the field phases. *

* - * @param phasesString + * @param phases * a {@link java.lang.String} object. */ public final void setPhases(final List phases) { @@ -508,7 +512,7 @@ public class SpellAbilityVariables { } /** - * @param kicked0 the kicked to set + * @param kicked the kicked to set */ public void setKicked(boolean kicked) { this.kicked = kicked; @@ -943,4 +947,27 @@ public class SpellAbilityVariables { this.opponentOnly = opponentOnly; } + /** + *

+ * Setter for the field ColorToCheck. + *

+ * + * @param s + * a {@link java.lang.String} object. + */ + public final void setColorToCheck(final String s) { + this.chosenColors = s; + } + + /** + *

+ * Getter for the field ColorToCheck. + *

+ * + * @return the String, chosenColors. + */ + public final String getColorToCheck() { + return this.chosenColors; + } + } // end class SpellAbilityVariables