diff --git a/forge-game/src/main/java/forge/game/card/CardState.java b/forge-game/src/main/java/forge/game/card/CardState.java index 549421395e6..2631e49cde5 100644 --- a/forge-game/src/main/java/forge/game/card/CardState.java +++ b/forge-game/src/main/java/forge/game/card/CardState.java @@ -79,6 +79,7 @@ public class CardState implements GameObject, IHasSVars, ITranslatable { private FCollection staticAbilities = new FCollection<>(); private String imageKey = ""; private Map sVars = Maps.newTreeMap(); + private Map abilityForTrigger = Maps.newHashMap(); private KeywordCollection cachedKeywords = new KeywordCollection(); @@ -951,6 +952,10 @@ public class CardState implements GameObject, IHasSVars, ITranslatable { return cloakUp; } + public SpellAbility getAbilityForTrigger(String svar) { + return abilityForTrigger.computeIfAbsent(svar, s -> AbilityFactory.getAbility(getCard(), s, this)); + } + @Override public String getTranslationKey() { String displayName = flavorName == null ? name : flavorName; diff --git a/forge-game/src/main/java/forge/game/trigger/Trigger.java b/forge-game/src/main/java/forge/game/trigger/Trigger.java index 6ff534df4c9..aeb8e0d6a96 100644 --- a/forge-game/src/main/java/forge/game/trigger/Trigger.java +++ b/forge-game/src/main/java/forge/game/trigger/Trigger.java @@ -611,7 +611,11 @@ public abstract class Trigger extends TriggerReplacementBase { public SpellAbility ensureAbility(final IHasSVars sVarHolder) { SpellAbility sa = getOverridingAbility(); if (sa == null && hasParam("Execute")) { - sa = AbilityFactory.getAbility(getHostCard(), getParam("Execute"), sVarHolder); + if (this.isIntrinsic() && sVarHolder instanceof CardState state) { + sa = state.getAbilityForTrigger(getParam("Execute")); + } else { + sa = AbilityFactory.getAbility(getHostCard(), getParam("Execute"), sVarHolder); + } setOverridingAbility(sa); } return sa; diff --git a/forge-gui/res/cardsfolder/v/victor_valgavoths_seneschal.txt b/forge-gui/res/cardsfolder/v/victor_valgavoths_seneschal.txt index 743bb9c4e4e..65800ccee12 100644 --- a/forge-gui/res/cardsfolder/v/victor_valgavoths_seneschal.txt +++ b/forge-gui/res/cardsfolder/v/victor_valgavoths_seneschal.txt @@ -4,12 +4,9 @@ Types:Legendary Creature Human Warlock PT:3/3 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Enchantment.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigSurveil | TriggerDescription$ Eerie — Whenever an enchantment you control enters and whenever you fully unlock a Room, surveil 2 if this is the first time this ability has resolved this turn. If it's the second time, each opponent discards a card. If it's the third time, put a creature card from a graveyard onto the battlefield under your control. T:Mode$ FullyUnlock | ValidCard$ Card.Room | ValidPlayer$ You | Secondary$ True | Execute$ TrigSurveil | TriggerZones$ Battlefield | TriggerDescription$ Eerie — Whenever an enchantment you control enters and whenever you fully unlock a Room, surveil 2 if this is the first time this ability has resolved this turn. If it's the second time, each opponent discards a card. If it's the third time, put a creature card from a graveyard onto the battlefield under your control. -SVar:TrigSurveil:DB$ Surveil | Amount$ 2 | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ1 | SubAbility$ DBDiscard -SVar:DBDiscard:DB$ Discard | Defined$ Player.Opponent | Mode$ TgtChoose | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ2 | SubAbility$ DBChangeZone -SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ 1 | Mandatory$ True | GainControl$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ3 | SelectPrompt$ Select a creature card in a graveyard | Hidden$ True | SubAbility$ DBLog -SVar:DBLog:DB$ StoreSVar | SVar$ X | Type$ CountSVar | Expression$ X/Plus.1 -SVar:X:Number$1 -T:Mode$ Phase | Phase$ Cleanup | TriggerZones$ Battlefield | Execute$ DBCleanup | Static$ True -SVar:DBCleanup:DB$ StoreSVar | SVar$ X | Type$ Number | Expression$ 1 +SVar:TrigSurveil:DB$ Surveil | Amount$ 2 | ConditionCheckSVar$ Resolved | ConditionSVarCompare$ EQ1 | SubAbility$ DBDiscard +SVar:DBDiscard:DB$ Discard | Defined$ Player.Opponent | Mode$ TgtChoose | ConditionCheckSVar$ Resolved | ConditionSVarCompare$ EQ2 | SubAbility$ DBChangeZone +SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ 1 | Mandatory$ True | GainControl$ True | ConditionCheckSVar$ Resolved | ConditionSVarCompare$ EQ3 | SelectPrompt$ Select a creature card in a graveyard | Hidden$ True +SVar:Resolved:Count$ResolvedThisTurn DeckNeeds:Type$Enchantment Oracle:Eerie — Whenever an enchantment you control enters and whenever you fully unlock a Room, surveil 2 if this is the first time this ability has resolved this turn. If it's the second time, each opponent discards a card. If it's the third time, put a creature card from a graveyard onto the battlefield under your control.