Skip to content

Commit

Permalink
Fix River Song's Diary + Rhuk, Hexgold Nabber (Card-Forge#4778)
Browse files Browse the repository at this point in the history
* ExiledWith: better handling for effects

* Support for Legate Lanius

* Fix Rhuk, Hexgold Nabber

* Fix missing params
  • Loading branch information
tool4ever authored Mar 4, 2024
1 parent 8df339b commit 9a8f6e5
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 176 deletions.
200 changes: 74 additions & 126 deletions forge-game/src/main/java/forge/game/ability/AbilityUtils.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ protected static void replaceDying(final SpellAbility sa) {
"| Origin$ Battlefield | Destination$ Graveyard " +
"| Description$ If that permanent would die this turn, exile it instead.";
String effect = "DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Battlefield | Destination$ " + zone;
if (sa.hasParam("ReplaceDyingRemember")) {
effect += " | RememberToEffectSource$ True";
if (sa.hasParam("ReplaceDyingExiledWith")) {
effect += " | ExiledWithEffectSource$ True";
}

ReplacementEffect re = ReplacementHandler.parseReplacement(repeffstr, eff, true);
Expand Down Expand Up @@ -952,6 +952,10 @@ public static void handleExiledWith(final Card movedCard, final SpellAbility cau
return;
}

if (cause.hasParam("ExiledWithEffectSource")) {
exilingSource = exilingSource.getEffectSource();
}

// during replacement LKI might be used
if (cause.isReplacementAbility() && exilingSource.isLKI()) {
exilingSource = exilingSource.getGame().getCardState(exilingSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ private void changeKnownOriginResolve(final SpellAbility sa) {
}
}

movedCard = game.getAction().moveToLibrary(gameCard, libraryPosition, sa);
movedCard = game.getAction().moveToLibrary(gameCard, libraryPosition, sa, moveParams);
} else if (destination.equals(ZoneType.Battlefield)) {
moveParams.put(AbilityKey.SimultaneousETB, tgtCards);
if (sa.isReplacementAbility()) {
Expand Down Expand Up @@ -773,11 +773,6 @@ private void changeKnownOriginResolve(final SpellAbility sa) {
}
}

if (sa.hasParam("RememberToEffectSource")) {
if (hostCard.isImmutable() && hostCard.getEffectSource() != null) {
hostCard.getEffectSource().addRemembered(movedCard);
}
}
if (remember != null) {
hostCard.addRemembered(movedCard);
// addRememberedFromCardState ?
Expand Down
36 changes: 6 additions & 30 deletions forge-gui/res/cardsfolder/g/gut_fanatical_priestess.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ PT:4/3
K:Specialize:5
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigFight | TriggerDescription$ When CARDNAME enters the battlefield, up to one target creature you control fights target creature you don't control. If the creature you don't control would die this turn, exile it instead.
SVar:TrigFight:DB$ Pump | ValidTgts$ Creature.YouCtrl | AILogic$ Fight | TgtPrompt$ Select up to one target creature you control | TargetMin$ 0 | TargetMax$ 1 | SubAbility$ DBFight
SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Select target creature you don't control | ReplaceDyingDefined$ ThisTargetedCard | ReplaceDyingRemember$ True
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Select target creature you don't control | ReplaceDyingDefined$ ThisTargetedCard | ReplaceDyingExiledWith$ True
AlternateMode:Specialize
Oracle:Specialize {5}\nWhen Gut, Fanatical Priestess enters the battlefield, up to one target creature you control fights target creature you don't control. If the creature you don't control would die this turn, exile it instead.

Expand All @@ -20,11 +16,7 @@ ManaCost:4 R R W
Types:Legendary Creature Goblin Shaman
PT:5/4
T:Mode$ Specializes | ValidCard$ Card.Self | Execute$ TrigCopy | TriggerDescription$ When this creature specializes, create two tokens that are copies of a creature card exiled with this creature, except they're 2/2 and have haste. Sacrifice them at the beginning of your next end step.
SVar:TrigCopy:DB$ CopyPermanent | Defined$ Remembered | SetPower$ 2 | SetToughness$ 2 | NumCopies$ 2 | AddKeywords$ Haste | AtEOTTrig$ You_Sacrifice
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:TrigCopy:DB$ CopyPermanent | Choices$ Card | Defined$ ExiledWith | SetPower$ 2 | SetToughness$ 2 | NumCopies$ 2 | AddKeywords$ Haste | AtEOTTrig$ You_Sacrifice
DeckHas:Ability$Token
Oracle:When this creature specializes, create two tokens that are copies of a creature card exiled with this creature, except they're 2/2 and have haste. Sacrifice them at the beginning of your next end step.

Expand All @@ -35,11 +27,7 @@ ManaCost:4 U R R
Types:Legendary Creature Goblin Shaman
PT:5/4
T:Mode$ Specializes | ValidCard$ Card.Self | Execute$ TrigCopy | TriggerDescription$ When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 3/3 and has flying and haste. Sacrifice it at the beginning of your next end step.
SVar:TrigCopy:DB$ CopyPermanent | Defined$ Remembered | SetPower$ 3 | SetToughness$ 3 | AddKeywords$ Flying & Haste | AtEOTTrig$ You_Sacrifice
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:TrigCopy:DB$ CopyPermanent | Choices$ Card | Defined$ ExiledWith | SetPower$ 3 | SetToughness$ 3 | AddKeywords$ Flying & Haste | AtEOTTrig$ You_Sacrifice
Oracle:When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 3/3 and has flying and haste. Sacrifice it at the beginning of your next end step.

SPECIALIZE:BLACK
Expand All @@ -49,11 +37,7 @@ ManaCost:4 B R R
Types:Legendary Creature Goblin Shaman
PT:5/4
T:Mode$ Specializes | ValidCard$ Card.Self | Execute$ TrigCopy | TriggerDescription$ When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 4/4 and has menace and haste. Sacrifice it at the beginning of your next end step.
SVar:TrigCopy:DB$ CopyPermanent | Defined$ Remembered | SetPower$ 4 | SetToughness$ 4 | AddKeywords$ Menace & Haste | AtEOTTrig$ You_Sacrifice
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:TrigCopy:DB$ CopyPermanent | Choices$ Card | Defined$ ExiledWith | SetPower$ 4 | SetToughness$ 4 | AddKeywords$ Menace & Haste | AtEOTTrig$ You_Sacrifice
Oracle:When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 4/4 and has menace and haste. Sacrifice it at the beginning of your next end step.

SPECIALIZE:RED
Expand All @@ -63,11 +47,7 @@ ManaCost:4 R R R
Types:Legendary Creature Goblin Shaman
PT:5/4
T:Mode$ Specializes | ValidCard$ Card.Self | Execute$ TrigCopy | TriggerDescription$ When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it has double strike and haste. Sacrifice it at the beginning of your next end step.
SVar:TrigCopy:DB$ CopyPermanent | Defined$ Remembered | AddKeywords$ Double Strike & Haste | AtEOTTrig$ You_Sacrifice
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:TrigCopy:DB$ CopyPermanent | Choices$ Card | Defined$ ExiledWith | AddKeywords$ Double Strike & Haste | AtEOTTrig$ You_Sacrifice
Oracle:When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it has double strike and haste. Sacrifice it at the beginning of your next end step.

SPECIALIZE:GREEN
Expand All @@ -77,9 +57,5 @@ ManaCost:4 R R G
Types:Legendary Creature Goblin Shaman
PT:5/4
T:Mode$ Specializes | ValidCard$ Card.Self | Execute$ TrigCopy | TriggerDescription$ When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 5/5 and has trample and haste. Sacrifice it at the beginning of your next end step.
SVar:TrigCopy:DB$ CopyPermanent | Defined$ Remembered.ExiledWithSource | SetPower$ 5 | SetToughness$ 5 | AddKeywords$ Trample & Haste | AtEOTTrig$ You_Sacrifice
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered+ExiledWithSource | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:TrigCopy:DB$ CopyPermanent | Choices$ Card | Defined$ ExiledWith | SetPower$ 5 | SetToughness$ 5 | AddKeywords$ Trample & Haste | AtEOTTrig$ You_Sacrifice
Oracle:When this creature specializes, create a token that's a copy of a creature card exiled with this creature, except it's 5/5 and has trample and haste. Sacrifice it at the beginning of your next end step.
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/p/price_of_fame.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ManaCost:3 B
Types:Instant
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ 2 | ValidTarget$ Creature.Legendary | EffectZone$ All | Description$ CARDNAME costs {2} less to cast if it targets a legendary creature.
A:SP$ Destroy | ValidTgts$ Creature | SubAbility$ DBSurveil | TgtPrompt$ Select target creature | SpellDescription$ Destroy target creature.
SVar:DBSurveil:DB$ Surveil | Amount$ 2
SVar:DBSurveil:DB$ Surveil | Amount$ 2 | SpellDescription$ Surveil 2.
DeckHas:Ability$Surveil|Graveyard
Oracle:This spell costs {2} less to cast if it targets a legendary creature.\nDestroy target creature.\nSurveil 2. (Look at the top two cards of your library, then put any number of them into your graveyard and the rest on top of your library in any order.)
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/r/rhuk_hexgold_nabber.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ K:Trample
K:Haste
T:Mode$ Attacks | ValidCard$ Creature.equipped+YouCtrl+Other | Execute$ TrigAttach | TriggerZones$ Battlefield | TriggerDescription$ Whenever an equipped creature you control other than CARDNAME attacks or dies, you may attach all Equipment attached to that creature to NICKNAME.
T:Mode$ ChangesZone | ValidCard$ Creature.equipped+YouCtrl+Other | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigAttach | TriggerZones$ Battlefield | OptionalDecider$ You | Secondary$ True | TriggerDescription$ Whenever an equipped creature you control other than CARDNAME attacks or dies, you may attach all Equipment attached to that creature to NICKNAME.
SVar:TrigAttach:DB$ Attach | Object$ AttachedTo TriggeredCard.Equipment | Defined$ Self
SVar:TrigAttach:DB$ Attach | Object$ AttachedTo TriggeredCardLKICopy.Equipment | Defined$ Self
DeckNeeds:Type$Equipment
Oracle:Trample, haste\nWhenever an equipped creature you control other than Rhuk, Hexgold Nabber attacks or dies, you may attach all Equipment attached to that creature to Rhuk.
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/r/river_songs_diary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Types:Artifact
T:Mode$ SpellCast | ValidCard$ Instant.wasCastFromTheirHand,Sorcery.wasCastFromTheirHand | Execute$ TrigEffect | TriggerZones$ Battlefield | TriggerDescription$ Imprint — Whenever a player casts an instant or sorcery spell from their hand, exile it instead of putting it into a graveyard as it resolves.
SVar:TrigEffect:DB$ Effect | ReplacementEffects$ ReMoved | RememberObjects$ TriggeredCard
SVar:ReMoved:Event$ Moved | ValidCard$ Card.IsRemembered | Origin$ Stack | Destination$ Graveyard | Fizzle$ False | ReplaceWith$ DBExile | Description$ Exile it instead of putting it into a graveyard as it resolves.
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBExileSelf
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | ExiledWithEffectSource$ True | SubAbility$ DBExileSelf
SVar:DBExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | CheckSVar$ X | SVarCompare$ GE4 | Execute$ TrigChooseRandom | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, if there are four or more cards exiled with CARDNAME, choose one of them at random. You may cast it without paying its mana cost.
SVar:TrigChooseRandom:DB$ ChooseCard | ChoiceZone$ Exile | AtRandom$ True | Choices$ Card.ExiledWithSource | SubAbility$ DBPlay
Expand Down
9 changes: 2 additions & 7 deletions forge-gui/res/cardsfolder/r/rod_of_absorption.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
Name:Rod of Absorption
ManaCost:2 U
Types:Artifact
T:Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Exile | Destination$ Any | TriggerZones$ Battlefield | Execute$ TrigForget | Static$ True
SVar:TrigForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DBCleanup | Static$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
T:Mode$ SpellCast | ValidCard$ Instant,Sorcery | Execute$ TrigEffect | TriggerZones$ Battlefield | TriggerDescription$ Whenever a player casts an instant or sorcery spell, exile it instead of putting it into a graveyard as it resolves.
SVar:TrigEffect:DB$ Effect | ReplacementEffects$ ReMoved | RememberObjects$ TriggeredCard
SVar:ReMoved:Event$ Moved | ValidCard$ Card.IsRemembered | Origin$ Stack | Destination$ Graveyard | Fizzle$ False | ReplaceWith$ DBExile | Description$ Exile it instead of putting it into a graveyard as it resolves.
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | SubAbility$ DBRemember
SVar:DBRemember:DB$ Animate | Defined$ EffectSource | RememberObjects$ ReplacedCard | Duration$ Permanent | SubAbility$ ExileSelf
SVar:DBExile:DB$ ChangeZone | Defined$ ReplacedCard | Origin$ Stack | Destination$ Exile | ExiledWithEffectSource$ True | SubAbility$ ExileSelf
SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self
A:AB$ Play | Cost$ X T Sac<1/CARDNAME> | Defined$ ValidExile Card.IsRemembered | ValidSA$ Spell | Amount$ All | WithTotalCMC$ X | WithoutManaCost$ True | Optional$ True | AILogic$ WithTotalCMC | SpellDescription$ You may cast any number of spells from among cards exiled with CARDNAME with total mana value X or less without paying their mana costs.
A:AB$ Play | Cost$ X T Sac<1/CARDNAME> | Defined$ ExiledWith | ValidSA$ Spell | Amount$ All | WithTotalCMC$ X | WithoutManaCost$ True | Optional$ True | AILogic$ WithTotalCMC | SpellDescription$ You may cast any number of spells from among cards exiled with CARDNAME with total mana value X or less without paying their mana costs.
SVar:X:Count$xPaid
Oracle:Whenever a player casts an instant or sorcery spell, exile it instead of putting it into a graveyard as it resolves.\n{X}, {T}, Sacrifice Rod of Absorption: You may cast any number of spells from among cards exiled with Rod of Absorption with total mana value X or less without paying their mana costs.
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/t/tetsuo_imperial_champion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name:Tetsuo, Imperial Champion
ManaCost:U B R
Types:Legendary Creature Human Samurai
PT:3/3
T:Mode$ Attacks | ValidCard$ Card.Self+equipped | Execute$ TrigChoose | TriggerDescription$ Whenever CARDNAME attacks,if it's equipped, ABILITY
T:Mode$ Attacks | ValidCard$ Card.Self | IsPresent$ Card.Self+equipped | Execute$ TrigChoose | TriggerDescription$ Whenever CARDNAME attacks, if it's equipped, ABILITY
SVar:TrigChoose:DB$ Charm | Choices$ DBDealDamage,DBCast | CharmNum$ 1
SVar:DBDealDamage:DB$ DealDamage | ValidTgts$ Any | NumDmg$ X | SpellDescription$ NICKNAME deals damage equal to the highest mana value among Equipment attached to it to any target.
SVar:DBCast:DB$ Play | ValidZone$ Hand | Valid$ Instant.YouCtrl+cmcLEX,Sorcery.YouCtrl+cmcLEX | ValidSA$ Spell | Optional$ True | WithoutManaCost$ True | AILogic$ ReplaySpell | SpellDescription$ You may cast an instant or sorcery spell from your hand with mana value less than or equal to the highest mana value among Equipment attached to NICKNAME without paying its mana cost.
Expand Down
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/w/warchanter_skald.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name:Warchanter Skald
ManaCost:2 W
Types:Creature Dwarf Cleric
PT:2/3
T:Mode$ Taps | ValidCard$ Card.Self+enchanted,Card.Self+equipped | TriggerZones$ Battlefield | Execute$ TrigToken | TriggerDescription$ Whenever Warchanter Skald becomes tapped, if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token.
T:Mode$ Taps | ValidCard$ Card.Self | IsPresent$ Card.Self+enchanted,Card.Self+equipped | TriggerZones$ Battlefield | Execute$ TrigToken | TriggerDescription$ Whenever CARDNAME becomes tapped, if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token.
SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ r_2_1_dwarf_berserker | TokenOwner$ You
SVar:EnchantMe:Once
SVar:EquipMe:Once
Expand Down

0 comments on commit 9a8f6e5

Please sign in to comment.