mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Trigger: reuse Execute for multiple Trigger
This commit is contained in:
@@ -79,6 +79,7 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
|||||||
private FCollection<StaticAbility> staticAbilities = new FCollection<>();
|
private FCollection<StaticAbility> staticAbilities = new FCollection<>();
|
||||||
private String imageKey = "";
|
private String imageKey = "";
|
||||||
private Map<String, String> sVars = Maps.newTreeMap();
|
private Map<String, String> sVars = Maps.newTreeMap();
|
||||||
|
private Map<String, SpellAbility> abilityForTrigger = Maps.newHashMap();
|
||||||
|
|
||||||
private KeywordCollection cachedKeywords = new KeywordCollection();
|
private KeywordCollection cachedKeywords = new KeywordCollection();
|
||||||
|
|
||||||
@@ -951,6 +952,10 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
|||||||
return cloakUp;
|
return cloakUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SpellAbility getAbilityForTrigger(String svar) {
|
||||||
|
return abilityForTrigger.computeIfAbsent(svar, s -> AbilityFactory.getAbility(getCard(), s, this));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslationKey() {
|
public String getTranslationKey() {
|
||||||
String displayName = flavorName == null ? name : flavorName;
|
String displayName = flavorName == null ? name : flavorName;
|
||||||
|
|||||||
@@ -611,7 +611,11 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
public SpellAbility ensureAbility(final IHasSVars sVarHolder) {
|
public SpellAbility ensureAbility(final IHasSVars sVarHolder) {
|
||||||
SpellAbility sa = getOverridingAbility();
|
SpellAbility sa = getOverridingAbility();
|
||||||
if (sa == null && hasParam("Execute")) {
|
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);
|
setOverridingAbility(sa);
|
||||||
}
|
}
|
||||||
return sa;
|
return sa;
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ Types:Legendary Creature Human Warlock
|
|||||||
PT:3/3
|
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$ 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.
|
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:TrigSurveil:DB$ Surveil | Amount$ 2 | ConditionCheckSVar$ Resolved | ConditionSVarCompare$ EQ1 | SubAbility$ DBDiscard
|
||||||
SVar:DBDiscard:DB$ Discard | Defined$ Player.Opponent | Mode$ TgtChoose | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ2 | SubAbility$ DBChangeZone
|
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$ X | ConditionSVarCompare$ EQ3 | SelectPrompt$ Select a creature card in a graveyard | Hidden$ True | SubAbility$ DBLog
|
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:DBLog:DB$ StoreSVar | SVar$ X | Type$ CountSVar | Expression$ X/Plus.1
|
SVar:Resolved:Count$ResolvedThisTurn
|
||||||
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
|
|
||||||
DeckNeeds:Type$Enchantment
|
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.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user