tests: real fix of Auratouched Mage - miss draw card effect (#9462)

This commit is contained in:
Oleg Agafonov 2023-06-18 16:50:51 +04:00
parent b30e9ec348
commit 38be371c25
2 changed files with 35 additions and 12 deletions

View file

@ -2,13 +2,13 @@ package org.mage.test.cards.abilities.other;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.mage.test.serverside.base.CardTestPlayerBase;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* {@link mage.cards.a.AuratouchedMage Auratouched Mage} Creature Human Wizard
* 3/3 {5}{W}
*
* <p>
* When Auratouched Mage enters the battlefield, search your library for an Aura
* card that could enchant it. If Auratouched Mage is still on the battlefield,
* put that Aura card onto the battlefield attached to it. Otherwise, reveal the
@ -23,7 +23,7 @@ public class AuratouchedMageTest extends CardTestPlayerBase {
* battlefield and its ETB ability resolving, you must be able to search for
* an Aura that can legally target it with whatever types it has at the
* ability resolves.
*
* <p>
* Relevant Ruling: Any Aura card you find must be able to enchant
* Auratouched Mage as it currently exists, or as it most recently existed
* on the battlefield if its no longer on the battlefield. If an effect has
@ -32,20 +32,42 @@ public class AuratouchedMageTest extends CardTestPlayerBase {
*/
@Test
public void testAuratouchedMageEffectHasMadeIntoTypeArtifact() {
//Expected result: An effect has made Auratouched Mage into an artifact upon entering the battlefield. An aura that only works on artifacts should work.
setStrictChooseMode(true);
skipInitShuffling();
// expected result: An effect has made Auratouched Mage into an artifact upon entering the battlefield. An aura that only works on artifacts should work.
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 8);
addCard(Zone.HAND, playerA, "Auratouched Mage"); //5W cost
addCard(Zone.HAND, playerA, "Argent Mutation"); //2U cost. Target is an artifact until end of turn
addCard(Zone.LIBRARY, playerA, "Relic Ward", 2); //Only enchants an artifact permanent (second copy avoids rare fail to find target)
// When Auratouched Mage enters the battlefield, search your library for an Aura card that could enchant it.
// If Auratouched Mage is still on the battlefield, put that Aura card onto the battlefield attached to it.
// Otherwise, reveal the Aura card and put it into your hand. Then shuffle.
addCard(Zone.HAND, playerA, "Auratouched Mage"); // 5W cost
//
// Target permanent becomes an artifact in addition to its other types until end of turn.
// Draw a card.
addCard(Zone.HAND, playerA, "Argent Mutation"); // {2}{U}
//
// You may cast Relic Ward as though it had flash.
// Enchant artifact
addCard(Zone.LIBRARY, playerA, "Relic Ward", 1); // {1}{W}
addCard(Zone.LIBRARY, playerA, "Mountain", 1); // mountain first in library, so draw will take it instead a relic ward
// prepare mage's ETB trigger
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Auratouched Mage");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, 1); // Wait for Auratouched Mage to ETB
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Argent Mutation", "Auratouched Mage"); // Turn it into an artifact before its ETB ability resolves
addTarget(playerA, "Relic Ward");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
checkStackObject("prepare etb", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "When {this} enters the battlefield", 1);
// make mage as artifact before ETB resolve
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Argent Mutation", "Auratouched Mage");
checkStackObject("prepare artifact", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "When {this} enters the battlefield", 1);
checkStackObject("prepare artifact", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Argent Mutation", 1);
// on etb resolve: search aura and attach it to mage
//showLibrary("after resolve", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
addTarget(playerA, "Relic Ward");
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Auratouched Mage", 1);

View file

@ -9,6 +9,7 @@ import mage.abilities.Ability;
import mage.constants.PutCards;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.util.CardUtil;
import org.apache.log4j.Logger;
/**
@ -142,6 +143,6 @@ public class SpellStack extends ArrayDeque<StackObject> {
@Override
public String toString() {
return this.size() + (this.isEmpty() ? "" : " (top: " + this.getFirst().toString() + ")");
return this.size() + (this.isEmpty() ? "" : " (top: " + CardUtil.substring(this.getFirst().toString(), 100) + ")");
}
}