From e83ffb2ad7da6024e98b2c51df3b4b02a3aa9406 Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Mon, 16 May 2022 15:29:15 -0600 Subject: [PATCH] Fixing several tests. Working towards enabling assertAllCommandsUsed() inside execute(). --- .../abilities/keywords/ConstellationTest.java | 6 ++- .../cards/abilities/keywords/DashTest.java | 40 +++++++++------- .../abilities/keywords/HexproofTest.java | 14 ++++-- .../cards/abilities/keywords/PersistTest.java | 4 -- .../oneshot/counterspell/SecondGuessTest.java | 5 +- .../continuous/AngelOfJubilationTest.java | 27 +++++++---- .../cards/continuous/MasterThiefTest.java | 24 ++++++---- .../cards/copy/CleverImpersonatorTest.java | 12 ++--- .../cost/additional/LivingDestinyTest.java | 11 ++--- .../cost/modification/ArcaneMeleeTest.java | 38 +++++---------- .../enchantments/CircleOfAfflictionTest.java | 47 ++++++++----------- .../mage/test/cards/mana/ManaSourceTest.java | 9 ++-- .../mana/conditional/ConditionalManaTest.java | 4 +- .../test/cards/planeswalker/JaceTest.java | 16 +++---- .../LilianaDefiantNecromancerTest.java | 4 +- .../cards/replacement/DiscardEffectsTest.java | 5 +- .../replacement/LeylineOfTheVoidTest.java | 11 +++-- .../replacement/MistcutterHydraTest.java | 44 +++++------------ .../canttarget/DenseFoliageTest.java | 2 +- .../CantUseActivatedAbilitiesTest.java | 3 +- .../cards/restriction/ReflectorMageTest.java | 2 +- .../mage/test/cards/rules/CantCastTest.java | 41 +++++++++++----- .../cards/single/an/AliFromCairoTest.java | 15 ++++-- .../cards/single/dka/AltarOfTheLostTest.java | 31 ++++++------ .../cards/single/dka/FaithsShieldTest.java | 24 ++++++++-- .../cards/single/fut/DaybreakCoronetTest.java | 37 +++++---------- .../cards/single/m14/JacesMindseekerTest.java | 1 - .../single/mrd/ChaliceOfTheVoidTest.java | 3 +- .../single/soi/WolfOfDevilsBreachTest.java | 5 +- .../cards/single/zen/InfernoTrapTest.java | 17 ++++--- .../triggers/BonecladNecromancerTest.java | 29 ++++++++---- .../triggers/delayed/PostMortemLungeTest.java | 11 ++--- .../multiplayer/PlayerLeftGameRange1Test.java | 21 ++++++--- 33 files changed, 294 insertions(+), 269 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConstellationTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConstellationTest.java index e6e6d6f050..b1b8e8f491 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConstellationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/ConstellationTest.java @@ -231,8 +231,12 @@ public class ConstellationTest extends CardTestPlayerBase { } @Test - public void test_DaxosGotBoostAndNewTypeByDependencyEffects() { + public void test_DaxosGotBoostAndNewTypeByDependencyEffects_RegularWay() { playDaxosAndVampire(false); + } + + @Test + public void test_DaxosGotBoostAndNewTypeByDependencyEffects_DifferentWay() { playDaxosAndVampire(true); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java index 0691e76bbe..6444a3d2ed 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java @@ -8,28 +8,30 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * 702.109. {@link mage.abilities.keyword.DashAbility Dash} + * 702.109a Dash represents three abilities: two static abilities that + * function while the card with dash is on the stack, one of which may + * create a delayed triggered ability, and a static ability that functions + * while the object with dash is on the battlefield. + * + * “Dash [cost]” means “You may cast this card by paying [cost] rather that + * its mana cost,” “If this spell's dash cost was paid, return the permanent this + * spell becomes to its owner's hand at the beginning of the next end step,” + * and “As long as this permanent's dash cost was paid, it has haste.” + * + * Paying a card's dash cost follows the rules for paying alternative costs + * in rules 601.2b and 601.2e–g. + * * @author BetaSteward */ public class DashTest extends CardTestPlayerBase { - /** - * 702.108. Dash 702.108a Dash represents three abilities: two static - * abilities that function while the card with dash is on the stack, one of - * which may create a delayed triggered ability, and a static ability that - * functions while the object with dash is on the battlefield. “Dash [cost]” - * means “You may cast this card by paying [cost] rather that its mana - * cost,” “If this spell's dash cost was paid, return the permanent this - * spell becomes to its owner's hand at the beginning of the next end step,” - * and “As long as this permanent's dash cost was paid, it has haste.” - * Paying a card's dash cost follows the rules for paying alternative costs - * in rules 601.2b and 601.2e–g. + * Screamreach Brawler + * Creature — Orc Berserker 2/3 + * {2}{R} * - */ - /** - * Screamreach Brawler Creature — Orc Berserker 2/3, 2R (3) Dash {1}{R} (You - * may cast this spell for its dash cost. If you do, it gains haste, and - * it's returned from the battlefield to its owner's hand at the beginning - * of the next end step.) + * Dash {1}{R} (You may cast this spell for its dash cost. If you do, it gains haste, and it's returned + * from the battlefield to its owner's hand at the beginning of the next end step.) */ @Test public void testDash() { @@ -56,11 +58,13 @@ public class DashTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Screamreach Brawler"); setChoice(playerA, false); - attack(1, playerA, "Screamreach Brawler"); + checkPlayableAbility("attack", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "attack: Scream", false); setStopAt(2, PhaseStep.UNTAP); execute(); + // TODO: Must be a better way to check if a creature can't attack + assertLife(playerB, 20); assertPermanentCount(playerA, "Screamreach Brawler", 1); assertHandCount(playerA, "Screamreach Brawler", 0); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java index b89b952e33..4e20ce02d5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/HexproofTest.java @@ -76,11 +76,13 @@ public class HexproofTest extends CardTestPlayerBaseWithAIHelps { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6); addCard(Zone.HAND, playerA, "Murder", 2); - addCard(Zone.BATTLEFIELD, playerB, "Knight of Grace"); - addCard(Zone.BATTLEFIELD, playerB, "Knight of Malice"); + addCard(Zone.BATTLEFIELD, playerB, "Knight of Grace"); // White + addCard(Zone.BATTLEFIELD, playerB, "Knight of Malice"); // Black - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", "Knight of Grace"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", "Knight of Malice"); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + + checkPlayableAbility("knight of grace", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Murder", false); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -143,12 +145,14 @@ public class HexproofTest extends CardTestPlayerBaseWithAIHelps { // You have hexproof. (You can't be the target of spells or abilities your opponents control.) addCard(Zone.BATTLEFIELD, playerB, "Leyline of Sanctity", 1); + setStrictChooseMode(true); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1:"); addTarget(playerA, playerB); + setStopAt(1, PhaseStep.END_TURN); + try { - setStrictChooseMode(true); - setStopAt(1, PhaseStep.END_TURN); execute(); assertAllCommandsUsed(); Assert.fail("must throw exception on execute"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java index b9a73de769..da00dccfe5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/PersistTest.java @@ -140,9 +140,6 @@ public class PersistTest extends CardTestPlayerBase { block(2, playerA, "Kitchen Finks:0", "Wurmcoil Engine"); block(2, playerA, "Kitchen Finks:1", "Wurmcoil Engine"); - setChoice(playerB, "Creatures entering the battlefield don't cause abilities to trigger"); - setChoice(playerB, "Creatures entering the battlefield don't cause abilities to trigger"); - setStopAt(2, PhaseStep.END_TURN); execute(); @@ -153,7 +150,6 @@ public class PersistTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Phyrexian Wurm Token", 2); assertPermanentCount(playerA, "Kitchen Finks", 2); assertPowerToughness(playerA, "Kitchen Finks", 2, 1, Filter.ComparisonScope.All); - } /** diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/SecondGuessTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/SecondGuessTest.java index df49bc6bd3..06958c05f7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/SecondGuessTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/SecondGuessTest.java @@ -22,7 +22,7 @@ public class SecondGuessTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Second Guess"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Second Guess", "Lightning Bolt"); + checkPlayableAbility("can't counter lightning bolt", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Second", false); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -66,8 +66,9 @@ public class SecondGuessTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", playerB); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Second Guess", "Shock"); // can't be cast (no valid target), so Secon Guess spell stays on hand + checkPlayableAbility("can't counter lightning bolt", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Second", false); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/AngelOfJubilationTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/AngelOfJubilationTest.java index 3f1bf13327..bf6c3e8ee1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/AngelOfJubilationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/AngelOfJubilationTest.java @@ -6,8 +6,13 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * Angel of Jubilation Other nonblack creatures you control get +1/+1. Players - * can't pay life or sacrifice creatures to cast spells or activate abilities + * {@link mage.cards.a.AngelOfJubilation Angel of Jubilation} + * {1}{W}{W}{W} + * Creature — Angel + * Flying + * + * Other nonblack creatures you control get +1/+1. + * Players can't pay life or sacrifice creatures to cast spells or activate abilities * * @author noxx */ @@ -64,8 +69,9 @@ public class AngelOfJubilationTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Nantuko Husk"); addCard(Zone.BATTLEFIELD, playerB, "Corpse Traders"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice a creature: {this} gets +2/+2 until end of turn."); - playerB.addChoice("Corpse Traders"); + checkPlayableAbility("Can't sac", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice", false); +// activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice a creature: {this} gets +2/+2 until end of turn."); +// playerB.addChoice("Corpse Traders"); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -102,9 +108,10 @@ public class AngelOfJubilationTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Nantuko Husk"); addCard(Zone.BATTLEFIELD, playerB, "Llanowar Elves", 2); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}, Sacrifice a permanent you control: Return target creature to its owner's hand."); - playerB.addChoice("Nantuko Husk"); - playerA.addTarget("Angel of Jubilation"); + checkPlayableAbility("Can't sac", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}, Sacrifice", false); +// activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}, Sacrifice a permanent you control: Return target creature to its owner's hand."); +// playerB.addChoice("Nantuko Husk"); +// playerA.addTarget("Angel of Jubilation"); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -121,7 +128,8 @@ public class AngelOfJubilationTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Soulblast"); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 6); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Soulblast", playerA); + checkPlayableAbility("Can't sac all", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Soulblast", false); +// castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Soulblast", playerA); setStopAt(1, PhaseStep.END_TURN); execute(); @@ -138,8 +146,7 @@ public class AngelOfJubilationTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Angel of Jubilation"); addCard(Zone.BATTLEFIELD, playerB, "Children of Korlis"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice {this}: You gain life equal to the life you've lost this turn."); - playerB.addChoice("Skirk Prospector"); + checkPlayableAbility("Can't sac", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice", false); setStopAt(1, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MasterThiefTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MasterThiefTest.java index af26181472..3201ef19e9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MasterThiefTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/continuous/MasterThiefTest.java @@ -7,6 +7,11 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.m.MasterThief Master Thief} + * {2}{U}{U} + * Creature — Human Rogue + * When Master Thief enters the battlefield, gain control of target artifact for as long as you control Master Thief. + * * @author JayDi85 */ public class MasterThiefTest extends CardTestPlayerBase { @@ -17,9 +22,8 @@ public class MasterThiefTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Master Thief", 3); addCard(Zone.BATTLEFIELD, playerB, "Accorder's Shield", 1); - // cast and get control of shield + // Cast Master Theif, auto get control of the shield since it's the only artifact in play castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master Thief"); - addTarget(playerB, "Accorder's Shield"); setStopAt(3, PhaseStep.PRECOMBAT_MAIN); execute(); @@ -44,9 +48,9 @@ public class MasterThiefTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master Thief"); addTarget(playerA, "Accorder's Shield"); - // sacrifice Master Thief -- must lost control + // sacrifice Master Thief -- must lose control activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a creature"); - addTarget(playerA, "Master Thief"); + setChoice(playerA, "Master Thief"); setStopAt(3, PhaseStep.POSTCOMBAT_MAIN); execute(); @@ -64,25 +68,29 @@ public class MasterThiefTest extends CardTestPlayerBase { @Test public void testMasterThief_LostControlOnSacrificeButArtifactAttached() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 10); addCard(Zone.HAND, playerA, "Master Thief", 3); - addCard(Zone.BATTLEFIELD, playerB, "Accorder's Shield", 1); + + addCard(Zone.BATTLEFIELD, playerA, "Island", 10); addCard(Zone.BATTLEFIELD, playerA, "Bearer of the Heavens", 1); addCard(Zone.BATTLEFIELD, playerA, "Ashnod's Altar", 1); + addCard(Zone.BATTLEFIELD, playerB, "Accorder's Shield", 1); + // cast and get control of shield castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master Thief"); addTarget(playerA, "Accorder's Shield"); + checkPermanentCount("must control shield", 1, PhaseStep.BEGIN_COMBAT, playerA, "Accorder's Shield", 1); // attach and boost activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Equip {3}"); addTarget(playerA, "Bearer of the Heavens"); + checkAbility("bear must have boost", 1, PhaseStep.END_TURN, playerA, "Bearer of the Heavens", VigilanceAbility.class, true); - // sacrifice Master Thief -- must lost control, but attached and boosted + // sacrifice Master Thief, lose control of the shield but it should still be attached to Bearer of the Heavens activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice a creature"); - addTarget(playerA, "Master Thief"); + setChoice(playerA, "Master Thief"); setStopAt(3, PhaseStep.POSTCOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CleverImpersonatorTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CleverImpersonatorTest.java index 4d0f9af52b..7e85b67704 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/CleverImpersonatorTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/CleverImpersonatorTest.java @@ -197,19 +197,17 @@ public class CleverImpersonatorTest extends CardTestPlayerBase { @Test public void testKindredDiscovery() { - addCard(Zone.BATTLEFIELD, playerA, "Island", 5); addCard(Zone.HAND, playerA, "Kindred Discovery"); + addCard(Zone.BATTLEFIELD, playerA, "Island", 5); - - addCard(Zone.BATTLEFIELD, playerB, "Island", 5); - // Skip your draw step. - addCard(Zone.BATTLEFIELD, playerB, "Dragon Appeasement"); addCard(Zone.HAND, playerB, "Clever Impersonator"); addCard(Zone.HAND, playerB, "Ornithopter", 2); addCard(Zone.HAND, playerB, "Memnite"); + // Skip your draw step. + addCard(Zone.BATTLEFIELD, playerB, "Dragon Appeasement"); + addCard(Zone.BATTLEFIELD, playerB, "Island", 5); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Kindred Discovery"); - setChoice(playerA, "Construct Token"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Kindred Discovery"); // Construct token auto-chosen castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator"); setChoice(playerB, "Kindred Discovery"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/LivingDestinyTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/LivingDestinyTest.java index 861301d8e3..f89229b0f9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/LivingDestinyTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/additional/LivingDestinyTest.java @@ -28,24 +28,21 @@ public class LivingDestinyTest extends CardTestPlayerBase { } /** - * Card can't be cast without possibility to pay additional cost + * Card can't be cast without possibility to pay additional cost. */ @Test public void testCantCast() { addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); addCard(Zone.HAND, playerA, "Living Destiny"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Living Destiny"); + checkPlayableAbility("Cast Living Destiny", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Living", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - - // card is still at hand - assertHandCount(playerA, 1); } /** - * Tests that non creature card can't be revealed + * Tests that non creature card can't be revealed. */ @Test public void testNonCreatureCard() { @@ -53,7 +50,7 @@ public class LivingDestinyTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Living Destiny"); addCard(Zone.HAND, playerA, "Divination"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Living Destiny"); + checkPlayableAbility("Cast Living Destiny", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Living", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/ArcaneMeleeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/ArcaneMeleeTest.java index 78a08f6360..c6c25c1fd5 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/ArcaneMeleeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/cost/modification/ArcaneMeleeTest.java @@ -10,9 +10,11 @@ import org.mage.test.serverside.base.CardTestPlayerBase; import java.util.UUID; /** - * Arcane Melee: - * Enchantment - * Instant and sorcery spells cost {2} less to cast. + * {@link mage.cards.a.ArcaneMelee Arcane Melee} + * {4}{U} + * Enchantment + * + * Instant and sorcery spells cost {2} less to cast. * * @author noxx */ @@ -42,7 +44,7 @@ public class ArcaneMeleeTest extends CardTestPlayerBase { /** - * "Arcane Melee" shouldn't cause any affect while being in hand + * Shouldn't have any affect while being in the hand. */ @Test public void testInHand() { @@ -50,7 +52,7 @@ public class ArcaneMeleeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Arcane Melee", 1); addCard(Zone.HAND, playerA, "Flow of Ideas", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flow of Ideas"); + checkPlayableAbility("doesn't work on creature", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Flow", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -63,7 +65,7 @@ public class ArcaneMeleeTest extends CardTestPlayerBase { } /** - * Test cumulative effect of cost reduction effects + * Test cumulative effect of cost reduction effects. */ @Test public void testMultiArcaneMelee() { @@ -76,26 +78,14 @@ public class ArcaneMeleeTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); // by default players don't draw 7 cards at startup in tests (it can be changed through command though) // 1 card: Flow of Ideas should be cast and one card should be drawn assertHandCount(playerA, 1); - - // check there is 'Flow of Ideas' in graveyard - boolean found = false; - for (UUID cardId : playerA.getGraveyard()) { - Card card = currentGame.getCard(cardId); - if (card.getName().equals("Flow of Ideas")) { - found = true; - break; - } - } - Assert.assertTrue("Flow of Ideas wasn't found in graveyard, means it wasn't cast", found); + assertGraveyardCount(playerA, "Flow of Ideas", 1); } /** - * Tests that "Arcane Melee" doesn't affect creature card + * Should not affect creature card. */ @Test public void testNonInstantAndSorcery() { @@ -103,15 +93,9 @@ public class ArcaneMeleeTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Arcane Melee", 1); addCard(Zone.HAND, playerA, "Merfolk Looter", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Merfolk Looter"); + checkPlayableAbility("doesn't work on creature", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Merfolk", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - - assertLife(playerA, 20); - assertLife(playerB, 20); - // by default players don't draw 7 cards at startup in tests (it can be changed through command though) - // 1 card: Merfolk Looter (Arcane Melee doesn't affect creatures' costs) - assertHandCount(playerA, 1); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/CircleOfAfflictionTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/CircleOfAfflictionTest.java index f12690304e..695870f532 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/CircleOfAfflictionTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/enchantments/CircleOfAfflictionTest.java @@ -7,20 +7,22 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * + * {@link mage.cards.c.CircleOfAffliction Circle of Affliction} + * {1}{B} + * Enchantment + * As Circle of Affliction enters the battlefield, choose a color. + * Whenever a source of the chosen color deals damage to you, you may pay {1}. + * If you do, target player loses 1 life and you gain 1 life. + * * @author LevelX2 */ public class CircleOfAfflictionTest extends CardTestPlayerBase { /** - * + * Test that it works for a single attacker of the chosen color. */ @Test public void testOneAttackerDamage() { - - // Enchantment - {1}{B} - // As Circle of Affliction enters the battlefield, choose a color. - // Whenever a source of the chosen color deals damage to you, you may pay {1}. If you do, target player loses 1 life and you gain 1 life. addCard(Zone.HAND, playerA, "Circle of Affliction", 1); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); @@ -42,17 +44,14 @@ public class CircleOfAfflictionTest extends CardTestPlayerBase { } /** - * + * Test that it works for multiple attackers of the same chosen color. */ @Test public void testTwoAttackersDamage() { - - addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // {1}{W} 2/2 - - addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); - // As Circle of Affliction enters the battlefield, choose a color. - // Whenever a source of the chosen color deals damage to you, you may pay {1}. If you do, target player loses 1 life and you gain 1 life. addCard(Zone.HAND, playerA, "Circle of Affliction", 1);// {1}{B} + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // {1}{W} 2/2 castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Circle of Affliction"); setChoice(playerA, "White"); @@ -74,16 +73,13 @@ public class CircleOfAfflictionTest extends CardTestPlayerBase { } /** - * + * Test that it works for both spells and combat damage from sources of the chosen color. */ @Test public void testMixOfSpellsAndCombatDamage() { - - addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6); - // As Circle of Affliction enters the battlefield, choose a color. - // Whenever a source of the chosen color deals damage to you, you may pay {1}. If you do, target player loses 1 life and you gain 1 life. addCard(Zone.HAND, playerA, "Circle of Affliction", 1);// {1}{B} - + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6); + addCard(Zone.HAND, playerB, "Lava Spike", 2); // {R} deals 3 damage to target player addCard(Zone.BATTLEFIELD, playerB, "Hill Giant", 2); // {3}{R} 3/3 addCard(Zone.BATTLEFIELD, playerB, "Mountain", 4); @@ -116,18 +112,17 @@ public class CircleOfAfflictionTest extends CardTestPlayerBase { } /** - * + * Check that if there are multiple attackers, ensure that it only works for those of the chosen color. */ @Test public void testTwoAttackersDamageDifferentColors() { - + addCard(Zone.HAND, playerA, "Circle of Affliction", 1);// {1}{B} + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); // {1}{W} 2/2 addCard(Zone.BATTLEFIELD, playerB, "Hill Giant", 1); // {3}{R} 3/3 - addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); - // As Circle of Affliction enters the battlefield, choose a color. - // Whenever a source of the chosen color deals damage to you, you may pay {1}. If you do, target player loses 1 life and you gain 1 life. - addCard(Zone.HAND, playerA, "Circle of Affliction", 1);// {1}{B} + setStrictChooseMode(true); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Circle of Affliction"); setChoice(playerA, "White"); @@ -136,8 +131,6 @@ public class CircleOfAfflictionTest extends CardTestPlayerBase { attack(2, playerB, "Hill Giant"); addTarget(playerA, playerB); setChoice(playerA, true); - addTarget(playerA, playerB); // should not be able to drain Hill Giant with white selected - setChoice(playerA, true); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ManaSourceTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ManaSourceTest.java index 0fc9c2b2f4..da645fa5ca 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ManaSourceTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ManaSourceTest.java @@ -32,15 +32,14 @@ public class ManaSourceTest extends CardTestPlayerBase { try { execute(); - - assertExileCount("Simian Spirit Guide", 1); - - assertPermanentCount(playerA, "Myr Superion", 0); - assertHandCount(playerA, "Myr Superion", 1); } catch (Throwable e) { if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage()); } } + + assertExileCount("Simian Spirit Guide", 1); + assertPermanentCount(playerA, "Myr Superion", 0); + assertHandCount(playerA, "Myr Superion", 1); } } 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 4b95301083..31fabd0c0c 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 @@ -45,9 +45,7 @@ public class ConditionalManaTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2); addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); - playerA.addChoice("White"); - playerA.addChoice("White"); + checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Silvercoat", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java index 6cf57aa70e..8087e6d731 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/JaceTest.java @@ -62,8 +62,7 @@ public class JaceTest extends CardTestPlayerBase { // If a nontoken creature would enter the battlefield and it wasn't cast, exile it instead. addCard(Zone.BATTLEFIELD, playerB, "Containment Priest", 1); // {2}{U}{U} - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card"); - setChoice(playerA, "Pillarfield Ox"); + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card"); // The Ox is auto-chosen setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); @@ -93,8 +92,7 @@ public class JaceTest extends CardTestPlayerBase { // If a nontoken creature would enter the battlefield and it wasn't cast, exile it instead. addCard(Zone.BATTLEFIELD, playerB, "Containment Priest", 1); // {2}{U}{U} - activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card"); - setChoice(playerA, "Pillarfield Ox"); + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card"); // The Ox is auto-chosen rollbackTurns(3, PhaseStep.BEGIN_COMBAT, playerA, 0); // Start of turn 3 @@ -119,7 +117,8 @@ public class JaceTest extends CardTestPlayerBase { // exile Jace, Vryn's Prodigy, then return him to the battefield transformed under his owner's control. String jVryn = "Jace, Vryn's Prodigy"; // {U}{1} 0/2 - //−3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead. + //−3: You may cast target instant or sorcery card from your graveyard this turn. + // If that card would be put into your graveyard this turn, exile it instead. String jTelepath = "Jace, Telepath Unbound"; // 5 loyalty // Sorcery, Suspend 4 {U}. Target player draws three cards. @@ -131,11 +130,14 @@ public class JaceTest extends CardTestPlayerBase { addCard(Zone.GRAVEYARD, playerA, ancestralVision); addCard(Zone.HAND, playerA, "Swamp", 1); + setStrictChooseMode(true); + activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}:"); setChoice(playerA, "Swamp"); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "-3:"); addTarget(playerA, ancestralVision); - castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, ancestralVision); + + checkPlayableAbility("Can't cast Ancestral Vision", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast" + ancestralVision, false); setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); @@ -175,7 +177,5 @@ public class JaceTest extends CardTestPlayerBase { assertPermanentCount(playerB, "Perimeter Captain", 1); assertGraveyardCount(playerB, "Perimeter Captain", 1); - } - } 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 b684ad9e11..f1a37e26f0 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 @@ -19,7 +19,9 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); // Lifelink - // Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield. + // Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, + // then return her to the battlefield transformed under her owner's control. + // If you do, put a 2/2 black Zombie creature token onto the battlefield. addCard(Zone.HAND, playerA, "Liliana, Heretical Healer"); addCard(Zone.HAND, playerB, "Lightning Bolt"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DiscardEffectsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DiscardEffectsTest.java index dfe9286bb4..3a6a0b2fa2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DiscardEffectsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/DiscardEffectsTest.java @@ -19,7 +19,7 @@ public class DiscardEffectsTest extends CardTestPlayerBase { // Loxodon Smiter can't be countered. // If a spell or ability an opponent controls causes you to discard Loxodon Smiter, put it onto the battlefield instead of putting it into your graveyard. addCard(Zone.HAND, playerB, "Loxodon Smiter"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Thoughtseize"); addTarget(playerA, playerB); setChoice(playerA, "Loxodon Smiter"); @@ -40,7 +40,8 @@ public class DiscardEffectsTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Loxodon Smiter"); addCard(Zone.HAND, playerA, "Sift"); // {3}{U} Sorcery - draw 3 discard 1 addCard(Zone.BATTLEFIELD, playerA, "Island", 4); - + + setStrictChooseMode(true); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sift"); setChoice(playerA, "Loxodon Smiter"); setStopAt(1, PhaseStep.BEGIN_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/LeylineOfTheVoidTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/LeylineOfTheVoidTest.java index f7e1c2e4d6..c22d3d9f9f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/LeylineOfTheVoidTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/LeylineOfTheVoidTest.java @@ -86,14 +86,15 @@ public class LeylineOfTheVoidTest extends CardTestPlayerBase { // Morbid — At the beginning of each end step, if a creature died this turn, you may draw a card. addCard(Zone.BATTLEFIELD, playerB, "Deathreap Ritual"); addCard(Zone.BATTLEFIELD, playerB, "Memnite"); - + + setStrictChooseMode(true); + castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Murder"); - setChoice(playerA, "Memnite"); - setChoice(playerB, true); - + addTarget(playerA, "Memnite"); + setStopAt(2, PhaseStep.END_TURN); execute(); - + assertHandCount(playerB, 1); // card drawn for turn assertExileCount(playerB, 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/MistcutterHydraTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/MistcutterHydraTest.java index 6d4a1d5135..c693d99123 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/MistcutterHydraTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/MistcutterHydraTest.java @@ -7,6 +7,14 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.m.MistcutterHydra Mistcutter Hydra} + * {X}{G} + * Creature — Hydra + * 0/0 + * + * This spell can’t be countered. + * Haste, protection from blue + * Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. * * @author LevelX2 */ @@ -17,11 +25,6 @@ public class MistcutterHydraTest extends CardTestPlayerBase { */ @Test public void testHydraNormal3Counters() { - // Mistcutter Hydra - // Creature — Hydra 0/0, XG (1) - // Mistcutter Hydra can't be countered. - // Haste, protection from blue - // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. addCard(Zone.HAND, playerA, "Mistcutter Hydra"); addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); @@ -43,11 +46,6 @@ public class MistcutterHydraTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Banishing Light"); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); - // Mistcutter Hydra - // Creature — Hydra 0/0, XG (1) - // Mistcutter Hydra can't be countered. - // Haste, protection from blue - // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. addCard(Zone.HAND, playerB, "Mistcutter Hydra"); addCard(Zone.BATTLEFIELD, playerB, "Forest", 2); addCard(Zone.HAND, playerB, "Disenchant"); @@ -55,16 +53,12 @@ public class MistcutterHydraTest extends CardTestPlayerBase { castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Mistcutter Hydra"); setChoice(playerB, "X=3"); - castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banishing Light"); - setChoice(playerA, "Mistcutter Hydra"); + castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banishing Light"); // Target autochosenj castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "Disenchant","Banishing Light"); setStopAt(4, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); - assertGraveyardCount(playerA, "Banishing Light", 1); assertGraveyardCount(playerB, "Disenchant", 1); assertGraveyardCount(playerB, "Mistcutter Hydra", 1); @@ -76,11 +70,6 @@ public class MistcutterHydraTest extends CardTestPlayerBase { */ @Test public void testApocalypseHydraNormal3Counters() { - // Apocalypse {X}{R}{G} - // Apocalypse Hydra enters the battlefield with X +1/+1 counters on it. - // If X is 5 or more, it enters the battlefield with an additional X +1/+1 counters on it. - // {1}{R}, Remove a +1/+1 counter from Apocalypse Hydra: Apocalypse Hydra deals 1 damage to any target. - // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. addCard(Zone.HAND, playerA, "Apocalypse Hydra"); addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); @@ -100,17 +89,13 @@ public class MistcutterHydraTest extends CardTestPlayerBase { */ @Test public void testHydraReturnsAfterCounterWithZeroCounters() { - // Apocalypse {X}{R}{G} - // Apocalypse Hydra enters the battlefield with X +1/+1 counters on it. - // If X is 5 or more, it enters the battlefield with an additional X +1/+1 counters on it. - // {1}{R}, Remove a +1/+1 counter from Apocalypse Hydra: Apocalypse Hydra deals 1 damage to any target. - // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. - addCard(Zone.HAND, playerA, "Apocalypse Hydra"); - addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); // Put target artifact or creature card from a graveyard onto the battlefield under // your control. Shuffle Beacon of Unrest into its owner's library. addCard(Zone.HAND, playerA, "Beacon of Unrest"); + addCard(Zone.HAND, playerA, "Apocalypse Hydra"); + + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.HAND, playerB, "Counterspell"); @@ -129,8 +114,5 @@ public class MistcutterHydraTest extends CardTestPlayerBase { assertHandCount(playerA,"Beacon of Unrest", 0); assertPermanentCount(playerA, "Apocalypse Hydra", 0); assertGraveyardCount(playerA, "Apocalypse Hydra", 1); - - - // assertPowerToughness(playerA, "Mistcutter Hydra", 3,3); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/canttarget/DenseFoliageTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/canttarget/DenseFoliageTest.java index 1f2140c670..e2de2d7f95 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/replacement/canttarget/DenseFoliageTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/replacement/canttarget/DenseFoliageTest.java @@ -36,13 +36,13 @@ public class DenseFoliageTest extends CardTestPlayerBase { try { execute(); - assertPermanentCount(playerB, "Eager Cadet", 1); Assert.fail("must throw exception on execute"); } catch (Throwable e) { if (!e.getMessage().contains("setup good targets")) { Assert.fail("must throw error about bad targets, but got:\n" + e.getMessage()); } } + assertPermanentCount(playerB, "Eager Cadet", 1); } /** diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantUseActivatedAbilitiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantUseActivatedAbilitiesTest.java index 456d12c811..e6a6441d2e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantUseActivatedAbilitiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/restriction/CantUseActivatedAbilitiesTest.java @@ -45,7 +45,8 @@ public class CantUseActivatedAbilitiesTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Adarkar Sentinel"); // Artifact Creature — Soldier (3/3) addCard(Zone.BATTLEFIELD, playerB, "Island"); - activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}: "); + checkPlayableAbility("Can't Tap", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}", false); +// activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}: "); setStopAt(1, PhaseStep.BEGIN_COMBAT); 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 72ee6078d4..ac50730433 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 @@ -61,7 +61,7 @@ public class ReflectorMageTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); addTarget(playerA, "Bronze Sable"); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Bronze Sable"); // should not be allowed + checkPlayableAbility("sable not available", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Bronze", false); setStopAt(2, PhaseStep.END_TURN); execute(); 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 b2d7a4a6e5..311593e7e8 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 @@ -73,16 +73,15 @@ public class CantCastTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertHandCount(playerA, "Blaze", 1); - - assertLife(playerB, 20); - 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 not have throw error about bad targets, but got:\n" + e.getMessage()); } } + + assertHandCount(playerA, "Blaze", 1); + assertLife(playerB, 20); } /** @@ -137,14 +136,14 @@ public class CantCastTest extends CardTestPlayerBase { try { execute(); - - assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0); - assertHandCount(playerA, "Pine Walker", 1); } catch (Throwable e) { if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage()); } } + + assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0); + assertHandCount(playerA, "Pine Walker", 1); } /** @@ -165,13 +164,13 @@ public class CantCastTest extends CardTestPlayerBase { try { execute(); - - assertHandCount(playerA, "Mox Opal", 1); } catch (Throwable e) { if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) { Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage()); } } + + assertHandCount(playerA, "Mox Opal", 1); } /** @@ -223,16 +222,30 @@ public class CantCastTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Llanowar Elves", 1); // Creature {G} addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1); addCard(Zone.BATTLEFIELD, playerB, "Forest", 2); + // Abrupt Decay can't be countered. // Destroy target nonland permanent with converted mana cost 3 or less. addCard(Zone.HAND, playerB, "Abrupt Decay", 1); // {B}{G} castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "Llanowar Elves"); + activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: You"); setChoice(playerB, "Ethersworn Canonist"); + +// checkPlayableAbility("2nd spell cast", 4, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Abrupt", false); castSpell(4, PhaseStep.POSTCOMBAT_MAIN, playerB, "Abrupt Decay", "Ethersworn Canonist"); setStopAt(4, PhaseStep.END_TURN); - execute(); + + try { + execute(); + assertAllCommandsUsed(); + + Assert.fail("must throw exception on execute"); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerB must have 0 actions but found 1")) { + Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage()); + } + } assertCounterCount(playerA, "Aether Vial", CounterType.CHARGE, 2); assertPermanentCount(playerB, "Llanowar Elves", 1); @@ -258,10 +271,12 @@ public class CantCastTest extends CardTestPlayerBase { addCard(Zone.HAND, playerB, "Damnation", 1); // SORCERY {2}{B}{B} addCard(Zone.BATTLEFIELD, playerB, "Swamp", 4); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Alhammarret, High Arbiter"); - setChoice(playerA, "Damnation"); + setStrictChooseMode(true); - castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Damnation"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Alhammarret, High Arbiter"); + addTarget(playerA, "Damnation"); + + checkPlayableAbility("damnation check", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Damnation", false); setStopAt(2, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/an/AliFromCairoTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/an/AliFromCairoTest.java index 47d9f2da46..d07b05b9b9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/an/AliFromCairoTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/an/AliFromCairoTest.java @@ -6,6 +6,10 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.a.AliFromCairo Ali from Cairo} + * {2}{R}{R} + * Creature — Human + * Damage that would reduce your life total to less than 1 reduces it to 1 instead. * * @author BetaSteward */ @@ -15,10 +19,12 @@ public class AliFromCairoTest extends CardTestPlayerBase { public void testCard() { addCard(Zone.BATTLEFIELD, playerA, "Ali from Cairo", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 12); + addCard(Zone.BATTLEFIELD, playerB, "Soulfire Grand Master", 1); - addCard(Zone.BATTLEFIELD, playerB, "Mountain", 12); + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); + addCard(Zone.HAND, playerA, "Lightning Bolt", 7); - addCard(Zone.HAND, playerB, "Lightning Bolt", 7); + addCard(Zone.HAND, playerB, "Lightning Bolt", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); @@ -27,10 +33,9 @@ public class AliFromCairoTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/AltarOfTheLostTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/AltarOfTheLostTest.java index e74e465a5d..1198e8d11d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/AltarOfTheLostTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/AltarOfTheLostTest.java @@ -7,15 +7,22 @@ import org.mage.test.player.TestPlayer; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.a.AltarOfTheLost Altar of the Lost} + * {3} + * Artifact + * Altar of the Lost enters the battlefield tapped. + * {T}: Add two mana in any combination of colors. + * Spend this mana only to cast spells with flashback from a graveyard. * * @author BetaSteward */ public class AltarOfTheLostTest extends CardTestPlayerBase { + /** + * Test that the mana can be used to cast the spell from the graveyard using flashback. + */ @Test - public void testCard() { - // Altar of the Lost enters the battlefield tapped. - // {tap}: Add two mana in any combination of colors. Spend this mana only to cast spells with flashback from a graveyard. + public void testFlashback() { addCard(Zone.BATTLEFIELD, playerA, "Altar of the Lost"); // Put two 1/1 white Spirit creature tokens with flying onto the battlefield. // Flashback {1}{B} @@ -31,28 +38,22 @@ public class AltarOfTheLostTest extends CardTestPlayerBase { setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); assertPermanentCount(playerA, "Spirit Token", 2); } + /** + * Test that the same card cannot be cast from the hand even though it has a flashback ability. + */ @Test - public void testCard1() { - addCard(Zone.BATTLEFIELD, playerA, "Plains"); + public void testCantCastFromHand() { + addCard(Zone.BATTLEFIELD, playerA, "Plains",2 ); addCard(Zone.BATTLEFIELD, playerA, "Altar of the Lost"); addCard(Zone.HAND, playerA, "Lingering Souls"); - setChoice(playerA, "X=0"); - setChoice(playerA, "X=0"); - setChoice(playerA, "X=2"); - setChoice(playerA, TestPlayer.CHOICE_SKIP); - - castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Lingering Souls"); + checkPlayableAbility("mana not available", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lingering", false); setStopAt(3, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); assertPermanentCount(playerA, "Spirit Token", 0); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/FaithsShieldTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/FaithsShieldTest.java index 42af5ed049..7bd4a32174 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/FaithsShieldTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/dka/FaithsShieldTest.java @@ -2,9 +2,13 @@ package org.mage.test.cards.single.dka; import mage.constants.PhaseStep; import mage.constants.Zone; +import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; +import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.fail; + /** * * also tests regenerate and @@ -27,15 +31,25 @@ public class FaithsShieldTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Faith's Shield"); addCard(Zone.HAND, playerA, "Lightning Bolt"); - setChoice(playerA, "Red"); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Faith's Shield", "White Knight"); - castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "White Knight"); + setChoice(playerA, "Red"); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt"); + addTarget(playerA, "White Knight"); setStopAt(1, PhaseStep.END_TURN); - execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); + try { + execute(); + Assert.fail("must throw exception on execute"); + } catch (Throwable e) { + if (!e.getMessage().contains("setup good targets")) { + Assert.fail("must throw error about bad targets, but got:\n" + e.getMessage()); + } + } + assertPermanentCount(playerA, "White Knight", 1); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/fut/DaybreakCoronetTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/fut/DaybreakCoronetTest.java index f32abed363..2c0e1a7f31 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/fut/DaybreakCoronetTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/fut/DaybreakCoronetTest.java @@ -7,33 +7,29 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.d.DaybreakCoronet Daybreak Coronet} + * {W}{W} + * Enchantment — Aura + * Enchant creature with another Aura attached to it + * Enchanted creature gets +3/+3 and has first strike, vigilance, and lifelink. + * (Damage dealt by the creature also causes its controller to gain that much life.) * * @author LevelX2 */ public class DaybreakCoronetTest extends CardTestPlayerBase { - // Daybreak Coronet {W}{W} - // Enchantment — Aura - // Enchant creature with another Aura attached to it - // Enchanted creature gets +3/+3 and has first strike, vigilance, and lifelink. (Damage dealt by the creature also causes its controller to gain that much life.) - - @Test public void testCantEnchantTargetWithoutAura() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); addCard(Zone.HAND, playerA, "Daybreak Coronet"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daybreak Coronet", "Silvercoat Lion"); + checkPlayableAbility("can't cast coronet", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Daybreak", false); setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); - assertPermanentCount(playerA, "Daybreak Coronet", 0); - } @Test @@ -50,17 +46,14 @@ public class DaybreakCoronetTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); - assertPermanentCount(playerA, "Daybreak Coronet", 1); - } - /* - If Daybreak Coronet is already attached to a permanent and - the other aura is destroyed. The target for Daybreak Coronet - gets illegal and the Daybreak Coronet has to go to graveyard. - */ + + /** + * If all other Auras attached to the enchanted creature stop enchanting it, + * Daybreak Coronet will be attached to an illegal permanent and will be put into its owner’s graveyard. + * (2007-05-01) + */ @Test public void testTargetGetsIllegal() { addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); @@ -79,13 +72,9 @@ public class DaybreakCoronetTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.END_TURN); execute(); - assertLife(playerA, 20); - assertLife(playerB, 20); - assertGraveyardCount(playerA, "Holy Strength", 1); assertGraveyardCount(playerB, "Demystify", 1); assertPermanentCount(playerA, "Daybreak Coronet", 0); assertGraveyardCount(playerA, "Daybreak Coronet", 1); - } } 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 14839d1373..efdbf00340 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 @@ -36,7 +36,6 @@ public class JacesMindseekerTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jace's Mindseeker"); addTarget(playerA, playerB); setChoice(playerA, true); - setChoice(playerA, "Lightning Bolt"); addTarget(playerA, playerB); setStopAt(1, PhaseStep.BEGIN_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/ChaliceOfTheVoidTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/ChaliceOfTheVoidTest.java index 7ffc7f4263..f4dbc5cc8f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/ChaliceOfTheVoidTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/mrd/ChaliceOfTheVoidTest.java @@ -53,7 +53,8 @@ public class ChaliceOfTheVoidTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chalice of the Void"); setChoice(playerA, "X=1"); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Mental Misstep", "Chalice of the Void", "Chalice of the Void"); + checkPlayableAbility("can't Mental Misstep", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Mental", false); +// castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Mental Misstep", "Chalice of the Void", "Chalice of the Void"); setStrictChooseMode(true); setStopAt(1, PhaseStep.BEGIN_COMBAT); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/WolfOfDevilsBreachTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/WolfOfDevilsBreachTest.java index 158b21cec3..647ae77cb2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/WolfOfDevilsBreachTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/soi/WolfOfDevilsBreachTest.java @@ -47,10 +47,11 @@ public class WolfOfDevilsBreachTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Bronze Sable", 1); // (2) 2/1 addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1); // 2/2 + setStrictChooseMode(true); attack(1, playerA, "Wolf of Devil's Breach"); - setChoice(playerA, false); - setChoice(playerA, "Bronze Sable"); addTarget(playerA, "Grizzly Bears"); + setChoice(playerA, false); + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/zen/InfernoTrapTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/zen/InfernoTrapTest.java index 7fb60eadf9..f9a89ae474 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/zen/InfernoTrapTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/zen/InfernoTrapTest.java @@ -7,6 +7,12 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.i.InfernoTrap Inferno Trap} + * {3}{R} + * Instant — Trap + * + * If you’ve been dealt damage by two or more creatures this turn, you may pay {R} rather than pay this spell’s mana cost. + * Inferno Trap deals 4 damage to target creature. * * @author LevelX2 */ @@ -15,16 +21,15 @@ public class InfernoTrapTest extends CardTestPlayerBase { @Test public void testTwoDamageStepsCountOnlyAsOneCreature() { addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); - // If you've been dealt damage by two or more creatures this turn, you may pay {R} rather than pay Inferno Trap's mana cost. - // Inferno Trap deals 4 damage to target creature. - addCard(Zone.HAND, playerA, "Inferno Trap"); // Instant {3}{R} + // Instant {3}{R} + addCard(Zone.HAND, playerA, "Inferno Trap"); - // Flying, double strike - addCard(Zone.BATTLEFIELD, playerB, "Skyhunter Skirmisher"); // 1/1 + // Flying, double strike 1/1 + addCard(Zone.BATTLEFIELD, playerB, "Skyhunter Skirmisher"); attack(2, playerB, "Skyhunter Skirmisher"); - castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Inferno Trap", "Skyhunter Skirmisher"); + checkPlayableAbility("Inferno Trap not reduced", 2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Inferno", false); setStopAt(2, PhaseStep.END_TURN); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/BonecladNecromancerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/BonecladNecromancerTest.java index ace78c7fec..8921523ba7 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/BonecladNecromancerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/BonecladNecromancerTest.java @@ -6,18 +6,19 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** + * {@link mage.cards.b.BonecladNecromancer Boneclad Necromancer} + * P/T 3/3 + * {3}{B}{B} + * Creature — Human Wizard + * When Boneclad Necromancer enters the battlefield, you may exile target creature card from a graveyard. + * If you do, create a 2/2 black Zombie creature token. + * + * * Added this test class to test issue #5875 * https://github.com/magefree/mage/issues/5875 * * Boneclad Necromancer could exile non-creature cards from the graveyard to get his 2/2 Zombie. * - * Boneclad Necromancer {3}{B}{B} - * - * Card Type: Creature — Human Wizard - * P / T: 3 / 3 - * Description: When Boneclad Necromancer enters the battlefield, you may exile target creature card from a graveyard. - * If you do, create a 2/2 black Zombie creature token. - * * @author jgray1206 */ public class BonecladNecromancerTest extends CardTestPlayerBase { @@ -28,8 +29,12 @@ public class BonecladNecromancerTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Boneclad Necromancer", 1); addCard(Zone.GRAVEYARD, playerA, "Raptor Hatchling", 1); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer"); - playerA.addChoice("Raptor Hatchling"); + addTarget(playerA,"Raptor Hatchling"); + setChoice(playerA, "Yes"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -45,8 +50,12 @@ public class BonecladNecromancerTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Boneclad Necromancer", 1); addCard(Zone.GRAVEYARD, playerB, "Raptor Hatchling", 1); + setStrictChooseMode(true); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer"); - playerA.addChoice("Raptor Hatchling"); + addTarget(playerA,"Raptor Hatchling"); + setChoice(playerA, "Yes"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -63,7 +72,7 @@ public class BonecladNecromancerTest extends CardTestPlayerBase { addCard(Zone.GRAVEYARD, playerA, "Feral Invocation", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boneclad Necromancer"); - playerA.addChoice("Feral Invocation"); + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/delayed/PostMortemLungeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/delayed/PostMortemLungeTest.java index bb9dbe6143..f2af0ab763 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/triggers/delayed/PostMortemLungeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/triggers/delayed/PostMortemLungeTest.java @@ -16,7 +16,6 @@ public class PostMortemLungeTest extends CardTestPlayerBase { */ @Test public void testExilesCreatureAtEndStep() { - /* {X}{B/P} - Sorcery Return target creature card with converted mana cost X from your graveyard to the battlefield. @@ -25,16 +24,14 @@ public class PostMortemLungeTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Postmortem Lunge"); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); addCard(Zone.GRAVEYARD, playerA, "Elite Vanguard"); // {W} 2/1 creature - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Postmortem Lunge"); - addTarget(playerA, "Elite Vanguard"); - setChoice(playerA, "Elite Vanguard"); - + attack(1, playerA, "Elite Vanguard"); - + setStopAt(1, PhaseStep.CLEANUP); execute(); - + assertLife(playerB, 18); assertGraveyardCount(playerA, "Postmortem Lunge", 1); assertExileCount("Elite Vanguard", 1); diff --git a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRange1Test.java b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRange1Test.java index c62bb027ca..0a085b3a76 100644 --- a/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRange1Test.java +++ b/Mage.Tests/src/test/java/org/mage/test/multiplayer/PlayerLeftGameRange1Test.java @@ -161,8 +161,6 @@ public class PlayerLeftGameRange1Test 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(3, playerC, "Silvercoat Lion", playerB); castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerC, "Silvercoat Lion"); @@ -291,6 +289,9 @@ public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); addCard(Zone.LIBRARY, playerA, "Pillarfield Ox", 1); + addCard(Zone.BATTLEFIELD, playerB, "Island", 3); + addCard(Zone.BATTLEFIELD, playerB, "Proteus Staff", 1); + addCard(Zone.BATTLEFIELD, playerD, "Island", 3); // {2}{U}, {T}: Put target creature on the bottom of its owner's library. That creature's controller reveals cards from the // top of their library until they reveal a creature card. The player puts that card onto the battlefield and the @@ -305,9 +306,6 @@ public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase { addCard(Zone.BATTLEFIELD, playerC, "Wall of Air", 1); addCard(Zone.LIBRARY, playerC, "Wind Drake", 2); - addCard(Zone.BATTLEFIELD, playerB, "Island", 3); - addCard(Zone.BATTLEFIELD, playerB, "Proteus Staff", 1); - skipInitShuffling(); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pithing Needle"); @@ -316,12 +314,23 @@ public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase { activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerD, "{2}{U}", "Silvercoat Lion"); // not allowed activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerC, "{2}{U}", "Eager Cadet"); // allowed because Needle out of range + + // Concede the game concede(3, PhaseStep.POSTCOMBAT_MAIN, playerA); activateAbility(4, PhaseStep.PRECOMBAT_MAIN, playerB, "{2}{U}", "Wall of Air"); // allowed because Needle lost game setStopAt(4, PhaseStep.POSTCOMBAT_MAIN); - execute(); + + try { + execute(); + assertAllCommandsUsed(); + Assert.fail("must throw exception on execute"); + } catch (Throwable e) { + if (!e.getMessage().contains("Player PlayerD must have 0 actions but found 1")) { + Assert.fail("must throw error PlayerD canot acting, but got:\n" + e.getMessage()); + } + } assertLife(playerA, 2); Assert.assertFalse("Player A is no longer in the game", playerA.isInGame());