From 8bc3bcf7e412766f11a75e6a6032c2ded2b2ef73 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:09:38 +0000 Subject: [PATCH] --- res/cards.txt | 20 +- res/main.properties | 2 +- src/forge/CardFactory.java | 377 ++++++++++++++++++++++++++++++++++++- 3 files changed, 391 insertions(+), 8 deletions(-) diff --git a/res/cards.txt b/res/cards.txt index d140152fca9..6d694576e1a 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,18 @@ +Force of Will +3 U U +Instant +no text + +Thwart +2 U U +Instant +no text + +Ensnare +3 U +Instant +no text + Carnophage B Creature Zombie @@ -9447,8 +9462,6 @@ Guided Strike 1 W Instant Target creature gets +1/+0 and gains first strike until end of turn. Draw a card. -spPumpTgt:+1/+0/First Strike -Cantrip Mobilization 2 W @@ -15016,8 +15029,6 @@ Aggressive Urge 1 G Instant Target creature gets +1/+1 until end of turn. Draw a card. -spPumpTgt:+1/+1 -Cantrip Needle Storm 2 G @@ -15522,7 +15533,6 @@ Might of Oaks 3 G Instant Target creature gets +7/+7 until end of turn. -spPumpTgt:+7/+7 Spined Wurm 4 G diff --git a/res/main.properties b/res/main.properties index 7cc050b3bb0..640427f4b31 100644 --- a/res/main.properties +++ b/res/main.properties @@ -1,6 +1,6 @@ program/mail=mtgerror@yahoo.com program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 -program/version=Forge -- official beta: 09/12/14, SVN revision: 251 +program/version=Forge -- official beta: 09/12/14, SVN revision: 252 tokens--file=AllTokens.txt diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index ab629c059c4..ef99aa9b76c 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -6980,6 +6980,124 @@ public class CardFactory implements NewConstants { card.clearSpellAbility(); card.addSpellAbility(spell); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ensnare")) + { + SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = -5170378205496330425L; + public void resolve() + { + CardList creats = new CardList(); + creats.addAll(AllZone.Human_Play.getCards()); + creats.addAll(AllZone.Computer_Play.getCards()); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature(); + } + }); + for(int i = 0; i < creats.size(); i++) + creats.get(i).tap(); + }//resolve() + public boolean canPlayAI() + { + return false; + } + }; + spell.setDescription("Tap all creatures."); + spell.setStackDescription(card.getName() + " - Tap all creatures"); + + final SpellAbility bounce = new Spell(card) + { + private static final long serialVersionUID = 6331598238749406160L; + public void resolve() + { + CardList creats = new CardList(); + creats.addAll(AllZone.Human_Play.getCards()); + creats.addAll(AllZone.Computer_Play.getCards()); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature(); + } + }); + for(int i = 0; i < creats.size(); i++) + creats.get(i).tap(); + } + public boolean canPlay() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList list = new CardList(play.getCards()); + list = list.getType("Island"); + return list.size() >= 2; + } + public boolean canPlayAI() + { + return false; + } + + }; + bounce.setDescription("You may return three Islands you control to their owner's hand rather than pay Ensnare's mana cost."); + bounce.setStackDescription(card.getName() + " - Tap all creatures."); + bounce.setManaCost("0"); + + final Input bounceIslands = new Input() + { + private static final long serialVersionUID = -8511915834608321343L; + int stop = 2; + int count = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select an Island"); + ButtonUtil.disableAll(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(c.getType().contains("Island") && zone.is(Constant.Zone.Play)) + { + AllZone.GameAction.moveToHand(c); + + count++; + if(count == stop) { + AllZone.Stack.add(bounce); + stop(); + } + } + }//selectCard() + }; + + bounce.setBeforePayMana(bounceIslands); + + Command bounceIslandsAI = new Command() + { + private static final long serialVersionUID = 6399831162328201755L; + + public void execute() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList list = new CardList(play.getCards()); + list = list.getType("Island"); + //TODO: sort by tapped + + for (int i=0;i<2;i++) + { + AllZone.GameAction.moveToHand(list.get(i)); + } + } + }; + + bounce.setBeforePayManaAI(bounceIslandsAI); + + card.clearSpellAbility(); + card.addSpellAbility(bounce); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** @@ -17541,8 +17659,10 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); AllZone.GameAction.moveToHand(c); count++; - if(count == stop) - stop(); + if(count == stop) { + AllZone.Stack.add(bounce); + stop(); + } } }//selectCard() }; @@ -17574,6 +17694,259 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); card.addSpellAbility(spell); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Thwart")) + { + final SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = 6549506712141125977L; + public void resolve() + { + SpellAbility sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + public boolean canPlay() + { + if(AllZone.Stack.size() == 0) + return false; + + //see if spell is on stack and that opponent played it + String opponent = AllZone.GameAction.getOpponent(card.getController()); + SpellAbility sa = AllZone.Stack.peek(); + + return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) + && CardFactoryUtil.isCounterable(sa.getSourceCard()); + } + public boolean canPlayAI() + { + return false; + } + }; + spell.setDescription("Counter target spell."); + spell.setStackDescription(card.getName() + " - Counter target spell."); + + final SpellAbility bounce = new Spell(card) + { + private static final long serialVersionUID = -8310299673731730438L; + + public void resolve() + { + SpellAbility sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + public boolean canPlay() + { + if(AllZone.Stack.size() == 0) + return false; + + //see if spell is on stack and that opponent played it + String opponent = AllZone.GameAction.getOpponent(card.getController()); + SpellAbility sa = AllZone.Stack.peek(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList list = new CardList(play.getCards()); + list = list.getType("Island"); + return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) + && CardFactoryUtil.isCounterable(sa.getSourceCard()) && list.size() >= 3; + } + + public boolean canPlayAI() + { + return false; + } + + }; + bounce.setDescription("You may return two Islands you control to their owner's hand rather than pay Thwart's mana cost."); + bounce.setStackDescription(card.getName() + " - Counter target spell."); + bounce.setManaCost("0"); + + final Input bounceIslands = new Input() + { + private static final long serialVersionUID = 3124427514142382129L; + int stop = 3; + int count = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select an Island"); + ButtonUtil.disableAll(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(c.getType().contains("Island") && zone.is(Constant.Zone.Play)) + { + AllZone.GameAction.moveToHand(c); + + count++; + if(count == stop) { + AllZone.Stack.add(bounce); + stop(); + } + } + }//selectCard() + }; + + bounce.setBeforePayMana(bounceIslands); + + Command bounceIslandsAI = new Command() + { + private static final long serialVersionUID = 8250154784542733353L; + + public void execute() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList list = new CardList(play.getCards()); + list = list.getType("Island"); + //TODO: sort by tapped + + for (int i=0;i<3;i++) + { + AllZone.GameAction.moveToHand(list.get(i)); + } + } + }; + + bounce.setBeforePayManaAI(bounceIslandsAI); + + card.clearSpellAbility(); + card.addSpellAbility(bounce); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Force of Will")) + { + final SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = 7960371805654673281L; + public void resolve() + { + SpellAbility sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + public boolean canPlay() + { + if(AllZone.Stack.size() == 0) + return false; + + //see if spell is on stack and that opponent played it + String opponent = AllZone.GameAction.getOpponent(card.getController()); + SpellAbility sa = AllZone.Stack.peek(); + + return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) + && CardFactoryUtil.isCounterable(sa.getSourceCard()); + } + public boolean canPlayAI() + { + return false; + } + }; + spell.setDescription("Counter target spell."); + spell.setStackDescription(card.getName() + " - Counter target spell."); + + final SpellAbility alt = new Spell(card) + { + private static final long serialVersionUID = -8643870743780757816L; + + public void resolve() + { + SpellAbility sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + public boolean canPlay() + { + if(AllZone.Stack.size() == 0) + return false; + + //see if spell is on stack and that opponent played it + String opponent = AllZone.GameAction.getOpponent(card.getController()); + SpellAbility sa = AllZone.Stack.peek(); + + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + CardList list = new CardList(hand.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return CardUtil.getColors(c).contains(Constant.Color.Blue) && !c.equals(card); + } + }); + return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) + && CardFactoryUtil.isCounterable(sa.getSourceCard()) && list.size() >= 1; + } + + public boolean canPlayAI() + { + return false; + } + + }; + alt.setDescription("You may pay 1 life and exile a blue card from your hand rather than pay Force of Will's mana cost."); + alt.setStackDescription(card.getName() + " - Counter target spell."); + alt.setManaCost("0"); + + final Input exileBlue = new Input() + { + private static final long serialVersionUID = 8692998689009712987L; + int stop = 1; + int count = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select a blue card"); + ButtonUtil.disableAll(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(CardUtil.getColors(c).contains(Constant.Color.Blue) && zone.is(Constant.Zone.Play)) + { + AllZone.GameAction.removeFromGame(c); + String player = card.getController(); + AllZone.GameAction.getPlayerLife(player).subtractLife(1); + + count++; + if(count == stop) { + AllZone.Stack.add(alt); + stop(); + } + } + }//selectCard() + }; + + + alt.setBeforePayMana(exileBlue); + + /* + Command bounceIslandsAI = new Command() + { + private static final long serialVersionUID = -8745630329512914365L; + + public void execute() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList list = new CardList(play.getCards()); + list = list.getType("Island"); + //TODO: sort by tapped + + for (int i=0;i<3;i++) + { + AllZone.GameAction.moveToHand(list.get(i)); + } + } + }; + + alt.setBeforePayManaAI(bounceIslandsAI); + */ + + card.clearSpellAbility(); + card.addSpellAbility(alt); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + // Cards with Cycling abilities // -1 means keyword "Cycling" not found