From c238925c22d737c5ae5dfab78cba9f69d6db21e2 Mon Sep 17 00:00:00 2001 From: swordshine Date: Sat, 30 Mar 2013 12:37:09 +0000 Subject: [PATCH] - Added Koskun Falls --- .gitattributes | 1 + res/cardsfolder/k/koskun_falls.txt | 11 +++++++++ src/main/java/forge/game/GameActionUtil.java | 26 ++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 res/cardsfolder/k/koskun_falls.txt diff --git a/.gitattributes b/.gitattributes index f171d371d86..abca738a842 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5779,6 +5779,7 @@ res/cardsfolder/k/korlash_heir_to_blackblade.txt svneol=native#text/plain res/cardsfolder/k/kormus_bell.txt svneol=native#text/plain res/cardsfolder/k/korozda_guildmage.txt -text res/cardsfolder/k/korozda_monitor.txt -text +res/cardsfolder/k/koskun_falls.txt -text res/cardsfolder/k/koskun_keep.txt svneol=native#text/plain res/cardsfolder/k/koth_of_the_hammer.txt svneol=native#text/plain res/cardsfolder/k/koths_courier.txt svneol=native#text/plain diff --git a/res/cardsfolder/k/koskun_falls.txt b/res/cardsfolder/k/koskun_falls.txt new file mode 100644 index 00000000000..0ae87ef0de7 --- /dev/null +++ b/res/cardsfolder/k/koskun_falls.txt @@ -0,0 +1,11 @@ +Name:Koskun Falls +ManaCost:2 B B +Types:World Enchantment +S:Mode$ CantAttackUnless | ValidCard$ Creature | Target$ You | Cost$ 2 | Description$ Creatures can't attack you unless their controller pays 2 for each creature he or she controls that's attacking you. +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ At the beginning of your upkeep, sacrifice CARDNAME unless you tap an untapped creature you control. +SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | Defined$ Self | UnlessCost$ tapXType<1/Creature> | UnlessPayer$ You +SVar:NeedsToPlayVar:Y GE1 +SVar:Y:Count$Valid Creature.YouCtrl +SVar:Picture:http://www.wizards.com/global/images/magic/general/koskun_fallss.jpg +Oracle:At the beginning of your upkeep, sacrifice Koskun Falls unless you tap an untapped creature you control.\nCreatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you. +SetInfo:HML Rare \ No newline at end of file diff --git a/src/main/java/forge/game/GameActionUtil.java b/src/main/java/forge/game/GameActionUtil.java index 01137a5afa6..3131c1cde59 100644 --- a/src/main/java/forge/game/GameActionUtil.java +++ b/src/main/java/forge/game/GameActionUtil.java @@ -51,6 +51,7 @@ import forge.card.cost.CostPutCounter; import forge.card.cost.CostRemoveCounter; import forge.card.cost.CostReturn; import forge.card.cost.CostSacrifice; +import forge.card.cost.CostTapType; import forge.card.cost.CostUtil; import forge.card.mana.ManaCost; import forge.card.spellability.Ability; @@ -563,6 +564,31 @@ public final class GameActionUtil { cpl.reportPaidCardsTo(sourceAbility); } + else if (part instanceof CostTapType) { + List choiceList = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType().split(";"), p, source); + choiceList = CardLists.filter(choiceList, Presets.UNTAPPED); + int amount = getAmountFromPartX(part, source, sourceAbility); + + if (choiceList.size() < amount) { + // unable to pay (not enough cards) + return false; + } + + InputSelectCards inp = new InputSelectCardsFromList(amount, amount, choiceList); + inp.setMessage("Select %d card(s) to tap"); + inp.setCancelAllowed(true); + + FThreads.setInputAndWait(inp); + if (inp.hasCancelled() || inp.getSelected().size() != amount) + return false; + + CostPartWithList cpl = (CostPartWithList)part; + for (Card c : inp.getSelected()) { + cpl.executePayment(sourceAbility, c); + } + cpl.reportPaidCardsTo(sourceAbility); + } + else if (part instanceof CostPartMana ) { if (!((CostPartMana) part).getManaToPay().equals("0")) // non-zero costs require input mayRemovePart = false;