From ad2d01b46f9ee3aa8368fce37c7c1d301d750919 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 6 Jul 2020 10:49:57 +0400 Subject: [PATCH] Added tests for #6698 (Emrakul, the Promised End) --- .../single/emn/EmrakulThePromisedEndTest.java | 64 +++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/EmrakulThePromisedEndTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/EmrakulThePromisedEndTest.java index 6ab93d4b734..0a51f5095da 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/EmrakulThePromisedEndTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/EmrakulThePromisedEndTest.java @@ -6,14 +6,13 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author Quercitron */ public class EmrakulThePromisedEndTest extends CardTestPlayerBase { // Test that extra turn is added correctly when Emrakul is cast during an opponent's turn. @Test - public void testExtraTurn_Turn2() { + public void test_ExtraTurn_Turn2() { addCard(Zone.BATTLEFIELD, playerB, "Island", 20); // Creature cards you own that aren't on the battlefield have flash. addCard(Zone.HAND, playerB, "Teferi, Mage of Zhalfir"); @@ -23,41 +22,98 @@ public class EmrakulThePromisedEndTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Teferi, Mage of Zhalfir"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Emrakul, the Promised End"); + addTarget(playerB, playerA); + setStrictChooseMode(true); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); + assertAllCommandsUsed(); assertActivePlayer(playerB); } @Test - public void testExtraTurn_Turn3() { + public void test_ExtraTurn_Turn3() { addCard(Zone.BATTLEFIELD, playerB, "Island", 20); addCard(Zone.HAND, playerB, "Teferi, Mage of Zhalfir"); addCard(Zone.HAND, playerB, "Emrakul, the Promised End"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Teferi, Mage of Zhalfir"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Emrakul, the Promised End"); + addTarget(playerB, playerA); + setStrictChooseMode(true); setStopAt(3, PhaseStep.POSTCOMBAT_MAIN); execute(); + assertAllCommandsUsed(); assertActivePlayer(playerA); } @Test - public void testExtraTurn_Turn4() { + public void test_ExtraTurn_Turn4() { addCard(Zone.BATTLEFIELD, playerB, "Island", 20); addCard(Zone.HAND, playerB, "Teferi, Mage of Zhalfir"); addCard(Zone.HAND, playerB, "Emrakul, the Promised End"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Teferi, Mage of Zhalfir"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Emrakul, the Promised End"); + addTarget(playerB, playerA); + setStrictChooseMode(true); setStopAt(4, PhaseStep.POSTCOMBAT_MAIN); execute(); + assertAllCommandsUsed(); assertActivePlayer(playerA); } + @Test + public void test_CostReduction_FromHand() { + // {13} + // This spell costs {1} less to cast for each card type among cards in your graveyard. + // When you cast this spell, you gain control of target opponent during that player’s next turn. After that turn, that player takes an extra turn. + addCard(Zone.HAND, playerA, "Emrakul, the Promised End"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 13 - 2); + addCard(Zone.GRAVEYARD, playerA, "Balduvian Bears", 1); + addCard(Zone.GRAVEYARD, playerA, "Lightning Bolt", 1); + + checkPlayableAbility("can play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Emrakul, the Promised End", true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Emrakul, the Promised End"); + addTarget(playerA, playerB); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Emrakul, the Promised End", 1); + } + + @Test + public void test_CostReduction_FromLibrary() { + removeAllCardsFromLibrary(playerA); + + // {13} + // This spell costs {1} less to cast for each card type among cards in your graveyard. + // When you cast this spell, you gain control of target opponent during that player’s next turn. After that turn, that player takes an extra turn. + addCard(Zone.LIBRARY, playerA, "Emrakul, the Promised End"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 13 - 2); + addCard(Zone.GRAVEYARD, playerA, "Balduvian Bears", 1); + addCard(Zone.GRAVEYARD, playerA, "Lightning Bolt", 1); + // + // You may cast creature spells from the top of your library. + addCard(Zone.BATTLEFIELD, playerA, "Vivien, Monsters' Advocate", 1); + + checkPlayableAbility("can play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Emrakul, the Promised End", true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Emrakul, the Promised End"); + addTarget(playerA, playerB); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Emrakul, the Promised End", 1); + } }