diff --git a/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java b/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java index 249b14f173e..a5d100572d2 100644 --- a/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java +++ b/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java @@ -79,7 +79,7 @@ class DayOfTheMoonEffect extends OneShotEffect { String cardName = cardChoice.getChoice(); List names = getOrSetValue(game, source); names.add(cardName); - names.removeIf(Objects::nonNull); + names.removeIf(Objects::isNull); if (names.isEmpty()) { return true; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/acr/TheAesirEscapeValhallaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/acr/TheAesirEscapeValhallaTest.java new file mode 100644 index 00000000000..0a4dd929de2 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/acr/TheAesirEscapeValhallaTest.java @@ -0,0 +1,50 @@ +package org.mage.test.cards.single.acr; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class TheAesirEscapeValhallaTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.t.TheAesirEscapeValhalla The Aesir Escape Valhalla} {2}{G} + * Enchantment — Saga + * I — Exile a permanent card from your graveyard. You gain life equal to its mana value. + * II — Put a number of +1/+1 counters on target creature you control equal to the mana value of the exiled card. + * III — Return this Saga and the exiled card to their owner’s hand. + */ + private static final String aesir = "The Aesir Escape Valhalla"; + + @Test + public void test_SimplePlay() { + addCard(Zone.HAND, playerA, aesir, 1); + addCard(Zone.GRAVEYARD, playerA, "Gigantosaurus"); // 10/10 {G}{G}{G}{G}{G} + addCard(Zone.BATTLEFIELD, playerA, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aesir); + setChoice(playerA, "Gigantosaurus"); + + checkLife("after I, lifecount", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, 20 + 5); + checkExileCount("after I, exiled", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gigantosaurus", 1); + + // turn 3 + addTarget(playerA, "Memnite"); + + checkPermanentCounters("after II, +1/+1 counters", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", CounterType.P1P1, 5); + + // turn 5 + + setStrictChooseMode(true); + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertHandCount(playerA, "Gigantosaurus", 1); + assertHandCount(playerA, aesir, 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/who/DayOfTheMoonTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/who/DayOfTheMoonTest.java new file mode 100644 index 00000000000..36ff52be2bc --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/who/DayOfTheMoonTest.java @@ -0,0 +1,54 @@ +package org.mage.test.cards.single.who; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class DayOfTheMoonTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.d.DayOfTheMoon Day of the Moon} {2}{R} + * Enchantment — Saga + * I, II, III — Choose a creature card name, then goad all creatures with a name chosen for this enchantment. (Until your next turn, they attack each combat if able and attack a player other than you if able.) + */ + private static final String day = "Day of the Moon"; + + @Ignore // goal of #11619 is to fix this nicely + @Test + public void test_SimplePlay() { + addCard(Zone.HAND, playerA, day, 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard", 1); + addCard(Zone.BATTLEFIELD, playerB, "Centaur Courser", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, day); + setChoice(playerA, "Memnite"); + + // turn 2, Memnite has to attack. + + // turn 3 + setChoice(playerA, "Centaur Courser"); + + // turn 4, Memnite and Centaur Courser have to attack. + + // turn 5 + setChoice(playerA, "Elite Vanguard"); + + // turn 6, Memnite, Centaur Courser and Elite Vanguard have to attack. + + // turn 8, Nothing goaded anymore + + setStrictChooseMode(true); + setStopAt(8, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertLife(playerA, 20 - 1 * 3 - 3 * 2 - 2); + assertGraveyardCount(playerA, day, 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/TheAkroanWarTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/TheAkroanWarTest.java new file mode 100644 index 00000000000..6774678952b --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/TheAkroanWarTest.java @@ -0,0 +1,53 @@ +package org.mage.test.cards.single.woe; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class TheAkroanWarTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.t.TheAkroanWar The Akroan War} {3}{R} + * Enchantment — Saga + * I — Gain control of target creature for as long as this Saga remains on the battlefield. + * II — Until your next turn, creatures your opponents control attack each combat if able. + * III — Each tapped creature deals damage to itself equal to its power. + */ + private static final String war = "The Akroan War"; + + @Test + public void test_SimplePlay() { + addCard(Zone.HAND, playerA, war, 1); + addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1); + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, war); + addTarget(playerA, "Grizzly Bears"); + + checkPermanentCount("after I, Bears under A control", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grizzly Bears", 1); + + checkPermanentCount("T3: Bears still in control ", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 1); + checkPermanentCount("T3: Bears still in control ", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 1); + checkPermanentCount("T4: Bears still in control ", 4, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 1); + + // turn 4 -- mandatory attack after II, so no need to declare + //attack(4, playerB, "Memnite", playerA); + + // turn 5 + checkPermanentCount("before III, Bears still in control ", 5, PhaseStep.UPKEEP, playerA, "Grizzly Bears", 1); + + setStrictChooseMode(true); + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertLife(playerA, 20 - 1); + assertGraveyardCount(playerA, war, 1); + assertGraveyardCount(playerB, "Memnite", 1); + assertPermanentCount(playerB, "Grizzly Bears", 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java new file mode 100644 index 00000000000..108a01564ac --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/woe/ThePrincessTakesFlightTest.java @@ -0,0 +1,57 @@ +package org.mage.test.cards.single.woe; + +import mage.abilities.keyword.FlyingAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author Susucr + */ +public class ThePrincessTakesFlightTest extends CardTestPlayerBase { + + /** + * {@link mage.cards.t.ThePrincessTakesFlight The Princess Takes Flight} {2}{W} + * Enchantment — Saga + * I — Exile up to one target creature. + * II — Target creature you control gets +2/+2 and gains flying until end of turn. + * III — Return the exiled card to the battlefield under its owner’s control. + */ + private static final String flight = "The Princess Takes Flight"; + + @Ignore // goal of #11619 is to fix this nicely + @Test + public void test_SimplePlay() { + addCard(Zone.HAND, playerA, flight, 1); + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1); + addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, flight); + addTarget(playerA, "Memnite"); + + checkExileCount("after I, exiled Memnite", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1); + + // turn 3 + addTarget(playerA, "Grizzly Bears"); + + checkPT("after II, 4/4 Bears", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grizzly Bears", 2 + 2, 2 + 2); + checkAbility("after II, flying Bears", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grizzly Bears", FlyingAbility.class, true); + checkExileCount("after II, still exiled Memnite", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Memnite", 1); + + // boosts are temporary + checkPT("4: back to 2/2 Bears", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grizzly Bears", 2, 2); + checkAbility("4: back to non-flying Bears", 4, PhaseStep.POSTCOMBAT_MAIN, playerA, "Grizzly Bears", FlyingAbility.class, false); + + // turn 5 + + setStrictChooseMode(true); + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertExileCount(playerB, "Memnite", 0); + assertPermanentCount(playerB, "Memnite", 1); + } +}