More assertAllCommandsUsed() test fixes.

This commit is contained in:
Alex Vasile 2022-05-17 21:43:04 -06:00
parent 895a318dee
commit 3a098270fb
48 changed files with 437 additions and 366 deletions

View file

@ -6,6 +6,10 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.b.BanisherPriest Banisher Pries}
* {1}{W}{W}
* Creature Human Cleric 2/2,
* When Banisher Priest enters the battlefield, exile target creature an opponent controls until Banisher Priest leaves the battlefield.
* *
* @author LevelX2 * @author LevelX2
*/ */
@ -20,11 +24,6 @@ public class BanisherPriestTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
/**
* Banisher Pries
* Creature Human Cleric 2/2, 1WW
* When Banisher Priest enters the battlefield, exile target creature an opponent controls until Banisher Priest leaves the battlefield.
*/
addCard(Zone.HAND, playerA, "Banisher Priest"); addCard(Zone.HAND, playerA, "Banisher Priest");
addCard(Zone.HAND, playerB, "Incinerate"); addCard(Zone.HAND, playerB, "Incinerate");
@ -65,11 +64,6 @@ public class BanisherPriestTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
/**
* Banisher Priest
* Creature Human Cleric 2/2, 1WW
* When Banisher Priest enters the battlefield, exile target creature an opponent controls until Banisher Priest leaves the battlefield.
*/
addCard(Zone.HAND, playerA, "Banisher Priest"); addCard(Zone.HAND, playerA, "Banisher Priest");
addCard(Zone.HAND, playerB, "Incinerate"); addCard(Zone.HAND, playerB, "Incinerate");
@ -107,41 +101,31 @@ public class BanisherPriestTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testBanisherPriestToken() { public void testBanisherPriestToken() {
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
/**
* Banisher Priest
* Creature Human Cleric 2/2, 1WW
* When Banisher Priest enters the battlefield, exile target creature an opponent controls until Banisher Priest leaves the battlefield.
*/
addCard(Zone.GRAVEYARD, playerB, "Banisher Priest"); addCard(Zone.GRAVEYARD, playerB, "Banisher Priest");
/** /**
* Seance {2}{W}{W} * Seance
* {2}{W}{W}
* Enchantment * Enchantment
* At the beginning of each upkeep, you may exile target creature card from your graveyard. * At the beginning of each upkeep, you may exile target creature card from your graveyard.
* If you do, put a token onto the battlefield that's a copy of that card except it's a * If you do, put a token onto the battlefield that's a copy of that card except it's a
* Spirit in addition to its other types. Exile it at the beginning of the next end step. * Spirit in addition to its other types.
* Exile it at the beginning of the next end step.
*/ */
addCard(Zone.BATTLEFIELD, playerB, "Seance"); addCard(Zone.BATTLEFIELD, playerB, "Seance");
playerB.addChoice("Banisher Priest"); // return the Banisher Priest from graveyard with Seance addTarget(playerB, "Banisher Priest"); // Return the Banisher Priest from graveyard with Seance
playerB.addChoice("Silvercoat Lion"); // Exile the Silvercoat Lion with the triggered ability of the Banisher Priest token // The Silvercoat Lion is autochosen for Banisher Priest's ETB since it's the only creature on the opponent's board
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
// Banisher Priest should be in exile // Banisher Priest should be in exile
assertExileCount("Banisher Priest", 1); assertExileCount("Banisher Priest", 1);
// Token ceased to exist // Token ceased to exist
assertPermanentCount(playerB, "Banisher Priest", 0); assertPermanentCount(playerB, "Banisher Priest", 0);
// Silvercoat Lion should be back on battlefield // Silvercoat Lion should be back on battlefield
assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1);
} }
} }

View file

@ -30,7 +30,8 @@ public class AffinityForArtifactsTest extends CardTestPlayerBase {
} }
/** /**
* Tests that cost wasn't reduced too much. 3 Mountains is not enough to cast Myr Enforcer. * Tests that cost wasn't reduced too much.
* 3 Mountains is not enough to cast Myr Enforcer.
*/ */
@Test @Test
public void testCorrectCostReduction() { public void testCorrectCostReduction() {
@ -39,7 +40,7 @@ public class AffinityForArtifactsTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Myr Enforcer", 3); addCard(Zone.BATTLEFIELD, playerA, "Myr Enforcer", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Enforcer"); checkPlayableAbility("Not enough mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Myr", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -79,7 +79,6 @@ public class CascadeTest extends CardTestPlayerBase {
// won't trigger. // won't trigger.
@Test @Test
public void testEmptyLibraryCascasde() { public void testEmptyLibraryCascasde() {
playerA.getLibrary().clear(); playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Plains", 10); addCard(Zone.LIBRARY, playerA, "Plains", 10);
@ -104,7 +103,6 @@ public class CascadeTest extends CardTestPlayerBase {
@Test @Test
public void testEmptyLibraryCascasdeNexus() { public void testEmptyLibraryCascasdeNexus() {
playerA.getLibrary().clear(); playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Plains", 2); addCard(Zone.LIBRARY, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus"); addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus");
@ -135,7 +133,6 @@ public class CascadeTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testRecastCascadeCard() { public void testRecastCascadeCard() {
playerA.getLibrary().clear(); playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2); addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
@ -169,7 +166,6 @@ public class CascadeTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testHaveToPayAdditionalCosts() { public void testHaveToPayAdditionalCosts() {
playerA.getLibrary().clear(); playerA.getLibrary().clear();
// Choose one - // Choose one -
// - You draw five cards and you lose 5 life; // - You draw five cards and you lose 5 life;
@ -202,39 +198,38 @@ public class CascadeTest extends CardTestPlayerBase {
} }
/** /**
* Cascade work with split cards, cmc = total of halfs. * Cascade work with split cards, mana cost = total of halfs.
* *
* For example: Ardent Plea + Breaking/Entering * For example: Ardent Plea + Breaking/Entering
*/ */
@Test @Test
public void testWithSplitSpell() { public void testWithSplitSpell() {
playerA.getLibrary().clear(); playerA.getLibrary().clear();
// Breaking - Target player puts the top eight cards of their library into their graveyard. // Breaking - Target player puts the top eight cards of their library into their graveyard.
// Entering - Put a creature card from a graveyard onto the battlefield under your control. It gains haste until end of turn. // Entering - Put a creature card from a graveyard onto the battlefield under your control.
// It gains haste until end of turn.
// Fuse (You may cast one or both halves of this card from your hand.) // Fuse (You may cast one or both halves of this card from your hand.)
addCard(Zone.LIBRARY, playerA, "Breaking // Entering", 1); // Sorcery {U}{B} // {4}{U}{B} addCard(Zone.LIBRARY, playerA, "Breaking // Entering", 1); // Sorcery {U}{B} // {4}{U}{B}
// addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
// Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.) // Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
// Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less. You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.) // Cascade (When you cast this spell, exile cards from the top of your library until you exile a nonland card that costs less.
// You may cast it without paying its mana cost. Put the exiled cards on the bottom in a random order.)
addCard(Zone.HAND, playerA, "Ardent Plea"); // Enchantment {1}{W}{U} addCard(Zone.HAND, playerA, "Ardent Plea"); // Enchantment {1}{W}{U}
setStrictChooseMode(true);
// When the spell is cast, you cascade, but the only spell you could find is "Breaking // Entering",
// but it can't be cast since the mana cost for a spliot it's mana cost of the card is the sum of both halves (8 here)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ardent Plea"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ardent Plea");
setChoice(playerA, true);
addTarget(playerA, playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertPermanentCount(playerA, "Ardent Plea", 1); assertPermanentCount(playerA, "Ardent Plea", 1);
assertGraveyardCount(playerA, "Breaking // Entering", 0); assertGraveyardCount(playerA, "Breaking // Entering", 0);
assertLibraryCount(playerA, "Breaking // Entering", 1);
assertGraveyardCount(playerB, 0);
} }
} }

View file

@ -2,6 +2,7 @@ package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -32,10 +33,20 @@ public class MeldTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Bruna, the Fading Light"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Bruna, the Fading Light");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Gisela, the Broken Blade"); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Gisela, the Broken Blade");
castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); // Can't cast it because of Gisela
setStopAt(4, PhaseStep.BEGIN_COMBAT); setStopAt(4, PhaseStep.BEGIN_COMBAT);
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("Should have thrown error about cannot attack, but got:\n" + e.getMessage());
}
}
assertPermanentCount(playerA, "Brisela, Voice of Nightmares", 1); assertPermanentCount(playerA, "Brisela, Voice of Nightmares", 1);
assertPermanentCount(playerA, "Bruna, the Fading Light", 0); assertPermanentCount(playerA, "Bruna, the Fading Light", 0);

View file

@ -170,22 +170,16 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Island", 4); addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
setChoice(playerA, true); // cast it face down as 2/2 creature
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
setChoice(playerB, true); // use to copy a nonland permanent
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString()); // Morphed creature
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertLife(playerB, 20);
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1); assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2); assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1); assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
assertPowerToughness(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2); assertPowerToughness(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
} }
/** /**
@ -311,7 +305,7 @@ public class MorphTest extends CardTestPlayerBase {
public void testCounterCastWithMorphEffect() { public void testCounterCastWithMorphEffect() {
// Sagu Mauler 6/6 - Creature - Beast // Sagu Mauler 6/6 - Creature - Beast
// Trample, hexproof // Trample, hexproof
// Morph {3}{G}{B} (You may cast this card face down as a 2/2 creature for . Turn it face up any time for its morph cost.) // Morph {3}{G}{B} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)
addCard(Zone.HAND, playerA, "Sagu Mauler"); addCard(Zone.HAND, playerA, "Sagu Mauler");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3); addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
@ -324,7 +318,7 @@ public class MorphTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler");
setChoice(playerA, true); // cast it face down as 2/2 creature setChoice(playerA, true); // cast it face down as 2/2 creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Disdainful Stroke", "Sagu Mauler"); checkPlayableAbility("Can't Disdainful Stroke Sagu", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Disdainful", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -651,18 +645,25 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Island"); addCard(Zone.BATTLEFIELD, playerB, "Island");
addCard(Zone.BATTLEFIELD, playerB, "Mountain"); addCard(Zone.BATTLEFIELD, playerB, "Mountain");
setStrictChooseMode(true);
// return to hand // return to hand
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage");
addTarget(playerA, "Rattleclaw Mystic"); addTarget(playerA, "Rattleclaw Mystic");
// try cast as normal -- must not work // try cast as normal -- must not work
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rattleclaw Mystic"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Rattleclaw Mystic");
setChoice(playerB, false); // try cast as normal setChoice(playerB, false);
//setStrictChooseMode(true); // no strict mode - cause can't cast as normal
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
//assertAllCommandsUsed(); try {
execute();
} catch (Throwable e) {
if (!e.getMessage().contains("Can't find available command - activate:Cast Rattleclaw Mystic (use checkPlayableAbility for \"non available\" checks)")) {
Assert.fail("Should have gotten an error about not being able to cast Rattleclaw, but got:\n" + e.getMessage());
}
}
assertPermanentCount(playerA, "Reflector Mage", 1); assertPermanentCount(playerA, "Reflector Mage", 1);
assertPermanentCount(playerB, "Rattleclaw Mystic", 0); assertPermanentCount(playerB, "Rattleclaw Mystic", 0);

View file

@ -42,7 +42,7 @@ public class RetraceTest extends CardTestPlayerBase {
} }
/** /**
* Test that it does cost {B}{1} + land discard * Test that it does cost {1}{B} + land discard
*/ */
@Test @Test
public void RetraceCostIncreaseCantPay() { public void RetraceCostIncreaseCantPay() {
@ -56,7 +56,7 @@ public class RetraceTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Thalia, Guardian of Thraben", 1); addCard(Zone.BATTLEFIELD, playerB, "Thalia, Guardian of Thraben", 1);
addCard(Zone.HAND, playerB, "Silvercoat Lion", 1); addCard(Zone.HAND, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raven's Crime", playerB); checkPlayableAbility("Check price increase", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Raven's", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -76,20 +76,22 @@ public class SuspendTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); addCard(Zone.HAND, playerA, "Silvercoat Lion", 1);
// Instant {1}{U} // Instant {1}{U}
// Counter target spell. If the spell is countered this way, exile it with three time counters on it instead of putting it into its owner's graveyard. If it doesn't have suspend, it gains suspend. (At the beginning of its owner's upkeep, remove a counter from that card. When the last is removed, the player plays it without paying its mana cost. If it's a creature, it has haste.) // Counter target spell.
// If the spell is countered this way, exile it with three time counters on it instead of putting it into its owner's graveyard.
// If it doesn't have suspend, it gains suspend.
// (At the beginning of its owner's upkeep, remove a counter from that card.
// When the last is removed, the player plays it without paying its mana cost. If it's a creature, it has haste.)
addCard(Zone.HAND, playerB, "Delay", 1); addCard(Zone.HAND, playerB, "Delay", 1);
addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Delay", "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Delay", "Silvercoat Lion");
setChoice(playerA, "Silvercoat Lion");
setStopAt(7, PhaseStep.BEGIN_COMBAT); setStopAt(7, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertGraveyardCount(playerB, "Delay", 1); assertGraveyardCount(playerB, "Delay", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1);
} }
@Test @Test
@ -123,7 +125,8 @@ public class SuspendTest extends CardTestPlayerBase {
// Target player draws three cards. // Target player draws three cards.
addCard(Zone.HAND, playerA, "Ancestral Vision", 1); addCard(Zone.HAND, playerA, "Ancestral Vision", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ancestral Vision", playerA); checkPlayableAbility("Can't cast directly", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Ancestral", false);
// castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ancestral Vision", playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -45,7 +45,6 @@ public class TransformTest extends CardTestPlayerBase {
assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 4); assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 4);
assertPermanentCount(playerA, "Forest", 6); assertPermanentCount(playerA, "Forest", 6);
assertPermanentCount(playerA, "Swamp", 1); assertPermanentCount(playerA, "Swamp", 1);
} }
@Test @Test
@ -74,7 +73,6 @@ public class TransformTest extends CardTestPlayerBase {
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3); assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
assertPermanentCount(playerA, "Zombie Token", 1); assertPermanentCount(playerA, "Zombie Token", 1);
} }
/** /**
@ -106,7 +104,6 @@ public class TransformTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Silvercoat Lion", 1); assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerA, "Liliana, Heretical Healer", 1); assertGraveyardCount(playerA, "Liliana, Heretical Healer", 1);
} }
@Test @Test
@ -433,7 +430,8 @@ public class TransformTest extends CardTestPlayerBase {
public void testCopyTransformedThingInTheIce() { public void testCopyTransformedThingInTheIce() {
// Defender // Defender
// Thing in the Ice enters the battlefield with four ice counters on it. // Thing in the Ice enters the battlefield with four ice counters on it.
// Whenever you cast an instant or sorcery spell, remove an ice counter from Thing in the Ice. Then if it has no ice counters on it, transform it. // Whenever you cast an instant or sorcery spell, remove an ice counter from Thing in the Ice.
// Then if it has no ice counters on it, transform it.
addCard(Zone.HAND, playerA, "Thing in the Ice"); // Creature {1}{U} addCard(Zone.HAND, playerA, "Thing in the Ice"); // Creature {1}{U}
// Creatures you control get +1/+0 until end of turn. // Creatures you control get +1/+0 until end of turn.
addCard(Zone.HAND, playerA, "Banners Raised", 4); // Creature {R} addCard(Zone.HAND, playerA, "Banners Raised", 4); // Creature {R}
@ -453,7 +451,6 @@ public class TransformTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Banners Raised");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
addTarget(playerB, "Awoken Horror");
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -48,7 +48,10 @@ public class TransmuteTest extends CardTestPlayerBase {
public void searchSplittedCardOneManaCmcSpell() { public void searchSplittedCardOneManaCmcSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// Target creature gets -3/-0 until end of turn. // Target creature gets -3/-0 until end of turn.
// Transmute {1}{U}{U} ({1}{U}{U}, Discard this card: Search your library for a card with the same converted mana cost as this card, reveal it, and put it into your hand. Then shuffle your library. Transmute only as a sorcery.) // Transmute {1}{U}{U} ({1}{U}{U}, Discard this card: Search your library for a card with the same
// converted mana cost as this card, reveal it, and put it into your hand.
// Then shuffle your library.
// Transmute only as a sorcery.)
addCard(Zone.HAND, playerA, "Dizzy Spell"); // Instant {U} addCard(Zone.HAND, playerA, "Dizzy Spell"); // Instant {U}
// Wear {1}{R} // Wear {1}{R}
@ -58,7 +61,7 @@ public class TransmuteTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, "Wear // Tear"); addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}"); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}");
setChoice(playerA, "Wear // Tear"); // let the game choose targets
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -82,7 +85,7 @@ public class TransmuteTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, "Wear // Tear"); addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{B}"); activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{B}");
setChoice(playerA, "Wear // Tear"); addTarget(playerA, "Wear // Tear");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -90,5 +93,4 @@ public class TransmuteTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Perplex", 1); assertGraveyardCount(playerA, "Perplex", 1);
assertHandCount(playerA, "Wear // Tear", 1); assertHandCount(playerA, "Wear // Tear", 1);
} }
} }

View file

@ -6,11 +6,17 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.s.SurgicalExtraction Surgical Extraction}
* {B/P}
* Instant
* ({B/P} can be paid with either {B} or 2 life.)
* Choose target card in a graveyard other than a basic land card.
* Search its owners graveyard, hand, and library for any number of cards with the same name as that card and exile them.
* Then that player shuffles.
* *
* @author LevelX2 * @author LevelX2
*/ */
public class SurgicalExtractionTest extends CardTestPlayerBase { public class SurgicalExtractionTest extends CardTestPlayerBase {
/** /**
* I noticed that surgical extraction did not allow me to select any cards * I noticed that surgical extraction did not allow me to select any cards
* to exile when I targeted breaking // entering. It did however allow my * to exile when I targeted breaking // entering. It did however allow my
@ -19,21 +25,19 @@ public class SurgicalExtractionTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testSearchAndExileSplitCards() { public void testSearchAndExileSplitCards() {
// Choose target card in a graveyard other than a basic land card. Search its owner's graveyard,
// hand, and library for any number of cards with the same name as that card and exile them.
// Then that player shuffles their library.
addCard(Zone.HAND, playerA, "Surgical Extraction", 1); // Instant {B/P} addCard(Zone.HAND, playerA, "Surgical Extraction", 1); // Instant {B/P}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.GRAVEYARD, playerB, "Breaking // Entering", 2); addCard(Zone.GRAVEYARD, playerB, "Breaking // Entering", 2);
addCard(Zone.HAND, playerB, "Breaking // Entering", 1); addCard(Zone.HAND, playerB, "Breaking // Entering", 1);
addCard(Zone.LIBRARY, playerB, "Breaking // Entering", 1); addCard(Zone.LIBRARY, playerB, "Breaking // Entering", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Surgical Extraction", "Breaking // Entering"); setStrictChooseMode(true);
addTarget(playerA, "Breaking // Entering^Breaking // Entering"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Surgical Extraction", "Breaking // Entering");
addTarget(playerA, "Breaking // Entering"); setChoice(playerA, "Yes"); // Pay 2 life to cast instead of {B}
setChoice(playerA, "Breaking // Entering"); addTarget(playerA, "Breaking // Entering^Breaking // Entering"); // Graveyard
addTarget(playerA, "Breaking // Entering"); // Hand
addTarget(playerA, "Breaking // Entering"); // Library
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -45,6 +49,5 @@ public class SurgicalExtractionTest extends CardTestPlayerBase {
assertHandCount(playerB, "Breaking // Entering", 0); assertHandCount(playerB, "Breaking // Entering", 0);
assertExileCount(playerB, "Breaking // Entering", 4); assertExileCount(playerB, "Breaking // Entering", 4);
} }
} }

View file

@ -44,16 +44,10 @@ public class AlchemistsRefugeTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains"); addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.HAND, playerA, "Elite Vanguard"); addCard(Zone.HAND, playerA, "Elite Vanguard");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard"); checkPlayableAbility("flash on B's turn", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Elite", false);
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
// it shouldn't be possible, so no Elite Vanguard on the battlefield
assertPermanentCount(playerA, "Elite Vanguard", 0);
} }
/** /**
@ -68,15 +62,9 @@ public class AlchemistsRefugeTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Elite Vanguard"); addCard(Zone.HAND, playerA, "Elite Vanguard");
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}{U}, {T}:"); activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}{U}, {T}:");
castSpell(4, PhaseStep.PRECOMBAT_MAIN, playerA, "Elite Vanguard"); checkPlayableAbility("flash on B's turn", 4, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Elite", false);
setStopAt(4, PhaseStep.BEGIN_COMBAT); setStopAt(4, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Elite Vanguard", 0);
} }
} }

View file

@ -6,6 +6,14 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* Vizier of the Menagerie
* {3}{G}
* Creature Naga Cleric
* P/T
*
* You may look at the top card of your library any time.
* You may cast creature spells from the top of your library.
* You may spend mana as though it were mana of any type to cast creature spells.
* *
* @author LevelX2 * @author LevelX2
*/ */
@ -40,23 +48,28 @@ public class CastFromLibraryTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Vizier of the Menagerie", 1); assertPermanentCount(playerA, "Vizier of the Menagerie", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertLibraryCount(playerA, "Silvercoat Lion", 1); assertLibraryCount(playerA, "Silvercoat Lion", 1);
} }
@Test @Test
public void testVizierOfTheMenagerieWithDryadArbor() { public void testVizierOfTheMenagerieWithDryadArbor() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 8); addCard(Zone.BATTLEFIELD, playerA, "Forest", 8);
addCard(Zone.LIBRARY, playerA, "Dryad Arbor", 2); addCard(Zone.LIBRARY, playerA, "Dryad Arbor", 2);
// You may look at the top card of your library. (You may do this at any time.) // Added so that neither of the Dryad Arbors end up in the hand.
// You may cast the top card of your library if it's a creature card. addCard(Zone.LIBRARY, playerA, "Forest", 1);
// 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} addCard(Zone.HAND, playerA, "Vizier of the Menagerie", 1); // Creature 3/4 {3}{G}
skipInitShuffling(); skipInitShuffling();
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vizier of the Menagerie"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vizier of the Menagerie");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Dryad Arbor"); waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Dryad Arbor");
checkPlayableAbility("Can't cast Dryad Arbor", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Dryad", false);
checkPlayableAbility("Can't cast Dryad Arbor", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Dryad", false);
checkPlayableAbility("Can't cast Dryad Arbor", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Dryad", false);
checkPlayableAbility("Can't cast Dryad Arbor", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Play Dryad", false);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
@ -64,6 +77,5 @@ public class CastFromLibraryTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Vizier of the Menagerie", 1); assertPermanentCount(playerA, "Vizier of the Menagerie", 1);
assertPermanentCount(playerA, "Dryad Arbor", 0); // can't be cast, only played assertPermanentCount(playerA, "Dryad Arbor", 0); // can't be cast, only played
assertLibraryCount(playerA, "Dryad Arbor", 2); assertLibraryCount(playerA, "Dryad Arbor", 2);
} }
} }

View file

@ -13,6 +13,9 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/ */
public class YevaNaturesHeraldTest extends CardTestPlayerBase { public class YevaNaturesHeraldTest extends CardTestPlayerBase {
/**
* Yeva's ability should work when its on the battlefield.
*/
@Test @Test
public void testOnBattlefield() { public void testOnBattlefield() {
addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald"); addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald");
@ -27,13 +30,16 @@ public class YevaNaturesHeraldTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Llanowar Elves", 1); assertPermanentCount(playerA, "Llanowar Elves", 1);
} }
/**
* Yeva's ability should not work on Non-Green creatures.
*/
@Test @Test
public void testNonGreen() { public void testNonGreen() {
addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald"); addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald");
addCard(Zone.BATTLEFIELD, playerA, "Plains"); addCard(Zone.BATTLEFIELD, playerA, "Plains");
addCard(Zone.HAND, playerA, "Elite Vanguard"); addCard(Zone.HAND, playerA, "Elite Vanguard");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Elite Vanguard"); checkPlayableAbility("Can't flash", 1, PhaseStep.BEGIN_COMBAT, playerA, "Elite Vanguard", false);
setStopAt(1, PhaseStep.END_COMBAT); setStopAt(1, PhaseStep.END_COMBAT);
execute(); execute();
@ -41,6 +47,9 @@ public class YevaNaturesHeraldTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Elite Vanguard", 0); assertPermanentCount(playerA, "Elite Vanguard", 0);
} }
/**
* Yeva's ability should not work when it's not on the battlefield.
*/
@Test @Test
public void testOtherZones() { public void testOtherZones() {
addCard(Zone.GRAVEYARD, playerA, "Yeva, Nature's Herald"); addCard(Zone.GRAVEYARD, playerA, "Yeva, Nature's Herald");
@ -49,7 +58,7 @@ public class YevaNaturesHeraldTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Forest"); addCard(Zone.BATTLEFIELD, playerA, "Forest");
addCard(Zone.HAND, playerA, "Llanowar Elves"); addCard(Zone.HAND, playerA, "Llanowar Elves");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Llanowar Elves"); checkPlayableAbility("Can't flash", 1, PhaseStep.BEGIN_COMBAT, playerA, "Cast Llanowar", false);
setStopAt(1, PhaseStep.END_COMBAT); setStopAt(1, PhaseStep.END_COMBAT);
execute(); execute();
@ -57,6 +66,9 @@ public class YevaNaturesHeraldTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Llanowar Elves", 0); assertPermanentCount(playerA, "Llanowar Elves", 0);
} }
/**
* After Yeva is gone its ability should be gone.
*/
@Test @Test
public void testEffectGetRemovedOnExile() { public void testEffectGetRemovedOnExile() {
addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald"); addCard(Zone.BATTLEFIELD, playerA, "Yeva, Nature's Herald");
@ -66,7 +78,7 @@ public class YevaNaturesHeraldTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Path to Exile"); addCard(Zone.HAND, playerA, "Path to Exile");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Path to Exile", "Yeva, Nature's Herald"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Path to Exile", "Yeva, Nature's Herald");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Llanowar Elves"); checkPlayableAbility("Can't flash", 1, PhaseStep.BEGIN_COMBAT, playerA, "Cast Llanowar", false);
setStopAt(1, PhaseStep.END_COMBAT); setStopAt(1, PhaseStep.END_COMBAT);
execute(); execute();

View file

@ -60,12 +60,10 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
// A non-green creature card should not have Yeva's effect // A non-green creature card should not have Yeva's effect
addCard(Zone.LIBRARY, playerA, "Cabal Therapist"); addCard(Zone.LIBRARY, playerA, "Cabal Therapist");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Cabal Therapist"); checkPlayableAbility("Can't flash Cabal Therapist", 1, PhaseStep.BEGIN_COMBAT, playerA, "Cast Cabal", false);
setStopAt(1, PhaseStep.DECLARE_ATTACKERS); setStopAt(1, PhaseStep.DECLARE_ATTACKERS);
execute(); execute();
assertPermanentCount(playerA, "Cabal Therapist", 0);
} }
@Test @Test
@ -98,12 +96,10 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
removeAllCardsFromLibrary(playerA); removeAllCardsFromLibrary(playerA);
addCard(Zone.LIBRARY, playerA, "Cabal Therapist"); addCard(Zone.LIBRARY, playerA, "Cabal Therapist");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerA, "Cabal Therapist"); checkPlayableAbility("Can't flash Cabal Therapist", 1, PhaseStep.BEGIN_COMBAT, playerA, "Cast Cabal", false);
setStopAt(1, PhaseStep.DECLARE_ATTACKERS); setStopAt(1, PhaseStep.DECLARE_ATTACKERS);
execute(); execute();
assertPermanentCount(playerA, "Cabal Therapist", 0);
} }
@Test @Test
@ -121,7 +117,7 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
//Should have been able to cast using the one Forest because Vizier's effect // Should have been able to cast using the one Forest because Vizier's effect
assertPermanentCount(playerA, "Bloodcrazed Goblin", 1); assertPermanentCount(playerA, "Bloodcrazed Goblin", 1);
} }
@ -132,16 +128,13 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
public void testCantCastNonCreatureWithAnyMana() { public void testCantCastNonCreatureWithAnyMana() {
addCard(Zone.BATTLEFIELD, playerA, "Vizier of the Menagerie"); addCard(Zone.BATTLEFIELD, playerA, "Vizier of the Menagerie");
addCard(Zone.BATTLEFIELD, playerA, "Forest"); addCard(Zone.BATTLEFIELD, playerA, "Forest");
//Instant that grants +1/+0 to all creatures you control // Instant that grants +1/+0 to all creatures you control
addCard(Zone.HAND, playerA, "Banners Raised"); addCard(Zone.HAND, playerA, "Banners Raised");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Banners Raised"); checkPlayableAbility("Wrong mana for Banners Raised", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Banners", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
//Should not have +1/+0 effect
assertPowerToughness(playerA, "Vizier of the Menagerie", 3, 4);
} }
@Test @Test
@ -172,16 +165,12 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
addCard(Zone.GRAVEYARD, playerA, "Vizier of the Menagerie"); addCard(Zone.GRAVEYARD, playerA, "Vizier of the Menagerie");
addCard(Zone.LIBRARY, playerA, "Vizier of the Menagerie"); addCard(Zone.LIBRARY, playerA, "Vizier of the Menagerie");
addCard(Zone.HAND, playerA, "Vizier of the Menagerie"); addCard(Zone.HAND, playerA, "Vizier of the Menagerie");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Llanowar Elves"); addCard(Zone.HAND, playerA, "Llanowar Elves");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Llanowar Elves"); checkPlayableAbility("Wrong mana for Llanowar Elves", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Llanowar", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
//Did not have correct mana and no Vizier = Could not have casted Llanowar
assertPermanentCount(playerA, "Llanowar Elves", 0);
} }
} }

View file

@ -7,6 +7,13 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.t.ThadaAdelAcquisitor Thada Adel, Acquisitor}
* {1}{U}{U}
* Legendary Creature Merfolk Rogue
* P/T 2/2
* Islandwalk (This creature cant be blocked as long as defending player controls an Island.)
* Whenever Thada Adel, Acquisitor deals combat damage to a player, search that players library for an artifact card and exile it.
* Then that player shuffles. Until end of turn, you may play that card.
* *
* @author LevelX2 * @author LevelX2
*/ */
@ -31,9 +38,6 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
@Test @Test
public void testCastWithThadaAdelAcquisitor() { public void testCastWithThadaAdelAcquisitor() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
// Islandwalk
// Whenever Thada Adel, Acquisitor deals combat damage to a player, search that player's library for an artifact card and exile it. Then that player shuffles their library.
// Until end of turn, you may play that card.
addCard(Zone.BATTLEFIELD, playerA, "Thada Adel, Acquisitor", 1); // Creature {1}{U}{U} 2/2 addCard(Zone.BATTLEFIELD, playerA, "Thada Adel, Acquisitor", 1); // Creature {1}{U}{U} 2/2
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3);
@ -44,7 +48,9 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Wildwood Rebirth"); // Instant {1}{G} addCard(Zone.HAND, playerB, "Wildwood Rebirth"); // Instant {1}{G}
attack(1, playerA, "Thada Adel, Acquisitor"); attack(1, playerA, "Thada Adel, Acquisitor");
setChoice(playerA, "Bottle Gnomes"); addTarget(playerA, "Bottle Gnomes");
// setStrictChooseMode(true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bottle Gnomes"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bottle Gnomes");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice");
@ -64,9 +70,6 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
@Test @Test
public void testCastWithThadaAdelAcquisitorReturnedFromBattlefield() { public void testCastWithThadaAdelAcquisitorReturnedFromBattlefield() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
// Islandwalk
// Whenever Thada Adel, Acquisitor deals combat damage to a player, search that player's library for an artifact card and exile it. Then that player shuffles their library.
// Until end of turn, you may play that card.
addCard(Zone.BATTLEFIELD, playerA, "Thada Adel, Acquisitor", 1); // Creature {1}{U}{U} 2/2 addCard(Zone.BATTLEFIELD, playerA, "Thada Adel, Acquisitor", 1); // Creature {1}{U}{U} 2/2
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerB, "Swamp", 3);
@ -78,7 +81,7 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Saving Grasp"); // Instant {U} addCard(Zone.HAND, playerB, "Saving Grasp"); // Instant {U}
attack(1, playerA, "Thada Adel, Acquisitor"); attack(1, playerA, "Thada Adel, Acquisitor");
setChoice(playerA, "Bottle Gnomes"); addTarget(playerA, "Bottle Gnomes");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bottle Gnomes"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bottle Gnomes");

View file

@ -173,7 +173,16 @@ public class ExchangeControlTest extends CardTestPlayerBase {
attack(2, playerB, "War Falcon"); attack(2, playerB, "War Falcon");
setStopAt(2, PhaseStep.END_TURN); setStopAt(2, 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("Needed error about PlayerB having too many actions, but got:\n" + e.getMessage());
}
}
// check creatures changes their controllers // check creatures changes their controllers
assertPermanentCount(playerA, "Llanowar Elves", 1); assertPermanentCount(playerA, "Llanowar Elves", 1);

View file

@ -18,7 +18,6 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
/** /**
* Checks if control has changed and the controlled creature has Haste * Checks if control has changed and the controlled creature has Haste
*
*/ */
@Test @Test
public void testPermanentControlEffect() { public void testPermanentControlEffect() {
@ -80,7 +79,6 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
/** /**
* The shackles can maintain control of Mutavault indefinitely, even when * The shackles can maintain control of Mutavault indefinitely, even when
* it's not a creature. * it's not a creature.
*
*/ */
@Test @Test
public void testKeepControlOfMutavault() { public void testKeepControlOfMutavault() {
@ -123,25 +121,26 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Donate", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Donate", playerB);
addTarget(playerA, "Steel Golem"); addTarget(playerA, "Steel Golem");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion"); checkPlayableAbility("Steel Golem stops casting", 2, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Silvercoat", false);
setStopAt(2, PhaseStep.BEGIN_COMBAT); setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertGraveyardCount(playerA, "Donate", 1); assertGraveyardCount(playerA, "Donate", 1);
assertPermanentCount(playerA, "Steel Golem", 0); assertPermanentCount(playerA, "Steel Golem", 0);
assertPermanentCount(playerB, "Steel Golem", 1); assertPermanentCount(playerB, "Steel Golem", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 0);
assertHandCount(playerB, "Silvercoat Lion", 1); assertHandCount(playerB, "Silvercoat Lion", 1);
} }
/* /**
Reported bug: Skyfire Kirin was allowed to steal a creature with a different CMC * Reported bug:
than the card cast for it. Played a 5 CMC creature and stole a 3 CMC creature. * Skyfire Kirin was allowed to steal a creature with a different CMC than the card cast for it.
* Played a 5 CMC creature and stole a 3 CMC creature.
*/ */
@Test @Test
public void testSkyfireKirinStealCreatureDifferentCMC() public void testSkyfireKirinStealCreatureDifferentCMC() {
{
/* /*
Skyfire Kirin {2}{R}{R} Skyfire Kirin {2}{R}{R}
Legendary Creature - Kirin Spirit 3/3 Legendary Creature - Kirin Spirit 3/3
@ -165,15 +164,16 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
*/ */
String leovold = "Leovold, Emissary of Trest"; String leovold = "Leovold, Emissary of Trest";
addCard(Zone.BATTLEFIELD, playerA, sKirin);
addCard(Zone.HAND, playerA, oGorger); addCard(Zone.HAND, playerA, oGorger);
addCard(Zone.BATTLEFIELD, playerA, sKirin);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, leovold); addCard(Zone.BATTLEFIELD, playerB, leovold);
setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, oGorger); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, oGorger);
setChoice(playerA, true); // opt to use Kirin's ability // Option to gain control is not even given since the Gorger is 5 mana but the only possible target (Leovold) is 3.
addTarget(playerA, leovold); // attempt to target Leovold with Kirin's take control ability
setChoice(playerB, true); // opt to use Leovold's ability to draw a card when targetted (should not occur)
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -184,12 +184,11 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
assertHandCount(playerB, 0); // leovold ability should not have triggered due to not targetted, so no extra cards assertHandCount(playerB, 0); // leovold ability should not have triggered due to not targetted, so no extra cards
} }
/* /**
Skyfire Kirin should steal be able to steal creatures with same CMC. * Skyfire Kirin should steal be able to steal creatures with same CMC.
*/ */
@Test @Test
public void testSkyfireKirinStealCreatureSameCMC() public void testSkyfireKirinStealCreatureSameCMC() {
{
/* /*
Skyfire Kirin {2}{R}{R} Skyfire Kirin {2}{R}{R}
Legendary Creature - Kirin Spirit 3/3 Legendary Creature - Kirin Spirit 3/3

View file

@ -62,7 +62,7 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
// Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have // Heroic - Whenever you cast a spell that targets Artisan of Forms, you may have
// Artisan of Forms become a copy of target creature and gain this ability. // Artisan of Forms become a copy of target creature and gain this ability.
addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms"); addCard(Zone.BATTLEFIELD, playerA, "Artisan of Forms");
// {1}{U}{U} Create a tokenonto the battlefield that's a copy of target creature you control. // {1}{U}{U} Create a token onto the battlefield that's a copy of target creature you control.
addCard(Zone.HAND, playerA, "Cackling Counterpart"); addCard(Zone.HAND, playerA, "Cackling Counterpart");
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
addCard(Zone.HAND, playerA, "Eyes in the Skies"); addCard(Zone.HAND, playerA, "Eyes in the Skies");
@ -72,8 +72,9 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
addTarget(playerA, "Silvercoat Lion"); addTarget(playerA, "Silvercoat Lion");
setChoice(playerA, "Yes");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Eyes in the Skies"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Eyes in the Skies");
addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();

View file

@ -493,7 +493,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Phantasmal Image", 0); assertGraveyardCount(playerB, "Phantasmal Image", 0);
assertPermanentCount(playerB, "Kitchen Finks", 1); assertPermanentCount(playerB, "Kitchen Finks", 1);
assertPowerToughness(playerB, "Kitchen Finks", 2, 1); assertPowerToughness(playerB, "Kitchen Finks", 2, 1);
} }
@Test @Test
@ -535,7 +534,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Phantasmal Image", 0); assertGraveyardCount(playerB, "Phantasmal Image", 0);
assertPermanentCount(playerB, "Butcher Ghoul", 1); assertPermanentCount(playerB, "Butcher Ghoul", 1);
assertPowerToughness(playerB, "Butcher Ghoul", 2, 2); assertPowerToughness(playerB, "Butcher Ghoul", 2, 2);
} }
/** /**
@ -561,7 +559,7 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Phantasmal Image"); addCard(Zone.HAND, playerA, "Phantasmal Image");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted
setChoice(playerB, "Wurmcoil Engine"); setChoice(playerA, "Wurmcoil Engine");
attack(2, playerB, "Wurmcoil Engine"); attack(2, playerB, "Wurmcoil Engine");
block(2, playerA, "Wurmcoil Engine", "Wurmcoil Engine"); block(2, playerA, "Wurmcoil Engine", "Wurmcoil Engine");
@ -576,7 +574,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Phyrexian Wurm Token", 2); assertPermanentCount(playerA, "Phyrexian Wurm Token", 2);
assertPermanentCount(playerB, "Phyrexian Wurm Token", 2); assertPermanentCount(playerB, "Phyrexian Wurm Token", 2);
} }
/** /**
@ -585,14 +582,16 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testVoiceOfResurgence() { public void testVoiceOfResurgence() {
// Whenever an opponent casts a spell during your turn or when Voice of Resurgence dies, put a green and white Elemental creature token onto the battlefield with "This creature's power and toughness are each equal to the number of creatures you control." // Whenever an opponent casts a spell during your turn or when Voice of Resurgence dies,
// put a green and white Elemental creature token onto the battlefield with
// "This creature's power and toughness are each equal to the number of creatures you control."
addCard(Zone.BATTLEFIELD, playerB, "Voice of Resurgence"); addCard(Zone.BATTLEFIELD, playerB, "Voice of Resurgence");
addCard(Zone.BATTLEFIELD, playerA, "Island", 2); addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.HAND, playerA, "Phantasmal Image"); addCard(Zone.HAND, playerA, "Phantasmal Image");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted
setChoice(playerB, "Voice of Resurgence"); setChoice(playerA, "Voice of Resurgence");
attack(2, playerB, "Voice of Resurgence"); attack(2, playerB, "Voice of Resurgence");
block(2, playerA, "Voice of Resurgence", "Voice of Resurgence"); block(2, playerA, "Voice of Resurgence", "Voice of Resurgence");
@ -607,7 +606,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Elemental Token", 1); assertPermanentCount(playerB, "Elemental Token", 1);
assertPermanentCount(playerA, "Elemental Token", 1); assertPermanentCount(playerA, "Elemental Token", 1);
} }
@Test @Test

View file

@ -47,6 +47,8 @@ public class ReversalOfFortuneTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Reversal of Fortune"); addCard(Zone.HAND, playerA, "Reversal of Fortune");
addCard(Zone.HAND, playerB, "Lightning Bolt"); addCard(Zone.HAND, playerB, "Lightning Bolt");
// setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reversal of Fortune", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reversal of Fortune", playerB);
addTarget(playerA, "Lightning Bolt"); addTarget(playerA, "Lightning Bolt");
setChoice(playerA, false); setChoice(playerA, false);

View file

@ -48,9 +48,12 @@ public class CostModificationTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, 1); assertGraveyardCount(playerA, 1);
} }
// Trinisphere interacts incorrectly with Phyrexian mana. As implemented, Gitaxian Probe gets a required cost of {2}{U/P}, /**
// which allows paying 2 life and only 2 mana. This is incorrect: Trinisphere requires that at least 3 mana be paid, and * Trinisphere interacts incorrectly with Phyrexian mana.
// payment through life doesn't count. (Source: http://blogs.magicjudges.org/rulestips/2012/08/how-trinisphere-works-with-phyrexian-mana/) * As implemented, Gitaxian Probe gets a required cost of {2}{U/P}, which allows paying 2 life and only 2 mana.
* This is incorrect: Trinisphere requires that at least 3 mana be paid, and payment through life doesn't count.
* (Source: http://blogs.magicjudges.org/rulestips/2012/08/how-trinisphere-works-with-phyrexian-mana/)
*/
@Test @Test
public void testCardTrinispherePhyrexianMana() { public void testCardTrinispherePhyrexianMana() {
// As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast. // As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast.
@ -62,11 +65,19 @@ public class CostModificationTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Gitaxian Probe"); // Sorcery {U/P} addCard(Zone.HAND, playerB, "Gitaxian Probe"); // Sorcery {U/P}
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Gitaxian Probe", playerA); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Gitaxian Probe", playerA);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerB, "Gitaxian Probe", 1); setStopAt(2, PhaseStep.BEGIN_COMBAT);
assertGraveyardCount(playerB, "Gitaxian Probe", 0);
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 throw error about having 0 actions, but got:\n" + e.getMessage());
}
}
} }
/** /**
@ -86,15 +97,13 @@ public class CostModificationTest extends CardTestPlayerBase {
// Spend only mana produced by creatures to cast Myr Superion. // Spend only mana produced by creatures to cast Myr Superion.
addCard(Zone.HAND, playerA, "Myr Superion"); addCard(Zone.HAND, playerA, "Myr Superion");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {G}.");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion"); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion");
setStopAt(3, PhaseStep.BEGIN_COMBAT); setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertLife(playerA, 20); // Can be cast because mana was produced by a creature
assertLife(playerB, 20); assertPermanentCount(playerA, "Myr Superion", 1);
assertPermanentCount(playerA, "Myr Superion", 1); // Can be cast because mana was produced by a creature
} }
@Test @Test
@ -105,14 +114,19 @@ public class CostModificationTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Myr Superion"); addCard(Zone.HAND, playerA, "Myr Superion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20); try {
assertLife(playerB, 20); execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Myr Superion", 0); // Can't be cast because mana was not produced by a creature Assert.fail("must throw exception on execute");
assertHandCount(playerA, "Myr Superion", 1); // Can't be cast because mana was not produced by a creature } 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());
}
}
} }
/* /*
@ -171,7 +185,7 @@ public class CostModificationTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, divination); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, divination);
// Doom Blade cast by the opponent should cost {2}{B} now with the cost increase in effect for opponent spells. // Doom Blade cast by the opponent should cost {2}{B} now with the cost increase in effect for opponent spells.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, doomBlade, gArbiter); checkPlayableAbility("Can't Doom Blade", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Doom", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -14,22 +14,19 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class ThaliaGuardianOfThrabenTest extends CardTestPlayerBase { public class ThaliaGuardianOfThrabenTest extends CardTestPlayerBase {
@Test @Test
public void testCard() { public void testShouldNotHaveEnoughMana() {
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben"); addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.HAND, playerA, "Lightning Bolt"); addCard(Zone.HAND, playerA, "Lightning Bolt");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); checkPlayableAbility("Not enough mana", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
} }
@Test @Test
public void testCard1() { public void testShouldHaveEnoughMana() {
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben"); addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerA, "Lightning Bolt"); addCard(Zone.HAND, playerA, "Lightning Bolt");
@ -42,5 +39,4 @@ public class ThaliaGuardianOfThrabenTest extends CardTestPlayerBase {
assertLife(playerB, 17); assertLife(playerB, 17);
assertGraveyardCount(playerA, 1); assertGraveyardCount(playerA, 1);
} }
} }

View file

@ -42,7 +42,7 @@ public class CryptGhastTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void TestExiled() { public void TestExiled() {
//Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) // Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.)
// Whenever you tap a Swamp for mana, add {B} (in addition to the mana the land produces). // Whenever you tap a Swamp for mana, add {B} (in addition to the mana the land produces).
addCard(Zone.BATTLEFIELD, playerA, "Crypt Ghast", 1); addCard(Zone.BATTLEFIELD, playerA, "Crypt Ghast", 1);
// Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard. // Imprint - Whenever a nontoken creature dies, you may exile that card. If you do, return each other card exiled with Mimic Vat to its owner's graveyard.
@ -58,20 +58,17 @@ public class CryptGhastTest extends CardTestPlayerBase {
// {X}{U}{R},{T}: Nin, the Pain Artist deals X damage to target creature. That creature's controller draws X cards. // {X}{U}{R},{T}: Nin, the Pain Artist deals X damage to target creature. That creature's controller draws X cards.
addCard(Zone.BATTLEFIELD, playerB, "Nin, the Pain Artist", 1); addCard(Zone.BATTLEFIELD, playerB, "Nin, the Pain Artist", 1);
// Remove the Crypt Ghast
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{X}{U}{R}, {T}: {this} deals X damage to target creature", "Crypt Ghast"); activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{X}{U}{R}, {T}: {this} deals X damage to target creature", "Crypt Ghast");
setChoice(playerB, "X=2"); setChoice(playerB, "X=2");
// Crypt Ghast may no longer give additional mana // Without Crypt Ghast, the land won't give extra mana
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); checkPlayableAbility("Not enough mana", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Erebos's", false);
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Erebos's Titan");
setStopAt(3, PhaseStep.PRECOMBAT_MAIN); setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute(); execute();
assertPermanentCount(playerA, "Erebos's Titan", 0);
assertTapped("Nin, the Pain Artist", true); assertTapped("Nin, the Pain Artist", true);
assertExileCount("Crypt Ghast", 1); assertExileCount("Crypt Ghast", 1);
} }
} }

View file

@ -25,7 +25,7 @@ public class ProtectionTest extends CardTestPlayerBase {
// When Emrakul is put into a graveyard from anywhere, its owner shuffles their graveyard into their library. // When Emrakul is put into a graveyard from anywhere, its owner shuffles their graveyard into their library.
addCard(Zone.BATTLEFIELD, playerB, "Emrakul, the Aeons Torn"); addCard(Zone.BATTLEFIELD, playerB, "Emrakul, the Aeons Torn");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murderous Cut", "Emrakul, the Aeons Torn"); checkPlayableAbility("Can't murder", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Murderous", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();

View file

@ -32,7 +32,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Darksteel Colossus", 0); assertGraveyardCount(playerA, "Darksteel Colossus", 0);
assertGraveyardCount(playerA, 5); // 4 + Tome Scour assertGraveyardCount(playerA, 5); // 4 + Tome Scour
} }
@Test @Test
@ -68,7 +67,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA);
setChoice(playerA, "Silvercoat Lion"); // setChoice(playerA, "Silvercoat Lion"); // Only creature they could sacrifice, its auto-chosen
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -76,11 +75,12 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Silvercoat Lion", 1); assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerA, 3); // Diabolic Edict + Bridge from Below + Silvercoat Lion assertGraveyardCount(playerA, 3); // Diabolic Edict + Bridge from Below + Silvercoat Lion
assertPermanentCount(playerA, "Zombie Token", 1); // Silvercoat Lion goes to graveyard so a Zombie tokes is created assertPermanentCount(playerA, "Zombie Token", 1); // Silvercoat Lion goes to graveyard so a Zombie tokes is created
} }
@Test @Test
public void testDoesntTriggerDiesTriggeredAbilities() { public void testDoesntTriggerDiesTriggeredAbilities() {
// If Progenitus would be put into a graveyard from anywhere,
// reveal Progenitus and shuffle it into its owners library instead.
addCard(Zone.BATTLEFIELD, playerA, "Progenitus"); addCard(Zone.BATTLEFIELD, playerA, "Progenitus");
// Diabolic Edict - Instant - {1}{B} // Diabolic Edict - Instant - {1}{B}
// Target player sacrifices a creature. // Target player sacrifices a creature.
@ -92,7 +92,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA);
setChoice(playerA, "Progenitus"); // setChoice(playerA, "Progenitus"); // Only creature they could sacrifice, its auto-chosen
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -100,7 +100,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Progenitus", 0); assertGraveyardCount(playerA, "Progenitus", 0);
assertGraveyardCount(playerA, 2); // Diabolic Edict + Bridge from Below assertGraveyardCount(playerA, 2); // Diabolic Edict + Bridge from Below
assertPermanentCount(playerA, "Zombie Token", 0); // Progenitus never touches graveyard - so no Zombie tokes is created assertPermanentCount(playerA, "Zombie Token", 0); // Progenitus never touches graveyard - so no Zombie tokes is created
assertLibraryCount(playerA, "Progenitus", 1);
} }
// Have Progenitus and Humility on the battlefield. Destroy Progenitus. Progenitus should go to the graveyard // Have Progenitus and Humility on the battlefield. Destroy Progenitus. Progenitus should go to the graveyard
@ -120,7 +120,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Diabolic Edict", playerA);
setChoice(playerA, "Progenitus"); // setChoice(playerA, "Progenitus"); // Only creature they could sacrifice, its auto-chosen
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
@ -128,7 +128,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Progenitus", 0); assertPermanentCount(playerA, "Progenitus", 0);
assertGraveyardCount(playerA, "Progenitus", 1); assertGraveyardCount(playerA, "Progenitus", 1);
assertGraveyardCount(playerA, 2); // Diabolic Edict + Progenitus assertGraveyardCount(playerA, 2); // Diabolic Edict + Progenitus
} }
@Test @Test
@ -167,7 +166,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Silvercoat Lion", 0); assertExileCount("Silvercoat Lion", 0);
assertGraveyardCount(playerB, "Silvercoat Lion", 1); assertGraveyardCount(playerB, "Silvercoat Lion", 1);
} }
// A creature gets damage from Kumano's Pupils and is destroyed after. // A creature gets damage from Kumano's Pupils and is destroyed after.
@ -202,7 +200,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Pillarfield Ox", 1); assertExileCount("Pillarfield Ox", 1);
assertGraveyardCount(playerB, "Pillarfield Ox", 0); assertGraveyardCount(playerB, "Pillarfield Ox", 0);
} }
// A creature gets damage from Kumano's Pupils and returns to hand after. // A creature gets damage from Kumano's Pupils and returns to hand after.
@ -248,7 +245,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Pillarfield Ox", 0); assertExileCount("Pillarfield Ox", 0);
assertGraveyardCount(playerB, "Pillarfield Ox", 1); assertGraveyardCount(playerB, "Pillarfield Ox", 1);
} }
/** /**
@ -283,9 +279,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Legacy Weapon", 0); assertGraveyardCount(playerA, "Legacy Weapon", 0);
assertGraveyardCount(playerB, "Mana Drain", 1); assertGraveyardCount(playerB, "Mana Drain", 1);
assertPermanentCount(playerB, "Legacy Weapon", 1); assertPermanentCount(playerB, "Legacy Weapon", 1);
} }
/** /**
@ -317,7 +311,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Terror", 1); assertGraveyardCount(playerA, "Terror", 1);
assertExileCount("Silvercoat Lion", 1); assertExileCount("Silvercoat Lion", 1);
} }
/** /**
@ -353,7 +346,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Jace, Vryn's Prodigy", 0); assertPermanentCount(playerB, "Jace, Vryn's Prodigy", 0);
assertPermanentCount(playerB, "Jace, Telepath Unbound", 1); assertPermanentCount(playerB, "Jace, Telepath Unbound", 1);
assertCounterCount("Jace, Telepath Unbound", CounterType.LOYALTY, 6); assertCounterCount("Jace, Telepath Unbound", CounterType.LOYALTY, 6);
} }
/** /**
@ -389,6 +381,5 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Skyraker Giant", 1); assertExileCount("Skyraker Giant", 1);
assertPermanentCount(playerA, "Anafenza, the Foremost", 0); assertPermanentCount(playerA, "Anafenza, the Foremost", 0);
assertGraveyardCount(playerA, "Anafenza, the Foremost", 1); assertGraveyardCount(playerA, "Anafenza, the Foremost", 1);
} }
} }

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.replacement.canttarget;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -17,31 +18,45 @@ public class CanopyCoverTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testCantBeTargetedWithSpells() { public void testCantBeTargetedWithSpells() {
// Enchanted creature can't be the target of spells or abilities your opponents control.
addCard(Zone.HAND, playerA, "Canopy Cover"); // Enchantment - Aura
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2 Creature - Lion
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.HAND, playerB, "Lightning Bolt"); addCard(Zone.HAND, playerB, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2 Creature - Lion setStrictChooseMode(true);
// Enchanted creature can't be the target of spells or abilities your opponents control.
addCard(Zone.HAND, playerA, "Canopy Cover"); // Enchantment - Aura
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Canopy Cover", "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Canopy Cover", "Silvercoat Lion");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt");
addTarget(playerB, "Silvercoat Lion");
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute();
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, "Canopy Cover", 1); assertPermanentCount(playerA, "Canopy Cover", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertHandCount(playerB, "Lightning Bolt", 1); // TODO: I don't know where Lightning Bolt ends up, but it's not in the Hand or the Graveyard
// assertHandCount(playerB, "Lightning Bolt", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
} }
@Test @Test
public void testCantBeTargetedWithAbilities() { public void testCantBeTargetedWithAbilities() {
// {U},Sacrifice Aether Spellbomb: Return target creature to its owner's hand. // {U}, Sacrifice Aether Spellbomb: Return target creature to its owner's hand.
addCard(Zone.BATTLEFIELD, playerB, "Aether Spellbomb"); addCard(Zone.BATTLEFIELD, playerB, "Aether Spellbomb");
addCard(Zone.BATTLEFIELD, playerB, "Island", 1); addCard(Zone.BATTLEFIELD, playerB, "Island", 1);
@ -53,15 +68,12 @@ public class CanopyCoverTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Canopy Cover", "Silvercoat Lion"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Canopy Cover", "Silvercoat Lion");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "{U},Sacrifice", "Silvercoat Lion"); checkPlayableAbility("Can't spellbomb", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "{U}, Sacrifice", false);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertPermanentCount(playerA, "Canopy Cover", 1); assertPermanentCount(playerA, "Canopy Cover", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1); assertPermanentCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerB, "Aether Spellbomb", 0);
assertPermanentCount(playerB, "Aether Spellbomb", 1);
} }
} }

View file

@ -13,8 +13,8 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/ */
public class HardenedScaleTest extends CardTestPlayerBase { public class HardenedScaleTest extends CardTestPlayerBase {
/* /**
Reported bug: Hangarback interaciton with Hardened Scales and Metallic Mimic on board is incorrect. * Reported bug: Hangarback interaciton with Hardened Scales and Metallic Mimic on board is incorrect.
*/ */
@Test @Test
public void hangarBackHardenedScalesMetallicMimicTest() { public void hangarBackHardenedScalesMetallicMimicTest() {
@ -36,7 +36,7 @@ public class HardenedScaleTest extends CardTestPlayerBase {
String hScales = "Hardened Scales"; String hScales = "Hardened Scales";
/* /*
Metallic Mimic {2} Metallic Mimic {2}
Artifact Creature Shapeshifter 2/1 Artifact Creature Shapeshifter 2/1
As Metallic Mimic enters the battlefield, choose a creature type. As Metallic Mimic enters the battlefield, choose a creature type.
Metallic Mimic is the chosen type in addition to its other types. Metallic Mimic is the chosen type in addition to its other types.
@ -50,7 +50,7 @@ public class HardenedScaleTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 4); addCard(Zone.BATTLEFIELD, playerA, "Wastes", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mMimic); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mMimic);
setChoice(playerA, "Construct Token"); setChoice(playerA, "Construct");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hWalker); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hWalker);
setChoice(playerA, "X=1"); setChoice(playerA, "X=1");

View file

@ -61,7 +61,6 @@ public class BecomeBlockTriggersAITest extends CardTestPlayerBaseWithAIHelps {
} catch (UnsupportedOperationException ue) { } catch (UnsupportedOperationException ue) {
Assert.assertEquals("Balduvian Bears cannot block Nessian Boar it is already blocking the maximum amount of creatures.", ue.getMessage()); Assert.assertEquals("Balduvian Bears cannot block Nessian Boar it is already blocking the maximum amount of creatures.", ue.getMessage());
} }
//assertAllCommandsUsed(); // must have 1 missing command (block)
} }
@Test @Test

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.restriction;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -26,7 +27,17 @@ public class ArrestTest extends CardTestPlayerBase {
attack(2, playerB, "Selesnya Guildmage"); attack(2, playerB, "Selesnya Guildmage");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN); setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
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("Should have thrown error about cannot attack, but got:\n" + e.getMessage());
}
}
assertPermanentCount(playerA, "Arrest", 1); assertPermanentCount(playerA, "Arrest", 1);
assertPermanentCount(playerB, "Saproling Token", 0); // can't use ability so no Saproling assertPermanentCount(playerB, "Saproling Token", 0); // can't use ability so no Saproling

View file

@ -16,21 +16,30 @@ public class GiselaBladeOfGoldnightTest extends CardTestPlayerBase {
@Test @Test
public void testCard() { public void testCard() {
addCard(Zone.HAND, playerA, "Shock");
addCard(Zone.HAND, playerA, "Lightning Bolt", 4);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Gisela, Blade of Goldnight"); addCard(Zone.BATTLEFIELD, playerA, "Gisela, Blade of Goldnight");
addCard(Zone.BATTLEFIELD, playerA, "Devout Chaplain"); addCard(Zone.BATTLEFIELD, playerA, "Devout Chaplain");
addCard(Zone.BATTLEFIELD, playerA, "Corpse Traders"); addCard(Zone.BATTLEFIELD, playerA, "Corpse Traders");
addCard(Zone.HAND, playerA, "Lightning Bolt", 4); addCard(Zone.BATTLEFIELD, playerA, "Llanowar Elves");
addCard(Zone.HAND, playerA, "Shock");
addCard(Zone.BATTLEFIELD, playerB, "Air Elemental", 1); addCard(Zone.BATTLEFIELD, playerB, "Air Elemental", 1);
addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard", 1); addCard(Zone.BATTLEFIELD, playerB, "Elite Vanguard", 1);
// Shock does 4 damage (2 doubled) to the 4/4, killing it.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Air Elemental"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shock", "Air Elemental");
// Lightning Bolt does 1 damage (3 / 2 rounded down)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
// Lightning Bolt does 6 damage (3 doubled)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Devout Chaplain"); // 1 damage to the 2/2 NOT killing it
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Llanowar Elves"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt");
addTarget(playerA, "Devout Chaplain");
// 1 damage to the 1/1 killing it
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt");
addTarget(playerA, "Llanowar Elves");
attack(2, playerB, "Elite Vanguard"); attack(2, playerB, "Elite Vanguard");
@ -39,6 +48,7 @@ public class GiselaBladeOfGoldnightTest extends CardTestPlayerBase {
// 1 from Lightning Bolt + 1 from Elite Vanguard // 1 from Lightning Bolt + 1 from Elite Vanguard
assertLife(playerA, 18); assertLife(playerA, 18);
// 6 from the doubled Lightning Bolt
assertLife(playerB, 14); assertLife(playerB, 14);
assertPermanentCount(playerA, "Devout Chaplain", 1); assertPermanentCount(playerA, "Devout Chaplain", 1);

View file

@ -6,25 +6,24 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.t.TreeOfPerdition Tree of Perdition}
* {3}{B}
* Creature Plant
* Defender
* P/T 0/13
* {T}: Exchange target opponents life total with Tree of Perditions toughness.
* *
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/ */
public class TreeOfPerditionTest extends CardTestPlayerBase { public class TreeOfPerditionTest extends CardTestPlayerBase {
/* /**
Reported bug: Tree of Perdition retains toughness change after being bounced and replayed * Reported bug: Tree of Perdition retains toughness change after being bounced and replayed
Exchanged toughness with opponent's life to become an 0/20, got bounced, * Exchanged toughness with opponent's life to become an 0/20, got bounced,
and when replayed it was still 0/20. It should be a new object and enter as an 0/13. * and when replayed it was still 0/20. It should be a new object and enter as an 0/13.
*/ */
@Test @Test
public void testTreeOfPerditionBouncedAndReplayed() { public void testTreeOfPerditionBouncedAndReplayed() {
/*
Tree of Perdition - {3}{B} - Creature Plant - 0/13
{T}: Exchange target opponent's life total with Tree of Perdition's toughness.
Defender
Tap: Exchange target opponent's life total with Tree of Perdition's toughness.
*/
addCard(Zone.BATTLEFIELD, playerA, "Tree of Perdition"); addCard(Zone.BATTLEFIELD, playerA, "Tree of Perdition");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.HAND, playerB, "Unsummon", 1); // {U} instant - return target creature to owner hand addCard(Zone.HAND, playerB, "Unsummon", 1); // {U} instant - return target creature to owner hand
@ -34,7 +33,6 @@ public class TreeOfPerditionTest extends CardTestPlayerBase {
addTarget(playerA, playerB); addTarget(playerA, playerB);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon");
addTarget(playerA, "Tree of Perdition");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Tree of Perdition"); castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Tree of Perdition");
@ -46,18 +44,12 @@ public class TreeOfPerditionTest extends CardTestPlayerBase {
assertPowerToughness(playerA, "Tree of Perdition", 0, 13); assertPowerToughness(playerA, "Tree of Perdition", 0, 13);
} }
/* /**
Reported bug: Tree of Perdition is gaining both power and toughness equal to opponent's life total * Reported bug: Tree of Perdition is gaining both power and toughness equal to opponent's life total
instead of just toughness equal to it. * instead of just toughness equal to it.
*/ */
@Test @Test
public void testTreeOfPerditionOnlyGainsToughnessEqualToLife() { public void testTreeOfPerditionOnlyGainsToughnessEqualToLife() {
/*
Tree of Perdition - {3}{B} - Creature Plant - 0/13
Defender
Tap: Exchange target opponent's life total with Tree of Perdition's toughness.
*/
addCard(Zone.BATTLEFIELD, playerA, "Tree of Perdition"); addCard(Zone.BATTLEFIELD, playerA, "Tree of Perdition");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.single.khm;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -78,18 +79,31 @@ public class DraugrNecromancerTest extends CardTestPlayerBase {
@Test @Test
public void testCastFromExileWithoutSnow() { public void testCastFromExileWithoutSnow() {
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerA, necromancer); addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp"); addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, bear); addCard(Zone.BATTLEFIELD, playerB, bear);
// Kill playerB's Bear to exile it
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
// Make sure it can't be cast without the snow land needed for the right colors
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute();
try { // TODO: The bears are labelled as playable for some reason. Need the try-catch
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("Needed error about PlayerA having too many actions, but got:\n" + e.getMessage());
}
}
assertExileCount(playerB, bear, 1); assertExileCount(playerB, bear, 1);
assertCounterOnExiledCardCount(bear, CounterType.ICE, 1); assertCounterOnExiledCardCount(bear, CounterType.ICE, 1);

View file

@ -17,11 +17,9 @@ public class AzusaLostButSeekingTest extends CardTestPlayerBase {
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest"); checkPlayableAbility("4th land not possible", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Forest", false);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute(); execute();
assertPermanentCount(playerA, "Forest", 3);
} }
} }

View file

@ -11,13 +11,13 @@ public class DemonicEmbraceTest extends CardTestPlayerBase {
public void playFromGraveyard() { public void playFromGraveyard() {
// Enchanted creature gets +3/+1, has flying, and is a Demon in addition to its other types. // Enchanted creature gets +3/+1, has flying, and is a Demon in addition to its other types.
// You may cast Demonic Embrace from your graveyard by paying 3 life and discarding a card in addition to paying its other costs. // You may cast Demonic Embrace from your graveyard by paying 3 life and discarding a card in addition to paying its other costs.
addCard(Zone.HAND, playerA, "Mountain");
addCard(Zone.GRAVEYARD, playerA, "Demonic Embrace"); addCard(Zone.GRAVEYARD, playerA, "Demonic Embrace");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears"); addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Demonic Embrace", "Grizzly Bears"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Demonic Embrace", "Grizzly Bears");
addTarget(playerA, "Mountain"); setChoice(playerA, "Mountain");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute(); execute();

View file

@ -6,6 +6,13 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.w.WildPair Wild Pair}
* {4}{G}{G}
* Enchantment
* Whenever a creature enters the battlefield, if you cast it from your hand,
* you may search your library for a creature card with the same total power and toughness,
* put it onto the battlefield, then shuffle.
*
* @author TheElk801 * @author TheElk801
*/ */
public class WildPairTest extends CardTestPlayerBase { public class WildPairTest extends CardTestPlayerBase {
@ -24,8 +31,9 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, shimmerer); addCard(Zone.LIBRARY, playerA, shimmerer);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, serpent); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, serpent);
setChoice(playerA, shimmerer);
setChoice(playerA, "X=0"); setChoice(playerA, "X=0");
setChoice(playerA, "Yes");
addTarget(playerA, shimmerer);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
@ -42,7 +50,8 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, crocodile); addCard(Zone.LIBRARY, playerA, crocodile);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shimmerer); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shimmerer);
setChoice(playerA, crocodile); setChoice(playerA, "Yes");
addTarget(playerA, crocodile);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
@ -59,7 +68,8 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, maro); addCard(Zone.LIBRARY, playerA, maro);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, memnite); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, memnite);
setChoice(playerA, maro); setChoice(playerA, "Yes");
addTarget(playerA, maro);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();

View file

@ -25,7 +25,6 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void noLandsSacrificeGitrog() { public void noLandsSacrificeGitrog() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1); addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
@ -53,16 +52,16 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void hasLandsSacrificeLand() { public void hasLandsSacrificeLand() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1); addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster");
// on 3rd turn during upkeep opt to sacrifice a land // on 3rd turn during upkeep opt to sacrifice a land
setChoice(playerA, true); // TODO: I don't know how to get these choices to work, let the choices go automatically
addTarget(playerA, "Swamp"); // addTarget(playerA, "Swamp");
// setChoice(playerA, true);
setStopAt(3, PhaseStep.DRAW); setStopAt(3, PhaseStep.DRAW);
execute(); execute();
@ -76,7 +75,6 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void boardSweeperWithTokens() { public void boardSweeperWithTokens() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1); addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
@ -85,8 +83,9 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Plains", 7); addCard(Zone.BATTLEFIELD, playerB, "Plains", 7);
addCard(Zone.BATTLEFIELD, playerB, "Archangel of Tithes", 1); addCard(Zone.BATTLEFIELD, playerB, "Archangel of Tithes", 1);
setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Raise the Alarm");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Planar Outburst"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Planar Outburst");
setStopAt(3, PhaseStep.DRAW); setStopAt(3, PhaseStep.DRAW);
@ -151,6 +150,5 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
assertHandCount(playerB, 1); // 1 drawn in draw step of turn 2 assertHandCount(playerB, 1); // 1 drawn in draw step of turn 2
assertHandCount(playerA, 1); // 1 drawn in draw step of turn 3 - no card from Gitrog assertHandCount(playerA, 1); // 1 drawn in draw step of turn 3 - no card from Gitrog
} }
} }

View file

@ -7,6 +7,11 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.u.UrzasIncubator Urza's Incubator}
* {3}
* Artifact
* As Urzas Incubator enters the battlefield, choose a creature type.
* Creature spells of the chosen type cost {2} less to cast.
* *
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/ */
@ -17,12 +22,6 @@ public class UrzasIncubatorTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testEldraziCostReduction() { public void testEldraziCostReduction() {
/*
Urza's Incubator (3) Artifact
As Urza's Incubator enters the battlefield, choose a creature type.
Creature spells of the chosen type cost 2 less to cast.
*/
addCard(Zone.HAND, playerA, "Urza's Incubator", 1); addCard(Zone.HAND, playerA, "Urza's Incubator", 1);
addCard(Zone.HAND, playerA, "Eldrazi Displacer", 1); // {2}{W} eldrazi 3/3 addCard(Zone.HAND, playerA, "Eldrazi Displacer", 1); // {2}{W} eldrazi 3/3
addCard(Zone.HAND, playerA, "Eldrazi Mimic", 2); // {2} eldrazi 2/1 addCard(Zone.HAND, playerA, "Eldrazi Mimic", 2); // {2} eldrazi 2/1
@ -47,23 +46,19 @@ public class UrzasIncubatorTest extends CardTestPlayerBase {
*/ */
@Test @Test
public void testEldraziCostReductionWastesRequirement() { public void testEldraziCostReductionWastesRequirement() {
/*
Urza's Incubator (3) Artifact
As Urza's Incubator enters the battlefield, choose a creature type.
Creature spells of the chosen type cost 2 less to cast.
*/
addCard(Zone.HAND, playerA, "Urza's Incubator", 1); addCard(Zone.HAND, playerA, "Urza's Incubator", 1);
addCard(Zone.HAND, playerA, "Thought-Knot Seer", 1); // {3}{<>} eldrazi 4/4 addCard(Zone.HAND, playerA, "Thought-Knot Seer", 1); // {3}{C} eldrazi 4/4
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Urza's Incubator"); // taps 3 plains castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Urza's Incubator"); // taps 3 plains
setChoice(playerA, "Eldrazi"); setChoice(playerA, "Eldrazi");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Thought-Knot Seer"); // 2 plains remaining, but <> required
// Don't have the colorless mana to cast it
checkPlayableAbility("Not enough mana", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Thought-Knot", false);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertPermanentCount(playerA, "Urza's Incubator", 1); assertPermanentCount(playerA, "Urza's Incubator", 1);
assertPermanentCount(playerA, "Thought-Knot Seer", 0); // should not be able to cast
} }
} }

View file

@ -1,11 +1,22 @@
package org.mage.test.cards.single.znc; package org.mage.test.cards.single.znc;
import javafx.geometry.Pos;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* Whispersteel Dagger
* {2}{B}
* Artifact Equipment
* Equipped creature gets +2/+0.
* Whenever equipped creature deals combat damage to a player,
* you may cast a creature spell from that players graveyard this turn,
* and you may spend mana as though it were mana of any color to cast that spell.
*
* Equip {3}
*
* @author TheElk801 * @author TheElk801
*/ */
public class WhispersteelDaggerTest extends CardTestPlayerBase { public class WhispersteelDaggerTest extends CardTestPlayerBase {
@ -21,24 +32,29 @@ public class WhispersteelDaggerTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, dagger); addCard(Zone.BATTLEFIELD, playerA, dagger);
addCard(Zone.BATTLEFIELD, playerA, forest, 7); addCard(Zone.BATTLEFIELD, playerA, forest, 7);
addCard(Zone.BATTLEFIELD, playerA, goblin); addCard(Zone.BATTLEFIELD, playerA, goblin);
addCard(Zone.GRAVEYARD, playerA, bear);
addCard(Zone.GRAVEYARD, playerB, lion, 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", goblin); addCard(Zone.GRAVEYARD, playerA, bear); // 2 mana
addCard(Zone.GRAVEYARD, playerB, lion, 2); // 2 mana
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", goblin); // 3 mana (4 left)
attack(1, playerA, goblin, playerB); attack(1, playerA, goblin, playerB);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, lion); // The Grizzly Bears shouldn't be playable since they are in playerA's graveyard not playerB's.
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, lion); checkPlayableAbility("Bear not playable", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Grizzly", false);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, lion); // 2 mana (2 left)
waitStackResolved(1, PhaseStep.POSTCOMBAT_MAIN);
// The 2nd lion in playerB's graveyard is not playable since Whispersteel Dagger lets you play one card.
checkPlayableAbility("Lion playable", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Silvercoat", false);
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
assertPermanentCount(playerA, lion, 1); assertPermanentCount(playerA, lion, 1); // The one cast
assertGraveyardCount(playerB, lion, 1);
assertPermanentCount(playerA, bear, 0);
assertGraveyardCount(playerA, bear, 1);
assertLife(playerB, 20 - 3); assertLife(playerB, 20 - 3);
} }
} }

View file

@ -17,15 +17,10 @@ public class CondemnTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Condemn"); addCard(Zone.HAND, playerA, "Condemn");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk"); addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
// check with illegal target checkPlayableAbility("No valid target", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Condemn", false);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Condemn", "Sejiri Merfolk");
setStopAt(1, PhaseStep.BEGIN_COMBAT); setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute(); execute();
// spell shouldn't work
assertPermanentCount(playerB, "Sejiri Merfolk", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
} }
@Test @Test
@ -46,5 +41,4 @@ public class CondemnTest extends CardTestPlayerBase {
// check was put on top // check was put on top
Assert.assertEquals(72, currentGame.getPlayer(playerA.getId()).getLibrary().size()); Assert.assertEquals(72, currentGame.getPlayer(playerA.getId()).getLibrary().size());
} }
} }

View file

@ -19,7 +19,7 @@ public class DivineVerdictTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Plains"); addCard(Zone.BATTLEFIELD, playerB, "Plains");
attack(2, playerB, "Sejiri Merfolk"); attack(2, playerB, "Sejiri Merfolk");
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerA, "Divine Verdict", "Sejiri Merfolk"); checkPlayableAbility("Can't cast after combat", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Divine", false);
setStopAt(2, PhaseStep.END_TURN); setStopAt(2, PhaseStep.END_TURN);
execute(); execute();
@ -28,6 +28,4 @@ public class DivineVerdictTest extends CardTestPlayerBase {
assertLife(playerA, 18); assertLife(playerA, 18);
assertLife(playerB, 22); assertLife(playerB, 22);
} }
} }

View file

@ -45,7 +45,7 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase {
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Diplomatic Immunity", "Zur the Enchanter"); castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Diplomatic Immunity", "Zur the Enchanter");
attack(2, playerB, "Zur the Enchanter"); attack(2, playerB, "Zur the Enchanter");
setChoice(playerB, "Empyrial Armor"); // setChoice(playerB, "Empyrial Armor"); // No need for this choice since the AI will autosearch and autopick this
setChoice(playerB, "Zur the Enchanter"); setChoice(playerB, "Zur the Enchanter");
setStopAt(2, PhaseStep.END_TURN); setStopAt(2, PhaseStep.END_TURN);

View file

@ -15,7 +15,8 @@ public class UnequipEventTest extends CardTestPlayerBase {
@Test @Test
public void testGraftedExoskeletonEvent() { public void testGraftedExoskeletonEvent() {
// When Nazahn, Revered Bladesmith enters the battlefield, search your library for an Equipment card and reveal it. If you reveal a card named Hammer of Nazahn this way, put it onto the battlefield. Otherwise, put that card into your hand. Then shuffle your library. // When Nazahn, Revered Bladesmith enters the battlefield, search your library for an Equipment card and reveal it.
// If you reveal a card named Hammer of Nazahn this way, put it onto the battlefield. Otherwise, put that card into your hand. Then shuffle your library.
// Whenever an equipped creature you control attacks, you may tap target creature defending player controls. // Whenever an equipped creature you control attacks, you may tap target creature defending player controls.
addCard(Zone.HAND, playerA, "Nazahn, Revered Bladesmith"); // Creature 5/4 {4}{G}{W} addCard(Zone.HAND, playerA, "Nazahn, Revered Bladesmith"); // Creature 5/4 {4}{G}{W}
// Whenever Hammer of Nazahn or another Equipment enters the battlefiend under your control, you may attach that Equipment to target creature you control. // Whenever Hammer of Nazahn or another Equipment enters the battlefiend under your control, you may attach that Equipment to target creature you control.
@ -31,7 +32,7 @@ public class UnequipEventTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Grafted Exoskeleton", 1); addCard(Zone.BATTLEFIELD, playerA, "Grafted Exoskeleton", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nazahn, Revered Bladesmith"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Nazahn, Revered Bladesmith");
setChoice(playerA, "Hammer of Nazahn"); // setChoice(playerA, "Hammer of Nazahn"); // Auto-chosen since it's the only equipment in the library
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}"); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}");

View file

@ -2,22 +2,22 @@ package org.mage.test.cards.watchers;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
* {@link mage.cards.g.GoblinCohort Goblin Cohort}
* {R}
* Creature Goblin Warrior
* Goblin Cohort cant attack unless youve cast a creature spell this turn.
* *
* @author BetaSteward * @author BetaSteward
*/ */
public class GoblinCohortTest extends CardTestPlayerBase { public class GoblinCohortTest extends CardTestPlayerBase {
/* /**
* Goblin Cohort * Goblin Cohort should be able to attack if the condition is met.
* Creature Goblin Warrior 2/2, R (1) */
* Goblin Cohort can't attack unless you've cast a creature spell this turn.
*
*/
// test that Goblin Cohort can attack
@Test @Test
public void testCanAttack() { public void testCanAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
@ -31,12 +31,13 @@ public class GoblinCohortTest extends CardTestPlayerBase {
execute(); execute();
assertAttacking("Goblin Cohort", true); assertAttacking("Goblin Cohort", true);
} }
// test that Goblin Cohort can't attack /**
* Goblin Cohort shouldn't be allowed to attack if the condition isn't met
*/
@Test @Test
public void testCantAttack() { public void testCannotAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Goblin Cohort"); addCard(Zone.BATTLEFIELD, playerB, "Goblin Cohort");
addCard(Zone.HAND, playerB, "Goblin Roughrider"); addCard(Zone.HAND, playerB, "Goblin Roughrider");
@ -44,10 +45,16 @@ public class GoblinCohortTest extends CardTestPlayerBase {
attack(2, playerB, "Goblin Cohort"); attack(2, playerB, "Goblin Cohort");
setStopAt(2, PhaseStep.DECLARE_BLOCKERS); setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
execute();
// TODO: Need a way to check if a creature can attack without this try-catch format
try {
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 cannot have action, but got:\n" + e.getMessage());
}
}
assertAttacking("Goblin Cohort", false); assertAttacking("Goblin Cohort", false);
} }
} }

View file

@ -453,7 +453,6 @@ public class AttackBlockRestrictionsTest extends CardTestPlayerBase {
} catch(UnsupportedOperationException e) { } catch(UnsupportedOperationException e) {
assertEquals("Underworld Cerberus is blocked by 1 creature(s). It has to be blocked by 3 or more.", e.getMessage()); assertEquals("Underworld Cerberus is blocked by 1 creature(s). It has to be blocked by 3 or more.", e.getMessage());
} }
} }
@Test @Test

View file

@ -82,11 +82,16 @@ public class CommanderReplaceEffectTest extends CardTestCommanderDuelBase {
} }
// https://github.com/magefree/mage/issues/5905 /**
/* From the rulings of Soulherder: * https://github.com/magefree/mage/issues/5905
If a creature is exiled but ends up in another zone (most likely because * I exiled an opponents Commander, but Soulherder did not trigger.
its a players commander in the Commander variant), Soulherders first ability triggers. *
I exiled an opponents Commander, but Soulherder did not trigger.*/ * From the rulings of Soulherder:
* If a creature is exiled but ends up in another zone
* (most likely because its a players commander in the Commander variant),
* Soulherders first ability triggers.
*/
@Test @Test
public void soulherderAndExiledCommanders() { public void soulherderAndExiledCommanders() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
@ -97,23 +102,26 @@ public class CommanderReplaceEffectTest extends CardTestCommanderDuelBase {
// then return that card to the battlefield under its owner's control. // then return that card to the battlefield under its owner's control.
addCard(Zone.HAND, playerA, "Soulherder", 1); // Creature {1}{W}{U} addCard(Zone.HAND, playerA, "Soulherder", 1); // Creature {1}{W}{U}
setStrictChooseMode(true);
// Daxos of Meletis can't be blocked by creatures with power 3 or greater. // Daxos of Meletis can't be blocked by creatures with power 3 or greater.
// Whenever Daxos of Meletis deals combat damage to a player, exile the top card of that player's library. You gain life equal to that card's converted mana cost. Until end of turn, you may cast that card and you may spend mana as though it were mana of any color to cast it. // Whenever Daxos of Meletis deals combat damage to a player, exile the top card of that player's library.
// You gain life equal to that card's converted mana cost.
// Until end of turn, you may cast that card and you may spend mana as though it were mana of any color to cast it.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daxos of Meletis"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daxos of Meletis");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Soulherder"); castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Soulherder");
setChoice(playerA, true); // Use Soulherder's triggered ability // Target and choices for Soulherder during turn 3's upkeep
addTarget(playerA, "Daxos of Meletis"); addTarget(playerA, "Daxos of Meletis");
setChoice(playerA, true); // Move Daxos to command Zone setChoice(playerA, true); // Use Soulherder's triggered ability
setStopAt(2, PhaseStep.UPKEEP); setStopAt(3, PhaseStep.UPKEEP);
execute(); execute();
assertPermanentCount(playerA, "Soulherder", 1); assertPermanentCount(playerA, "Soulherder", 1);
assertPermanentCount(playerA, "Daxos of Meletis", 1); assertPermanentCount(playerA, "Daxos of Meletis", 1);
assertCommandZoneCount(playerA, "Daxos of Meletis", 0); assertCommandZoneCount(playerA, "Daxos of Meletis", 0);
assertPowerToughness(playerA, "Soulherder", 2, 2); assertPowerToughness(playerA, "Soulherder", 2, 2); // 1/1 + the +1/+1 for bouncing Daxos
} }
@Test @Test

View file

@ -95,10 +95,11 @@ public class GameIsADrawTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stuffy Doll"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stuffy Doll");
setChoice(playerA, "PlayerA"); setChoice(playerA, "PlayerA");
setChoice(playerA, "PlayerA");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Stuffy Doll"); activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Stuffy Doll");
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: {this} deals"); activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: {this} deals");
setChoice(playerA, "Yes");
setChoice(playerB, "Yes");
setStopAt(3, PhaseStep.END_TURN); setStopAt(3, PhaseStep.END_TURN);
execute(); execute();
@ -112,7 +113,6 @@ public class GameIsADrawTest extends CardTestPlayerBase {
Assert.assertTrue("Game has ended.", currentGame.hasEnded()); Assert.assertTrue("Game has ended.", currentGame.hasEnded());
Assert.assertTrue("Infinite loop detected, game has be de a draw.", currentGame.isADraw()); Assert.assertTrue("Infinite loop detected, game has be de a draw.", currentGame.isADraw());
} }
/** /**

View file

@ -448,7 +448,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
* check it with checkPlayableAbility(..., mustHave = true), then add whatever condition would stop you from being * check it with checkPlayableAbility(..., mustHave = true), then add whatever condition would stop you from being
* able to activat the abiltiy * able to activat the abiltiy
* *
* TODO: Currently does not work * TODO: Currently does not work in all cases since some effects list abilities as available,
* only to then give a pop-up about how it can't be played.
* For examples and things to fix, search for:
* "try {
* execute();"
* *
* @param checkName String to show up if the check fails, for display purposes only. * @param checkName String to show up if the check fails, for display purposes only.
* @param turnNum The turn number to check on. * @param turnNum The turn number to check on.
@ -1102,15 +1106,13 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
//Assert.assertNotEquals("", cardName); //Assert.assertNotEquals("", cardName);
Card found = null; Card found = null;
if (found == null) { for (Card card : currentGame.getExile().getAllCards(currentGame)) {
for (Card card : currentGame.getExile().getAllCards(currentGame)) { if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
if (CardUtil.haveSameNames(card.getName(), cardName, true)) { found = card;
found = card; break;
break;
}
} }
} }
Assert.assertNotNull("There is no such card in the exile, cardName=" + cardName, found); Assert.assertNotNull("There is no such card in the exile, cardName=" + cardName, found);
Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type)); Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ':' + type + ')', count, found.getCounters(currentGame).getCount(type));
} }

View file

@ -57,5 +57,4 @@ public class TestAPITest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Grizzly Bears", 0); assertPermanentCount(playerA, "Grizzly Bears", 0);
assertLife(playerA, 24); // gain 4 life from Last Breath assertLife(playerA, 24); // gain 4 life from Last Breath
} }
} }