* Shifting Shadows - Fixed not proper handling of gained triggered abilities during step resolution of Shifting Shadows effect (fixes #6571).

This commit is contained in:
LevelX2 2020-06-03 15:07:52 +02:00
parent f65f4a4344
commit 07386cce8d
6 changed files with 316 additions and 7 deletions

View file

@ -46,10 +46,12 @@ public final class MairsilThePretender extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// When Mairsil, the Pretender enters the battlefield, you may exile an artifact or creature card from your hand or graveyard and put a cage counter on it.
// When Mairsil, the Pretender enters the battlefield, you may exile an artifact or creature card from your hand
// or graveyard and put a cage counter on it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new MairsilThePretenderExileEffect(), true));
// Mairsil, the Pretender has all activated abilities of all cards you own in exile with cage counters on them. You may activate each of those abilities only once each turn.
// Mairsil, the Pretender has all activated abilities of all cards you own in exile with cage counters on them.
// You may activate each of those abilities only once each turn.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new MairsilThePretenderGainAbilitiesEffect());
this.addAbility(ability);
}

View file

@ -71,12 +71,12 @@ public final class ShiftingShadow extends CardImpl {
class ShiftingShadowEffect extends OneShotEffect {
private UUID auraId;
private final UUID auraId;
public ShiftingShadowEffect(UUID auraId) {
super(Outcome.PutCreatureInPlay);
this.staticText = "destroy this creature. Reveal cards from the top of your library until you reveal a creature card. "
+ "Put that card onto the battlefield and attach Shifting Shadow to it, then put all other cards revealed this way on the bottom of your library in a random order";
+ "Put that card onto the battlefield and attach {this} to it, then put all other cards revealed this way on the bottom of your library in a random order";
this.auraId = auraId;
}
@ -107,6 +107,11 @@ class ShiftingShadowEffect extends OneShotEffect {
}
if (aura != null) {
enchanted.destroy(source.getSourceId(), game, false);
// Because this effect has two steps, we have to call the processAction method here, so that triggered effects of the target going to graveyard go to the stack
// If we don't do it here, gained triggered effects to the target will be removed from the following moveCards method and the applyEffcts done there.
// Example: {@link org.mage.test.commander.duel.MairsilThePretenderTest#MairsilThePretenderTest Test}
game.getState().processAction(game);
Cards revealed = new CardsImpl();
Cards otherCards = new CardsImpl();
for (Card card : controller.getLibrary().getCards(game)) {