Fix trigger running with no zone for Wall of Stolen Identity

This commit is contained in:
Bug Hunter
2021-05-14 05:39:08 +00:00
committed by Michael Kamensky
parent ddbe5af21c
commit 80a1c13a07
5 changed files with 15 additions and 10 deletions

View File

@@ -3,7 +3,6 @@ package forge.game.ability.effects;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -170,9 +169,9 @@ public class CloneEffect extends SpellAbilityEffect {
cloneCard.clearImprintedCards(); cloneCard.clearImprintedCards();
cloneCard.clearRemembered(); cloneCard.clearRemembered();
// restore original Remembered and Imprinted, ignore cards from players who lost // restore original Remembered and Imprinted, ignore cards from players who lost
cloneCard.addImprintedCards(Iterables.filter(clonedImprinted, Predicates.not(CardPredicates.inZone(ZoneType.None)))); cloneCard.addImprintedCards(Iterables.filter(clonedImprinted, CardPredicates.ownerLives()));
cloneCard.addRemembered(Iterables.filter(clonedRemembered, Player.class)); cloneCard.addRemembered(Iterables.filter(clonedRemembered, Player.class));
cloneCard.addRemembered(Iterables.filter(Iterables.filter(clonedRemembered, Card.class), CardPredicates.ownerLives())); cloneCard.addRemembered(Iterables.filter(Iterables.filter(clonedRemembered, Card.class), CardPredicates.ownerLives()));
cloneCard.updateStateForView(); cloneCard.updateStateForView();
game.fireEvent(new GameEventCardStatsChanged(cloneCard)); game.fireEvent(new GameEventCardStatsChanged(cloneCard));
} }

View File

@@ -9,6 +9,7 @@ import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect; import forge.game.ability.SpellAbilityEffect;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardUtil; import forge.game.card.CardUtil;
import forge.game.replacement.ReplacementType;
import forge.game.spellability.AbilitySub; import forge.game.spellability.AbilitySub;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.trigger.Trigger; import forge.game.trigger.Trigger;
@@ -57,7 +58,9 @@ public class ImmediateTriggerEffect extends SpellAbilityEffect {
Card lki = CardUtil.getLKICopy(gameCard); Card lki = CardUtil.getLKICopy(gameCard);
lki.clearControllers(); lki.clearControllers();
lki.setOwner(sa.getActivatingPlayer()); lki.setOwner(sa.getActivatingPlayer());
final Trigger immediateTrig = TriggerHandler.parseTrigger(mapParams, lki, sa.isIntrinsic(), null); // if this trigger is part of ETBReplacement it shouldn't run with LKI from incomplete zone change (Wall of Stolen Identity)
final Card trigHost = sa.getRootAbility().getReplacementEffect() != null && sa.getRootAbility().getReplacementEffect().getMode().equals(ReplacementType.Moved) ? gameCard : lki;
final Trigger immediateTrig = TriggerHandler.parseTrigger(mapParams, trigHost, sa.isIntrinsic(), null);
immediateTrig.setSpawningAbility(sa.copy(lki, sa.getActivatingPlayer(), true)); immediateTrig.setSpawningAbility(sa.copy(lki, sa.getActivatingPlayer(), true));
// Need to copy paid costs // Need to copy paid costs

View File

@@ -91,9 +91,8 @@ public class PumpEffect extends SpellAbilityEffect {
@Override @Override
public void run() { public void run() {
gameCard.removePTBoost(timestamp, 0); gameCard.removePTBoost(timestamp, 0);
boolean updateText = false; boolean updateText = gameCard.removeCanBlockAny(timestamp);
updateText = gameCard.removeCanBlockAny(timestamp) || updateText; updateText |= gameCard.removeCanBlockAdditional(timestamp);
updateText = gameCard.removeCanBlockAdditional(timestamp) || updateText;
if (keywords.size() > 0) { if (keywords.size() > 0) {
@@ -146,8 +145,12 @@ public class PumpEffect extends SpellAbilityEffect {
} }
private static void addUntilCommand(final SpellAbility sa, GameCommand untilEOT) { private static void addUntilCommand(final SpellAbility sa, GameCommand untilEOT) {
final Card host = sa.getHostCard(); Card host = sa.getHostCard();
final Game game = host.getGame(); final Game game = host.getGame();
// in case host was LKI
if (host.isLKI()) {
host = game.getCardState(host);
}
if (sa.hasParam("UntilEndOfCombat")) { if (sa.hasParam("UntilEndOfCombat")) {
game.getEndOfCombat().addUntil(untilEOT); game.getEndOfCombat().addUntil(untilEOT);

View File

@@ -96,7 +96,7 @@ public class CardFactoryUtil {
String abString = "AB$ Mana | Cost$ T | Produced$ " + strcolor + String abString = "AB$ Mana | Cost$ T | Produced$ " + strcolor +
" | Secondary$ True | SpellDescription$ Add {" + strcolor + "}."; " | Secondary$ True | SpellDescription$ Add {" + strcolor + "}.";
SpellAbility sa = AbilityFactory.getAbility(abString, state); SpellAbility sa = AbilityFactory.getAbility(abString, state);
sa.setIntrinsic(true); // always intristic sa.setIntrinsic(true); // always intrisic
return sa; return sa;
} }

View File

@@ -6,6 +6,6 @@ K:ETBReplacement:Copy:DBCopy:Optional
SVar:DBCopy:DB$ Clone | Choices$ Creature.Other | AddTypes$ Wall | AddKeywords$ Defender | AiChoiceLogic$ BestOppCtrl | SubAbility$ DBTrigger | RememberCloneOrigin$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it's a Wall in addition to its other types and has defender. When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control CARDNAME. SVar:DBCopy:DB$ Clone | Choices$ Creature.Other | AddTypes$ Wall | AddKeywords$ Defender | AiChoiceLogic$ BestOppCtrl | SubAbility$ DBTrigger | RememberCloneOrigin$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except it's a Wall in addition to its other types and has defender. When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control CARDNAME.
SVar:DBTrigger:DB$ ImmediateTrigger | Execute$ DBTap | RememberObjects$ RememberedCard | SubAbility$ DBCleanup | TriggerDescription$ When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control CARDNAME. SVar:DBTrigger:DB$ ImmediateTrigger | Execute$ DBTap | RememberObjects$ RememberedCard | SubAbility$ DBCleanup | TriggerDescription$ When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control CARDNAME.
SVar:DBTap:DB$ Tap | Defined$ DelayTriggerRemembered | SubAbility$ DBPump SVar:DBTap:DB$ Tap | Defined$ DelayTriggerRemembered | SubAbility$ DBPump
SVar:DBPump:DB$ Pump | Defined$ DelayTriggerRemembered | KW$ HIDDEN CARDNAME doesn't untap during your untap step. | UntilHostLeavesPlay$ True SVar:DBPump:DB$ Pump | Defined$ DelayTriggerRemembered | KW$ HIDDEN CARDNAME doesn't untap during your untap step. | UntilLoseControlOfHost$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
Oracle:You may have Wall of Stolen Identity enter the battlefield as a copy of any creature on the battlefield, except it's a Wall in addition to its other types and has defender. When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control Wall of Stolen Identity. Oracle:You may have Wall of Stolen Identity enter the battlefield as a copy of any creature on the battlefield, except it's a Wall in addition to its other types and has defender. When you do, tap the copied creature and it doesn't untap during its controller's untap step for as long as you control Wall of Stolen Identity.