From c662008ed01eb610d3b226b92fc16072c754fa5a Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 05:35:49 +0000 Subject: [PATCH] Added card Parallel Evolution. Added CardFactoryUtil.copyTokens(CardList) to support new card. --- res/cards.txt | 5 +++++ src/forge/CardFactory.java | 41 +++++++++++++++++++++++++++++++++- src/forge/CardFactoryUtil.java | 22 +++++++++++++++++- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/res/cards.txt b/res/cards.txt index 2d0c8ec78bc..33bdb41dda9 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -16041,6 +16041,11 @@ Acorn Harvest Sorcery no text +Parallel Evolution +3 G G +Sorcery +For each creature token on the battlefield, its controller puts a token that's a copy of that creature onto the battlefield. + Beast Attack 2 G G G Instant diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 70989edc49c..5c2c08c673e 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -9163,7 +9163,7 @@ public class CardFactory implements NewConstants { choice = AllZone.Display.getChoice("Choose", removeLand(all.toArray())); Card[] showLibrary = library.getCards(); - Comparator com = new TableSorter(new CardList(showLibrary), 2, true); + Comparator com = new TableSorter(new CardList(showLibrary), 2, true); Arrays.sort(showLibrary, com); AllZone.Display.getChoiceOptional("Opponent's Library", showLibrary); @@ -11816,6 +11816,45 @@ public class CardFactory implements NewConstants { }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Parallel Evolution")) { + SpellAbility spell = new Spell(card) { + + private static final long serialVersionUID = 3456160935845779623L; + + @Override + public void resolve() { + + // for each play zone add a copy of each creature token card + CardList creature = new CardList(); + creature.addAll(AllZone.Human_Play.getCards()); + creature.addAll(AllZone.Computer_Play.getCards()); + + creature = creature.getType("Creature"); + + creature = creature.filter(new CardListFilter() + { + public boolean addCard(Card crd) + { + return crd.isToken(); + } + }); + + CardFactoryUtil.copyTokens(creature); + + } + }; + + spell.setDescription("For each creature token on the battlefield, its controller puts a token that's a copy of that creature onto the battlefield."); + spell.setStackDescription("For each creature token on the battlefield, its controller puts a token that's a copy of that creature onto the battlefield."); + + card.setFlashback(true); + card.clearSpellAbility(); + card.addSpellAbility(spell); + card.addSpellAbility(CardFactoryUtil.ability_Flashback(card, "4 G G G", "0")); + + }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if(cardName.equals("Beast Attack")) { SpellAbility spell = new Spell(card) { diff --git a/src/forge/CardFactoryUtil.java b/src/forge/CardFactoryUtil.java index f649b83ec61..ec28e4f2ab7 100644 --- a/src/forge/CardFactoryUtil.java +++ b/src/forge/CardFactoryUtil.java @@ -1,4 +1,3 @@ - package forge; @@ -4080,6 +4079,27 @@ public class CardFactoryUtil { return list; } + public static CardList copyTokens(CardList tokenList) + { + CardList list = new CardList(); + + for(int tokenAdd = 0; tokenAdd < tokenList.size(); tokenAdd++){ + Card thisToken = tokenList.getCard(tokenAdd); + + ArrayList tal = thisToken.getType(); + String tokenTypes [] = new String [tal.size ()]; + tal.toArray (tokenTypes); + + ArrayList kal = thisToken.getIntrinsicKeyword(); + String tokenKeywords [] = new String [kal.size ()]; + kal.toArray(tokenKeywords); + + list.add(makeToken(thisToken.getName(), thisToken.getImageName(), thisToken.getController(), thisToken.getManaCost(), tokenTypes, thisToken.getBaseAttack(), thisToken.getBaseDefense(), tokenKeywords)); + } + + return list; + } + public static int getTotalBushidoMagnitude(Card c) { int count = 0; ArrayList keywords = c.getKeyword();