From 38be371c253fd0a4330cbc28edb6d71ecf5a5064 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 18 Jun 2023 16:50:51 +0400 Subject: [PATCH] tests: real fix of Auratouched Mage - miss draw card effect (#9462) --- .../abilities/other/AuratouchedMageTest.java | 44 ++++++++++++++----- .../main/java/mage/game/stack/SpellStack.java | 3 +- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/AuratouchedMageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/AuratouchedMageTest.java index 50acda5f33..6793fc3d30 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/AuratouchedMageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/AuratouchedMageTest.java @@ -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} - * + *

* 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. - * + *

* 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 it’s 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); diff --git a/Mage/src/main/java/mage/game/stack/SpellStack.java b/Mage/src/main/java/mage/game/stack/SpellStack.java index 2be7261dab..f1e80fbc61 100644 --- a/Mage/src/main/java/mage/game/stack/SpellStack.java +++ b/Mage/src/main/java/mage/game/stack/SpellStack.java @@ -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 { @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) + ")"); } }