From c05941cf0d7e31b4e605c3b3573a03125176ef01 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 24 Dec 2016 10:16:03 +0100 Subject: [PATCH] * Added cascade test. --- Mage.Sets/src/mage/cards/e/EnlistedWurm.java | 7 +- .../cards/abilities/keywords/CascadeTest.java | 70 ++++++++++++++----- .../watchers/EpharaGodOfThePolisTest.java | 46 ++++++------ 3 files changed, 80 insertions(+), 43 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/EnlistedWurm.java b/Mage.Sets/src/mage/cards/e/EnlistedWurm.java index 1dc6dd3ef0..107552e08f 100644 --- a/Mage.Sets/src/mage/cards/e/EnlistedWurm.java +++ b/Mage.Sets/src/mage/cards/e/EnlistedWurm.java @@ -28,11 +28,11 @@ package mage.cards.e; import java.util.UUID; -import mage.constants.CardType; import mage.MageInt; import mage.abilities.keyword.CascadeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; /** * @@ -41,14 +41,13 @@ import mage.cards.CardSetInfo; public class EnlistedWurm extends CardImpl { public EnlistedWurm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}"); this.subtype.add("Wurm"); - - this.power = new MageInt(5); this.toughness = new MageInt(5); + // Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.) this.addAbility(new CascadeAbility()); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java index 48124877b2..8595a113a2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CascadeTest.java @@ -1,6 +1,5 @@ package org.mage.test.cards.abilities.keywords; - import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Assert; @@ -12,22 +11,21 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author BetaSteward */ public class CascadeTest extends CardTestPlayerBase { - + /* * Maelstrom Nexus {WUBRG} * Enchantment - * The first spell you cast each turn has cascade. (When you cast your first - * spell, exile cards from the top of your library until you exile a nonland - * card that costs less. You may cast it without paying its mana cost. Put + * The first spell you cast each turn has cascade. (When you cast your first + * spell, exile cards from the top of your library until you exile a nonland + * card that costs less. You may cast it without paying its mana cost. Put * the exiled cards on the bottom in a random order.) * * Predatory Advantage {3RG} * Enchantment - * At the beginning of each opponent's end step, if that player didn't cast - * a creature spell this turn, put a 2/2 green Lizard creature token onto + * At the beginning of each opponent's end step, if that player didn't cast + * a creature spell this turn, put a 2/2 green Lizard creature token onto * the battlefield. - */ - + */ // test that Predatory Advantage gains Cascade when cast @Test public void testGainsCascade() { @@ -36,16 +34,16 @@ public class CascadeTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus"); addCard(Zone.HAND, playerA, "Predatory Advantage"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage"); - + setStopAt(2, PhaseStep.END_TURN); execute(); - + assertPermanentCount(playerA, "Predatory Advantage", 1); assertPermanentCount(playerA, "Sejiri Merfolk", 1); assertPermanentCount(playerA, "Lizard", 1); - + } // test that 2nd spell cast (Nacatl Outlander) does not gain Cascade @@ -59,18 +57,18 @@ public class CascadeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Nacatl Outlander"); addCard(Zone.LIBRARY, playerA, "Arbor Elf"); addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Nacatl Outlander"); - + setStopAt(1, PhaseStep.END_TURN); execute(); - + assertPermanentCount(playerA, "Predatory Advantage", 1); assertPermanentCount(playerA, "Sejiri Merfolk", 1); assertPermanentCount(playerA, "Nacatl Outlander", 1); assertPermanentCount(playerA, "Arbor Elf", 0); - + } // test that player does not lose if all cards are exiled by cascade @@ -81,7 +79,7 @@ public class CascadeTest extends CardTestPlayerBase { // won't trigger. @Test public void testEmptyLibraryCascasde() { - + playerA.getLibrary().clear(); addCard(Zone.LIBRARY, playerA, "Plains", 10); @@ -127,7 +125,41 @@ public class CascadeTest extends CardTestPlayerBase { // the 2 lands go back to library Assert.assertEquals("The 2 lands went back to library", 2, playerA.getLibrary().size()); Assert.assertTrue("Player A is still in game", playerA.isInGame()); - + + } + + /** + * Whenever Enlisted wurm is returned to hand, or was cast previously by an + * opponent's Gonti, after it is returned to my hand, it will not let me + * cast it. + */ + @Test + public void testRecastCascadeCard() { + + playerA.getLibrary().clear(); + addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 6); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); + + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + // Cascade + addCard(Zone.HAND, playerA, "Enlisted Wurm"); // Creature {4}{G}{W} + + addCard(Zone.BATTLEFIELD, playerB, "Island", 1); + addCard(Zone.HAND, playerB, "Unsummon"); // Instant {U} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Enlisted Wurm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon", "Enlisted Wurm"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Enlisted Wurm"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerB, "Unsummon", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 2); + assertPermanentCount(playerA, "Enlisted Wurm", 1); + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java index 24c886f8d0..3b78c92781 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/EpharaGodOfThePolisTest.java @@ -10,44 +10,50 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author BetaSteward */ public class EpharaGodOfThePolisTest extends CardTestPlayerBase { + /* * Ephara, God of the Polis * Legendary Enchantment Creature — God 6/5, 2WU (4) * Indestructible - * As long as your devotion to white and blue is less than seven, Ephara + * As long as your devotion to white and blue is less than seven, Ephara * isn't a creature. - * At the beginning of each upkeep, if you had another creature enter the + * At the beginning of each upkeep, if you had another creature enter the * battlefield under your control last turn, draw a card. * - */ - + */ // test that an extra card is drawn @Test public void testDrawCard() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis"); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Zone.BATTLEFIELD, playerA, "Island", 3); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + addCard(Zone.HAND, playerA, "Ephara, God of the Polis"); addCard(Zone.HAND, playerA, "Goblin Roughrider"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Roughrider"); - - setStopAt(3, PhaseStep.UPKEEP); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephara, God of the Polis"); + + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - - this.assertHandCount(playerA, 1); - + + this.assertHandCount(playerA, 2); + } - + // test that an extra card is not drawn @Test public void testNotDrawCard() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis"); - - setStopAt(3, PhaseStep.UPKEEP); + addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + addCard(Zone.HAND, playerA, "Ephara, God of the Polis"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ephara, God of the Polis"); + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); - - this.assertHandCount(playerA, 0); - + + this.assertHandCount(playerA, 1); + this.assertPermanentCount(playerA, "Ephara, God of the Polis", 1); + } }