From e7963de7c831ec36f0c187e5c3e4c46b3255121e Mon Sep 17 00:00:00 2001 From: Derek Monturo Date: Sat, 20 May 2017 09:24:45 -0400 Subject: [PATCH] more scarabs tests --- .../cards/enchantments/NestOfScarabsTest.java | 151 ++++++++++++++++-- 1 file changed, 140 insertions(+), 11 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java index 1a15d98b04..185c45f266 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/NestOfScarabsTest.java @@ -12,19 +12,19 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class NestOfScarabsTest extends CardTestPlayerBase { + + /* + Nest of Scarabs 2B + Enchantment + Whenever you put one or more -1/-1 counters on a creature, create that many 1/1 black Insect creature tokens. + */ + private final String nestScarabs = "Nest of Scarabs"; + /* * Reported bug: Nest of Scarabs not triggering off -1/-1 counters placed on creatures. - * NOTE: this test is failing due to bug in code. See issue #3174 */ @Test - public void scarabsWithSoulStinger_TwoCountersTwoTokens() { - - /* - Nest of Scarabs 2B - Enchantment - Whenever you put one or more -1/-1 counters on a creature, create that many 1/1 black Insect creature tokens. - */ - String nScarabs = "Nest of Scarabs"; + public void scarabs_SoulStinger_TwoCountersTwoTokens() { /* Soulstinger 3B @@ -34,7 +34,7 @@ public class NestOfScarabsTest extends CardTestPlayerBase { */ String stinger = "Soulstinger"; - addCard(Zone.BATTLEFIELD, playerA, nScarabs); + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); addCard(Zone.HAND, playerA, stinger); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); @@ -44,10 +44,139 @@ public class NestOfScarabsTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - assertPermanentCount(playerA, nScarabs, 1); + assertPermanentCount(playerA, nestScarabs, 1); assertPermanentCount(playerA, stinger, 1); assertCounterCount(playerA, stinger, CounterType.M1M1, 2); assertPowerToughness(playerA, stinger, 2, 3); // 4/5 with two -1/-1 counters assertPermanentCount(playerA, "Insect", 2); // two counters = two insects } + + /* + * NOTE: test is failing due to bug in code. See issue #3402 + * Bug from testing: + Cast Black Sun's Zenith targetting own creature and 3 of opponent's creatures. Only getting 1 token. + */ + @Test + public void scarabs_BlackSunsZenithTargettingSelfAndOpponent_4Counters4Tokens() { + + /* + Black Sun's Zenith {X}{B}{B} + Sorcery + Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library. + */ + String blackZenith = "Black Sun's Zenith"; + + String hillGiant = "Hill Giant"; // {3}{R} 3/3 + String grizzly = "Grizzly Bears"; // {1}{G} 2/2 + String memnite = "Memnite"; // {0} 1/1 + String fugitive = "Fugitive Wizard"; // {U} 1/1 + + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); + addCard(Zone.HAND, playerA, blackZenith); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); + addCard(Zone.BATTLEFIELD, playerA, fugitive); + + addCard(Zone.BATTLEFIELD, playerB, grizzly); + addCard(Zone.BATTLEFIELD, playerB, memnite); + addCard(Zone.BATTLEFIELD, playerB, hillGiant); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith); + setChoice(playerA, "X=1"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, nestScarabs, 1); + assertHandCount(playerA, blackZenith, 0); + assertLibraryCount(playerA, blackZenith, 1); // shuffles back into library + assertGraveyardCount(playerA, fugitive, 1); + assertGraveyardCount(playerB, memnite, 1); + assertPermanentCount(playerB, grizzly, 1); + assertPermanentCount(playerB, hillGiant, 1); + assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); + assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1); + assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter + assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter + assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects + } + + /* + * NOTE: test is failing due to bug in code. See issue #3402 + * Bug from testing: + Cast Black Sun's Zenith targetting own creature and 3 of opponent's creatures. Only getting 1 token. + This time with both players having Nest of Scarabs out. + */ + @Test + public void scarabsForBothPlayers_BlackSunsZenithTargettingSelfAndOpponent_4Counters4Tokens() { + + /* + Black Sun's Zenith {X}{B}{B} + Sorcery + Put X -1/-1 counters on each creature. Shuffle Black Sun's Zenith into its owner's library. + */ + String blackZenith = "Black Sun's Zenith"; + + String hillGiant = "Hill Giant"; // {3}{R} 3/3 + String grizzly = "Grizzly Bears"; // {1}{G} 2/2 + String memnite = "Memnite"; // {0} 1/1 + String fugitive = "Fugitive Wizard"; // {U} 1/1 + + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); + addCard(Zone.HAND, playerA, blackZenith); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); + addCard(Zone.BATTLEFIELD, playerA, fugitive); + + addCard(Zone.BATTLEFIELD, playerB, nestScarabs); + addCard(Zone.BATTLEFIELD, playerB, grizzly); + addCard(Zone.BATTLEFIELD, playerB, memnite); + addCard(Zone.BATTLEFIELD, playerB, hillGiant); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, blackZenith); + setChoice(playerA, "X=1"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, nestScarabs, 1); + assertPermanentCount(playerB, nestScarabs, 1); + assertHandCount(playerA, blackZenith, 0); + assertLibraryCount(playerA, blackZenith, 1); // shuffles back into library + assertGraveyardCount(playerA, fugitive, 1); + assertGraveyardCount(playerB, memnite, 1); + assertPermanentCount(playerB, grizzly, 1); + assertPermanentCount(playerB, hillGiant, 1); + assertCounterCount(playerB, grizzly, CounterType.M1M1, 1); + assertCounterCount(playerB, hillGiant, CounterType.M1M1, 1); + assertPowerToughness(playerB, grizzly, 1, 1); // 2/2 with -1/-1 counter + assertPowerToughness(playerB, hillGiant, 2, 2); // 3/3 with -1/-1 counter + assertPermanentCount(playerB, "Insect", 0); // playerB did not place the -1/-1 counters, should not trigger + assertPermanentCount(playerA, "Insect", 4); // 4 counters = 4 insects + } + + /* + * NOTE: test is failing due to bug in code. See issue #3402 + Reported bug: Nest of Scarabs not triggering off infect damage dealt by creatures such as Blight Mamba + */ + @Test + public void scarab_infectDamageTriggers() { + + String bMamba = "Blight Mamba"; // {1}{G} 1/1 Creature - Snake, Infect with {1}{G}:Regen + String wOmens = "Wall of Omens"; // {1}{W} 0/4 defender ETB: draw a card + + addCard(Zone.BATTLEFIELD, playerA, nestScarabs); + addCard(Zone.BATTLEFIELD, playerA, bMamba); + addCard(Zone.BATTLEFIELD, playerB, wOmens); + + attack(3, playerA, bMamba); + block(3, playerB, wOmens, bMamba); + + setStopAt(3, PhaseStep.END_COMBAT); + execute(); + + assertLife(playerB, 20); + assertCounterCount(playerB, CounterType.POISON, 0); + assertPowerToughness(playerB, wOmens, -1, 3); // 0/4 with -1/-1 counter + assertCounterCount(playerB, wOmens, CounterType.M1M1, 1); + assertPermanentCount(playerA, "Insect", 1); + } }