From 3c0951c350cfdbd4756f68bf38a4f697c11aeea1 Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Sat, 20 Aug 2022 07:35:36 -0400 Subject: [PATCH] Enabled assertAllCommandsUsed by default and fixed remaining tests --- .../activated/PutToGraveyardTest.java | 6 +- .../abilities/enters/BanisherPriestTest.java | 8 ++- .../abilities/enters/GatherSpecimensTest.java | 21 ++----- .../enters/GreenbeltRampagerTest.java | 2 +- .../abilities/enters/SkylineCascadeTest.java | 8 +-- .../abilities/flicker/CloudshiftTest.java | 4 +- .../abilities/keywords/ChangelingTest.java | 2 +- .../cards/abilities/keywords/EmbalmTest.java | 5 +- .../abilities/keywords/EscalateTest.java | 2 + .../cards/abilities/keywords/EvolveTest.java | 6 +- .../cards/abilities/keywords/ExploitTest.java | 2 +- .../abilities/keywords/FlashbackTest.java | 12 +++- .../abilities/keywords/ForecastTest.java | 30 ++++------ .../cards/abilities/keywords/InfectTest.java | 11 ++-- .../cards/abilities/keywords/MorphTest.java | 2 + .../cards/abilities/keywords/ProvokeTest.java | 7 +-- .../keywords/SoulbondKeywordTest.java | 13 ++-- .../keywords/SpliceOnArcaneTest.java | 2 +- .../AddingCountersToPermanentsTest.java | 2 +- .../oneshot/counter/MovingCounterTest.java | 3 +- .../oneshot/damage/SatyrFiredancerTest.java | 2 +- .../oneshot/exile/FiendHunterTest.java | 2 +- .../oneshot/exile/OblivionSowerTest.java | 2 +- .../abilities/other/SoulConduitTest.java | 4 +- .../cards/asthough/CastFromLibraryTest.java | 5 +- .../conditional/LegendarySorceryTest.java | 6 +- .../conditional/ManaWasSpentToCastTest.java | 2 +- .../cards/conditional/TragicSlipTest.java | 16 +++-- .../continuous/MerfolkTricksterTest.java | 8 +-- .../cards/control/BronzeBombshellTest.java | 4 +- .../control/GainControlTargetEffectTest.java | 4 +- .../control/GontiLordOfLuxuryEffectTest.java | 8 +-- .../copy/CopyCreatureCardToTokenImplTest.java | 2 +- .../mage/test/cards/copy/CopySpellTest.java | 4 +- .../mage/test/cards/copy/CryptoplasmTest.java | 12 +++- .../test/cards/dynamicvalue/SweepTest.java | 6 ++ .../cards/enchantments/AnimateDeadTest.java | 6 ++ .../cards/enchantments/AuraMovingTest.java | 6 +- .../cards/enchantments/SagesReverieTest.java | 43 ++++++------- .../enchantments/StarfieldOfNyxTest.java | 8 ++- .../test/cards/mana/ChandrasEmbercatTest.java | 22 ++++--- .../test/cards/mana/EldraziTempleTest.java | 4 +- .../mana/conditional/ConditionalManaTest.java | 3 +- .../LilianaDefiantNecromancerTest.java | 20 ++++--- .../cards/replacement/WinLoseEffectsTest.java | 2 +- .../prevent/DeflectingPalmTest.java | 2 + .../cards/restriction/ReflectorMageTest.java | 5 +- .../mage/test/cards/rules/CantCastTest.java | 18 +++--- .../cards/single/aer/HopeOfGhirapurTest.java | 13 ++-- .../single/akh/BontuTheGlorifiedTest.java | 13 +++- .../cards/single/avr/CavernOfSoulsTest.java | 60 +++++++++---------- .../cards/single/bfz/EmeriaShepherdTest.java | 3 + .../cards/single/emn/NephaliaAcademyTest.java | 4 +- .../cards/single/emn/SoulSeparatorTest.java | 4 ++ .../cards/single/emn/SpellQuellerTest.java | 54 ++++++++--------- .../cards/single/emn/TreeOfPerditionTest.java | 4 +- .../cards/single/m14/JacesMindseekerTest.java | 2 + .../cards/single/mrd/CullingScalesTest.java | 3 +- .../cards/single/ogw/ThoughtKnotSeerTest.java | 6 +- .../single/soi/BriarbridgePatrolTest.java | 2 +- .../cards/single/soi/NightSideCMCTest.java | 2 +- .../single/tor/LaquatussChampionTest.java | 4 +- .../cards/triggers/JourneyToNowhereTest.java | 8 +-- .../cards/triggers/MasterOfCrueltiesTest.java | 4 +- .../test/cards/triggers/SilkwrapTest.java | 14 +++-- .../test/cards/triggers/SoulWardenTest.java | 5 +- .../cards/triggers/dies/ChronozoaTest.java | 2 +- .../triggers/dies/ElendaTheDuskRoseTest.java | 8 ++- .../triggers/dies/ServantOfTheScaleTest.java | 8 +-- .../commander/duel/CurseOfTheSwineTest.java | 16 ++--- .../PlayerLeftGameRangeAllTest.java | 1 - .../test/multiplayer/VindictiveLichTest.java | 2 +- .../mage/test/rollback/DemonicPactTest.java | 2 + .../mage/test/rollback/StateValuesTest.java | 6 +- .../base/impl/CardTestPlayerAPIImpl.java | 3 +- .../org/mage/test/testapi/TestAPITest.java | 14 ++++- ...tlefieldUnderOwnerControlTargetEffect.java | 1 + 77 files changed, 360 insertions(+), 282 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/PutToGraveyardTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/PutToGraveyardTest.java index 1d4c912815..9372ddc7bd 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/PutToGraveyardTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/PutToGraveyardTest.java @@ -28,13 +28,15 @@ public class PutToGraveyardTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stasis Snare"); addTarget(playerA, "Silvercoat Lion"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G},", TestPlayer.NO_TARGET, ""); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{1}{G},", TestPlayer.NO_TARGET, ""); addTarget(playerA, "Silvercoat Lion"); - setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStopAt(1, PhaseStep.END_TURN); execute(); assertPermanentCount(playerA, "Stasis Snare", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/BanisherPriestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/BanisherPriestTest.java index 1e4daec69a..a12d192867 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/BanisherPriestTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/BanisherPriestTest.java @@ -104,7 +104,7 @@ public class BanisherPriestTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); addCard(Zone.GRAVEYARD, playerB, "Banisher Priest"); - /** + /* * Seance * {2}{W}{W} * Enchantment @@ -114,8 +114,12 @@ public class BanisherPriestTest extends CardTestPlayerBase { * Exile it at the beginning of the next end step. */ addCard(Zone.BATTLEFIELD, playerB, "Seance"); + + setStrictChooseMode(true); + + setChoice(playerB, "Yes"); addTarget(playerB, "Banisher Priest"); // Return the Banisher Priest from graveyard with Seance - // The Silvercoat Lion is autochosen for Banisher Priest's ETB since it's the only creature on the opponent's board + addTarget(playerB, "Silvercoat Lion"); setStopAt(2, PhaseStep.PRECOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java index d46e4c57f5..759ebf45d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java @@ -9,17 +9,14 @@ import mage.constants.Zone; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; -/** +/* Gather Specimens - Instant {3}{U}{U}{U} + * + * If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. * * @author jeffwadsworth */ public class GatherSpecimensTest extends CardTestPlayerBase { - /* Gather Specimens - Instant {3}{U}{U}{U} - * - * If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. - */ - @Test public void testFromHandEffect() { setStrictChooseMode(true); @@ -44,11 +41,10 @@ public class GatherSpecimensTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Memnite", 1); assertPermanentCount(playerB, "Memnite", 0); - } + @Test public void testTokenCreatedFromSpellEffect() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.HAND, playerA, "Gather Specimens", 1); @@ -65,12 +61,10 @@ public class GatherSpecimensTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Spirit Token", 3); assertPermanentCount(playerB, "Spirit Token", 0); - } @Test public void testFromGraveyardEffect() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.HAND, playerA, "Gather Specimens", 1); addCard(Zone.LIBRARY, playerA, "Memnite", 10); @@ -90,12 +84,10 @@ public class GatherSpecimensTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Memnite", 1); assertPermanentCount(playerB, "Memnite", 0); - } @Test public void testFromExileEffect() { - addCard(Zone.BATTLEFIELD, playerA, "Plains", 10); addCard(Zone.BATTLEFIELD, playerA, "Island", 10); addCard(Zone.HAND, playerA, "Disenchant", 1); @@ -106,6 +98,8 @@ public class GatherSpecimensTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1); addCard(Zone.LIBRARY, playerB, "Plains", 10); + setStrictChooseMode(true); + // If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. castSpell(1, PhaseStep.UPKEEP, playerA, "Gather Specimens"); @@ -120,8 +114,5 @@ public class GatherSpecimensTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Memnite", 0); assertPermanentCount(playerA, "Memnite", 1); - } - - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java index 8c2f2fe387..2d94fd80d0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GreenbeltRampagerTest.java @@ -75,7 +75,7 @@ public class GreenbeltRampagerTest extends CardTestPlayerBase { skipInitShuffling(); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); - addTarget(playerA, playerB); + // addTarget(playerA, playerB); playerB is autochosen since only option setChoice(playerA, "Greenbelt Rampager"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Greenbelt Rampager"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/SkylineCascadeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/SkylineCascadeTest.java index 15c9caa991..c4385d8092 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/SkylineCascadeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/SkylineCascadeTest.java @@ -21,7 +21,7 @@ public class SkylineCascadeTest extends CardTestPlayerBase { // {W} 2/1 addCard(Zone.BATTLEFIELD, playerA, "Savannah Lions"); - /** + /* * Skyline Cascade enters the battlefield tapped. * When Skyline Cascade enters the battlefield, target creature an opponent controls doesn't untap during its controller's next untap step. * Tap: Add {U} . @@ -31,8 +31,8 @@ public class SkylineCascadeTest extends CardTestPlayerBase { attack(1, playerA, "Savannah Lions"); playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Skyline Cascade"); - addTarget(playerB, "Savannah Lions"); - + // Savannah Lions is autochosen + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); @@ -64,7 +64,7 @@ public class SkylineCascadeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Skyline Cascade"); playLand(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Skyline Cascade"); - addTarget(playerB, "Savannah Lions"); + // Savannah Lions is autochosen setStopAt(3, PhaseStep.PRECOMBAT_MAIN); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/flicker/CloudshiftTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/flicker/CloudshiftTest.java index edce17b249..ab42915412 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/flicker/CloudshiftTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/flicker/CloudshiftTest.java @@ -307,15 +307,13 @@ public class CloudshiftTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); // Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. addCard(Zone.HAND, playerA, "Act of Treason"); - // At the beginning of your end step, you may exile target creature you control, then return that card to the battlefield under your control addCard(Zone.BATTLEFIELD, playerA, "Conjurer's Closet"); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Act of Treason", "Silvercoat Lion"); - - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion is autochosen setStopAt(2, PhaseStep.PRECOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ChangelingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ChangelingTest.java index 26c217ad90..b8e65cddc9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ChangelingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ChangelingTest.java @@ -150,7 +150,7 @@ public class ChangelingTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Merfolk Trickster"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Merfolk Trickster"); - addTarget(playerA, "Game-Trail Changeling"); + // Game-Trail Changeling autochosen setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java index aa633a8307..ef88ab5cba 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java @@ -73,6 +73,8 @@ public class EmbalmTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, yOx); addCard(Zone.BATTLEFIELD, playerB, wKnight); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aSanctions); addTarget(playerA, yOx); castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, dBlade); @@ -122,7 +124,8 @@ public class EmbalmTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aSanctions); addTarget(playerA, yOx); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, dBlade); - addTarget(playerB, aSanctions); + // Angel of Sanction is auto-chosen since only option + waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Embalm"); addTarget(playerA, wKnight); castSpell(1, PhaseStep.END_TURN, playerB, dBlade); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java index 399a3a99e6..ce3c545178 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EscalateTest.java @@ -109,6 +109,8 @@ public class EscalateTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Collective Defiance"); // {1}{R}{R} sorcery addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Collective Defiance", "mode=2Wall of Omens"); setModeChoice(playerA, "1"); // opponent discards hand and draws that many setModeChoice(playerA, "2"); // deal 4 dmg to target creature (Wall of Omens) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EvolveTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EvolveTest.java index 20f0f861c4..fbbe2e8d0e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EvolveTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EvolveTest.java @@ -114,7 +114,6 @@ public class EvolveTest extends CardTestPlayerBase { @Test public void testMultipleCreaturesComeIntoPlay() { - // Cloudfin Raptor gets one +1/+1 because itself and other creatur return from exile addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6); addCard(Zone.BATTLEFIELD, playerA, "Judge's Familiar", 1); @@ -124,8 +123,11 @@ public class EvolveTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Plains", 6); addCard(Zone.HAND, playerB, "Banisher Priest", 2); + setStrictChooseMode(true); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Banisher Priest"); addTarget(playerB, "Cloudfin Raptor"); + waitStackResolved(2, PhaseStep.PRECOMBAT_MAIN); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Banisher Priest"); addTarget(playerB, "Judge's Familiar"); @@ -139,7 +141,7 @@ public class EvolveTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Banisher Priest", 0); - assertGraveyardCount(playerB, 2); + assertGraveyardCount(playerB, "Banisher Priest", 2); assertGraveyardCount(playerA, 1); assertPermanentCount(playerA, "Cloudfin Raptor", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploitTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploitTest.java index 9529096d34..1cd796bc6a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploitTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ExploitTest.java @@ -93,7 +93,7 @@ public class ExploitTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Qarsi Sadist"); setChoice(playerA, true); addTarget(playerA, "Qarsi Sadist"); // sacrifice to Exploit - addTarget(playerA, playerB); // Target for lose life + // Player B is auto-chosen to lose two life since only option setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java index d2e4d8a9d2..148e369028 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/FlashbackTest.java @@ -83,6 +83,8 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); addCard(Zone.GRAVEYARD, playerA, "Repeal", 1); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); addTarget(playerA, "Repeal"); @@ -113,6 +115,8 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Snapcaster Mage", 1); addCard(Zone.GRAVEYARD, playerA, "Blaze", 1); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); addTarget(playerA, "Blaze"); @@ -154,6 +158,8 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Lightning Bolt", 1); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unburial Rites", "Iona, Shield of Emeria"); setChoice(playerA, "Red"); @@ -253,6 +259,8 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Island", 2); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); addTarget(playerA, "Ancestral Vision"); @@ -346,6 +354,8 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Icefall Regent", 1); + setStrictChooseMode(true); + // When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn. // The flashback cost is equal to its mana cost. castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage"); @@ -507,7 +517,7 @@ public class FlashbackTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, memnite); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback"); // Flashback Dread Return - addTarget(playerA, bSable); // return to battlefield + // Bronze Sable is auto-chosen since only possible target // Only 3 creature under playerA's control, let them be auto-sac'ed to pay setStopAt(1, PhaseStep.BEGIN_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ForecastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ForecastTest.java index d3ff34250c..e31a96b2f6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ForecastTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ForecastTest.java @@ -7,32 +7,29 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * 702.56. Forecast 702.56a A forecast ability is a special kind of activated + * ability that can be activated only from a player's hand. It's written + * "Forecast - [Activated ability]." + * + * 702.56b A forecast ability may be activated only during the upkeep step of + * the card's owner and only once each turn. The controller of the forecast + * ability reveals the card with that ability from their hand as the + * ability is activated. That player plays with that card revealed in their + * hand until it leaves the player's hand or until a step or phase that isn't an + * upkeep step begins, whichever comes first. * * @author LevelX2 */ - public class ForecastTest extends CardTestPlayerBase { - /** - * 702.56. Forecast 702.56a A forecast ability is a special kind of activated - * ability that can be activated only from a player's hand. It's written - * "Forecast - [Activated ability]." - * - * 702.56b A forecast ability may be activated only during the upkeep step of - * the card's owner and only once each turn. The controller of the forecast - * ability reveals the card with that ability from their hand as the - * ability is activated. That player plays with that card revealed in their - * hand until it leaves the player's hand or until a step or phase that isn't an - * upkeep step begins, whichever comes first. - * - */ - @Test public void testPaladinOfPrahv() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); addCard(Zone.HAND, playerA, "Silvercoat Lion"); addCard(Zone.HAND, playerA, "Paladin of Prahv"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); activateAbility(3, PhaseStep.UPKEEP, playerA, "Forecast"); @@ -48,8 +45,5 @@ public class ForecastTest extends CardTestPlayerBase { assertLife(playerA, 22); assertLife(playerB, 18); - } - - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/InfectTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/InfectTest.java index afe24632fc..cf67fc91e8 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/InfectTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/InfectTest.java @@ -113,7 +113,9 @@ public class InfectTest extends CardTestPlayerBase { // Delve (Each card you exile from your graveyard while casting this spell pays for 1.) // Target creature gets +6/+6 until end of turn. addCard(Zone.HAND, playerA, "Become Immense", 1); - + + setStrictChooseMode(true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: {this} becomes"); attack(1, playerA, "Inkmoth Nexus"); castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Become Immense"); @@ -129,7 +131,6 @@ public class InfectTest extends CardTestPlayerBase { @Test public void testInkmothPumpedByBecomeImmense2() { - addCard(Zone.BATTLEFIELD, playerA, "Forest", 7); // {1}: Inkmoth Nexus becomes a 1/1 Blinkmoth artifact creature with flying and infect until end of turn. It's still a land. // (It deals damage to creatures in the form of -1/-1 counters and to players in the form of poison counters.) @@ -145,15 +146,15 @@ public class InfectTest extends CardTestPlayerBase { activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: {this} becomes"); attack(1, playerA, "Inkmoth Nexus"); castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Mutagenic Growth"); - addTarget(playerA, "Inkmoth Nexus"); + // Inkmoth Nexus is auto-chosen since it's the only possible target castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Might of Old Krosa"); - addTarget(playerA, "Inkmoth Nexus"); + // Inkmoth Nexus is auto-chosen since it's the only possible target // +5 poison activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: {this} becomes"); attack(3, playerA, "Inkmoth Nexus"); castSpell(3, PhaseStep.DECLARE_ATTACKERS, playerA, "Become Immense"); - addTarget(playerA, "Inkmoth Nexus"); + // Inkmoth Nexus is auto-chosen since it's the only possible target // +7 poison setStopAt(3, PhaseStep.END_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java index 4efb4ffffc..2f1eabae2f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/MorphTest.java @@ -533,6 +533,8 @@ public class MorphTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Supplant Form", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 6); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury"); setChoice(playerA, true); // cast it face down as 2/2 creature // showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProvokeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProvokeTest.java index 54cd655c38..9ddcd75a41 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProvokeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ProvokeTest.java @@ -24,7 +24,7 @@ public class ProvokeTest extends CardTestPlayerBase{ attack(2, playerB, "Silvercoat Lion"); // So it's tapped attack(3, playerA, "Brontotherium"); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion is auto-chosen since only target setStopAt(3, PhaseStep.POSTCOMBAT_MAIN); execute(); @@ -48,11 +48,11 @@ public class ProvokeTest extends CardTestPlayerBase{ // Threshold - As long as seven or more cards are in your graveyard, Putrid Imp gets +1/+1 and can't block. addCard(Zone.BATTLEFIELD, playerB, "Putrid Imp", 1); addCard(Zone.GRAVEYARD, playerB, "Swamp", 7); - + attack(2, playerB, "Putrid Imp"); // So it's tapped attack(3, playerA, "Brontotherium"); - addTarget(playerA, "Putrid Imp"); + // Putrid Imp is auto-chosen sicne only target setStopAt(3, PhaseStep.POSTCOMBAT_MAIN); execute(); @@ -62,6 +62,5 @@ public class ProvokeTest extends CardTestPlayerBase{ assertLife(playerA, 18); // one attack from Imp assertLife(playerB, 15); // Not blocked - } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java index 91a5f813b5..aefbf9b16f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SoulbondKeywordTest.java @@ -392,15 +392,14 @@ public class SoulbondKeywordTest extends CardTestPlayerBase { Permanent trustedForcemange = getPermanent("Trusted Forcemage", playerA.getId()); Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId()); - Assert.assertEquals(trustedForcemange.getPairedCard(), null); - Assert.assertEquals(eliteVanguard.getPairedCard(), null); + Assert.assertNull(trustedForcemange.getPairedCard()); + Assert.assertNull(eliteVanguard.getPairedCard()); } /** * Reported bug: Soulbond should use the stack, but unable to use instant speed removal since no trigger occurs */ @Test - // Soulbond does not currently use the stack, so this test will fail until then public void testRespondToSoulboundWithRemoval() { // When Palinchron enters the battlefield, untap up to seven lands. // {2}{U}{U}: Return Palinchron to its owner's hand. @@ -414,17 +413,17 @@ public class SoulbondKeywordTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deadeye Navigator"); - setChoice(playerA, true); - setChoice(playerA, "Palinchron"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, 1); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Doom Blade", "Deadeye Navigator"); // Deadeye's ability should not be usable since was destroyed before Soulbond trigger resolved - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{U}:"); + checkPlayableAbility("Can't activate", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{U}:", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); Permanent palinchron = getPermanent("Palinchron", playerA); - Assert.assertEquals(null, palinchron.getPairedCard()); // should not be paired + Assert.assertNull(palinchron.getPairedCard()); // should not be paired assertGraveyardCount(playerA, "Deadeye Navigator", 1); assertGraveyardCount(playerB, "Doom Blade", 1); assertPermanentCount(playerA, "Palinchron", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java index a17a6be61b..0741181454 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/SpliceOnArcaneTest.java @@ -65,7 +65,7 @@ public class SpliceOnArcaneTest extends CardTestPlayerBase { // activate splice: yes -> card with splice ability -> new target for spliced ability setChoice(playerA, true); addTarget(playerA, "Torrent of Stone"); - addTarget(playerA, "Silvercoat Lion"); // target for spliced ability: 4 damage + // Silvercoat Lion is auto-chosen is only possible target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java index eab560962d..8a926aefc1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/AddingCountersToPermanentsTest.java @@ -76,7 +76,7 @@ public class AddingCountersToPermanentsTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soulstinger"); - addTarget(playerA, "Soulstinger"); + // Soulstinger auto-chosen since only target castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Turn to Slag", "Soulstinger"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/MovingCounterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/MovingCounterTest.java index ab41e55acb..f76035385f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/MovingCounterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counter/MovingCounterTest.java @@ -102,7 +102,7 @@ public class MovingCounterTest extends CardTestPlayerBase { attack(3, playerA, "Leech Bonder"); activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{U},", "Leech Bonder"); - addTarget(playerA, "Ley Druid"); + // Ley Druid auto-chosen since only target setStopAt(3, PhaseStep.END_TURN); execute(); @@ -111,6 +111,5 @@ public class MovingCounterTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Ley Druid", 1); assertPowerToughness(playerA, "Leech Bonder", 2, 2); - } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java index f01f21d5ac..45632781d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/damage/SatyrFiredancerTest.java @@ -26,7 +26,7 @@ public class SatyrFiredancerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion autochosen since only option setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/FiendHunterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/FiendHunterTest.java index b63a335653..88e51a8dea 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/FiendHunterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/FiendHunterTest.java @@ -35,7 +35,7 @@ public class FiendHunterTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Primeval Titan"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiend Hunter"); - addTarget(playerA, "Primeval Titan"); + // Target autochosen since only one option setStopAt(2, PhaseStep.PRECOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/OblivionSowerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/OblivionSowerTest.java index 19680d1380..1ad05a0254 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/OblivionSowerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/exile/OblivionSowerTest.java @@ -30,7 +30,7 @@ public class OblivionSowerTest extends CardTestPlayerBase { skipInitShuffling(); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oblivion Sower"); - addTarget(playerA, playerB); + // addTarget(playerA, playerB); Auto-chosen since only option addTarget(playerA, "Canopy Vista^Canopy Vista^Canopy Vista"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/SoulConduitTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/SoulConduitTest.java index 82d17bce04..907fbf8b7a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/SoulConduitTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/SoulConduitTest.java @@ -35,7 +35,9 @@ public class SoulConduitTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 9); addCard(Zone.BATTLEFIELD, playerA, soulConduit); addCard(Zone.HAND, playerA, liveFast); - + + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, liveFast); // to force losing two life activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "{6}"); addTarget(playerA, playerA); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java index fee5cca8df..dfb3b022df 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/asthough/CastFromLibraryTest.java @@ -31,15 +31,12 @@ public class CastFromLibraryTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); - // You may look at the top card of your library. (You may do this at any time.) - // You may cast the top card of your library if it's a creature card. - // You may spend mana as though it were mana of any type to cast creature spells. addCard(Zone.HAND, playerA, "Vizier of the Menagerie", 1); // Creature 3/4 {3}{G} skipInitShuffling(); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vizier of the Menagerie"); - castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Silvercoat Lion"); + checkPlayableAbility("Can't cast at instant speed", 1, PhaseStep.BEGIN_COMBAT, playerA, "Cast Silvercoat Lion", false); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Silvercoat Lion"); setStopAt(1, PhaseStep.END_TURN); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/LegendarySorceryTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/LegendarySorceryTest.java index 043c0597ac..48fbb6d514 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/LegendarySorceryTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/LegendarySorceryTest.java @@ -90,12 +90,14 @@ public class LegendarySorceryTest extends CardTestPlayerBase { // Exile all nonland permanents that aren't legendary. addCard(Zone.GRAVEYARD, playerB, "Urza's Ruinous Blast"); // Sorcery Legendary {4}{W} + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dire Fleet Daredevil"); addTarget(playerA, "Urza's Ruinous Blast"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Urza's Ruinous Blast"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Urza's Ruinous Blast"); - setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStopAt(1, PhaseStep.END_TURN); execute(); assertExileCount(playerB, "Urza's Ruinous Blast", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java index 517cfe28fe..51e6d5acac 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java @@ -26,7 +26,7 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan"); - addTarget(playerA, "Abzan Banner"); + // Abzan Banner is auto-chosen since only possible target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java index 012ad3851e..ae61fbdb9d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/TragicSlipTest.java @@ -75,10 +75,11 @@ public class TragicSlipTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Pillarfield Ox", 0); } - /* - Killed an opponent's Young Pyromancer with Ulcerate then flashed back Tragic Slip with Snapcaster Mage targeting their Tarmogoyf. - Morbid didn't seem to work and only applied -1/-1 to the Tarmogoyf. - */ + /** + * Reported bug: + * Killed an opponent's Young Pyromancer with Ulcerate then flashed back Tragic Slip with Snapcaster Mage targeting their Tarmogoyf. + * Morbid didn't seem to work and only applied -1/-1 to the Tarmogoyf. + */ @Test public void testPlayedWithFlashbackAgain() { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); @@ -101,14 +102,17 @@ public class TragicSlipTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Tarmogoyf"); addCard(Zone.GRAVEYARD, playerB, "Mountain"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tragic Slip", "Silvercoat Lion"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Snapcaster Mage"); addTarget(playerA, "Tragic Slip"); + waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Snapcaster Mage"); - - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback {B}"); // now snapcaster mage is died so -13/-13 + waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback {B}"); // now snapcaster mage is ded so -13/-13 addTarget(playerA, "Tarmogoyf"); setStopAt(1, PhaseStep.END_TURN); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MerfolkTricksterTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MerfolkTricksterTest.java index d54aa2883e..e393254759 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MerfolkTricksterTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MerfolkTricksterTest.java @@ -81,11 +81,12 @@ public class MerfolkTricksterTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.HAND, playerB, mTrickster); + setStrictChooseMode(true); + attack(1, playerA, "Footlight Fiend"); castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerB, mTrickster); addTarget(playerB, "Footlight Fiend"); block(1, playerB, mTrickster, "Footlight Fiend"); - addTarget(playerA, mTrickster); setStopAt(1, PhaseStep.END_COMBAT); execute(); @@ -95,7 +96,6 @@ public class MerfolkTricksterTest extends CardTestPlayerBase { assertTappedCount("Island", true, 2); assertPermanentCount(playerB, mTrickster, 1); assertDamageReceived(playerB, mTrickster, 1); - //assertAllCommandsUsed(); // uncommenting this will force a failure since PlayerA cannot do a command to target Trickster, as expected } @Test @@ -110,13 +110,14 @@ public class MerfolkTricksterTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.HAND, playerB, mTrickster); + setStrictChooseMode(true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-2:"); attack(3, playerA, "Devil Token"); castSpell(3, PhaseStep.DECLARE_ATTACKERS, playerB, mTrickster); addTarget(playerB, "Devil Token"); block(3, playerB, mTrickster, "Devil Token"); - addTarget(playerA, mTrickster); setStopAt(3, PhaseStep.END_COMBAT); execute(); @@ -127,6 +128,5 @@ public class MerfolkTricksterTest extends CardTestPlayerBase { assertTappedCount("Island", true, 2); assertPermanentCount(playerB, mTrickster, 1); assertDamageReceived(playerB, mTrickster, 1); - // assertAllCommandsUsed(); // uncommenting this should force a failure since PlayerA cannot do a command to target Trickster, as expected } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/BronzeBombshellTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/BronzeBombshellTest.java index 501204af15..e499b5e0d2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/BronzeBombshellTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/BronzeBombshellTest.java @@ -28,7 +28,7 @@ public class BronzeBombshellTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Hero's Downfall"); // {1}{B}{B} castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hero's Downfall", "Bronze Bombshell"); - addTarget(playerA, playerB); + // playerB is autochosen since only possible target setStopAt(2, PhaseStep.UPKEEP); execute(); @@ -38,7 +38,5 @@ public class BronzeBombshellTest extends CardTestPlayerBase { assertLife(playerA, 20); assertLife(playerB, 13); - } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/GainControlTargetEffectTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/GainControlTargetEffectTest.java index 00512a41f6..37b707a659 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/GainControlTargetEffectTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/GainControlTargetEffectTest.java @@ -215,7 +215,9 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, oGorger); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerB, aLight); - + + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, oGorger); setChoice(playerA, true); // opt to use Kirin's ability addTarget(playerA, aLight); // target Angel of Light with Kirin's take control ability diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java index ab2baf7910..b65ce1c5eb 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/control/GontiLordOfLuxuryEffectTest.java @@ -37,7 +37,7 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); - addTarget(playerA, playerB); + // Player B is autochosen since only option setChoice(playerA, "Rashmi, Eternities Crafter"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Rashmi, Eternities Crafter"); @@ -82,7 +82,7 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Cyclonic Rift", 1); // Intant {1}{U} castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); - addTarget(playerA, playerB); + // Player B is autochosen since only option setChoice(playerA, "Mirari's Wake"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Mirari's Wake"); castSpell(1, PhaseStep.END_TURN, playerB, "Cyclonic Rift", "Mirari's Wake"); @@ -124,7 +124,7 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); - addTarget(playerA, playerB); + // Player B is autochosen since only option setChoice(playerA, "Lingering Souls"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lingering Souls"); @@ -174,7 +174,7 @@ public class GontiLordOfLuxuryEffectTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Dross Crocodile", 2); // Creature 5/1 castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gonti, Lord of Luxury"); - addTarget(playerA, playerB); + // Player B is autochosen since only option setChoice(playerA, "Ob Nixilis Reignited"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Ob Nixilis Reignited"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-3:", "Dross Crocodile"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopyCreatureCardToTokenImplTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopyCreatureCardToTokenImplTest.java index b70f35e2dd..54befa95fe 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopyCreatureCardToTokenImplTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopyCreatureCardToTokenImplTest.java @@ -71,7 +71,7 @@ public class CopyCreatureCardToTokenImplTest extends CardTestPlayerBase { castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Thrashing Brontodon"); activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}, Sacrifice"); - addTarget(playerB, "Alpha Myr"); + // Alpha Myr is auto-chosen since only valid target setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopySpellTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopySpellTest.java index f30c624167..18ddef1fa2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopySpellTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CopySpellTest.java @@ -359,7 +359,7 @@ public class CopySpellTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Island", 2); // Flying, vigilance, deathtouch, lifelink // At the beginning of your end step, proliferate. - addCard(Zone.BATTLEFIELD, playerA, "Atraxa, Praetors' Voice", 4); + addCard(Zone.BATTLEFIELD, playerA, "Atraxa, Praetors' Voice", 1); // Walking Ballista enters the battlefield with X +1/+1 counters on it. // {4}: Put a +1/+1 counter on Walking Ballista. // Remove a +1/+1 counter from Walking Ballista: It deals 1 damage to any target. @@ -373,6 +373,8 @@ public class CopySpellTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Dualcaster Mage"); // Creature {1}{R}{R} addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Walking Ballista"); setChoice(playerA, "X=1"); setChoice(playerA, "Walking Ballista"); // for proliferate diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CryptoplasmTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CryptoplasmTest.java index 018f9173ee..715c13cb84 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CryptoplasmTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CryptoplasmTest.java @@ -131,7 +131,6 @@ public class CryptoplasmTest extends CardTestPlayerBase { assertLife(playerA, 25); } - @Test public void testTransformMultipleTime() { // At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability. @@ -141,10 +140,17 @@ public class CryptoplasmTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // 6/4 addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm", 1); // 6/4 - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptoplasm"); + setStrictChooseMode(true); + + // Turn 1 + setChoice(playerA, "Yes"); addTarget(playerA, "Silvercoat Lion"); + + // Turn 3 + setChoice(playerA, "Yes"); addTarget(playerA, "Craw Wurm"); - setStopAt(5, PhaseStep.PRECOMBAT_MAIN); + + setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); assertLife(playerA, 20); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/dynamicvalue/SweepTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/dynamicvalue/SweepTest.java index 43ba9779e5..e430494e4b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/dynamicvalue/SweepTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/dynamicvalue/SweepTest.java @@ -25,6 +25,8 @@ public class SweepTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin"); addCard(Zone.HAND, playerA, "Plow Through Reito"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plow Through Reito"); addTarget(playerA, "Raging Goblin"); // target to boost addTarget(playerA, "Plains"); // targets to sweep @@ -43,6 +45,8 @@ public class SweepTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin"); addCard(Zone.HAND, playerA, "Plow Through Reito"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plow Through Reito"); addTarget(playerA, "Raging Goblin"); // target to boost addTarget(playerA, "Plains^Plains"); // targets to sweep @@ -61,6 +65,8 @@ public class SweepTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin"); addCard(Zone.HAND, playerA, "Plow Through Reito"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plow Through Reito"); addTarget(playerA, "Raging Goblin"); // target to boost addTarget(playerA, "Plains^Plains^Plains"); // targets to sweep diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AnimateDeadTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AnimateDeadTest.java index 54b1f44a9f..37acd207c0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AnimateDeadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AnimateDeadTest.java @@ -44,7 +44,10 @@ public class AnimateDeadTest extends CardTestPlayerBase { // Enchanted creature gets -1/-0. addCard(Zone.HAND, playerA, "Animate Dead"); // {1}{B} + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Eternal Witness"); + setChoice(playerA, "Yes"); addTarget(playerA, "Silvercoat Lion"); setStopAt(1, PhaseStep.BEGIN_COMBAT); @@ -80,7 +83,10 @@ public class AnimateDeadTest extends CardTestPlayerBase { // Enchanted creature gets -1/-0. addCard(Zone.HAND, playerA, "Animate Dead"); // {1}{B} + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Eternal Witness"); + setChoice(playerA, "Yes"); addTarget(playerA, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Eternal Witness"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AuraMovingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AuraMovingTest.java index 5be462c5de..6630a69c67 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AuraMovingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/AuraMovingTest.java @@ -49,11 +49,9 @@ public class AuraMovingTest extends CardTestPlayerBase { castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Alexi's Cloak", "Bruna, Light of Alabaster"); attack(2, playerB, "Bruna, Light of Alabaster"); + setChoice(playerB, "Yes"); + setChoice(playerB, "Yes"); - setChoice(playerB, true); - addTarget(playerB, "Hostile Realm"); - setChoice(playerB, true); - addTarget(playerB, "Unholy Strength"); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/SagesReverieTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/SagesReverieTest.java index ab5fbbdf92..58688e223e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/SagesReverieTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/SagesReverieTest.java @@ -12,43 +12,44 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class SagesReverieTest extends CardTestPlayerBase { - /* - 21:11: MarioPineda casts Sage's Reverie [26d] targeting face down creature - 21:11: Ability triggers: Sage's Reverie [26d] - When Sage's Reverie [26d] enters the battlefield, draw a card for each aura you control that's attached to a creature. - 21:11: mbvash casts Crackling Doom [b78] - 21:11: MarioPineda loses 2 life - 21:11: MarioPineda sacrificed face down creature - 21:11: mbvash puts Crackling Doom [b78] from stack into their graveyard - 21:11: Cloudform [9cd] is put into graveyard from battlefield - 21:11: Sage's Reverie [26d] is put into graveyard from battlefield - 21:11: MarioPineda draws two cards - - There were two other Auras on the battlefield, and Sage's Reverie made me draw two cards even though the creature it was going to enchant left the battlefield. - - http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/604851-sages-reverie-question + /** + * 21:11: MarioPineda casts Sage's Reverie [26d] targeting face down creature + * 21:11: Ability triggers: Sage's Reverie [26d] - When Sage's Reverie [26d] enters the battlefield, draw a card for each aura you control that's attached to a creature. + * 21:11: mbvash casts Crackling Doom [b78] + * 21:11: MarioPineda loses 2 life + * 21:11: MarioPineda sacrificed face down creature + * 21:11: mbvash puts Crackling Doom [b78] from stack into their graveyard + * 21:11: Cloudform [9cd] is put into graveyard from battlefield + * 21:11: Sage's Reverie [26d] is put into graveyard from battlefield + * 21:11: MarioPineda draws two cards + * + * There were two other Auras on the battlefield, and Sage's Reverie made me draw two cards even though the creature it was going to enchant left the battlefield. + * + * http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/604851-sages-reverie-question */ @Test public void testNoCardDrawIfTargetIllegal() { + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1); addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); // Enchant creature // When Sage's Reverie enters the battlefield, draw a card for each aura you control that's attached to a creature. - addCard(Zone.BATTLEFIELD, playerA, "Sage's Reverie", 1); // {3}{W} + addCard(Zone.HAND, playerA, "Sage's Reverie", 1); // {3}{W} // Enchant creature // Enchanted creature has lifelink addCard(Zone.HAND, playerA, "Lifelink", 1); // {W} - addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); - addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1); addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3); // Destroy target creature or planeswalker. addCard(Zone.HAND, playerB, "Hero's Downfall"); // {1}{B}{B} + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lifelink", "Silvercoat Lion"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sage's Reverie", "Pillarfield Ox"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sage's Reverie", "Pillarfield Ox"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Hero's Downfall", "Pillarfield Ox", "Sage's Reverie"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Hero's Downfall", "Pillarfield Ox"); - - setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStopAt(1, PhaseStep.END_TURN); execute(); assertPermanentCount(playerA, "Lifelink", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/StarfieldOfNyxTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/StarfieldOfNyxTest.java index 2844d9dcc4..3f95501f20 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/StarfieldOfNyxTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/StarfieldOfNyxTest.java @@ -83,8 +83,10 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silumgar, the Drifting Death", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Starfield of Nyx"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Starfield of Nyx"); + setChoice(playerA, "Yes"); addTarget(playerA, "Singing Bell Strike"); setChoice(playerA, "Silumgar, the Drifting Death"); @@ -97,9 +99,9 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase { Permanent enchantment = getPermanent("Singing Bell Strike", playerA); if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = currentGame.getPermanent(enchantment.getAttachedTo()); - Assert.assertEquals("Silumgar was enchanted", enchanted.getName().equals("Silumgar, the Drifting Death"), true); + Assert.assertEquals("Silumgar was enchanted", "Silumgar, the Drifting Death", enchanted.getName()); } else { - Assert.assertEquals("Singing Bell Strike not on the battlefield", false, true); + Assert.fail("Singing Bell Strike not on the battlefield"); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ChandrasEmbercatTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ChandrasEmbercatTest.java index f702737f64..93de9be65f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ChandrasEmbercatTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ChandrasEmbercatTest.java @@ -18,7 +18,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class ChandrasEmbercatTest extends CardTestPlayerBase { - // Make sure we can use the mana to cast elementals + /** + * Make sure we can use the mana to cast elementals + */ @Test public void testCanCastElementalWithMana() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); @@ -36,7 +38,9 @@ public class ChandrasEmbercatTest extends CardTestPlayerBase { } - // Make sure we can use the mana to cast Chandra Planeswalkers + /** + * Make sure we can use the mana to cast Chandra Planeswalkers + */ @Test public void testCanCastChandraPlaneswalkerWithMana() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); @@ -54,7 +58,9 @@ public class ChandrasEmbercatTest extends CardTestPlayerBase { } - // Make sure we cant use the mana to cast non-Chandra Planeswalkers + /** + * Make sure we can't use the mana to cast non-Chandra Planeswalkers. + */ @Test public void testCantCastNonChandraPlaneswalkerWithMana() { addCard(Zone.BATTLEFIELD, playerA, "Island", 3); @@ -63,7 +69,7 @@ public class ChandrasEmbercatTest extends CardTestPlayerBase { //A non-Chandra planeswalker that costs {2}{U}{U} addCard(Zone.HAND, playerA, "Jace, the Mind Sculptor", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jace, the Mind Sculptor"); + checkPlayableAbility("Mana should be restricted", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Jace", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -72,7 +78,9 @@ public class ChandrasEmbercatTest extends CardTestPlayerBase { } - // Make sure we cant use the mana to cast non-Elemental creatures + /** + * Make sure we can't use the mana to cast non-Elemental creatures. + */ @Test public void testCantCastNonElementalCreatureWithMana() { addCard(Zone.BATTLEFIELD, playerA, "Island", 1); @@ -81,13 +89,11 @@ public class ChandrasEmbercatTest extends CardTestPlayerBase { //A non-elemental creature that costs {1}{R} addCard(Zone.HAND, playerA, "Raptor Hatchling", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raptor Hatchling"); + checkPlayableAbility("Mana should be restricted", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Raptor", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Raptor Hatchling", 0); - } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/EldraziTempleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/EldraziTempleTest.java index 1fe7fa5df0..9508a98e4a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/EldraziTempleTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/EldraziTempleTest.java @@ -57,12 +57,10 @@ public class EldraziTempleTest extends CardTestPlayerBase { // If a land is tapped for two or more mana, it produces {C} instead of any other type and amount. // Each spell a player casts costs {1} more to cast for each other spell that player has cast this turn. addCard(Zone.BATTLEFIELD, playerB, "Damping Sphere", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Barrage Tyrant"); + checkPlayableAbility("Damping Sphere effective", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Barrage Tyrant", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - - assertPermanentCount(playerA, "Barrage Tyrant", 0); } @Test diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java index 31fabd0c0c..b27ae4847f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java @@ -105,8 +105,9 @@ public class ConditionalManaTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 4); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Snapping Drake"); + setStrictChooseMode(true); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Snapping Drake"); activateManaAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: Add {C}{C}{C}{C}"); activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{X}, {T}: Untap"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java index f1a37e26f0..e75774398f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java @@ -3,6 +3,7 @@ package org.mage.test.cards.planeswalker; import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -36,7 +37,16 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { setChoice(playerA, "X=1"); setStopAt(1, PhaseStep.END_TURN); - execute(); + + try { + execute(); + + Assert.fail("must throw exception on execute"); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { + Assert.fail("Should have thrown error about cannot attack, but got:\n" + e.getMessage()); + } + } assertGraveyardCount(playerB, "Lightning Bolt", 1); assertPermanentCount(playerA, "Liliana, Heretical Healer", 0); @@ -65,10 +75,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { // Transformed into Liliana, Defiant Necromancer with (3) loyalty to start // -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield. - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); - setChoice(playerA, "X=3"); - addTarget(playerA, "Alesha, Who Smiles at Death"); // dunno which to use for returning from grave, both target/choice seem to work - setChoice(playerA, "Alesha, Who Smiles at Death"); + checkPlayableAbility("Can't -X", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:", false); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -103,8 +110,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { // -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield. activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); setChoice(playerA, "X=2"); - addTarget(playerA, "Bronze Sable"); // dunno which to use for returning from grave, both target/choice seem to work - setChoice(playerA, "Bronze Sable"); + // Bronze Sable is auto-chosen since only option setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java index e2c56bfe9e..e5bcc383ee 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/WinLoseEffectsTest.java @@ -58,7 +58,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Island", 6); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Set Adrift"); - addTarget(playerB, "Platinum Angel"); + // Platinum Angel is auto-chosen since only possible target setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/prevent/DeflectingPalmTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/prevent/DeflectingPalmTest.java index 8f58df1b51..5fee1f97a0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/prevent/DeflectingPalmTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/prevent/DeflectingPalmTest.java @@ -112,6 +112,8 @@ public class DeflectingPalmTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Mountain"); addCard(Zone.HAND, playerB, "Lightning Bolt"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deflecting Palm", null, "Lightning Bolt"); setChoice(playerA, "Lightning Bolt"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/ReflectorMageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/ReflectorMageTest.java index ac50730433..1521bb32b7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/ReflectorMageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/ReflectorMageTest.java @@ -31,7 +31,7 @@ public class ReflectorMageTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Bronze Sable", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); - addTarget(playerA, "Bronze Sable"); + // Bronze Sable is auto-chosen since only option castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bronze Sable"); @@ -48,7 +48,6 @@ public class ReflectorMageTest extends CardTestPlayerBase { */ @Test public void testReflectorMageRestrictionEffect() { - // {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand. // That creature's owner can't cast spells with the same name as that creature until your next turn. addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3 @@ -59,7 +58,7 @@ public class ReflectorMageTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Bronze Sable", 1); // (2) 2/1 castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); - addTarget(playerA, "Bronze Sable"); + // Bronze Sable is auto-chosen since only option checkPlayableAbility("sable not available", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Bronze", false); setStopAt(2, PhaseStep.END_TURN); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java index 311593e7e8..534c13f463 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java @@ -174,29 +174,31 @@ public class CantCastTest extends CardTestPlayerBase { } /** - * Test that panic can only be cast during the correct pahse/steĆ¼ + * Test that panic can only be cast during the correct phase/step */ @Test public void testPanic() { - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); // Cast Panic only during combat before blockers are declared. // Target creature can't block this turn. // Draw a card at the beginning of the next turn's upkeep. - addCard(Zone.HAND, playerA, "Panic", 4); // Instant - {R} + addCard(Zone.HAND, playerA, "Panic", 2); // Instant - {R} + addCard(Zone.BATTLEFIELD, playerA, "Akroan Conscriptor", 1); addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Panic", "Silvercoat Lion"); + checkPlayableAbility("not in precombat", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Panic", false); + attack(1, playerA, "Akroan Conscriptor"); castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Panic", "Silvercoat Lion"); - castSpell(1, PhaseStep.DECLARE_BLOCKERS, playerA, "Panic", "Silvercoat Lion"); - castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Panic", "Silvercoat Lion"); + checkPlayableAbility("not on declare blockers", 1, PhaseStep.DECLARE_BLOCKERS, playerA, "Cast Panic", false); + checkPlayableAbility("not in postcombat", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Panic", false); setStopAt(2, PhaseStep.PRECOMBAT_MAIN); execute(); - assertHandCount(playerA, "Panic", 3); - assertHandCount(playerA, 4); + assertHandCount(playerA, "Panic", 1); + assertHandCount(playerA, 2); assertGraveyardCount(playerA, "Panic", 1); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java index df838afba5..11fa5f9641 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/aer/HopeOfGhirapurTest.java @@ -18,10 +18,12 @@ public class HopeOfGhirapurTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); addCard(Zone.HAND, playerB, "Shock"); + setStrictChooseMode(true); + attack(1, playerA, "Hope of Ghirapur"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice", playerB); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock", playerA); + checkPlayableAbility("Can't Shock", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock", false); setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); @@ -31,8 +33,10 @@ public class HopeOfGhirapurTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Hope of Ghirapur", 0); } - // Test that ability cannot be activated if after damage Hope of Ghirapur was removed - // from the battlefield and returned back. + /** + * Test that ability cannot be activated if after damage Hope of Ghirapur was removed + * from the battlefield and returned back. + */ @Test public void testWhenHopeOfGhirapurWasRemovedAndReturnedBack() { // Flying @@ -47,7 +51,7 @@ public class HopeOfGhirapurTest extends CardTestPlayerBase { attack(1, playerA, "Hope of Ghirapur"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cloudshift", "Hope of Ghirapur"); - activateAbility(1, PhaseStep.END_TURN, playerA, "Sacrifice", playerB); + checkPlayableAbility("Hope of Ghirapur died", 1, PhaseStep.END_TURN, playerA, "Sacrifice", false); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Shock", playerA); @@ -58,5 +62,4 @@ public class HopeOfGhirapurTest extends CardTestPlayerBase { assertLife(playerB, 19); assertPermanentCount(playerA, "Hope of Ghirapur", 1); } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/akh/BontuTheGlorifiedTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/akh/BontuTheGlorifiedTest.java index e6eb32dfff..a312f75155 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/akh/BontuTheGlorifiedTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/akh/BontuTheGlorifiedTest.java @@ -2,6 +2,7 @@ package org.mage.test.cards.single.akh; import mage.constants.PhaseStep; import mage.constants.Zone; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -25,7 +26,17 @@ public class BontuTheGlorifiedTest extends CardTestPlayerBase { attack(1, playerA, bontu); setStopAt(4, PhaseStep.POSTCOMBAT_MAIN); - execute(); + + try { + execute(); + assertAllCommandsUsed(); + + Assert.fail("must throw exception on execute"); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { + Assert.fail("must throw error about having 0 actions, but got:\n" + e.getMessage()); + } + } assertLife(playerB, 20); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/avr/CavernOfSoulsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/avr/CavernOfSoulsTest.java index 34db9c4181..4006a6460f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/avr/CavernOfSoulsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/avr/CavernOfSoulsTest.java @@ -2,6 +2,7 @@ package org.mage.test.cards.single.avr; import mage.constants.PhaseStep; import mage.constants.Zone; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -19,10 +20,9 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Cavern of Souls"); addCard(Zone.HAND, playerA, "Azure Drake"); - setChoice(playerA, "Drake"); - setChoice(playerA, "Blue"); - playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls"); + setChoice(playerA, "Drake"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Azure Drake"); setStopAt(1, PhaseStep.BEGIN_COMBAT); @@ -32,30 +32,29 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { } /** - * Tests "Cavern of Souls" with "Human" creature type chosen. Then tests - * casting Azure Drake (should fail) and Elite Vanguard (should be ok as it - * has "Human" subtype) + * Tests "Cavern of Souls" with "Human" creature type chosen. + * Then tests casting Abuna Acolyte (should fail) and Elite Vanguard (should be ok as ithas "Human" subtype) */ @Test public void testNoCastBecauseOfCreatureType() { addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); addCard(Zone.HAND, playerA, "Cavern of Souls"); addCard(Zone.HAND, playerA, "Abuna Acolyte"); - addCard(Zone.HAND, playerA, "Elite Vanguard"); - - setChoice(playerA, "Human"); - setChoice(playerA, "White"); - setChoice(playerA, "White"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls"); // choose Human + setChoice(playerA, "Human"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Abuna Acolyte"); // not Human but Cat Cleric - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard"); // Human setStopAt(1, PhaseStep.BEGIN_COMBAT); - execute(); - assertPermanentCount(playerA, "Abuna Acolyte", 0); - assertPermanentCount(playerA, "Elite Vanguard", 1); + try { + execute(); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { + Assert.fail("Should have had error playerA having too many actions, but got:\n" + e.getMessage()); + } + } } /** @@ -149,35 +148,38 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { public void testConditionlManaWorksIfCavernIsReplayed() { addCard(Zone.HAND, playerA, "Cavern of Souls"); addCard(Zone.HAND, playerA, "Gladecover Scout"); // Elf costing {G} - // addCard(Zone.HAND, playerA, "Fume Spitter"); // Horror costing {B} + addCard(Zone.HAND, playerA, "Fume Spitter"); // Horror costing {B} // Instant - {U}{U} - Return target permanent to its owner's hand. addCard(Zone.HAND, playerB, "Boomerang"); addCard(Zone.BATTLEFIELD, playerB, "Island", 2); + setStrictChooseMode(true); + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls"); setChoice(playerA, "Elf"); // getting green mana for Elf into pool - activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add 1 mana of any one color. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered."); + activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add one mana of "); setChoice(playerA, "Green"); // return cavern to hand castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, "Boomerang", "Cavern of Souls"); - - // playing the cavern again choose different creature type - playLand(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls"); - setChoice(playerA, "Horror"); + waitStackResolved(3, PhaseStep.PRECOMBAT_MAIN); // the green mana usable for Elf should be in the mana pool castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Gladecover Scout"); - activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add 1 mana of any one color. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered."); - setChoice(playerA, "Black"); + // playing the cavern again choose different creature type + playLand(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cavern of Souls"); + setChoice(playerA, "Horror"); // the black mana usable for Horror should be in the mana pool - // castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Fume Spitter"); - setStopAt(3, PhaseStep.BEGIN_COMBAT); + activateManaAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add one mana of "); + setChoice(playerA, "Black"); + castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Fume Spitter"); + + setStopAt(3, PhaseStep.END_TURN); execute(); assertGraveyardCount(playerB, "Boomerang", 1); @@ -186,7 +188,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { // Check the elf was cast assertPermanentCount(playerA, "Gladecover Scout", 1); // Check Horror on the Battlefield - // assertPermanentCount(playerA, "Fume Spitter", 1); + assertPermanentCount(playerA, "Fume Spitter", 1); } /** @@ -212,7 +214,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { setChoice(playerA, "Drake"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Return to the Ranks"); setChoice(playerA, "X=1"); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion is auto-chosen since only target castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Counterspell", "Return to the Ranks"); @@ -224,7 +226,6 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Counterspell", 1); assertGraveyardCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 0); - } /** @@ -242,14 +243,13 @@ public class CavernOfSoulsTest extends CardTestPlayerBase { playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls"); setChoice(playerA, "Drake"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Desert Drake"); + checkPlayableAbility("Can't cast the drak", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Desert", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertPermanentCount(playerA, "Cavern of Souls", 1); assertPermanentCount(playerA, "Desert Drake", 0); - } @Test diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/EmeriaShepherdTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/EmeriaShepherdTest.java index 954bf014e1..2e57988a20 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/EmeriaShepherdTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/bfz/EmeriaShepherdTest.java @@ -39,8 +39,11 @@ public class EmeriaShepherdTest extends CardTestPlayerBase { addCard(Zone.GRAVEYARD, playerA, bruna); addCard(Zone.BATTLEFIELD, playerA, "Plains", 7); + setStrictChooseMode(true); + playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plains"); setChoice(playerA, true); // opt to use Emeria's triggered ability + setChoice(playerA, true); // opt to put it onto the battlefield instead of the hand addTarget(playerA, bruna); // target Bruna in grave setStopAt(1, PhaseStep.BEGIN_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/NephaliaAcademyTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/NephaliaAcademyTest.java index a3358d1bde..0d6bdca8a4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/NephaliaAcademyTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/NephaliaAcademyTest.java @@ -27,7 +27,7 @@ public class NephaliaAcademyTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Nephalia Academy", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Duress"); - addTarget(playerA, playerB); + // playerB is auto-chosen since only possible target setChoice(playerA, "Giant Growth"); // choose to discard Giant Growth setChoice(playerB, true); // replacement effect, choose to reveal the card and place on top of library execute(); @@ -49,7 +49,7 @@ public class NephaliaAcademyTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Nephalia Academy", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Duress"); - addTarget(playerA, playerB); + // playerB is auto-chosen since only possible target setChoice(playerA, "Giant Growth"); // choose to discard Giant Growth setChoice(playerB, false); // decline the replacement effect, allow the discard to happen execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java index 6b68473043..e41f8d74ad 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SoulSeparatorTest.java @@ -27,6 +27,8 @@ public class SoulSeparatorTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5); addCard(Zone.GRAVEYARD, playerA, "Sylvan Advocate"); // 2/3 vigilance + setStrictChooseMode(true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{5}"); addTarget(playerA, "Sylvan Advocate"); @@ -61,6 +63,8 @@ public class SoulSeparatorTest extends CardTestPlayerBase { // {tap}: Exchange target opponent's life total with Tree of Perdition's toughness. addCard(Zone.GRAVEYARD, playerA, "Tree of Perdition"); + setStrictChooseMode(true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{5}"); addTarget(playerA, "Tree of Perdition"); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Exchange"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SpellQuellerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SpellQuellerTest.java index 7e847a3e61..8059705c03 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SpellQuellerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/SpellQuellerTest.java @@ -6,6 +6,14 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.s.SpellQueller Spell Queller} + * {1}{W}{U} + * Spirit + * Flash Flying + * + * When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. + * When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. + * 2/3 * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ @@ -13,10 +21,6 @@ public class SpellQuellerTest extends CardTestPlayerBase { @Test public void testExileSpellCMCFour() { - - // {1}{W}{U} Flash Flying 2/3 Spirit - // When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. - // When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. addCard(Zone.HAND, playerB, "Spell Queller"); addCard(Zone.BATTLEFIELD, playerB, "Plains", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 2); @@ -26,7 +30,7 @@ public class SpellQuellerTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Languish"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Spell Queller"); - addTarget(playerB, "Languish"); + // Languish is auto-chosen since only possible target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -37,10 +41,6 @@ public class SpellQuellerTest extends CardTestPlayerBase { @Test public void testAttemptExileSpellCMCFive() { - - // {1}{W}{U} Flash Flying 2/3 Spirit - // When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. - // When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. addCard(Zone.HAND, playerB, "Spell Queller"); addCard(Zone.BATTLEFIELD, playerB, "Plains", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 2); @@ -50,7 +50,7 @@ public class SpellQuellerTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battle Sliver"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Spell Queller"); - addTarget(playerB, "Battle Sliver"); + // Battle Sliver is auto-chosen since only possible target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -62,10 +62,6 @@ public class SpellQuellerTest extends CardTestPlayerBase { @Test public void testExileSpellAndDiesAllowsFreeCast() { - - // {1}{W}{U} Flash Flying 2/3 Spirit - // When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. - // When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. addCard(Zone.HAND, playerB, "Spell Queller"); addCard(Zone.BATTLEFIELD, playerB, "Plains", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 2); @@ -74,14 +70,14 @@ public class SpellQuellerTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Murder"); // {1}{B}{B} instant - destroy target creature addCard(Zone.BATTLEFIELD, playerA, "Island", 1); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Divination"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Spell Queller"); - addTarget(playerB, "Divination"); + // Divination is autochosen since only possible target castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder"); - addTarget(playerA, "Spell Queller"); - setChoice(playerB, true); // elect to cast exiled card (divination) for free + // Spell Queller is auto-chosen since only possible target + setChoice(playerA, "Yes"); // elect to cast exiled card (divination) for free setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); @@ -93,16 +89,15 @@ public class SpellQuellerTest extends CardTestPlayerBase { assertHandCount(playerA, 3); // card drawn on draw step + 2 from divination } - /* - Reported bug: "...Spell Queller exiled my Nissa, Vastwood Seeker. Next turn they processed Nissa with Wasteland Strangler and killed my Tireless Tracker. - I then cast Quarantine Field, targeting Spell Queller and Wasteland Strangler. That's when the error message occurred. (fatal exception)" - */ + /** + * Reported bug: + * "...Spell Queller exiled my Nissa, Vastwood Seeker. + * Next turn they processed Nissa with Wasteland Strangler and killed my Tireless Tracker. + * I then cast Quarantine Field, targeting Spell Queller and Wasteland Strangler. + * That's when the error message occurred. (fatal exception)" + */ @Test public void testExiledSpellProcessedThenQuellerDies() { - - // {1}{W}{U} Flash Flying 2/3 Spirit - // When Spell Queller enters the battlefield, exile target spell with converted mana cost 4 or less. - // When Spell Queller leaves the battlefield, the exiled card's owner may cast that card without paying its mana cost. addCard(Zone.HAND, playerB, "Spell Queller"); // {2}{B} 3/2 Eldrazi (devoid) @@ -118,14 +113,16 @@ public class SpellQuellerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); addCard(Zone.BATTLEFIELD, playerA, "Sylvan Advocate"); // {1}{G} 2/3 vigilance - + + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Centaur Courser"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Spell Queller"); addTarget(playerB, "Centaur Courser"); // exiles courser castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Wasteland Strangler"); setChoice(playerB, true); - setChoice(playerB, "Centaur Courser"); // put courser from exile into grave from ETB ability + addTarget(playerB, "Centaur Courser"); // put courser from exile into grave from ETB ability addTarget(playerB, "Sylvan Advocate"); // gives -3/-3 to Advocate castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Wrath of God"); // kill queller and strangler @@ -140,5 +137,4 @@ public class SpellQuellerTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Wasteland Strangler", 1); assertExileCount(playerA, 0); } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/TreeOfPerditionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/TreeOfPerditionTest.java index a46e7ee177..e4ce159c71 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/TreeOfPerditionTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/emn/TreeOfPerditionTest.java @@ -30,7 +30,7 @@ public class TreeOfPerditionTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD,playerB,"Island",1); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Exchange"); - addTarget(playerA, playerB); + // Player B is auto-targeted since they're the only option castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon"); @@ -54,7 +54,7 @@ public class TreeOfPerditionTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Exchange"); - addTarget(playerA, playerB); + // Player B is auto-targeted since they're the only option setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/m14/JacesMindseekerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/m14/JacesMindseekerTest.java index efdbf00340..1c64445563 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/m14/JacesMindseekerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/m14/JacesMindseekerTest.java @@ -33,6 +33,8 @@ public class JacesMindseekerTest extends CardTestPlayerBase { addCard(Zone.LIBRARY, playerB, "Silvercoat Lion", 2); skipInitShuffling(); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jace's Mindseeker"); addTarget(playerA, playerB); setChoice(playerA, true); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/CullingScalesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/CullingScalesTest.java index 03cb0874ec..460611a3c0 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/CullingScalesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/CullingScalesTest.java @@ -48,7 +48,8 @@ public class CullingScalesTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Elvish Visionary"); // CMC = 2 addCard(Zone.BATTLEFIELD, playerB, "Plains", 5); addCard(Zone.BATTLEFIELD, playerA, "Culling Scales"); // CMC = 3 - + + setStrictChooseMode(true); // On upkeep Culling Scales targets Elvish Visionary addTarget(playerA, "Elvish Visionary"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTest.java index 3181e2de7e..82c5332beb 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/ThoughtKnotSeerTest.java @@ -28,7 +28,7 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); - addTarget(playerA, "Thought-Knot Seer"); + // Thought-Knot Seer is auto-chosen since only target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -56,7 +56,7 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon"); - addTarget(playerA, "Thought-Knot Seer"); + // Thought-Knot Seer is auto-chosen since only target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -83,7 +83,7 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doom Blade"); - addTarget(playerA, "Thought-Knot Seer"); + // Thought-Knot Seer is auto-chosen since only target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/BriarbridgePatrolTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/BriarbridgePatrolTest.java index 27bf06b3d2..3b59de2789 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/BriarbridgePatrolTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/BriarbridgePatrolTest.java @@ -55,7 +55,7 @@ public class BriarbridgePatrolTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rabid Bite", "Briarbridge Patrol"); - addTarget(playerA, "Wall of Roots"); + // Wall of Roots is auto-chosen since only target setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/NightSideCMCTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/NightSideCMCTest.java index 826b6c7a67..86367fb046 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/NightSideCMCTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/NightSideCMCTest.java @@ -35,7 +35,7 @@ public class NightSideCMCTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Repeal"); setChoice(playerB, "X=1"); - addTarget(playerB, insect); + // Insectile Aberration is auto-chosen since only target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/tor/LaquatussChampionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/tor/LaquatussChampionTest.java index 6ec74d61d5..38707d7432 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/tor/LaquatussChampionTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/tor/LaquatussChampionTest.java @@ -45,8 +45,8 @@ public class LaquatussChampionTest extends CardTestPlayerBase { @Test public void testDoubleZoneChange() { - addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6); - addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); addCard(Zone.HAND, playerA, "Laquatus's Champion"); addCard(Zone.HAND, playerA, "Cloudshift"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/JourneyToNowhereTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/JourneyToNowhereTest.java index c038932a7c..8fad700f06 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/JourneyToNowhereTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/JourneyToNowhereTest.java @@ -28,7 +28,7 @@ public class JourneyToNowhereTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Journey to Nowhere"); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion is auto-chosen since only target setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -46,7 +46,7 @@ public class JourneyToNowhereTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Journey to Nowhere"); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion is auto-chosen since it's the only possible target castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Disenchant", "Journey to Nowhere"); @@ -72,7 +72,7 @@ public class JourneyToNowhereTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Journey to Nowhere"); - addTarget(playerA, "Silvercoat Lion"); + // Silvercoat Lion" is auto-chosen since only target castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Disenchant", "Journey to Nowhere"); setStopAt(1, PhaseStep.BEGIN_COMBAT); @@ -107,7 +107,7 @@ public class JourneyToNowhereTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boomerang", "Journey to Nowhere", "Journey to Nowhere", StackClause.WHILE_NOT_ON_STACK); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Journey to Nowhere"); - addTarget(playerA, "Pillarfield Ox"); + // Pillarfield Ox is auto-chosen since only possible target castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Disenchant", "Journey to Nowhere"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/MasterOfCrueltiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/MasterOfCrueltiesTest.java index 6e41cf0150..14f31ab8e1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/MasterOfCrueltiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/MasterOfCrueltiesTest.java @@ -33,7 +33,7 @@ public class MasterOfCrueltiesTest extends CardTestPlayerBase { attack(2, playerB, "Alesha, Who Smiles at Death"); setChoice(playerB, true); - addTarget(playerB, "Master of Cruelties"); + // Master of Cruelties is autochosen since only target block(2, playerA, "Silvercoat Lion", "Master of Cruelties"); @@ -48,7 +48,5 @@ public class MasterOfCrueltiesTest extends CardTestPlayerBase { assertLife(playerB, 20); assertGraveyardCount(playerA, "Silvercoat Lion", 1); - } - } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SilkwrapTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SilkwrapTest.java index 285c6323b5..15753e53b3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SilkwrapTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SilkwrapTest.java @@ -10,11 +10,11 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public class SilkwrapTest extends CardTestPlayerBase { - - /* - * Reported bug - Silkwrap does not exile Hangarback. - Cards with X CMC are considered 0 CMC on the battlefield. - */ + + /** + * Reported bug - Silkwrap does not exile Hangarback. + * Cards with X CMC are considered 0 CMC on the battlefield. + */ @Test public void testHangarback() { @@ -22,7 +22,9 @@ public class SilkwrapTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Wastes", 8); addCard(Zone.HAND, playerB, "Silkwrap", 1); addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); - + + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hangarback Walker"); setChoice(playerA, "X=4"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SoulWardenTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SoulWardenTest.java index ab3bc1cd59..7e0c32d54e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SoulWardenTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/SoulWardenTest.java @@ -28,8 +28,7 @@ public class SoulWardenTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard"); // 2/1 creature castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raise the Alarm"); // put two 1/1 soldiers on the battlefield - castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt"); - addTarget(playerA, "Soul Warden"); + castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Lightning Bolt", "Soul Warden"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Elite Vanguard"); // should not gain life now that soul warden is dead setStopAt(1, PhaseStep.END_TURN); @@ -37,6 +36,8 @@ public class SoulWardenTest extends CardTestPlayerBase { assertGraveyardCount(playerA, "Lightning Bolt", 1); assertGraveyardCount(playerA, "Soul Warden", 1); + assertPermanentCount(playerA, "Soldier Token", 2); + assertPermanentCount(playerA, "Elite Vanguard", 2); assertLife(playerA, 23); assertLife(playerB, 20); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ChronozoaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ChronozoaTest.java index 1e5ff76f3c..4949f349a9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ChronozoaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ChronozoaTest.java @@ -31,7 +31,7 @@ public class ChronozoaTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chronozoa"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice a creature"); - addTarget(playerA, "Viscera Seer"); + setChoice(playerA, "Viscera Seer"); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ElendaTheDuskRoseTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ElendaTheDuskRoseTest.java index 1329d22080..a989eda781 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ElendaTheDuskRoseTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ElendaTheDuskRoseTest.java @@ -138,12 +138,14 @@ public class ElendaTheDuskRoseTest extends CardTestPlayerBase { // When Elenda dies, create X 1/1 white Vampire creature tokens with lifelink, where X is Elenda's power. addCard(Zone.HAND, playerA, "Elenda, the Dusk Rose", 1); // {2}{W}{B} 1/1 + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Elenda, the Dusk Rose"); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Sweltering Suns"); - + setChoice(playerA, "Whenever a creature is put"); + setChoice(playerA, "Whenever a creature is put"); + setChoice(playerA, "When "); setChoice(playerA, true); // use Angelic Renewal on Elenda, the Dusk Rose - setChoice(playerA, false); // use Angelic Renewal on Silvercoat Lion setStopAt(2, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ServantOfTheScaleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ServantOfTheScaleTest.java index 3cb6584d7f..ca79df8110 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ServantOfTheScaleTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/dies/ServantOfTheScaleTest.java @@ -16,7 +16,6 @@ public class ServantOfTheScaleTest extends CardTestPlayerBase { /** * Tests that the dies triggered ability distributes * the +1/+1 counters on Servant of the Scale - * */ @Test public void testDiesTriggeredAbility() { @@ -29,6 +28,8 @@ public class ServantOfTheScaleTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Mountain"); addCard(Zone.HAND, playerB, "Lightning Bolt"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Servant of the Scale"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Servant of the Scale"); addTarget(playerA, "Silvercoat Lion"); @@ -42,10 +43,7 @@ public class ServantOfTheScaleTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Lightning Bolt", 1); assertGraveyardCount(playerA, "Servant of the Scale", 1); - assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPowerToughness(playerA, "Silvercoat Lion", 3,3); - - } - + } } diff --git a/Mage.Tests/src/test/java/org/mage/test/commander/duel/CurseOfTheSwineTest.java b/Mage.Tests/src/test/java/org/mage/test/commander/duel/CurseOfTheSwineTest.java index 3c72b8b24b..baa53de5a7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/commander/duel/CurseOfTheSwineTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/commander/duel/CurseOfTheSwineTest.java @@ -18,21 +18,23 @@ public class CurseOfTheSwineTest extends CardTestCommanderDuelBase { setDecknamePlayerA("CommanderDuel_UW.dck"); // Commander = Daxos of Meletis return super.createNewGameAndPlayers(); } - /* - In a Commander game, if a commander is put into the command zone - instead of being exiled by Curse of the Swine, its controller will - still get a Boar token. + + /** + * In a Commander game, if a commander is put into the command zone + * instead of being exiled by Curse of the Swine, its controller will + * still get a Boar token. */ @Test - public void TestCurseOfTheSwine() - { + public void TestCurseOfTheSwine() { addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); addCard(Zone.HAND, playerA, "Curse of the Swine"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daxos of Meletis"); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Curse of the Swine"); setChoice(playerA, "X=1"); - addTarget(playerA, "Daxos of Meletis"); + // Daxos of Meletis is auto-chosen since only target + setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java index bdf35f59ac..18edda5f01 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRangeAllTest.java @@ -156,7 +156,6 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Confiscate", "Jace, Unraveler of Secrets"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-8: You get an emblem with"); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Blind with Anger", "Rootwater Commando"); attack(2, playerD, "Silvercoat Lion", playerC); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/VindictiveLichTest.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/VindictiveLichTest.java index 30e6e36737..1fe2d0f981 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/VindictiveLichTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/VindictiveLichTest.java @@ -55,7 +55,7 @@ public class VindictiveLichTest extends CardTestMultiPlayerBase { setModeChoice(playerA, "2"); addTarget(playerA, playerC); setModeChoice(playerA, "3"); - addTarget(playerA, playerD); + // Player D is auto-chosen since each mode needs a different opponent setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/rollback/DemonicPactTest.java b/Mage.Tests/src/test/java/org/mage/test/rollback/DemonicPactTest.java index 220b7c8025..e0e5cbc3f1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/rollback/DemonicPactTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/rollback/DemonicPactTest.java @@ -22,6 +22,8 @@ public class DemonicPactTest extends CardTestPlayerBase { // (4) - You lose the game. addCard(Zone.HAND, playerA, "Demonic Pact"); // Enchantment {2}{B}{B} + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Demonic Pact"); setModeChoice(playerA, "3"); diff --git a/Mage.Tests/src/test/java/org/mage/test/rollback/StateValuesTest.java b/Mage.Tests/src/test/java/org/mage/test/rollback/StateValuesTest.java index 99fecb26d8..56c6f72c56 100644 --- a/Mage.Tests/src/test/java/org/mage/test/rollback/StateValuesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/rollback/StateValuesTest.java @@ -17,12 +17,13 @@ public class StateValuesTest extends CardTestPlayerBase { public void testDragonWhelpActivatedFourTimes() { addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4); // Flying + // 2/3 // {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step. addCard(Zone.BATTLEFIELD, playerA, "Dragon Whelp", 1); // 2/3 activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); - attack(1, playerA, "Dragon Whelp"); + attack(1, playerA, "Dragon Whelp"); // 4 damage activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); @@ -35,7 +36,7 @@ public class StateValuesTest extends CardTestPlayerBase { activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: "); - attack(3, playerA, "Dragon Whelp"); +// attack(3, playerA, "Dragon Whelp"); rollbackAfterActionsEnd(); setStopAt(4, PhaseStep.UPKEEP); @@ -46,7 +47,6 @@ public class StateValuesTest extends CardTestPlayerBase { assertLife(playerA, 20); assertLife(playerB, 12); - } @Test diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 0def634039..626a36f184 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -285,8 +285,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement logger.info(Thread.currentThread().getStackTrace()[2].getMethodName() + " has been executed. Execution time: " + (t2 - t1) / 1000000 + " ms"); } - // TODO: 01.12.2018, JayDi85 - uncomment and fix MANY broken tests with wrong commands - //assertAllCommandsUsed(); + assertAllCommandsUsed(); } protected TestPlayer createNewPlayer(String playerName, RangeOfInfluence rangeOfInfluence) { diff --git a/Mage.Tests/src/test/java/org/mage/test/testapi/TestAPITest.java b/Mage.Tests/src/test/java/org/mage/test/testapi/TestAPITest.java index 95f3e183f8..6ac56d01b4 100644 --- a/Mage.Tests/src/test/java/org/mage/test/testapi/TestAPITest.java +++ b/Mage.Tests/src/test/java/org/mage/test/testapi/TestAPITest.java @@ -3,6 +3,7 @@ package org.mage.test.testapi; import mage.constants.PhaseStep; import mage.constants.Zone; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -16,7 +17,7 @@ public class TestAPITest extends CardTestPlayerBase { * Shock should be able to remove Last Breath's target before it resolves */ @Test - public void testCardTestPlayerAPIImpl1() { + public void testTwoInstancesInARow() { addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); @@ -39,7 +40,7 @@ public class TestAPITest extends CardTestPlayerBase { * Shock won't be even cast here as no Last Breath should resolve. */ @Test - public void testCardTestPlayerAPIImpl2() { + public void testWhileNotOnStackWorks() { addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); @@ -52,7 +53,14 @@ public class TestAPITest extends CardTestPlayerBase { StackClause.WHILE_NOT_ON_STACK); setStopAt(1, PhaseStep.END_TURN); - execute(); + + try { + execute(); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { + Assert.fail("Should have had error about playerA having too many actions, but got:\n" + e.getMessage()); + } + } assertPermanentCount(playerA, "Grizzly Bears", 0); assertLife(playerA, 24); // gain 4 life from Last Breath diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderOwnerControlTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderOwnerControlTargetEffect.java index 9ee2a3e58c..52c6215b82 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderOwnerControlTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderOwnerControlTargetEffect.java @@ -46,6 +46,7 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff updateText(); } + // TODO: This does not generate correct text, the ", then" should be from .concatBy, see Angelic Renewal for a card with incorrect text private void updateText() { this.staticText = ", then return " + this.returnName + " to the battlefield" + (tapped ? " tapped" : "")