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;
/**
* {@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
*/
@ -20,11 +24,6 @@ public class BanisherPriestTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
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, playerB, "Incinerate");
@ -65,11 +64,6 @@ public class BanisherPriestTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
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, playerB, "Incinerate");
@ -107,41 +101,31 @@ public class BanisherPriestTest extends CardTestPlayerBase {
*/
@Test
public void testBanisherPriestToken() {
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");
/**
* Seance {2}{W}{W}
* Seance
* {2}{W}{W}
* Enchantment
* 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
* 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");
playerB.addChoice("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
addTarget(playerB, "Banisher Priest"); // Return the Banisher Priest from graveyard with Seance
// The Silvercoat Lion is autochosen for Banisher Priest's ETB since it's the only creature on the opponent's board
setStopAt(1, PhaseStep.END_TURN);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
// Banisher Priest should be in exile
assertExileCount("Banisher Priest", 1);
// Token ceased to exist
assertPermanentCount(playerB, "Banisher Priest", 0);
// Silvercoat Lion should be back on battlefield
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
public void testCorrectCostReduction() {
@ -39,7 +40,7 @@ public class AffinityForArtifactsTest extends CardTestPlayerBase {
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);
execute();

View file

@ -79,7 +79,6 @@ public class CascadeTest extends CardTestPlayerBase {
// won't trigger.
@Test
public void testEmptyLibraryCascasde() {
playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Plains", 10);
@ -104,7 +103,6 @@ public class CascadeTest extends CardTestPlayerBase {
@Test
public void testEmptyLibraryCascasdeNexus() {
playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus");
@ -135,7 +133,6 @@ public class CascadeTest extends CardTestPlayerBase {
*/
@Test
public void testRecastCascadeCard() {
playerA.getLibrary().clear();
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 2);
@ -169,7 +166,6 @@ public class CascadeTest extends CardTestPlayerBase {
*/
@Test
public void testHaveToPayAdditionalCosts() {
playerA.getLibrary().clear();
// Choose one -
// - 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
*/
@Test
public void testWithSplitSpell() {
playerA.getLibrary().clear();
// 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.)
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, "Island", 2);
// 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}
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");
setChoice(playerA, true);
addTarget(playerA, playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Ardent Plea", 1);
assertGraveyardCount(playerA, "Breaking // Entering", 0);
assertGraveyardCount(playerB, 0);
assertLibraryCount(playerA, "Breaking // Entering", 1);
}
}

View file

@ -2,6 +2,7 @@ package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
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(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion");
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);
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, "Bruna, the Fading Light", 0);

View file

@ -170,22 +170,16 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
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");
setChoice(playerB, true); // use to copy a nonland permanent
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString()); // Morphed creature
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 20);
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
assertPowerToughness(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
}
/**
@ -311,7 +305,7 @@ public class MorphTest extends CardTestPlayerBase {
public void testCounterCastWithMorphEffect() {
// Sagu Mauler 6/6 - Creature - Beast
// 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.BATTLEFIELD, playerA, "Forest", 3);
@ -324,7 +318,7 @@ public class MorphTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler");
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);
execute();
@ -651,18 +645,25 @@ public class MorphTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Island");
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
setStrictChooseMode(true);
// return to hand
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage");
addTarget(playerA, "Rattleclaw Mystic");
// try cast as normal -- must not work
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);
try {
execute();
//assertAllCommandsUsed();
} 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(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
public void RetraceCostIncreaseCantPay() {
@ -56,7 +56,7 @@ public class RetraceTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Thalia, Guardian of Thraben", 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);
execute();

View file

@ -76,20 +76,22 @@ public class SuspendTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1);
// 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.BATTLEFIELD, playerB, "Island", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Delay", "Silvercoat Lion");
setChoice(playerA, "Silvercoat Lion");
setStopAt(7, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, "Delay", 1);
assertPermanentCount(playerA, "Silvercoat Lion", 1);
}
@Test
@ -123,7 +125,8 @@ public class SuspendTest extends CardTestPlayerBase {
// Target player draws three cards.
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);
execute();

View file

@ -45,7 +45,6 @@ public class TransformTest extends CardTestPlayerBase {
assertCounterCount("Nissa, Sage Animist", CounterType.LOYALTY, 4);
assertPermanentCount(playerA, "Forest", 6);
assertPermanentCount(playerA, "Swamp", 1);
}
@Test
@ -74,7 +73,6 @@ public class TransformTest extends CardTestPlayerBase {
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
assertPermanentCount(playerA, "Zombie Token", 1);
}
/**
@ -106,7 +104,6 @@ public class TransformTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
assertGraveyardCount(playerA, "Liliana, Heretical Healer", 1);
}
@Test
@ -433,7 +430,8 @@ public class TransformTest extends CardTestPlayerBase {
public void testCopyTransformedThingInTheIce() {
// Defender
// 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}
// Creatures you control get +1/+0 until end of turn.
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(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
addTarget(playerB, "Awoken Horror");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();

View file

@ -48,7 +48,10 @@ public class TransmuteTest extends CardTestPlayerBase {
public void searchSplittedCardOneManaCmcSpell() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// 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}
// Wear {1}{R}
@ -58,7 +61,7 @@ public class TransmuteTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{U}");
setChoice(playerA, "Wear // Tear");
// let the game choose targets
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -82,7 +85,7 @@ public class TransmuteTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, "Wear // Tear");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Transmute {1}{U}{B}");
setChoice(playerA, "Wear // Tear");
addTarget(playerA, "Wear // Tear");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -90,5 +93,4 @@ public class TransmuteTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Perplex", 1);
assertHandCount(playerA, "Wear // Tear", 1);
}
}

View file

@ -6,11 +6,17 @@ import org.junit.Test;
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
*/
public class SurgicalExtractionTest extends CardTestPlayerBase {
/**
* 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
@ -19,21 +25,19 @@ public class SurgicalExtractionTest extends CardTestPlayerBase {
*/
@Test
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.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.GRAVEYARD, playerB, "Breaking // Entering", 2);
addCard(Zone.HAND, 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");
addTarget(playerA, "Breaking // Entering");
setChoice(playerA, "Breaking // Entering");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Surgical Extraction", "Breaking // Entering");
setChoice(playerA, "Yes"); // Pay 2 life to cast instead of {B}
addTarget(playerA, "Breaking // Entering^Breaking // Entering"); // Graveyard
addTarget(playerA, "Breaking // Entering"); // Hand
addTarget(playerA, "Breaking // Entering"); // Library
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
@ -45,6 +49,5 @@ public class SurgicalExtractionTest extends CardTestPlayerBase {
assertHandCount(playerB, "Breaking // Entering", 0);
assertExileCount(playerB, "Breaking // Entering", 4);
}
}

View file

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

View file

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

View file

@ -60,12 +60,10 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
// A non-green creature card should not have Yeva's effect
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);
execute();
assertPermanentCount(playerA, "Cabal Therapist", 0);
}
@Test
@ -98,12 +96,10 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
removeAllCardsFromLibrary(playerA);
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);
execute();
assertPermanentCount(playerA, "Cabal Therapist", 0);
}
@Test
@ -135,13 +131,10 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
// Instant that grants +1/+0 to all creatures you control
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);
execute();
//Should not have +1/+0 effect
assertPowerToughness(playerA, "Vizier of the Menagerie", 3, 4);
}
@Test
@ -172,16 +165,12 @@ public class VizierOfTheMenagerieTest extends CardTestPlayerBase {
addCard(Zone.GRAVEYARD, playerA, "Vizier of the Menagerie");
addCard(Zone.LIBRARY, 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.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);
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;
/**
* {@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
*/
@ -31,9 +38,6 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
@Test
public void testCastWithThadaAdelAcquisitor() {
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, playerB, "Swamp", 3);
@ -44,7 +48,9 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Wildwood Rebirth"); // Instant {1}{G}
attack(1, playerA, "Thada Adel, Acquisitor");
setChoice(playerA, "Bottle Gnomes");
addTarget(playerA, "Bottle Gnomes");
// setStrictChooseMode(true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Bottle Gnomes");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sacrifice");
@ -64,9 +70,6 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
@Test
public void testCastWithThadaAdelAcquisitorReturnedFromBattlefield() {
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, playerB, "Swamp", 3);
@ -78,7 +81,7 @@ public class CastOtherPlayersCardFromExileTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Saving Grasp"); // Instant {U}
attack(1, playerA, "Thada Adel, Acquisitor");
setChoice(playerA, "Bottle Gnomes");
addTarget(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");
setStopAt(2, PhaseStep.END_TURN);
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
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
*
*/
@Test
public void testPermanentControlEffect() {
@ -80,7 +79,6 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
/**
* The shackles can maintain control of Mutavault indefinitely, even when
* it's not a creature.
*
*/
@Test
public void testKeepControlOfMutavault() {
@ -123,25 +121,26 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Donate", playerB);
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);
execute();
assertGraveyardCount(playerA, "Donate", 1);
assertPermanentCount(playerA, "Steel Golem", 0);
assertPermanentCount(playerB, "Steel Golem", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 0);
assertHandCount(playerB, "Silvercoat Lion", 1);
}
/*
Reported bug: 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.
/**
* Reported bug:
* 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
public void testSkyfireKirinStealCreatureDifferentCMC()
{
public void testSkyfireKirinStealCreatureDifferentCMC() {
/*
Skyfire Kirin {2}{R}{R}
Legendary Creature - Kirin Spirit 3/3
@ -165,15 +164,16 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
*/
String leovold = "Leovold, Emissary of Trest";
addCard(Zone.BATTLEFIELD, playerA, sKirin);
addCard(Zone.HAND, playerA, oGorger);
addCard(Zone.BATTLEFIELD, playerA, sKirin);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, leovold);
setStrictChooseMode(true);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, oGorger);
setChoice(playerA, true); // opt to use Kirin's ability
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)
// Option to gain control is not even given since the Gorger is 5 mana but the only possible target (Leovold) is 3.
setStopAt(1, PhaseStep.BEGIN_COMBAT);
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
}
/*
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
public void testSkyfireKirinStealCreatureSameCMC()
{
public void testSkyfireKirinStealCreatureSameCMC() {
/*
Skyfire Kirin {2}{R}{R}
Legendary Creature - Kirin Spirit 3/3

View file

@ -72,8 +72,9 @@ public class ArtisanOfFormsTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cackling Counterpart", "Artisan of Forms");
addTarget(playerA, "Silvercoat Lion");
setChoice(playerA, "Yes");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Eyes in the Skies");
addTarget(playerA, "Silvercoat Lion");
setStopAt(1, PhaseStep.END_TURN);
execute();

View file

@ -493,7 +493,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Phantasmal Image", 0);
assertPermanentCount(playerB, "Kitchen Finks", 1);
assertPowerToughness(playerB, "Kitchen Finks", 2, 1);
}
@Test
@ -535,7 +534,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertGraveyardCount(playerB, "Phantasmal Image", 0);
assertPermanentCount(playerB, "Butcher Ghoul", 1);
assertPowerToughness(playerB, "Butcher Ghoul", 2, 2);
}
/**
@ -561,7 +559,7 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Phantasmal Image");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Phantasmal Image"); // not targeted
setChoice(playerB, "Wurmcoil Engine");
setChoice(playerA, "Wurmcoil Engine");
attack(2, playerB, "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(playerB, "Phyrexian Wurm Token", 2);
}
/**
@ -585,14 +582,16 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
*/
@Test
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, playerA, "Island", 2);
addCard(Zone.HAND, playerA, "Phantasmal Image");
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");
block(2, playerA, "Voice of Resurgence", "Voice of Resurgence");
@ -607,7 +606,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Elemental Token", 1);
assertPermanentCount(playerA, "Elemental Token", 1);
}
@Test

View file

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

View file

@ -48,9 +48,12 @@ public class CostModificationTest extends CardTestPlayerBase {
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
// payment through life doesn't count. (Source: http://blogs.magicjudges.org/rulestips/2012/08/how-trinisphere-works-with-phyrexian-mana/)
/**
* 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 payment through life doesn't count.
* (Source: http://blogs.magicjudges.org/rulestips/2012/08/how-trinisphere-works-with-phyrexian-mana/)
*/
@Test
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.
@ -62,11 +65,19 @@ public class CostModificationTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerB, "Gitaxian Probe"); // Sorcery {U/P}
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Gitaxian Probe", playerA);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerB, "Gitaxian Probe", 1);
assertGraveyardCount(playerB, "Gitaxian Probe", 0);
setStopAt(2, PhaseStep.BEGIN_COMBAT);
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.
addCard(Zone.HAND, playerA, "Myr Superion");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Add {G}.");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Myr Superion", 1); // Can be cast because mana was produced by a creature
// Can be cast because mana was produced by a creature
assertPermanentCount(playerA, "Myr Superion", 1);
}
@Test
@ -105,14 +114,19 @@ public class CostModificationTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Myr Superion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
try {
execute();
assertAllCommandsUsed();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Myr Superion", 0); // Can't be cast because mana was not produced by a creature
assertHandCount(playerA, "Myr Superion", 1); // Can't be cast because mana was not produced by a creature
Assert.fail("must throw exception on execute");
} catch (Throwable e) {
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
Assert.fail("must throw error about having 0 actions, but got:\n" + e.getMessage());
}
}
}
/*
@ -171,7 +185,7 @@ public class CostModificationTest extends CardTestPlayerBase {
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.
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);
execute();

View file

@ -14,22 +14,19 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class ThaliaGuardianOfThrabenTest extends CardTestPlayerBase {
@Test
public void testCard() {
public void testShouldNotHaveEnoughMana() {
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
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);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
}
@Test
public void testCard1() {
public void testShouldHaveEnoughMana() {
addCard(Zone.BATTLEFIELD, playerA, "Thalia, Guardian of Thraben");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.HAND, playerA, "Lightning Bolt");
@ -42,5 +39,4 @@ public class ThaliaGuardianOfThrabenTest extends CardTestPlayerBase {
assertLife(playerB, 17);
assertGraveyardCount(playerA, 1);
}
}

View file

@ -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.
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");
setChoice(playerB, "X=2");
// Crypt Ghast may no longer give additional mana
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Erebos's Titan");
// Without Crypt Ghast, the land won't give extra mana
checkPlayableAbility("Not enough mana", 3, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Erebos's", false);
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Erebos's Titan", 0);
assertTapped("Nin, the Pain Artist", true);
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.
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);
execute();

View file

@ -32,7 +32,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Darksteel Colossus", 0);
assertGraveyardCount(playerA, 5); // 4 + Tome Scour
}
@Test
@ -68,7 +67,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
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);
execute();
@ -76,11 +75,12 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
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
}
@Test
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");
// Diabolic Edict - Instant - {1}{B}
// Target player sacrifices a creature.
@ -92,7 +92,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
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);
execute();
@ -100,7 +100,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Progenitus", 0);
assertGraveyardCount(playerA, 2); // Diabolic Edict + Bridge from Below
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
@ -120,7 +120,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
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);
execute();
@ -128,7 +128,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Progenitus", 0);
assertGraveyardCount(playerA, "Progenitus", 1);
assertGraveyardCount(playerA, 2); // Diabolic Edict + Progenitus
}
@Test
@ -167,7 +166,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Silvercoat Lion", 0);
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
}
// 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);
assertGraveyardCount(playerB, "Pillarfield Ox", 0);
}
// 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);
assertGraveyardCount(playerB, "Pillarfield Ox", 1);
}
/**
@ -283,9 +279,7 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Legacy Weapon", 0);
assertGraveyardCount(playerB, "Mana Drain", 1);
assertPermanentCount(playerB, "Legacy Weapon", 1);
}
/**
@ -317,7 +311,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Terror", 1);
assertExileCount("Silvercoat Lion", 1);
}
/**
@ -353,7 +346,6 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertPermanentCount(playerB, "Jace, Vryn's Prodigy", 0);
assertPermanentCount(playerB, "Jace, Telepath Unbound", 1);
assertCounterCount("Jace, Telepath Unbound", CounterType.LOYALTY, 6);
}
/**
@ -389,6 +381,5 @@ public class ZoneChangeReplacementTest extends CardTestPlayerBase {
assertExileCount("Skyraker Giant", 1);
assertPermanentCount(playerA, "Anafenza, the Foremost", 0);
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.Zone;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -17,26 +18,40 @@ public class CanopyCoverTest extends CardTestPlayerBase {
*/
@Test
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.BATTLEFIELD, playerB, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2 Creature - Lion
// 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);
setStrictChooseMode(true);
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);
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, "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
@ -53,15 +68,12 @@ public class CanopyCoverTest extends CardTestPlayerBase {
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);
execute();
assertPermanentCount(playerA, "Canopy Cover", 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 {
/*
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
public void hangarBackHardenedScalesMetallicMimicTest() {
@ -50,7 +50,7 @@ public class HardenedScaleTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, mMimic);
setChoice(playerA, "Construct Token");
setChoice(playerA, "Construct");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hWalker);
setChoice(playerA, "X=1");

View file

@ -61,7 +61,6 @@ public class BecomeBlockTriggersAITest extends CardTestPlayerBaseWithAIHelps {
} catch (UnsupportedOperationException ue) {
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

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.restriction;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -26,7 +27,17 @@ public class ArrestTest extends CardTestPlayerBase {
attack(2, playerB, "Selesnya Guildmage");
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
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(playerB, "Saproling Token", 0); // can't use ability so no Saproling

View file

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

View file

@ -6,25 +6,24 @@ import org.junit.Test;
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)
*/
public class TreeOfPerditionTest extends CardTestPlayerBase {
/*
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,
and when replayed it was still 0/20. It should be a new object and enter as an 0/13.
/**
* 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,
* and when replayed it was still 0/20. It should be a new object and enter as an 0/13.
*/
@Test
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, "Swamp", 4);
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);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Unsummon");
addTarget(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);
}
/*
Reported bug: Tree of Perdition is gaining both power and toughness equal to opponent's life total
instead of just toughness equal to it.
/**
* Reported bug: Tree of Perdition is gaining both power and toughness equal to opponent's life total
* instead of just toughness equal to it.
*/
@Test
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, "Swamp", 4);

View file

@ -3,6 +3,7 @@ package org.mage.test.cards.single.khm;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -78,18 +79,31 @@ public class DraugrNecromancerTest extends CardTestPlayerBase {
@Test
public void testCastFromExileWithoutSnow() {
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerA, necromancer);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
addCard(Zone.HAND, playerA, bolt);
addCard(Zone.BATTLEFIELD, playerB, bear);
// Kill playerB's Bear to exile it
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);
setStopAt(1, PhaseStep.END_TURN);
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);
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");
checkPlayableAbility("4th land not possible", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Play Forest", false);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Forest", 3);
}
}

View file

@ -11,13 +11,13 @@ public class DemonicEmbraceTest extends CardTestPlayerBase {
public void playFromGraveyard() {
// 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.
addCard(Zone.HAND, playerA, "Mountain");
addCard(Zone.GRAVEYARD, playerA, "Demonic Embrace");
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Demonic Embrace", "Grizzly Bears");
addTarget(playerA, "Mountain");
setChoice(playerA, "Mountain");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();

View file

@ -6,6 +6,13 @@ import org.junit.Test;
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
*/
public class WildPairTest extends CardTestPlayerBase {
@ -24,8 +31,9 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, shimmerer);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, serpent);
setChoice(playerA, shimmerer);
setChoice(playerA, "X=0");
setChoice(playerA, "Yes");
addTarget(playerA, shimmerer);
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -42,7 +50,8 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, crocodile);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shimmerer);
setChoice(playerA, crocodile);
setChoice(playerA, "Yes");
addTarget(playerA, crocodile);
setStopAt(1, PhaseStep.END_TURN);
execute();
@ -59,7 +68,8 @@ public class WildPairTest extends CardTestPlayerBase {
addCard(Zone.LIBRARY, playerA, maro);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, memnite);
setChoice(playerA, maro);
setChoice(playerA, "Yes");
addTarget(playerA, maro);
setStopAt(1, PhaseStep.END_TURN);
execute();

View file

@ -25,7 +25,6 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/
@Test
public void noLandsSacrificeGitrog() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
@ -53,16 +52,16 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/
@Test
public void hasLandsSacrificeLand() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "The Gitrog Monster");
// on 3rd turn during upkeep opt to sacrifice a land
setChoice(playerA, true);
addTarget(playerA, "Swamp");
// TODO: I don't know how to get these choices to work, let the choices go automatically
// addTarget(playerA, "Swamp");
// setChoice(playerA, true);
setStopAt(3, PhaseStep.DRAW);
execute();
@ -76,7 +75,6 @@ public class TheGitrogMonsterTest extends CardTestPlayerBase {
*/
@Test
public void boardSweeperWithTokens() {
addCard(Zone.HAND, playerA, "The Gitrog Monster", 1);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
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, "Archangel of Tithes", 1);
setStrictChooseMode(true);
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");
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(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;
/**
* {@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)
*/
@ -17,12 +22,6 @@ public class UrzasIncubatorTest extends CardTestPlayerBase {
*/
@Test
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, "Eldrazi Displacer", 1); // {2}{W} eldrazi 3/3
addCard(Zone.HAND, playerA, "Eldrazi Mimic", 2); // {2} eldrazi 2/1
@ -47,23 +46,19 @@ public class UrzasIncubatorTest extends CardTestPlayerBase {
*/
@Test
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, "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);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Urza's Incubator"); // taps 3 plains
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);
execute();
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;
import javafx.geometry.Pos;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
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
*/
public class WhispersteelDaggerTest extends CardTestPlayerBase {
@ -21,24 +32,29 @@ public class WhispersteelDaggerTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, dagger);
addCard(Zone.BATTLEFIELD, playerA, forest, 7);
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);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, lion);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, lion);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
// The Grizzly Bears shouldn't be playable since they are in playerA's graveyard not playerB's.
checkPlayableAbility("Bear not playable", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Cast Grizzly", false);
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);
execute();
assertPermanentCount(playerA, lion, 1);
assertGraveyardCount(playerB, lion, 1);
assertPermanentCount(playerA, bear, 0);
assertGraveyardCount(playerA, bear, 1);
assertPermanentCount(playerA, lion, 1); // The one cast
assertLife(playerB, 20 - 3);
}
}

View file

@ -17,15 +17,10 @@ public class CondemnTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Condemn");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
// check with illegal target
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Condemn", "Sejiri Merfolk");
checkPlayableAbility("No valid target", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Condemn", false);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
// spell shouldn't work
assertPermanentCount(playerB, "Sejiri Merfolk", 1);
assertLife(playerA, 20);
assertLife(playerB, 20);
}
@Test
@ -46,5 +41,4 @@ public class CondemnTest extends CardTestPlayerBase {
// check was put on top
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");
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);
execute();
@ -28,6 +28,4 @@ public class DivineVerdictTest extends CardTestPlayerBase {
assertLife(playerA, 18);
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");
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");
setStopAt(2, PhaseStep.END_TURN);

View file

@ -15,7 +15,8 @@ public class UnequipEventTest extends CardTestPlayerBase {
@Test
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.
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.
@ -31,7 +32,7 @@ public class UnequipEventTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Grafted Exoskeleton", 1);
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}");

View file

@ -2,22 +2,22 @@ package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
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
*/
public class GoblinCohortTest extends CardTestPlayerBase {
/*
* Goblin Cohort
* Creature Goblin Warrior 2/2, R (1)
* Goblin Cohort can't attack unless you've cast a creature spell this turn.
*
/**
* Goblin Cohort should be able to attack if the condition is met.
*/
// test that Goblin Cohort can attack
@Test
public void testCanAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
@ -31,12 +31,13 @@ public class GoblinCohortTest extends CardTestPlayerBase {
execute();
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
public void testCantAttack() {
public void testCannotAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Goblin Cohort");
addCard(Zone.HAND, playerB, "Goblin Roughrider");
@ -44,10 +45,16 @@ public class GoblinCohortTest extends CardTestPlayerBase {
attack(2, playerB, "Goblin Cohort");
setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
// 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);
}
}

View file

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

View file

@ -82,11 +82,16 @@ public class CommanderReplaceEffectTest extends CardTestCommanderDuelBase {
}
// https://github.com/magefree/mage/issues/5905
/* 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.
I exiled an opponents Commander, but Soulherder did not trigger.*/
/**
* https://github.com/magefree/mage/issues/5905
* 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
public void soulherderAndExiledCommanders() {
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.
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.
// 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.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");
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();
assertPermanentCount(playerA, "Soulherder", 1);
assertPermanentCount(playerA, "Daxos of Meletis", 1);
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

View file

@ -95,10 +95,11 @@ public class GameIsADrawTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Stuffy Doll");
setChoice(playerA, "PlayerA");
setChoice(playerA, "PlayerA");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Stuffy Doll");
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: {this} deals");
setChoice(playerA, "Yes");
setChoice(playerB, "Yes");
setStopAt(3, PhaseStep.END_TURN);
execute();
@ -112,7 +113,6 @@ public class GameIsADrawTest extends CardTestPlayerBase {
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
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
* 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 turnNum The turn number to check on.
@ -1102,7 +1106,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
//Assert.assertNotEquals("", cardName);
Card found = null;
if (found == null) {
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
found = card;
@ -1110,7 +1113,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
}
}
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));
}

View file

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