From 5a38a19f8d4363a56a887a8206558e6edfb27584 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sat, 5 Nov 2011 08:45:10 +0000 Subject: [PATCH] - Added Phase requirements to static abilities. - Added Hand to Hand. --- .gitattributes | 1 + res/cardsfolder/h/hand_to_hand.txt | 12 +++++++ .../card/staticability/StaticAbility.java | 32 +++++++++++++++---- 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 res/cardsfolder/h/hand_to_hand.txt diff --git a/.gitattributes b/.gitattributes index 3bf87da9276..5d142c95dfc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3620,6 +3620,7 @@ res/cardsfolder/h/hand_of_emrakul.txt svneol=native#text/plain res/cardsfolder/h/hand_of_honor.txt svneol=native#text/plain res/cardsfolder/h/hand_of_justice.txt svneol=native#text/plain res/cardsfolder/h/hand_of_the_praetors.txt svneol=native#text/plain +res/cardsfolder/h/hand_to_hand.txt -text res/cardsfolder/h/hanna_ships_navigator.txt svneol=native#text/plain res/cardsfolder/h/hannas_custody.txt svneol=native#text/plain res/cardsfolder/h/hanweir_watchkeep_bane_of_hanweir.txt -text diff --git a/res/cardsfolder/h/hand_to_hand.txt b/res/cardsfolder/h/hand_to_hand.txt new file mode 100644 index 00000000000..19c7f4c8e8d --- /dev/null +++ b/res/cardsfolder/h/hand_to_hand.txt @@ -0,0 +1,12 @@ +Name:Hand to Hand +ManaCost:2 R +Types:Enchantment +Text:no text +S:Mode$ CantBeCast | ValidCard$ Instant | Phases$ BeginCombat->EndCombat | Description$ During combat, players can't cast instant spells or activate abilities that aren't mana abilities. +S:Mode$ CantBeActivated | ValidCard$ Card| Phases$ BeginCombat->EndCombat | NonMana$ True +SVar:RemRandomDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/hand_to_hand.jpg +SetInfo:TMP|Rare|http://magiccards.info/scans/en/tp/180.jpg +Oracle:During combat, players can't cast instant spells or activate abilities that aren't mana abilities. +End \ No newline at end of file diff --git a/src/main/java/forge/card/staticability/StaticAbility.java b/src/main/java/forge/card/staticability/StaticAbility.java index d7253626840..0e7f6bc5415 100644 --- a/src/main/java/forge/card/staticability/StaticAbility.java +++ b/src/main/java/forge/card/staticability/StaticAbility.java @@ -327,33 +327,51 @@ public class StaticAbility { Zone effectZone = Zone.Battlefield; // default - if (this.mapParams.containsKey("EffectZone")) { + if (mapParams.containsKey("EffectZone")) { effectZone = Zone.smartValueOf(this.mapParams.get("EffectZone")); } - if ((effectZone != null) && (!this.hostCard.isInZone(effectZone) || this.hostCard.isPhasedOut())) { + if ((effectZone != null) && (!hostCard.isInZone(effectZone) || hostCard.isPhasedOut())) { return false; } - if (this.mapParams.containsKey("Threshold") && !controller.hasThreshold()) { + if (mapParams.containsKey("Threshold") && !controller.hasThreshold()) { return false; } - if (this.mapParams.containsKey("Hellbent") && !controller.hasHellbent()) { + if (mapParams.containsKey("Hellbent") && !controller.hasHellbent()) { return false; } - if (this.mapParams.containsKey("Metalcraft") && !controller.hasMetalcraft()) { + if (mapParams.containsKey("Metalcraft") && !controller.hasMetalcraft()) { return false; } - if (this.mapParams.containsKey("PlayerTurn") && !AllZone.getPhase().isPlayerTurn(controller)) { + if (mapParams.containsKey("PlayerTurn") && !AllZone.getPhase().isPlayerTurn(controller)) { return false; } - if (this.mapParams.containsKey("OpponentTurn") && !AllZone.getPhase().isPlayerTurn(controller.getOpponent())) { + if (mapParams.containsKey("OpponentTurn") && !AllZone.getPhase().isPlayerTurn(controller.getOpponent())) { return false; } + + if (mapParams.containsKey("Phases")) { + String phases = mapParams.get("Phases"); + + if (phases.contains("->")) { + // If phases lists a Range, split and Build Activate String + // Combat_Begin->Combat_End (During Combat) + // Draw-> (After Upkeep) + // Upkeep->Combat_Begin (Before Declare Attackers) + + final String[] split = phases.split("->", 2); + phases = AllZone.getPhase().buildActivateString(split[0], split[1]); + } + + if (!phases.contains(AllZone.getPhase().getPhase())) { + return false; + } + } if (this.mapParams.containsKey("TopCardOfLibraryIs")) { final Card topCard = controller.getCardsIn(Zone.Library).get(0);