From 2207ba140e7516adee270b02e776d713c583d03e Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 14:56:33 +0000 Subject: [PATCH] add Power Sink (from original base Alpha) --- .gitattributes | 1 + res/cardsfolder/power_sink.txt | 10 ++++++++++ src/forge/AbilityFactory_CounterMagic.java | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 res/cardsfolder/power_sink.txt diff --git a/.gitattributes b/.gitattributes index e64f6c1ce26..af674197982 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3811,6 +3811,7 @@ res/cardsfolder/pouncing_jaguar.txt -text svneol=native#text/plain res/cardsfolder/power_armor.txt -text svneol=native#text/plain res/cardsfolder/power_artifact.txt -text svneol=native#text/plain res/cardsfolder/power_matrix.txt -text svneol=native#text/plain +res/cardsfolder/power_sink.txt -text svneol=native#text/plain res/cardsfolder/power_surge.txt -text svneol=native#text/plain res/cardsfolder/pradesh_gypsies.txt -text svneol=native#text/plain res/cardsfolder/predator_dragon.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/power_sink.txt b/res/cardsfolder/power_sink.txt new file mode 100644 index 00000000000..cb7e2dfb6c8 --- /dev/null +++ b/res/cardsfolder/power_sink.txt @@ -0,0 +1,10 @@ +Name:Power Sink +ManaCost:X U +Types:Instant +Text:no text +A:SP$Counter | Cost$ X U | Type$ Spell | UnlessCost$ X |PowerSink$True| SpellDescription$ Counter target spell unless its controller pays X. If he or she doesn't, that player taps all lands with mana abilities he or she controls and empties his or her mana pool. +SVar:X:Count$xPaid +SVar:RemAIDeck:True +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/power_sink.jpg +End \ No newline at end of file diff --git a/src/forge/AbilityFactory_CounterMagic.java b/src/forge/AbilityFactory_CounterMagic.java index 866eb5042d5..a74cd0f9f02 100644 --- a/src/forge/AbilityFactory_CounterMagic.java +++ b/src/forge/AbilityFactory_CounterMagic.java @@ -143,6 +143,7 @@ public class AbilityFactory_CounterMagic { public void execute() { removeFromStack(tgtSA,sa); + if(params.containsKey("PowerSink")) doPowerSink(AllZone.HumanPlayer); } }; @@ -153,6 +154,7 @@ public class AbilityFactory_CounterMagic { if(ComputerUtil.canPayCost(ability)) ComputerUtil.playNoStack(ability); else { removeFromStack(tgtSA,sa); + if(params.containsKey("PowerSink")) doPowerSink(AllZone.ComputerPlayer); } } doExtraActions(tgtSA,sa); @@ -181,6 +183,21 @@ public class AbilityFactory_CounterMagic { tgt[0] = null; } + + private void doPowerSink(Player p) { + //get all lands with mana abilities + CardList lands = AllZoneUtil.getPlayerLandsInPlay(p); + lands = lands.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.getManaAbility().size() > 0; + } + }); + //tap them + for(Card c:lands) c.tap(); + + //empty mana pool + if(p.isHuman()) AllZone.ManaPool.clearPool(); + } private String counterStackDescription(AbilityFactory af, SpellAbility sa){