From 5e94b017e23ce5803900bf82a3ab53b5d99fe05b Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:29:00 +0000 Subject: [PATCH] - Added an alternate way of sacrificing multiple tokens using Nemata, Grove Guardian (experimental). - Fixed Wort, Boggart Auntie / Squee, Goblin Nabob card duplication bug. - Hopefully fixed a bug with the AI using Ajani Vengeant, and not being able to target any permanents. - Hardcoded NOT to grab Ball Lightning with Bribery for the AI (since it has been reported so many times). - Fixed Korlash, Heir to Blackblade (should be able to fetch any 2 swamps now - select with CTRL + click). --- src/forge/CardFactory.java | 9 ++- src/forge/CardFactory_Creatures.java | 72 ++++++++++++++++++++++-- src/forge/CardFactory_Planeswalkers.java | 22 ++++++-- src/forge/GameActionUtil.java | 2 +- 4 files changed, 92 insertions(+), 13 deletions(-) diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 13588d34151..5fcd8123ddb 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -2888,7 +2888,7 @@ public class CardFactory implements NewConstants { //System.out.println("Creats size: " + creats.size()); if(card.getController().equals(Constant.Player.Human)) { - List selection = AllZone.Display.getChoices("Select creature to sacrifice", creats.toArray()); + List selection = AllZone.Display.getChoices("Select creatures to sacrifice", creats.toArray()); numCreatures[0] = selection.size(); for(int m = 0; m < selection.size(); m++) { @@ -9131,7 +9131,12 @@ public class CardFactory implements NewConstants { public void computerResolve() { CardList all = new CardList(AllZone.Human_Library.getCards()); - all = all.getType("Creature"); + all = all.filter(new CardListFilter(){ + public boolean addCard(Card c) + { + return c.isCreature() && !c.getName().equals("Ball Lightning"); + } + }); CardList flying = all.filter(new CardListFilter() { public boolean addCard(Card c) { diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index f2c8289a44b..11136f242d8 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -4,6 +4,7 @@ package forge; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import javax.swing.JOptionPane; @@ -1079,6 +1080,7 @@ public class CardFactory_Creatures { CardList list = new CardList(library.getCards()); CardList swamp = list.getType("Swamp"); + /* for(int i = 0; i < 2 && (!swamp.isEmpty()); i++) { Card c = swamp.get(0); swamp.remove(c); @@ -1087,6 +1089,18 @@ public class CardFactory_Creatures { play.add(c); c.tap(); } + */ + + List selection = AllZone.Display.getChoices("Select up to two swamps", swamp.toArray()); + + for(int i = 0; i < selection.size(); i++) { + Card c = selection.get(i); + + library.remove(c); + play.add(c); + c.tap(); + } + for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) { Command com = GameActionUtil.commands.get(effect); com.execute(); @@ -12185,8 +12199,7 @@ public class CardFactory_Creatures { @Override public void showMessage() { - CardList saps = new CardList( - AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); saps = saps.getType("Saproling"); stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", @@ -12194,11 +12207,61 @@ public class CardFactory_Creatures { } }; + final int[] numCreatures = new int[1]; final Ability a3 = new Ability(card,"0") { public void resolve() { - + CardList creats = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + creats = creats.getType("Saproling"); + + List selection = AllZone.Display.getChoices("Select Saprolings to sacrifice", creats.toArray()); + + numCreatures[0] = selection.size(); + for(int m = 0; m < selection.size(); m++) { + AllZone.GameAction.sacrifice(selection.get(m)); + } + + final Command eot1 = new Command() { + + private static final long serialVersionUID = 5732420491509961333L; + + public void execute() { + CardList saps = new CardList(); + saps.addAll(AllZone.Human_Play.getCards()); + saps.addAll(AllZone.Computer_Play.getCards()); + + saps = saps.getType("Saproling"); + + for(int i = 0; i < saps.size(); i++) { + Card sap = saps.get(i); + + sap.addTempAttackBoost(-numCreatures[0]); + sap.addTempDefenseBoost(-numCreatures[0]); + } + + } + }; + + CardList saps = new CardList(); + saps.addAll(AllZone.Human_Play.getCards()); + saps.addAll(AllZone.Computer_Play.getCards()); + + saps = saps.getType("Saproling"); + for(int i = 0; i < saps.size(); i++) { + Card sap = saps.get(i); + + sap.addTempAttackBoost(numCreatures[0]); + sap.addTempDefenseBoost(numCreatures[0]); + } + + AllZone.EndOfTurn.addUntil(eot1); + + } + + public boolean canPlayAI() + { + return false; } }; a1.setDescription("2G: Put a 1/1 green Saproling creature token into play."); @@ -12209,12 +12272,13 @@ public class CardFactory_Creatures { card.addSpellAbility(a2); a2.setDescription("Sacrifice a Saproling: Saproling creatures get +1/+1 until end of turn"); a2.setStackDescription("Saprolings get +1/+1 until end of turn."); + a2.setBeforePayMana(runtime); card.addSpellAbility(a3); a3.setDescription("(Alternate way of sacrificing multiple creatures)."); a3.setStackDescription("Saprolings get +X/+X until end of turn."); - a2.setBeforePayMana(runtime); + }//*************** END ************ END ************************** //*************** START *********** START ************************** diff --git a/src/forge/CardFactory_Planeswalkers.java b/src/forge/CardFactory_Planeswalkers.java index 33dfeb24ab3..b6f7304c701 100644 --- a/src/forge/CardFactory_Planeswalkers.java +++ b/src/forge/CardFactory_Planeswalkers.java @@ -1923,16 +1923,26 @@ class CardFactory_Planeswalkers { final SpellAbility ability1 = new Ability(card2, "0") { @Override public void resolve() { - card2.addCounterFromNonEffect(Counters.LOYALTY, 1); - turn[0] = AllZone.Phase.getTurn(); - - Card c = getTargetCard(); - c.addExtrinsicKeyword("This card doesn't untap during your next untap step."); + Card c = getTargetCard(); + if (c != null) + { + card2.addCounterFromNonEffect(Counters.LOYALTY, 1); + turn[0] = AllZone.Phase.getTurn(); + c.addExtrinsicKeyword("This card doesn't untap during your next untap step."); + } } @Override public boolean canPlayAI() { - return card2.getCounters(Counters.LOYALTY) < 8; + CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return CardFactoryUtil.canTarget(card2, c); + } + }); + return card2.getCounters(Counters.LOYALTY) < 8 && list.size() > 0; } @Override diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index c38897b8975..033d9190164 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -27,6 +27,7 @@ public class GameActionUtil { upkeep_Honden_of_Infinite_Rage(); upkeep_Land_Tax(); upkeep_Greener_Pastures(); + upkeep_Wort(); upkeep_Squee(); upkeep_Sporesower_Thallid(); upkeep_Dragonmaster_Outcast(); @@ -48,7 +49,6 @@ public class GameActionUtil { upkeep_Reya(); upkeep_Emeria(); upkeep_Oversold_Cemetery(); - upkeep_Wort(); upkeep_Nether_Spirit(); upkeep_Nettletooth_Djinn(); upkeep_Fledgling_Djinn();