From 8655ffd1519c57174de85ab9efe2d660cd057c9d Mon Sep 17 00:00:00 2001 From: RedDeckWins Date: Wed, 29 May 2013 05:11:59 +0000 Subject: [PATCH] Slowtrips finally slayed. --- res/cardsfolder/a/arcane_denial.txt | 8 ++-- res/cardsfolder/f/foreshadow.txt | 5 ++- res/cardsfolder/l/library_of_lat_nam.txt | 5 ++- res/cardsfolder/l/lodestone_bauble.txt | 5 ++- res/cardsfolder/s/sapphire_charm.txt | 5 ++- res/cardsfolder/t/thermal_flux.txt | 7 ++-- .../ability/effects/DelayedTriggerEffect.java | 14 +++++++ .../card/ability/effects/DrawEffect.java | 10 +---- .../java/forge/game/phase/PhaseHandler.java | 5 --- src/main/java/forge/game/phase/Upkeep.java | 42 ------------------- src/main/java/forge/game/player/Player.java | 35 ---------------- 11 files changed, 37 insertions(+), 104 deletions(-) diff --git a/res/cardsfolder/a/arcane_denial.txt b/res/cardsfolder/a/arcane_denial.txt index d914edfed27..201ab00832c 100644 --- a/res/cardsfolder/a/arcane_denial.txt +++ b/res/cardsfolder/a/arcane_denial.txt @@ -1,9 +1,11 @@ Name:Arcane Denial ManaCost:1 U Types:Instant -A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SubAbility$ DBDraw | SpellDescription$ Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep. You draw a card at the beginning of the next turn's upkeep. -SVar:DBDraw:DB$Draw | NumCards$ 2 | NextUpkeep$ True | Defined$ TargetedController | OptionalDecider$ True | SubAbility$ DBDraw2 -SVar:DBDraw2:DB$Draw | NumCards$ 1 | NextUpkeep$ True | Defined$ You +A:SP$ Counter | Cost$ 1 U | TargetType$ Spell | TgtPrompt$ Select target spell | RememberCountered$ True | ValidTgts$ Card | SubAbility$ DelTrigSlowtrip | SpellDescription$ Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep. You draw a card at the beginning of the next turn's upkeep. +SVar:DelTrigSlowtrip:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawSlowtrip | SubAbility$ DelTrigDrawTwo | TriggerDescription$ Draw a card. +SVar:DrawSlowtrip:DB$Draw | NumCards$ 1 | Defined$ You +SVar:DelTrigDrawTwo:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawTwo | TriggerDescription$ Draw up to two card. +SVar:DrawTwo:DB$Draw | NumCards$ 2 | Defined$ RememberedController | OptionalDecider$ True SVar:Picture:http://www.wizards.com/global/images/magic/general/arcane_denial.jpg Oracle:Counter target spell. Its controller may draw up to two cards at the beginning of the next turn's upkeep.\nYou draw a card at the beginning of the next turn's upkeep. SetInfo:ALL Common x2 \ No newline at end of file diff --git a/res/cardsfolder/f/foreshadow.txt b/res/cardsfolder/f/foreshadow.txt index f4885fcf1cc..0d2eff4fce8 100644 --- a/res/cardsfolder/f/foreshadow.txt +++ b/res/cardsfolder/f/foreshadow.txt @@ -3,8 +3,9 @@ ManaCost:1 U Types:Instant A:SP$ NameCard | Cost$ 1 U | Defined$ You | SubAbility$ DBMill | SpellDescription$ Name a card, then put the top card of target opponent's library into his or her graveyard. If that card is the named card, you draw a card. Draw a card at the beginning of the next turn's upkeep. SVar:DBMill:DB$ Mill | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | NumCards$ 1 | RememberMilled$ True | SubAbility$ DBDraw -SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ DBSlowDraw | References$ X -SVar:DBSlowDraw:DB$ Draw | Defined$ You | NextUpkeep$ True | NumCards$ 1 +SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ DelTrigSlowtrip | References$ X +SVar:DelTrigSlowtrip:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawSlowtrip | TriggerDescription$ Draw a card. +SVar:DrawSlowtrip:DB$Draw | NumCards$ 1 | Defined$ You SVar:X:Remembered$Valid Card.NamedCard SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/foreshadow.jpg diff --git a/res/cardsfolder/l/library_of_lat_nam.txt b/res/cardsfolder/l/library_of_lat_nam.txt index 26ef2512c02..ff32557e2c9 100644 --- a/res/cardsfolder/l/library_of_lat_nam.txt +++ b/res/cardsfolder/l/library_of_lat_nam.txt @@ -1,8 +1,9 @@ Name:Library of Lat-Nam ManaCost:4 U Types:Sorcery -A:SP$ Charm | Cost$ 4 U | Chooser$ Opponent | Choices$ SlowDraw,Tutor | SpellDescription$ An opponent chooses one - You draw three cards at the beginning of the next turn's upkeep; or you search your library for a card, put that card into your hand, then shuffle your library. -SVar:SlowDraw:DB$ Draw | NumCards$ 3 | Defined$ You | NextUpkeep$ True | SpellDescription$ You draw three cards at the beginning of the next turn's upkeep +A:SP$ Charm | Cost$ 4 U | Chooser$ Opponent | Choices$ DelTrigSlowDraw,Tutor | SpellDescription$ An opponent chooses one - You draw three cards at the beginning of the next turn's upkeep; or you search your library for a card, put that card into your hand, then shuffle your library. +SVar:DelTrigSlowDraw:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawSlowThree | SpellDescription$ You draw three cards at the beginning of the next turn's upkeep +SVar:DrawSlowThree:DB$Draw | NumCards$ 3 | Defined$ You SVar:Tutor:DB$ ChangeZone | Origin$ Library | Destination$ Hand | ChangeType$ Card | ChangeNum$ 1 | Mandatory$ True | SpellDescription$ You search your library for a card, put that card into your hand, then shuffle your library. SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/library_of_lat_nam.jpg diff --git a/res/cardsfolder/l/lodestone_bauble.txt b/res/cardsfolder/l/lodestone_bauble.txt index ee9118a66f5..b86eb9a0148 100644 --- a/res/cardsfolder/l/lodestone_bauble.txt +++ b/res/cardsfolder/l/lodestone_bauble.txt @@ -1,8 +1,9 @@ Name:Lodestone Bauble ManaCost:0 Types:Artifact -A:AB$ ChangeZone | Cost$ 1 T Sac<1/CARDNAME> | TargetMin$ 0 | TargetMax$ 4 | TargetsFromSingleZone$ True | Origin$ Graveyard | Destination$ Library | LibraryPosition$ 0 | TgtPrompt$ Choose target basic land card in a graveyard | ValidTgts$ Land.Basic | SubAbility$ DBDraw | SpellDescription$ Put up to four target basic land cards from a player's graveyard on top of his or her library in any order. That player draws a card at the beginning of the next turn's upkeep. -SVar:DBDraw:DB$ Draw | NumCards$ 1 | NextUpkeep$ True | Defined$ TargetedController +A:AB$ ChangeZone | Cost$ 1 T Sac<1/CARDNAME> | TargetMin$ 0 | TargetMax$ 4 | TargetsFromSingleZone$ True | Origin$ Graveyard | Destination$ Library | LibraryPosition$ 0 | TgtPrompt$ Choose target basic land card in a graveyard | ValidTgts$ Land.Basic | SubAbility$ DelTrigSlowtrip | SpellDescription$ Put up to four target basic land cards from a player's graveyard on top of his or her library in any order. That player draws a card at the beginning of the next turn's upkeep. +SVar:DelTrigSlowtrip:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawSlowtrip | TriggerDescription$ Draw a card. +SVar:DrawSlowtrip:DB$Draw | NumCards$ 1 | Defined$ You SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/lodestone_bauble.jpg Oracle:{1}, {T}, Sacrifice Lodestone Bauble: Put up to four target basic land cards from a player's graveyard on top of his or her library in any order. That player draws a card at the beginning of the next turn's upkeep. diff --git a/res/cardsfolder/s/sapphire_charm.txt b/res/cardsfolder/s/sapphire_charm.txt index 7369387c3b0..ea5962e4885 100644 --- a/res/cardsfolder/s/sapphire_charm.txt +++ b/res/cardsfolder/s/sapphire_charm.txt @@ -1,8 +1,9 @@ Name:Sapphire Charm ManaCost:U Types:Instant -A:SP$ Charm | Cost$ U | Choices$ Draw,Pump,Phases | CharmNum$ 1 | SpellDescription$ Choose one - Target player draws a card at the beginning of the next turn's upkeep; or target creature gains flying until end of turn; or target creature an opponent controls phases out. -SVar:Draw:DB$ Draw | ValidTgts$ Player | TgtPrompt$ Select target player | NumCards$ 1 | NextUpkeep$ True | SpellDescription$ Target player draws a card at the beginning of the next turn's upkeep. +A:SP$ Charm | Cost$ U | Choices$ DelTrigSlowtrip,Pump,Phases | CharmNum$ 1 | SpellDescription$ Choose one - Target player draws a card at the beginning of the next turn's upkeep; or target creature gains flying until end of turn; or target creature an opponent controls phases out. +SVar:DelTrigSlowtrip:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidTgts$ Player | RememberObjects$ Targeted | TgtPrompt$ Select target player | Execute$ DrawSlowtrip | TriggerDescription$ Target player draws a card at the beginning of the next turn's upkeep +SVar:DrawSlowtrip:DB$Draw | NumCards$ 1 | Defined$ Remembered | SpellDescription$ Draw a card. SVar:Pump:DB$ Pump | ValidTgts$ Creature | KW$ Flying | TgtPrompt$ Select target creature | SpellDescription$ Target creature gains flying until end of turn. SVar:Phases:DB$ Phases | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls | SpellDescription$ Target creature an opponent controls phases out. SVar:RemAIDeck:True diff --git a/res/cardsfolder/t/thermal_flux.txt b/res/cardsfolder/t/thermal_flux.txt index b2652407b4b..89ae383f64d 100644 --- a/res/cardsfolder/t/thermal_flux.txt +++ b/res/cardsfolder/t/thermal_flux.txt @@ -2,9 +2,10 @@ Name:Thermal Flux ManaCost:U Types:Instant A:SP$ Charm | Cost$ U | Choices$ ChooseFreeze,ChooseThaw | Defined$ You | SpellDescription$ Choose one - Target nonsnow permanent becomes snow until end of turn; or target snow permanent isn't snow until end of turn. Draw a card at the beginning of the next turn's upkeep. -SVar:ChooseFreeze:DB$ Animate | ValidTgts$ Permanent.nonSnow | TgtPrompt$ Select target nonsnow permanent | Types$ Snow | SubAbility$ ThermalDraw | SpellDescription$ Target nonsnow permanent becomes snow until end of turn. -SVar:ChooseThaw:DB$ Animate | ValidTgts$ Permanent.Snow | TgtPrompt$ Select target snow permanent | RemoveTypes$ Snow | SubAbility$ ThermalDraw | SpellDescription$ Target snow permanent isn't snow until end of turn. -SVar:ThermalDraw:DB$ Draw | NumCards$ 1 | NextUpkeep$ True +SVar:ChooseFreeze:DB$ Animate | ValidTgts$ Permanent.nonSnow | TgtPrompt$ Select target nonsnow permanent | Types$ Snow | SubAbility$ DelTrigSlowtrip | SpellDescription$ Target nonsnow permanent becomes snow until end of turn. Draw a card at the beginning of the next turn's upkeep. +SVar:ChooseThaw:DB$ Animate | ValidTgts$ Permanent.Snow | TgtPrompt$ Select target snow permanent | RemoveTypes$ Snow | SubAbility$ DelTrigSlowtrip | SpellDescription$ Target snow permanent isn't snow until end of turn. Draw a card at the beginning of the next turn's upkeep. +SVar:DelTrigSlowtrip:DB$ DelayedTrigger | Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | Execute$ DrawSlowtrip | TriggerDescription$ Draw a card. +SVar:DrawSlowtrip:DB$Draw | NumCards$ 1 | Defined$ You SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/thermal_flux.jpg Oracle:Choose one - Target nonsnow permanent becomes snow until end of turn; or target snow permanent isn't snow until end of turn.\nDraw a card at the beginning of the next turn's upkeep. diff --git a/src/main/java/forge/card/ability/effects/DelayedTriggerEffect.java b/src/main/java/forge/card/ability/effects/DelayedTriggerEffect.java index ed052a3bfe9..9978a0ce256 100644 --- a/src/main/java/forge/card/ability/effects/DelayedTriggerEffect.java +++ b/src/main/java/forge/card/ability/effects/DelayedTriggerEffect.java @@ -3,6 +3,7 @@ package forge.card.ability.effects; import java.util.HashMap; import java.util.Map; +import forge.card.ability.AbilityUtils; import forge.card.ability.SpellAbilityEffect; import forge.card.spellability.SpellAbility; import forge.card.trigger.Trigger; @@ -37,6 +38,19 @@ public class DelayedTriggerEffect extends SpellAbilityEffect { mapParams.remove("SpellDescription"); } + String triggerRemembered = null; + + // Set Remembered + if (sa.hasParam("RememberObjects")) { + triggerRemembered = sa.getParam("RememberObjects"); + } + + if (triggerRemembered != null) { + for (final Object o : AbilityUtils.getDefinedObjects(sa.getSourceCard(), triggerRemembered, sa)) { + sa.getSourceCard().addRemembered(o); + } + } + final Trigger delTrig = TriggerHandler.parseTrigger(mapParams, sa.getSourceCard(), true); sa.getActivatingPlayer().getGame().getTriggerHandler().registerDelayedTrigger(delTrig); diff --git a/src/main/java/forge/card/ability/effects/DrawEffect.java b/src/main/java/forge/card/ability/effects/DrawEffect.java index 3617b4d4424..af321d7dfd4 100644 --- a/src/main/java/forge/card/ability/effects/DrawEffect.java +++ b/src/main/java/forge/card/ability/effects/DrawEffect.java @@ -74,10 +74,6 @@ public class DrawEffect extends SpellAbilityEffect { final StringBuilder sb = new StringBuilder(); sb.append("Do you want to draw ").append(numCards).append(" cards(s)"); - if (slowDraw) { - sb.append(" next upkeep"); - } - sb.append("?"); if (!GuiDialog.confirm(sa.getSourceCard(), sb.toString())) { @@ -85,11 +81,9 @@ public class DrawEffect extends SpellAbilityEffect { } } } - + //TODO: remove this deprecation exception if (slowDraw) { - for (int i = 0; i < numCards; i++) { - p.addSlowtripList(source); - } + throw new RuntimeException("This api option is no longer supported. Please file a bug report with the card that threw this error."); } else { final List drawn = p.drawCards(numCards); if (sa.hasParam("Reveal")) { diff --git a/src/main/java/forge/game/phase/PhaseHandler.java b/src/main/java/forge/game/phase/PhaseHandler.java index 28f9c79bef3..f4a139648be 100644 --- a/src/main/java/forge/game/phase/PhaseHandler.java +++ b/src/main/java/forge/game/phase/PhaseHandler.java @@ -348,11 +348,6 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { case UPKEEP: if (this.getPlayerTurn().hasKeyword("Skip your upkeep step.")) { - // Slowtrips all say "on the next turn's upkeep" if there is no - // upkeep next turn, the trigger will never occur. - for (Player p : game.getPlayers()) { - p.clearSlowtripList(); - } this.setPlayersPriorityPermission(false); } else { this.nUpkeepsThisTurn++; diff --git a/src/main/java/forge/game/phase/Upkeep.java b/src/main/java/forge/game/phase/Upkeep.java index e89968636a8..f50256ad019 100644 --- a/src/main/java/forge/game/phase/Upkeep.java +++ b/src/main/java/forge/game/phase/Upkeep.java @@ -84,7 +84,6 @@ public class Upkeep extends Phase { game.getStack().freezeStack(); Upkeep.upkeepBraidOfFire(game); - Upkeep.upkeepSlowtrips(game); // for "Draw a card at the beginning of the next turn's upkeep." Upkeep.upkeepUpkeepCost(game); // sacrifice unless upkeep cost is paid Upkeep.upkeepEcho(game); @@ -202,47 +201,6 @@ public class Upkeep extends Phase { } } // echo - /** - *

- * upkeepSlowtrips. Draw a card at the beginning of the next turn's upkeep. - *

- */ - private static void upkeepSlowtrips(final GameState game) { - Player turnOwner = game.getPhaseHandler().getPlayerTurn(); - - // does order matter here? - drawForSlowtrips(turnOwner, game); - for (Player p : game.getPlayers()) { - if (p == turnOwner) { - continue; - } - drawForSlowtrips(p, game); - } - } - - public static void drawForSlowtrips(final Player player, final GameState game) { - List list = player.getSlowtripList(); - - for (Card card : list) { - // otherwise another slowtrip gets added - card.removeIntrinsicKeyword("Draw a card at the beginning of the next turn's upkeep."); - - final Ability slowtrip = new Ability(card, ManaCost.ZERO) { - @Override - public void resolve() { - player.drawCard(); - } - }; - slowtrip.setStackDescription(card + " - Draw a card."); - slowtrip.setDescription(card + " - Draw a card."); - slowtrip.setActivatingPlayer(player); - - game.getStack().addSimultaneousStackEntry(slowtrip); - - } - player.clearSlowtripList(); - } - /** *

* upkeepUpkeepCost. diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index 5f8742b98fd..ab0a076a6e2 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -134,9 +134,6 @@ public class Player extends GameEntity implements Comparable { /** The num discarded this turn. */ private int numDiscardedThisTurn = 0; - /** The slowtrip list. */ - private List slowtripList = new ArrayList(); - /** A list of tokens not in play, but on their way. * This list is kept in order to not break ETB-replacement * on tokens. */ @@ -1948,38 +1945,6 @@ public class Player extends GameEntity implements Comparable { return old; } - /** - *

- * Getter for the field slowtripList. - *

- * - * @return a {@link forge.CardList} object. - */ - public final List getSlowtripList() { - return this.slowtripList; - } - - /** - *

- * clearSlowtripList. - *

- */ - public final void clearSlowtripList() { - this.slowtripList.clear(); - } - - /** - *

- * addSlowtripList. - *

- * - * @param card - * a {@link forge.Card} object. - */ - public final void addSlowtripList(final Card card) { - this.slowtripList.add(card); - } - /** *

* getTurn.