mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Compare commits
5 Commits
master
...
695d1396ea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
695d1396ea | ||
|
|
0431ddaee9 | ||
|
|
9063717642 | ||
|
|
52b21fa72f | ||
|
|
9a398f2f50 |
@@ -79,6 +79,7 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||
private FCollection<StaticAbility> staticAbilities = new FCollection<>();
|
||||
private String imageKey = "";
|
||||
private Map<String, String> sVars = Maps.newTreeMap();
|
||||
private Map<String, SpellAbility> abilityForTrigger = Maps.newHashMap();
|
||||
|
||||
private KeywordCollection cachedKeywords = new KeywordCollection();
|
||||
|
||||
@@ -732,6 +733,11 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||
setFlavorName(source.getFlavorName());
|
||||
setSVars(source.getSVars());
|
||||
|
||||
abilityForTrigger.clear();
|
||||
for (Map.Entry<String, SpellAbility> e : source.abilityForTrigger.entrySet()) {
|
||||
abilityForTrigger.put(e.getKey(), e.getValue().copy(card, lki));
|
||||
}
|
||||
|
||||
abilities.clear();
|
||||
for (SpellAbility sa : source.abilities) {
|
||||
if (sa.isIntrinsic()) {
|
||||
@@ -758,7 +764,7 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||
continue;
|
||||
}
|
||||
if (tr.isIntrinsic()) {
|
||||
triggers.add(tr.copy(card, lki));
|
||||
triggers.add(tr.copy(card, lki, false, this));
|
||||
}
|
||||
}
|
||||
ReplacementEffect runRE = null;
|
||||
@@ -951,6 +957,14 @@ public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||
return cloakUp;
|
||||
}
|
||||
|
||||
public SpellAbility getAbilityForTrigger(String svar) {
|
||||
return abilityForTrigger.computeIfAbsent(svar, s -> AbilityFactory.getAbility(getCard(), s, this));
|
||||
}
|
||||
|
||||
public boolean hasAbilityForTrigger(String svar) {
|
||||
return abilityForTrigger.containsKey(svar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey() {
|
||||
String displayName = flavorName == null ? name : flavorName;
|
||||
|
||||
@@ -544,15 +544,22 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
}
|
||||
|
||||
public final Trigger copy(Card newHost, boolean lki) {
|
||||
return copy(newHost, lki, false);
|
||||
return copy(newHost, lki, false, null);
|
||||
}
|
||||
public final Trigger copy(Card newHost, boolean lki, boolean keepTextChanges) {
|
||||
return copy(newHost, lki, keepTextChanges, null);
|
||||
}
|
||||
public final Trigger copy(Card newHost, boolean lki, boolean keepTextChanges, CardState newState) {
|
||||
final Trigger copy = (Trigger) clone();
|
||||
|
||||
copyHelper(copy, newHost, lki || keepTextChanges);
|
||||
|
||||
if (getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(getOverridingAbility().copy(newHost, lki));
|
||||
if (isIntrinsic() && hasParam("Execute") && newState != null && newState.hasAbilityForTrigger(getParam("Execute"))) {
|
||||
copy.setOverridingAbility(newState.getAbilityForTrigger(getParam("Execute")));
|
||||
} else {
|
||||
copy.setOverridingAbility(getOverridingAbility().copy(newHost, lki));
|
||||
}
|
||||
}
|
||||
|
||||
if (!lki) {
|
||||
@@ -611,7 +618,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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user