From 89e787fff22e9fe9652fca0ce19a46d73aadcd70 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 04:20:46 +0000 Subject: [PATCH] add Energy Tap from Legends (great with Fireball) --- res/card-pictures.txt | 1 + res/cards.txt | 5 +++++ src/forge/AllZoneUtil.java | 9 +++++++++ src/forge/CardFactory.java | 41 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/res/card-pictures.txt b/res/card-pictures.txt index a0b06581d4d..ebb5758421b 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +energy_tap.jpg http://www.wizards.com/global/images/magic/general/energy_tap.jpg divine_offering.jpg http://www.wizards.com/global/images/magic/general/divine_offering.jpg argothian_pixies.jpg http://www.wizards.com/global/images/magic/general/argothian_pixies.jpg arc_slogger.jpg http://www.wizards.com/global/images/magic/general/arc_slogger.jpg diff --git a/res/cards.txt b/res/cards.txt index 476ca015579..39b5afbeba7 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Energy Tap +U +Sorcery +Tap target untapped creature you control. If you do, add X Colorless to your mana pool, where X is that creature's converted mana cost. + Divine Offering 1 W Instant diff --git a/src/forge/AllZoneUtil.java b/src/forge/AllZoneUtil.java index 32597bb0e62..f1a70bd7f75 100644 --- a/src/forge/AllZoneUtil.java +++ b/src/forge/AllZoneUtil.java @@ -352,4 +352,13 @@ public class AllZoneUtil { return c.isTapped(); } }; + + /** + * a CardListFilter to get all cards that are untapped + */ + public static CardListFilter untapped = new CardListFilter() { + public boolean addCard(Card c) { + return c.isUntapped(); + } + }; } \ No newline at end of file diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 8bcb3f1eba3..880d1a8cec3 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -19646,6 +19646,47 @@ public class CardFactory implements NewConstants { spell.setBeforePayMana(runtime); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Energy Tap")) { + /* + * Tap target untapped creature you control. If you do, add X to + * your mana pool, where X is that creature's converted mana cost. + */ + final SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = 8883585452278041848L; + + @Override + public void resolve() { + Card target = getTargetCard(); + if(null != target && target.isUntapped()) { + int cost = CardUtil.getConvertedManaCost(target); + Card mp = AllZone.ManaPool; + mp.addExtrinsicKeyword("ManaPool:"+cost); + target.tap(); + } + } + + @Override + public boolean canPlayAI() { + return false; + } + }; + Input runtime = new Input() { + private static final long serialVersionUID = -757364902159389697L; + + @Override + public void showMessage() { + CardList choices = AllZoneUtil.getCreaturesInPlay(card.getController()); + choices = choices.filter(AllZoneUtil.untapped); + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, choices, + "Select target tapped creature", true, false)); + }//showMessage() + };//Input + spell.setBeforePayMana(runtime); + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + // Cards with Cycling abilities // -1 means keyword "Cycling" not found if(hasKeyword(card, "Cycling") != -1) {