mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Solution attempt #2 for the delayed trigger activator bug: store the original delayed trigger activator and restore it before running the trigger if a stored value was found, in case it was previously overwritten by the AI routines (fixes e.g. Rainbow Vale).
This commit is contained in:
@@ -74,6 +74,7 @@ public class DelayedTriggerEffect extends SpellAbilityEffect {
|
||||
if (mapParams.containsKey("Execute")) {
|
||||
SpellAbility overridingSA = sa.getAdditonalAbility("Execute");
|
||||
overridingSA.setActivatingPlayer(sa.getActivatingPlayer());
|
||||
overridingSA.setDeltrigActivatingPlayer(sa.getActivatingPlayer()); // ensure that the original activator can be restored later
|
||||
// Set Transform timestamp when the delayed trigger is created
|
||||
if (ApiType.SetState == overridingSA.getApi()) {
|
||||
overridingSA.setSVar("StoredTransform", String.valueOf(sa.getHostCard().getTransformedTimestamp()));
|
||||
|
||||
@@ -81,6 +81,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
private String originalStackDescription = "", stackDescription = "";
|
||||
private ManaCost multiKickerManaCost = null;
|
||||
private Player activatingPlayer = null;
|
||||
private Player deltrigActivatingPlayer = null; // used by delayed triggers to ensure the original activator can be restored
|
||||
private Player targetingPlayer = null;
|
||||
|
||||
private boolean basicLandAbility; // granted by basic land type
|
||||
@@ -374,6 +375,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
view.updateCanPlay(this, false);
|
||||
}
|
||||
|
||||
public Player getDeltrigActivatingPlayer() {
|
||||
return deltrigActivatingPlayer;
|
||||
}
|
||||
public void setDeltrigActivatingPlayer(final Player player) {
|
||||
deltrigActivatingPlayer = player;
|
||||
}
|
||||
|
||||
public Player getTargetingPlayer() {
|
||||
return targetingPlayer;
|
||||
}
|
||||
|
||||
@@ -578,9 +578,15 @@ public class TriggerHandler {
|
||||
if (regtrig.getStoredTriggeredObjects() != null) {
|
||||
sa.setTriggeringObjects(regtrig.getStoredTriggeredObjects());
|
||||
}
|
||||
|
||||
if (sa.getActivatingPlayer() == null) { // overriding delayed trigger should have set activator
|
||||
sa.setActivatingPlayer(host.getController());
|
||||
} else if (sa.getDeltrigActivatingPlayer() != null) {
|
||||
// make sure that the original delayed trigger activator is restored
|
||||
// (may have been overwritten by the AI simulation routines, e.g. Rainbow Vale)
|
||||
sa.setActivatingPlayer(sa.getDeltrigActivatingPlayer());
|
||||
}
|
||||
|
||||
if (triggerParams.containsKey("TriggerController")) {
|
||||
Player p = AbilityUtils.getDefinedPlayers(regtrig.getHostCard(), triggerParams.get("TriggerController"), sa).get(0);
|
||||
sa.setActivatingPlayer(p);
|
||||
|
||||
Reference in New Issue
Block a user