mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
GameAction: fix timestamp and trigger for etb (#670)
* GameAction: fix trigger by etb counter
This commit is contained in:
@@ -246,10 +246,6 @@ public class GameAction {
|
|||||||
lastKnownInfo = CardUtil.getLKICopy(c);
|
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!suppress) {
|
|
||||||
copied.setTimestamp(game.getNextTimestamp());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lastKnownInfo.hasKeyword("Counters remain on CARDNAME as it moves to any zone other than a player's hand or library.")) {
|
if (!lastKnownInfo.hasKeyword("Counters remain on CARDNAME as it moves to any zone other than a player's hand or library.")) {
|
||||||
copied.clearCounters();
|
copied.clearCounters();
|
||||||
}
|
}
|
||||||
@@ -274,6 +270,8 @@ public class GameAction {
|
|||||||
copied = CardFactory.copyCard(c, false);
|
copied = CardFactory.copyCard(c, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copied.setTimestamp(c.getTimestamp());
|
||||||
|
|
||||||
if (zoneTo.is(ZoneType.Stack)) {
|
if (zoneTo.is(ZoneType.Stack)) {
|
||||||
// when moving to stack, copy changed card information
|
// when moving to stack, copy changed card information
|
||||||
copied.setChangedCardColors(c.getChangedCardColorsTable());
|
copied.setChangedCardColors(c.getChangedCardColorsTable());
|
||||||
@@ -286,7 +284,6 @@ public class GameAction {
|
|||||||
copied.setDrawnThisTurn(c.getDrawnThisTurn());
|
copied.setDrawnThisTurn(c.getDrawnThisTurn());
|
||||||
|
|
||||||
copied.copyChangedTextFrom(c);
|
copied.copyChangedTextFrom(c);
|
||||||
copied.setTimestamp(c.getTimestamp());
|
|
||||||
|
|
||||||
// clean up changes that come from its own static abilities
|
// clean up changes that come from its own static abilities
|
||||||
copied.cleanupCopiedChangesFrom(c);
|
copied.cleanupCopiedChangesFrom(c);
|
||||||
@@ -304,9 +301,6 @@ public class GameAction {
|
|||||||
// on Transformed objects)
|
// on Transformed objects)
|
||||||
copied.setState(CardStateName.Original, false);
|
copied.setState(CardStateName.Original, false);
|
||||||
copied.setBackSide(false);
|
copied.setBackSide(false);
|
||||||
|
|
||||||
// reset timestamp in changezone effects so they have same timestamp if ETB simultaneously
|
|
||||||
copied.setTimestamp(game.getNextTimestamp());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copied.setUnearthed(c.isUnearthed());
|
copied.setUnearthed(c.isUnearthed());
|
||||||
@@ -388,6 +382,11 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!zoneTo.is(ZoneType.Stack) && !suppress) {
|
||||||
|
// reset timestamp in changezone effects so they have same timestamp if ETB simultaneously
|
||||||
|
copied.setTimestamp(game.getNextTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
copied.getOwner().removeInboundToken(copied);
|
copied.getOwner().removeInboundToken(copied);
|
||||||
|
|
||||||
// Aura entering as Copy from stack
|
// Aura entering as Copy from stack
|
||||||
@@ -491,15 +490,6 @@ public class GameAction {
|
|||||||
|
|
||||||
GameEntityCounterTable table = new GameEntityCounterTable();
|
GameEntityCounterTable table = new GameEntityCounterTable();
|
||||||
|
|
||||||
// need to suspend cards own replacement effects
|
|
||||||
if (!suppress) {
|
|
||||||
if (toBattlefield && !copied.getEtbCounters().isEmpty()) {
|
|
||||||
for (final ReplacementEffect re : copied.getReplacementEffects()) {
|
|
||||||
re.setSuppressed(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mergedCards != null) {
|
if (mergedCards != null) {
|
||||||
// Move components of merged permanent here
|
// Move components of merged permanent here
|
||||||
// Also handle 723.3e and 903.9a
|
// Also handle 723.3e and 903.9a
|
||||||
@@ -546,14 +536,9 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do ETB counters after zone add
|
// do ETB counters after zone add
|
||||||
if (!suppress) {
|
if (!suppress && toBattlefield && !copied.getEtbCounters().isEmpty()) {
|
||||||
if (toBattlefield) {
|
game.getTriggerHandler().registerActiveTrigger(copied, false);
|
||||||
copied.putEtbCounters(table);
|
copied.putEtbCounters(table);
|
||||||
// enable replacement effects again
|
|
||||||
for (final ReplacementEffect re : copied.getReplacementEffects()) {
|
|
||||||
re.setSuppressed(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
copied.clearEtbCounters();
|
copied.clearEtbCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import forge.game.phase.PhaseHandler;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.player.PlayerCollection;
|
import forge.game.player.PlayerCollection;
|
||||||
import forge.game.player.PlayerPredicates;
|
import forge.game.player.PlayerPredicates;
|
||||||
import forge.game.replacement.ReplacementType;
|
|
||||||
import forge.game.spellability.AbilitySub;
|
import forge.game.spellability.AbilitySub;
|
||||||
import forge.game.spellability.LandAbility;
|
import forge.game.spellability.LandAbility;
|
||||||
import forge.game.spellability.OptionalCost;
|
import forge.game.spellability.OptionalCost;
|
||||||
@@ -218,11 +217,6 @@ public class AbilityUtils {
|
|||||||
else if (defined.startsWith("Replaced") && sa instanceof SpellAbility) {
|
else if (defined.startsWith("Replaced") && sa instanceof SpellAbility) {
|
||||||
final SpellAbility root = ((SpellAbility)sa).getRootAbility();
|
final SpellAbility root = ((SpellAbility)sa).getRootAbility();
|
||||||
AbilityKey type = AbilityKey.fromString(defined.substring(8));
|
AbilityKey type = AbilityKey.fromString(defined.substring(8));
|
||||||
// for Moved Effects, if it wants to know the affected Card, it might need to return the LKI
|
|
||||||
// or otherwise the timestamp does match
|
|
||||||
if (type == AbilityKey.Card && root.isReplacementAbility() && root.getReplacementEffect().getMode() == ReplacementType.Moved) {
|
|
||||||
type = AbilityKey.CardLKI;
|
|
||||||
}
|
|
||||||
final Object crd = root.getReplacingObject(type);
|
final Object crd = root.getReplacingObject(type);
|
||||||
|
|
||||||
if (crd instanceof Card) {
|
if (crd instanceof Card) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ManaCost:2 G
|
|||||||
Types:Legendary Enchantment Background
|
Types:Legendary Enchantment Background
|
||||||
S:Mode$ Continuous | Affected$ Creature.IsCommander+YouOwn | AddReplacementEffects$ This & Other | Description$ Commander creatures you own have "This creature enters the battlefield with an additional +1/+1 counter on it" and "Other creatures you control enter with an additional +1/+1 counter on them."
|
S:Mode$ Continuous | Affected$ Creature.IsCommander+YouOwn | AddReplacementEffects$ This & Other | Description$ Commander creatures you own have "This creature enters the battlefield with an additional +1/+1 counter on it" and "Other creatures you control enter with an additional +1/+1 counter on them."
|
||||||
SVar:This:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ ExtraCounter | ReplacementResult$ Updated | Description$ This creature enters the battlefield with an additional +1/+1 counter on it.
|
SVar:This:Event$ Moved | ValidCard$ Card.Self | Destination$ Battlefield | ReplaceWith$ ExtraCounter | ReplacementResult$ Updated | Description$ This creature enters the battlefield with an additional +1/+1 counter on it.
|
||||||
SVar:Other:Event$ Moved | ValidCard$ Creature.Other+YouCtrl | Destination$ Battlefield | ReplaceWith$ ExtraCounter | ReplacementResult$ Updated | Description$ Other creatures you control enter with an additional +1/+1 counter on them.
|
SVar:Other:Event$ Moved | ValidCard$ Creature.Other+YouCtrl | ActiveZones$ Battlefield | Destination$ Battlefield | ReplaceWith$ ExtraCounter | ReplacementResult$ Updated | Description$ Other creatures you control enter with an additional +1/+1 counter on them.
|
||||||
SVar:ExtraCounter:DB$ PutCounter | ETB$ True | Defined$ ReplacedCard | CounterType$ P1P1
|
SVar:ExtraCounter:DB$ PutCounter | ETB$ True | Defined$ ReplacedCard | CounterType$ P1P1
|
||||||
AI:RemoveDeck:NonCommander
|
AI:RemoveDeck:NonCommander
|
||||||
DeckHas:Ability$Counters
|
DeckHas:Ability$Counters
|
||||||
|
|||||||
Reference in New Issue
Block a user