From 278b1229c10526b66ff75da3ba896a0e3da2c8e4 Mon Sep 17 00:00:00 2001 From: elcnesh Date: Mon, 8 Dec 2014 20:50:34 +0000 Subject: [PATCH] Fix and cleanup Hideaway. Plus a typo in Praetor's Grasp. --- .../game/ability/effects/EffectEffect.java | 16 +++++++++---- .../java/forge/game/card/CardFactoryUtil.java | 17 +++++++++++++ .../game/zone/PlayerZoneBattlefield.java | 22 +++++++---------- .../res/cardsfolder/h/howltooth_hollow.txt | 2 -- .../res/cardsfolder/m/mosswort_bridge.txt | 2 -- .../res/cardsfolder/p/praetors_grasp.txt | 2 +- .../res/cardsfolder/s/shelldock_isle.txt | 24 +++++++++---------- .../res/cardsfolder/s/spinerock_knoll.txt | 2 -- .../res/cardsfolder/w/windbrisk_heights.txt | 4 +--- 9 files changed, 49 insertions(+), 42 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java b/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java index 5b78e815d0a..a2138926d28 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java @@ -52,6 +52,7 @@ public class EffectEffect extends SpellAbilityEffect { String effectRemembered = null; String effectImprinted = null; Player ownerEff = null; + boolean imprintOnHost = false; if (sa.hasParam("Abilities")) { effectAbilities = sa.getParam("Abilities").split(","); @@ -85,7 +86,6 @@ public class EffectEffect extends SpellAbilityEffect { effectImprinted = sa.getParam("ImprintCards"); } - // Effect eff = new Effect(); String name = sa.getParam("Name"); if (name == null) { name = sa.getHostCard().getName() + "'s Effect"; @@ -97,10 +97,14 @@ public class EffectEffect extends SpellAbilityEffect { } if (sa.hasParam("EffectOwner")) { - List effectOwner = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("EffectOwner"), sa); + final List effectOwner = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("EffectOwner"), sa); ownerEff = effectOwner.get(0); } + if (sa.hasParam("ImprintOnHost")) { + imprintOnHost = true; + } + final Player controller = sa.hasParam("EffectOwner") ? ownerEff : sa.getActivatingPlayer(); final Card eff = new Card(controller.getGame().nextCardId()); eff.setName(name); @@ -112,8 +116,6 @@ public class EffectEffect extends SpellAbilityEffect { eff.setImmutable(true); eff.setEffectSource(hostCard); - final Card e = eff; - // Grant SVars first in order to give references to granted abilities if (effectSVars != null) { for (final String s : effectSVars) { @@ -211,7 +213,7 @@ public class EffectEffect extends SpellAbilityEffect { @Override public void run() { - game.getAction().exile(e); + game.getAction().exile(eff); } }; @@ -233,6 +235,10 @@ public class EffectEffect extends SpellAbilityEffect { } } + if (imprintOnHost) { + hostCard.addImprintedCard(eff); + } + // TODO: Add targeting to the effect so it knows who it's dealing with game.getTriggerHandler().suppressMode(TriggerType.ChangesZone); game.getAction().moveTo(ZoneType.Command, eff); diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 21285211701..6c40f3da33c 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2613,6 +2613,23 @@ public class CardFactoryUtil { card.addSpellAbility(bestow); card.getCurrentState().addUnparsedAbility(sbAttach.toString()); } + else if (keyword.equals("Hideaway")) { + card.getCurrentState().addIntrinsicKeyword("CARDNAME enters the battlefield tapped."); + + final Trigger hideawayTrigger = TriggerHandler.parseTrigger("Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigHideawayDig | TriggerDescription$ When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.", card, true); + card.addTrigger(hideawayTrigger); + card.setSVar("TrigHideawayDig", "DB$ Dig | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True | SubAbility$ DBHideawayEffect"); + final Trigger gainControlTrigger = TriggerHandler.parseTrigger("Mode$ ChangesController | ValidCard$ Card.Self | Execute$ DBHideawayEffect | Static$ True", card, true); + card.addTrigger(gainControlTrigger); + card.setSVar("DBHideawayEffect", "DB$ Effect | StaticAbilities$ STHideawayEffectLookAtCard | Triggers$ THideawayEffectCleanup | SVars$ DBHideawayEffectExileSelf | ImprintOnHost$ True | SubAbility$ DBHideawayRemember"); + card.setSVar("STHideawayEffectLookAtCard", "Mode$ Continuous | Affected$ Card.IsRemembered | MayLookAt$ True | EffectZone$ Command | AffectedZone$ Exile | Description$ You may look at the exiled card."); + card.setSVar("THideawayEffectCleanup", "Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZone$ Command | Execute$ DBHideawayEffectExileSelf | Static$ True"); + card.setSVar("DBHideawayEffectExileSelf", "DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile"); + final Trigger changeZoneTrigger = TriggerHandler.parseTrigger("Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZone$ Command | Execute$ DBHideawayCleanup | Static$ True", card, true); + card.addTrigger(changeZoneTrigger); + card.setSVar("DBHideawayRemember", "DB$ Animate | Defined$ Imprinted | RememberObjects$ Remembered | Permanent$ True"); + card.setSVar("DBHideawayCleanup", "DB$ Cleanup | ClearRemembered$ True"); + } } // AddCost diff --git a/forge-game/src/main/java/forge/game/zone/PlayerZoneBattlefield.java b/forge-game/src/main/java/forge/game/zone/PlayerZoneBattlefield.java index 45d3cab3157..f1574a75d3b 100644 --- a/forge-game/src/main/java/forge/game/zone/PlayerZoneBattlefield.java +++ b/forge-game/src/main/java/forge/game/zone/PlayerZoneBattlefield.java @@ -30,6 +30,7 @@ import forge.game.trigger.ZCTrigger; *

* * @author Forge + * @version $Id$ */ public class PlayerZoneBattlefield extends PlayerZone { @@ -53,20 +54,13 @@ public class PlayerZoneBattlefield extends PlayerZone { super.add(c, position); if (trigger) { - if (c.hasKeyword("Hideaway")) { - // it enters the battlefield this way, and should not fire - // triggers - c.setTapped(true); - } - else { - // ETBTapped static abilities - for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) { - for (final StaticAbility stAb : ca.getStaticAbilities()) { - if (stAb.applyAbility("ETBTapped", c)) { - // it enters the battlefield this way, and should - // not fire triggers - c.setTapped(true); - } + // ETBTapped static abilities + for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) { + for (final StaticAbility stAb : ca.getStaticAbilities()) { + if (stAb.applyAbility("ETBTapped", c)) { + // it enters the battlefield this way, and should + // not fire triggers + c.setTapped(true); } } } diff --git a/forge-gui/res/cardsfolder/h/howltooth_hollow.txt b/forge-gui/res/cardsfolder/h/howltooth_hollow.txt index 012bf1e2807..5e9edf60f44 100644 --- a/forge-gui/res/cardsfolder/h/howltooth_hollow.txt +++ b/forge-gui/res/cardsfolder/h/howltooth_hollow.txt @@ -2,8 +2,6 @@ Name:Howltooth Hollow ManaCost:no cost Types:Land K:Hideaway -T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. -SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True A:AB$ Mana | Cost$ T | Produced$ B | SpellDescription$ Add {B} to your mana pool. A:AB$ Play | Cost$ B T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ Hands | ConditionSVarCompare$ EQ0 | ForgetRemembered$ True | References$ Hands | SpellDescription$ You may play the exiled card without paying its mana cost if each player has no cards in hand. SVar:Hands:Count$NumInAllHands diff --git a/forge-gui/res/cardsfolder/m/mosswort_bridge.txt b/forge-gui/res/cardsfolder/m/mosswort_bridge.txt index ee8163636e2..d1248851c69 100644 --- a/forge-gui/res/cardsfolder/m/mosswort_bridge.txt +++ b/forge-gui/res/cardsfolder/m/mosswort_bridge.txt @@ -2,8 +2,6 @@ Name:Mosswort Bridge ManaCost:no cost Types:Land K:Hideaway -T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. -SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True | ForgetOtherRemembered$ True A:AB$ Mana | Cost$ T | Produced$ G | SpellDescription$ Add {G} to your mana pool. A:AB$ Play | Cost$ G T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | References$ X | ConditionCheckSVar$ X | ConditionSVarCompare$ GE10 | ForgetRemembered$ True | SpellDescription$ You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater. SVar:X:Count$SumPower_Creature.YouCtrl diff --git a/forge-gui/res/cardsfolder/p/praetors_grasp.txt b/forge-gui/res/cardsfolder/p/praetors_grasp.txt index d096f616cc7..c17d841a0fd 100644 --- a/forge-gui/res/cardsfolder/p/praetors_grasp.txt +++ b/forge-gui/res/cardsfolder/p/praetors_grasp.txt @@ -2,7 +2,7 @@ Name:Praetor's Grasp ManaCost:1 B B Types:Sorcery A:SP$ ChangeZone | Cost$ 1 B B | Origin$ Library | Destination$ Exile | ExileFaceDown$ True | ValidTgts$ Opponent | ChangeType$ Card | ChangeNum$ 1 | IsCurse$ True | RememberChanged$ True | SubAbility$ DBEffect | StackDescription$ SpellDescription | SpellDescription$ Search target opponent's library for a card and exile it face down. Then that player shuffles his or her library. You may look at and play that card for as long as it remains exiled. -SVar:DBEffect:DB$ Effect | MayLookAt$ True | MayPlay$ True | RememberObjects$ Remembered | StaticAbilities$ STPlay | Duration$ Permanent | Triggers$ TrigCleanup | SVars$ DBExileSelf | SubAbility$ DBCleanup +SVar:DBEffect:DB$ Effect | RememberObjects$ Remembered | StaticAbilities$ STPlay | Duration$ Permanent | Triggers$ TrigCleanup | SVars$ DBExileSelf | SubAbility$ DBCleanup SVar:STPlay:Mode$ Continuous | MayLookAt$ True | MayPlay$ True | EffectZone$ Command | Affected$ Card.IsRemembered | AffectedZone$ Exile | Description$ You may look at and play a card as long as it remains exiled. SVar:TrigCleanup:Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZones$ Command | Execute$ DBExileSelf | Static$ True SVar:DBExileSelf:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile diff --git a/forge-gui/res/cardsfolder/s/shelldock_isle.txt b/forge-gui/res/cardsfolder/s/shelldock_isle.txt index 6f4c2b32962..eb659d6c512 100644 --- a/forge-gui/res/cardsfolder/s/shelldock_isle.txt +++ b/forge-gui/res/cardsfolder/s/shelldock_isle.txt @@ -1,13 +1,11 @@ -Name:Shelldock Isle -ManaCost:no cost -Types:Land -K:Hideaway -T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. -SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True -A:AB$ Mana | Cost$ T | Produced$ U | SpellDescription$ Add {U} to your mana pool. -A:AB$ Play | Cost$ U T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | ForgetRemembered$ True | References$ X | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it. -SVar:X:PlayerCountPlayers$LowestValidLibrary Card.YouOwn -SVar:RemRandomDeck:True -SVar:RemAIDeck:True -SVar:Picture:http://www.wizards.com/global/images/magic/general/shelldock_isle.jpg -Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {U} to your mana pool.\n{U}, {T}: You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it. +Name:Shelldock Isle +ManaCost:no cost +Types:Land +K:Hideaway +A:AB$ Mana | Cost$ T | Produced$ U | SpellDescription$ Add {U} to your mana pool. +A:AB$ Play | Cost$ U T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ LE20 | ForgetRemembered$ True | References$ X | SpellDescription$ You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it. +SVar:X:PlayerCountPlayers$LowestValidLibrary Card.YouOwn +SVar:RemRandomDeck:True +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/shelldock_isle.jpg +Oracle:Hideaway (This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library.)\n{T}: Add {U} to your mana pool.\n{U}, {T}: You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it. diff --git a/forge-gui/res/cardsfolder/s/spinerock_knoll.txt b/forge-gui/res/cardsfolder/s/spinerock_knoll.txt index 6a3956165a0..e83c8073872 100644 --- a/forge-gui/res/cardsfolder/s/spinerock_knoll.txt +++ b/forge-gui/res/cardsfolder/s/spinerock_knoll.txt @@ -2,8 +2,6 @@ Name:Spinerock Knoll ManaCost:no cost Types:Land K:Hideaway -T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. -SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True A:AB$ Mana | Cost$ T | Produced$ R | SpellDescription$ Add {R} to your mana pool. A:AB$ Play | Cost$ R T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE7 | References$ X | ForgetRemembered$ True | SpellDescription$ You may play the exiled card without paying its mana cost if an opponent was dealt 7 or more damage this turn. SVar:X:Count$MaxOppDamageThisTurn diff --git a/forge-gui/res/cardsfolder/w/windbrisk_heights.txt b/forge-gui/res/cardsfolder/w/windbrisk_heights.txt index 77c6b1ca664..4cdc4986cee 100644 --- a/forge-gui/res/cardsfolder/w/windbrisk_heights.txt +++ b/forge-gui/res/cardsfolder/w/windbrisk_heights.txt @@ -2,10 +2,8 @@ Name:Windbrisk Heights ManaCost:no cost Types:Land K:Hideaway -T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ This land enters the battlefield tapped. When it does, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library. -SVar:TrigDig:AB$ Dig | Cost$ 0 | Defined$ You | DigNum$ 4 | DestinationZone$ Exile | ExileFaceDown$ True | RememberChanged$ True A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add {W} to your mana pool. -A:AB$ Play | Cost$ W T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | ForgetRemembered$ True | PlayerTurn$ True | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn. +A:AB$ Play | Cost$ W T | Defined$ Remembered | Amount$ All | Controller$ You | WithoutManaCost$ True | Optional$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | References$ X | ForgetRemembered$ True | PlayerTurn$ True | SpellDescription$ You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn. SVar:X:Count$AttackersDeclared SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/windbrisk_heights.jpg