From 4d91c98cad08aa3b48d698b7d3965b9b456ecd69 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Fri, 3 Nov 2023 13:10:44 -0400 Subject: [PATCH] =?UTF-8?q?LCI=20=E2=80=93=20ReplaceExplore=20cards=20and?= =?UTF-8?q?=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/ability/effects/ExploreEffect.java | 7 +++++ .../game/replacement/ReplaceExplore.java | 27 +++++++++++++++++++ .../game/replacement/ReplacementType.java | 1 + .../upcoming/topography_tracker.txt | 11 ++++++++ .../upcoming/twists_and_turns_mycoid_maze.txt | 21 +++++++++++++++ .../res/tokenscripts/c_a_map_sac_explore.txt | 4 +-- 6 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 forge-game/src/main/java/forge/game/replacement/ReplaceExplore.java create mode 100644 forge-gui/res/cardsfolder/upcoming/topography_tracker.txt create mode 100644 forge-gui/res/cardsfolder/upcoming/twists_and_turns_mycoid_maze.txt diff --git a/forge-game/src/main/java/forge/game/ability/effects/ExploreEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ExploreEffect.java index b1d0469b3e3..79caa9d8856 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ExploreEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ExploreEffect.java @@ -14,6 +14,8 @@ import forge.game.card.CardCollection; import forge.game.card.CardZoneTable; import forge.game.card.CounterEnumType; import forge.game.player.Player; +import forge.game.replacement.ReplacementResult; +import forge.game.replacement.ReplacementType; import forge.game.spellability.SpellAbility; import forge.game.trigger.TriggerType; import forge.game.zone.Zone; @@ -53,6 +55,11 @@ public class ExploreEffect extends SpellAbilityEffect { moveParams.put(AbilityKey.LastStateBattlefield, sa.getLastStateBattlefield()); moveParams.put(AbilityKey.LastStateGraveyard, sa.getLastStateGraveyard()); for (final Card c : getTargetCards(sa)) { + + if (game.getReplacementHandler().run(ReplacementType.Explore, AbilityKey.mapFromAffected(c)) != ReplacementResult.NotReplaced) { + continue; + } + // revealed land card boolean revealedLand = false; final Player pl = c.getController(); diff --git a/forge-game/src/main/java/forge/game/replacement/ReplaceExplore.java b/forge-game/src/main/java/forge/game/replacement/ReplaceExplore.java new file mode 100644 index 00000000000..0157a84dac2 --- /dev/null +++ b/forge-game/src/main/java/forge/game/replacement/ReplaceExplore.java @@ -0,0 +1,27 @@ +package forge.game.replacement; + +import forge.game.ability.AbilityKey; +import forge.game.card.Card; +import forge.game.spellability.SpellAbility; + +import java.util.Map; + +public class ReplaceExplore extends ReplacementEffect { + + public ReplaceExplore(final Map params, final Card host, final boolean intrinsic) { + super(params, host, intrinsic); + } + + @Override + public boolean canReplace(Map runParams) { + if (!matchesValidParam("ValidExplorer", runParams.get(AbilityKey.Affected))) { + return false; + } + return true; + } + + @Override + public void setReplacingObjects(Map runParams, SpellAbility sa) { + sa.setReplacingObject(AbilityKey.Card, runParams.get(AbilityKey.Affected)); + } +} diff --git a/forge-game/src/main/java/forge/game/replacement/ReplacementType.java b/forge-game/src/main/java/forge/game/replacement/ReplacementType.java index 41106760423..1461fc23711 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplacementType.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplacementType.java @@ -26,6 +26,7 @@ public enum ReplacementType { Discard(ReplaceDiscard.class), Draw(ReplaceDraw.class), DrawCards(ReplaceDrawCards.class), + Explore(ReplaceExplore.class), GainLife(ReplaceGainLife.class), GameLoss(ReplaceGameLoss.class), Learn(ReplaceLearn.class), diff --git a/forge-gui/res/cardsfolder/upcoming/topography_tracker.txt b/forge-gui/res/cardsfolder/upcoming/topography_tracker.txt new file mode 100644 index 00000000000..407329f1144 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/topography_tracker.txt @@ -0,0 +1,11 @@ +Name:Topography Tracker +ManaCost:2 G +Types:Creature Merfolk Scout +PT:2/2 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When CARDNAME enters the battlefield, create a Map token. (It's an artifact with "{1}, {T}, Sacrifice this artifact: Target creature you control explores. Activate only as a sorcery.") +SVar:TrigToken:DB$ Token | TokenScript$ c_a_map_sac_explore +R:Event$ Explore | ValidExplorer$ Creature.YouCtrl | ReplaceWith$ Explore1 | Description$ If a creature you control would explore, instead it explores, then it explores again. +SVar:Explore1:DB$ Explore | Defined$ ReplacedCard | SubAbility$ Explore2 +SVar:Explore2:DB$ Explore | Defined$ ReplacedCard +DeckHas:Ability$Token|Sacrifice & Type$Map|Artifact +Oracle:When Topography Tracker enters the battlefield, create a Map token. (It's an artifact with "{1}, {T}, Sacrifice this artifact: Target creature you control explores. Activate only as a sorcery.")\nIf a creature you control would explore, instead it explores, then it explores again. diff --git a/forge-gui/res/cardsfolder/upcoming/twists_and_turns_mycoid_maze.txt b/forge-gui/res/cardsfolder/upcoming/twists_and_turns_mycoid_maze.txt new file mode 100644 index 00000000000..90760b48a48 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/twists_and_turns_mycoid_maze.txt @@ -0,0 +1,21 @@ +Name:Twists and Turns +ManaCost:G +Types:Enchantment +R:Event$ Explore | ValidExplorer$ Creature.YouCtrl | ReplaceWith$ DBScry | Description$ If a creature you control would explore, instead you scry 1, then that creature explores. +SVar:DBScry:DB$ Scry | SubAbility$ DBExplore +SVar:DBExplore:DB$ Explore | Defined$ ReplacedCard +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExplore | TriggerDescription$ When CARDNAME enters the battlefield, target creature you control explores. +SVar:TrigExplore:DB$ Explore | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Land.YouCtrl | TriggerZones$ Battlefield | CheckSVar$ Count$Valid Land.YouCtrl | SVarCompare$ GE7 | Execute$ TrigTransform | TriggerDescription$ When a land enters the battlefield under your control, if you control seven or more lands, transform CARDNAME. +SVar:TrigTransform:DB$ SetState | Mode$ Transform +AlternateMode:DoubleFaced +Oracle:If a creature you control would explore, instead you scry 1, then that creature explores.\nWhen Twists and Turns enters the battlefield, target creature you control explores.\nWhen a land enters the battlefield under your control, if you control seven or more lands, transform Twists and Turns. + +ALTERNATE + +Name:Mycoid Maze +ManaCost:no cost +Types:Land Cave +A:AB$ Mana | Cost$ T | Produced$ G | SpellDescription$ Add {G}. +A:AB$ Dig | Cost$ 3 G T | ForceRevealToController$ True | DigNum$ 4 | ChangeNum$ 1 | Optional$ True | ChangeValid$ Creature | RestRandomOrder$ True | SpellDescription$ Look at the top four cards of your library. You may reveal a creature card from among them and put them into your hand. Put the rest on the bottom of your library in a random order. +Oracle:(Transforms from Twists and Turns.)\n{T}: Add {G}.\n{3}{G}, {T}: Look at the top four cards of your library. You may reveal a creature card from among them and put that card into your hand. Put the rest on the bottom of your library in a random order. diff --git a/forge-gui/res/tokenscripts/c_a_map_sac_explore.txt b/forge-gui/res/tokenscripts/c_a_map_sac_explore.txt index 4250ff53fbf..569c282b6da 100644 --- a/forge-gui/res/tokenscripts/c_a_map_sac_explore.txt +++ b/forge-gui/res/tokenscripts/c_a_map_sac_explore.txt @@ -1,5 +1,5 @@ Name:Map Token ManaCost:no cost Types:Artifact Treasure -A:AB$ Explore | Cost$ 1 T Sac<1/CARDNAME/this artifact> | TgtPrompt Select target creature you control | ValidTgts$ Creature.YouCtrl | SorcerySpeed$ True | SpellDescription$ Target creature you control explores. Activate only as a sorcery. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on that creature, then put the card back or put it into your graveyard.)." -Oracle:{1}, {T}, Sacrifice this artifact: Target creature you control explores. Activate only as a sorcery. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on that creature, then put the card back or put it into your graveyard.)." +A:AB$ Explore | Cost$ 1 T Sac<1/CARDNAME/this artifact> | TgtPrompt$ Select target creature you control | ValidTgts$ Creature.YouCtrl | SorcerySpeed$ True | SpellDescription$ Target creature you control explores. Activate only as a sorcery. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on that creature, then put the card back or put it into your graveyard.) +Oracle:{1}, {T}, Sacrifice this artifact: Target creature you control explores. Activate only as a sorcery. (Reveal the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on that creature, then put the card back or put it into your graveyard.)