From b995b76a8f995795044c0b54459a311efa56062a Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 14:37:24 +0000 Subject: [PATCH] - Convert Cost list delimiter from ',' to ';' - Update affected cards - Convert Baru, Tarox, and Korlash to AFs --- res/cardsfolder/baru_fist_of_krosa.txt | 2 + res/cardsfolder/knight_of_the_reliquary.txt | 2 +- .../korlash_heir_to_blackblade.txt | 3 +- res/cardsfolder/surge_of_strength.txt | 2 +- res/cardsfolder/tarox_bladewing.txt | 2 + src/forge/Card.java | 7 +- src/forge/CardFactory_Creatures.java | 236 ------------------ src/forge/Cost_Payment.java | 26 +- 8 files changed, 25 insertions(+), 255 deletions(-) diff --git a/res/cardsfolder/baru_fist_of_krosa.txt b/res/cardsfolder/baru_fist_of_krosa.txt index b6ba97bdd0c..d0bc8e2e276 100644 --- a/res/cardsfolder/baru_fist_of_krosa.txt +++ b/res/cardsfolder/baru_fist_of_krosa.txt @@ -3,6 +3,8 @@ ManaCost:3 G G Types:Legendary Creature Human Druid Text:Whenever a Forest enters the battlefield, green creatures you control get +1/+1 and gain trample until end of turn. PT:4/4 +A:AB$Token | Cost$ Discard<1/Card.namedBaru, Fist of Krosa> | TokenAmount$ 1 | TokenName$ Wurm | TokenTypes$ Creature,Wurm | TokenOwner$ Controller | TokenColors$ Green | TokenPower$ X | TokenToughness$ X | CostDesc$ Grandeur - Discard another card named Baru, Fist of Krosa: | SpellDescription$ Put an X/X green Wurm creature token onto the battlefield, where X is the number of lands you control. +SVar:X:Valid Land.YouCtrl SVar:BuffedBy:Forest SVar:Rarity:Rare SVar:Picture:http://resources.wizards.com/magic/cards/fut/en-us/card136155.jpg diff --git a/res/cardsfolder/knight_of_the_reliquary.txt b/res/cardsfolder/knight_of_the_reliquary.txt index e9cc2640f79..b8db182c0d6 100644 --- a/res/cardsfolder/knight_of_the_reliquary.txt +++ b/res/cardsfolder/knight_of_the_reliquary.txt @@ -3,7 +3,7 @@ ManaCost:1 G W Types:Creature Human Knight Text:no text PT:2/2 -A:AB$ChangeZone | Cost$ T Sac<1/Forest,Plains> | Origin$ Library | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | SpellDescription$ Search your library for a land card, put it onto the battlefield, then shuffle your library. +A:AB$ChangeZone | Cost$ T Sac<1/Forest;Plains> | Origin$ Library | Destination$ Battlefield | ChangeType$ Land | ChangeNum$ 1 | SpellDescription$ Search your library for a land card, put it onto the battlefield, then shuffle your library. K:stPumpSelf:Creature:X/X:no Condition:CARDNAME gets +1/+1 for each land card in your graveyard. SVar:X:Count$TypeInYourYard.Land SVar:Rarity:Rare diff --git a/res/cardsfolder/korlash_heir_to_blackblade.txt b/res/cardsfolder/korlash_heir_to_blackblade.txt index 4b76adc90fc..23f38771e62 100644 --- a/res/cardsfolder/korlash_heir_to_blackblade.txt +++ b/res/cardsfolder/korlash_heir_to_blackblade.txt @@ -3,8 +3,9 @@ ManaCost:2 B B Types:Legendary Creature Zombie Warrior Text:no text PT:*/* -K:stSetPT:Count$TypeYouCtrl.Swamp:Count$TypeYouCtrl.Swamp:CARDNAME's power and toughness are each equal to the number of Swamps you control. +K:stSetPT:Count$TypeYouCtrl.Swamp:Count$TypeYouCtrl.Swamp:CARDNAME's power and toughness are each equal to the number of Swamps you control. A:AB$Regenerate | Cost$ 1 B | SpellDescription$ Regenerate CARDNAME. +A:AB$ChangeZone | Cost$ Discard<1/Card.namedKorlash, Heir to Blackblade> | Origin$ Library | Destination$ Battlefield | ChangeType$ Swamp | ChangeNum$ 2 | Tapped$ True | CostDesc$ Grandeur - Discard another card named Korlash, Heir to Blackblade: | SpellDescription$ Search your library for up to two Swamp cards, put them onto the battlefield tapped, then shuffle your library. SVar:BuffedBy:Swamp SVar:Rarity:Rare SVar:Picture:http://resources.wizards.com/magic/cards/fut/en-us/card136208.jpg diff --git a/res/cardsfolder/surge_of_strength.txt b/res/cardsfolder/surge_of_strength.txt index b72e4ba936a..67206c371c9 100644 --- a/res/cardsfolder/surge_of_strength.txt +++ b/res/cardsfolder/surge_of_strength.txt @@ -2,7 +2,7 @@ Name:Surge of Strength ManaCost:R G Types:Instant Text:no text -A:SP$Pump | Cost$ R G Discard<1/Card.Green,Card.Red> | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +X | KW$ Trample | CostDesc$ As an additional cost to cast Surge of Strength, discard a red or green card.\n | SpellDescription$ Target creature gains trample and gets +X/+0 until end of turn, where X is that creature's converted mana cost. +A:SP$Pump | Cost$ R G Discard<1/Card.Green;Card.Red> | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +X | KW$ Trample | CostDesc$ As an additional cost to cast Surge of Strength, discard a red or green card.\n | SpellDescription$ Target creature gains trample and gets +X/+0 until end of turn, where X is that creature's converted mana cost. SVar:X:Targeted$CardManaCost SVar:RemAIDeck:True SVar:Rarity:Uncommon diff --git a/res/cardsfolder/tarox_bladewing.txt b/res/cardsfolder/tarox_bladewing.txt index 3d15dce7a5d..f201594eedd 100644 --- a/res/cardsfolder/tarox_bladewing.txt +++ b/res/cardsfolder/tarox_bladewing.txt @@ -5,6 +5,8 @@ Text:no text PT:4/3 K:Flying K:Haste +A:AB$Pump | Cost$ Discard<1/Card.namedTarox Bladewing> | NumAtt$ +X | NumDef$ +X | CostDesc$ Grandeur - Discard another card named Tarox Bladewing: | SpellDescription$ Tarox Bladewing gets +X/+X until end of turn, where X is its power. +SVar:X:Count$CardPower SVar:Rarity:Rare SVar:Picture:http://resources.wizards.com/magic/cards/fut/en-us/card136139.jpg SetInfo:FUT|Rare|http://magiccards.info/scans/en/fut/123.jpg diff --git a/src/forge/Card.java b/src/forge/Card.java index c3785fe8374..61bd37bd984 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -2505,7 +2505,10 @@ public class Card extends MyObservable { // Takes arguments like Blue or withFlying public boolean hasProperty(String Property, final Player sourceController, final Card source) { - if (Property.contains("White") || // ... Card colors + //by name can also have color names, so needs to happen before colors. + if(Property.startsWith("named")) { if(!getName().equals(Property.substring(5))) return false; } + + else if (Property.contains("White") || // ... Card colors Property.contains("Blue") || Property.contains("Black") || Property.contains("Red") || @@ -2660,8 +2663,6 @@ public class Card extends MyObservable { else if (Property.startsWith("blocked")) { if(!AllZone.Combat.isBlocked(this)) return false;} - else if(Property.startsWith("named")) //by name - { if(!getName().equals(Property.substring(5))) return false;} else if(Property.startsWith("non")) // ... Other Card types { if(isType(Property.substring(3))) return false;} else { diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 5caf4f860bd..47adaea6cb6 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -323,242 +323,6 @@ public class CardFactory_Creatures { card.addSpellAbility(ability); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Korlash, Heir to Blackblade")) { - - final SpellAbility ability = new Ability(card, "0") { - @Override - public void chooseTargetAI() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - - list.get(0).getController().discard(list.get(0), this); - } - - @Override - public boolean canPlay() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - return 0 < list.size() && AllZone.getZone(card).getZoneName().equals(Constant.Zone.Battlefield) && super.canPlay(); - } - - @Override - public void resolve() { - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); - - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList list = new CardList(library.getCards()); - CardList swamp = list.getType("Swamp"); - - if (swamp.size() > 0) - { - if (card.getController().equals(AllZone.HumanPlayer)) - { - List selection = AllZone.Display.getChoices("Select up to two swamps", swamp.toArray()); - - for(int i = 0; i < selection.size(); i++) { - if (i == 2) - break; - Card c = selection.get(i); - - library.remove(c); - play.add(c); - c.tap(); - } - } - else - { - Card c = swamp.get(0); - play.add(c); - c.tap(); - swamp.remove(c); - if (swamp.size() > 0) { - c = swamp.get(0); - play.add(c); - c.tap(); - - } - } - } - - for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) { - Command com = GameActionUtil.commands.get(effect); - com.execute(); - } - GameActionUtil.executeCardStateEffects(); - } - }; - Input removeCard = new Input() { - private static final long serialVersionUID = -8560221326412798885L; - - int n = 0; - - @Override - public void showMessage() { - //this is called twice, this is an ugly hack - if(n % 2 == 0) stop(); - - - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(hand.getCards()); - - list = list.getName(card.getName()); - list.get(0).getController().discard(list.get(0), ability); - - AllZone.Stack.add(ability); - stop(); - } - }; - ability.setBeforePayMana(removeCard); - - ability.setDescription("Grandeur Ñ Discard another card named Korlash, Heir to Blackblade: Search your library for up to two Swamp cards, put them onto the battlefield tapped, then shuffle your library."); - StringBuilder sb = new StringBuilder(); - sb.append(card.getName()).append(" - Search for two swamps and put them onto the battlefield tapped."); - ability.setStackDescription(sb.toString()); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Tarox Bladewing")) { - final Command untilEOT = new Command() { - private static final long serialVersionUID = 2642394522583318055L; - - public void execute() { - int n = card.getNetAttack(); - - card.addTempDefenseBoost(-n / 2); - card.addTempAttackBoost(-n / 2); - } - }; - - final SpellAbility ability = new Ability(card, "0") { - @Override - public void chooseTargetAI() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - - list.get(0).getController().discard(list.get(0), this); - } - - @Override - public boolean canPlay() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - return 0 < list.size() && AllZone.getZone(card).getZoneName().equals(Constant.Zone.Battlefield) && super.canPlay(); - } - - @Override - public void resolve() { - card.addTempDefenseBoost(card.getNetAttack()); - card.addTempAttackBoost(card.getNetAttack()); - - AllZone.EndOfTurn.addUntil(untilEOT); - } - }; - Input removeCard = new Input() { - private static final long serialVersionUID = -1312910959802746127L; - - int n = 0; - - @Override - public void showMessage() { - //this is called twice, this is an ugly hack - if(n % 2 == 0) stop(); - - - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(hand.getCards()); - - list = list.getName(card.getName()); - list.get(0).getController().discard(list.get(0), ability); - - AllZone.Stack.add(ability); - stop(); - } - }; - ability.setBeforePayMana(removeCard); - - ability.setDescription("Grandeur - Discard another card named Tarox Bladewing: Tarox Bladewing gets +X/+X until end of turn, where X is his power."); - StringBuilder sb = new StringBuilder(); - sb.append(cardName).append(" - gets +X/+X until end of turn."); - ability.setStackDescription(sb.toString()); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Baru, Fist of Krosa")) { - final SpellAbility ability = new Ability(card, "0") { - @Override - public void chooseTargetAI() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - - list.get(0).getController().discard(list.get(0), this); - } - - @Override - public boolean canPlay() { - PlayerZone p = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(p.getCards()); - list = list.getName(card.getName()); - return 0 < list.size() && AllZone.getZone(card).getZoneName().equals(Constant.Zone.Battlefield) && super.canPlay(); - } - - @Override - public void resolve() { - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); - CardList list = new CardList(play.getCards()); - list = list.getType("Land"); - CardFactoryUtil.makeToken("Wurm", "G X X Wurm", card.getController(), "G", new String[] {"Creature", "Wurm"}, - list.size(), list.size(), new String[] {""}); - } - }; - Input removeCard = new Input() { - private static final long serialVersionUID = 7738090787920616790L; - - int n = 0; - - @Override - public void showMessage() { - //this is called twice, this is an ugly hack - if(n % 2 == 0) stop(); - - - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(hand.getCards()); - - list = list.getName(card.getName()); - list.get(0).getController().discard(list.get(0), ability); - - AllZone.Stack.add(ability); - stop(); - } - }; - ability.setBeforePayMana(removeCard); - - StringBuilder sbDesc = new StringBuilder(); - sbDesc.append("Grandeur - Discard another card named Baru, Fist of Krosa: Put an X/X "); - sbDesc.append("green Wurm creature token onto the battlefield, where X is the number of lands that you control."); - ability.setDescription(sbDesc.toString()); - - StringBuilder sbStack = new StringBuilder(); - sbStack.append(cardName).append(" - put X/X token onto the battlefield."); - ability.setStackDescription(sbStack.toString()); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if(cardName.equals("Filigree Angel")) { final SpellAbility ability = new Ability(card, "0") { diff --git a/src/forge/Cost_Payment.java b/src/forge/Cost_Payment.java index eb51ae222db..67c6851a8e5 100644 --- a/src/forge/Cost_Payment.java +++ b/src/forge/Cost_Payment.java @@ -87,7 +87,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); CardList typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(cost.getTapXType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getTapXType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); if (cost.getTap()) { typeList = typeList.filter(new CardListFilter() @@ -139,7 +139,7 @@ public class Cost_Payment { } else{ if (!discType.equals("Any") && !discType.equals("Random")){ - String validType[] = discType.split(","); + String validType[] = discType.split(";"); handList = handList.getValidCards(validType,ability.getActivatingPlayer() ,ability.getSourceCard()); } @@ -155,7 +155,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); CardList typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(cost.getSacType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getSacType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); if (typeList.size() < cost.getSacAmount()) return false; } @@ -167,7 +167,7 @@ public class Cost_Payment { if (!cost.getExileThis()){ CardList typeList = AllZoneUtil.getPlayerCardsInPlay(card.getController()); - typeList = typeList.getValidCards(cost.getExileType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getExileType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); if (typeList.size() < cost.getExileAmount()) return false; } @@ -179,7 +179,7 @@ public class Cost_Payment { if (!cost.getExileFromHandThis()){ CardList typeList = AllZoneUtil.getPlayerHand(card.getController()); - typeList = typeList.getValidCards(cost.getExileFromHandType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getExileFromHandType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); if (typeList.size() < cost.getExileFromHandAmount()) return false; } @@ -192,7 +192,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); CardList typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(cost.getReturnType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getReturnType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); if (typeList.size() < cost.getReturnAmount()) return false; } @@ -253,7 +253,7 @@ public class Cost_Payment { if (!payTapXType && cost.getTapXTypeCost()){ PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); CardList typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(cost.getTapXType().split(","),ability.getActivatingPlayer() ,ability.getSourceCard()); + typeList = typeList.getValidCards(cost.getTapXType().split(";"),ability.getActivatingPlayer() ,ability.getSourceCard()); changeInput.stopSetNext(input_tapXCost(cost.getTapXTypeAmount(),cost.getTapXType(), typeList, ability, this)); return false; @@ -326,7 +326,7 @@ public class Cost_Payment { } else{ if (!discType.equals("Any")){ - String validType[] = discType.split(","); + String validType[] = discType.split(";"); handList = handList.getValidCards(validType,ability.getActivatingPlayer() ,ability.getSourceCard()); } changeInput.stopSetNext(input_discardCost(discAmount, discType, handList, ability, this)); @@ -550,7 +550,7 @@ public class Cost_Payment { } else{ if (!discType.equals("Any")){ - String validType[] = discType.split(","); + String validType[] = discType.split(";"); AllZone.GameAction.AI_discardNumType(discAmount, validType, ability); } else{ @@ -822,7 +822,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, spell.getSourceCard().getController()); typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(type.split(","),spell.getActivatingPlayer() ,spell.getSourceCard()); + typeList = typeList.getValidCards(type.split(";"),spell.getActivatingPlayer() ,spell.getSourceCard()); AllZone.Display.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } @@ -948,7 +948,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, spell.getSourceCard().getController()); typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(type.split(","),spell.getActivatingPlayer() ,spell.getSourceCard()); + typeList = typeList.getValidCards(type.split(";"),spell.getActivatingPlayer() ,spell.getSourceCard()); AllZone.Display.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } @@ -1009,7 +1009,7 @@ public class Cost_Payment { PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, spell.getSourceCard().getController()); typeList = new CardList(hand.getCards()); - typeList = typeList.getValidCards(type.split(","),spell.getActivatingPlayer() ,spell.getSourceCard()); + typeList = typeList.getValidCards(type.split(";"),spell.getActivatingPlayer() ,spell.getSourceCard()); AllZone.Display.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } @@ -1155,7 +1155,7 @@ public class Cost_Payment { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, spell.getSourceCard().getController()); typeList = new CardList(play.getCards()); - typeList = typeList.getValidCards(type.split(","),spell.getActivatingPlayer() ,spell.getSourceCard()); + typeList = typeList.getValidCards(type.split(";"),spell.getActivatingPlayer() ,spell.getSourceCard()); AllZone.Display.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); }