From 217cc8056b5d8ece479c1b081edcd1184f54b79c Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 05:48:51 +0000 Subject: [PATCH] - Added a canPlayAI() method to Parallel Evolution. --- src/forge/CardFactory.java | 56 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index e2ff62c650d..880580f9434 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -12577,40 +12577,52 @@ public class CardFactory implements NewConstants { //*************** START *********** START ************************** else if(cardName.equals("Parallel Evolution")) { SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = 3456160935845779623L; + @Override + public boolean canPlayAI() { + CardList humTokenCreats = new CardList(); + humTokenCreats.addAll(AllZone.Human_Play.getCards()); + humTokenCreats = getTokenCreats(humTokenCreats); + + CardList compTokenCreats = new CardList(); + compTokenCreats.addAll(AllZone.Computer_Play.getCards()); + compTokenCreats = getTokenCreats(compTokenCreats); + + return compTokenCreats.size() > humTokenCreats.size(); + }//canPlayAI() + + CardList getTokenCreats(CardList list) { + list = list.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.isCreature() && c.isToken(); + } + }); + return list; + }//getTokenCreats() + @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); - - } - }; + // for each play zone add a copy of each creature token card + CardList AllTokenCreatures = new CardList(); + AllTokenCreatures.addAll(AllZone.Human_Play.getCards()); + AllTokenCreatures.addAll(AllZone.Computer_Play.getCards()); + + AllTokenCreatures = getTokenCreats(AllTokenCreatures); + + CardFactoryUtil.copyTokens(AllTokenCreatures); + + }//resolve() + };//SpellAbility 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."); + spell.setStackDescription("Parallel Evolution - 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 **************************