mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
Fixing several tests. Working towards enabling assertAllCommandsUsed() inside execute().
This commit is contained in:
parent
e955d47821
commit
2497e44182
12 changed files with 201 additions and 78 deletions
|
@ -28,7 +28,7 @@ public class ChangelingTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Long-Forgotten Gohei");
|
addCard(Zone.BATTLEFIELD, playerA, "Long-Forgotten Gohei");
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Woodland Changeling");
|
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Woodlan", false);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
|
@ -62,21 +62,22 @@ public class CyclingTest extends CardTestPlayerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cycle from graveyard or battlefield may not work
|
* Cycle from graveyard or battlefield should not work.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void cycleFromGraveyard() {
|
public void cycleFromGraveyard() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||||
|
|
||||||
// Destroy all creatures. They can't be regenerated. Draw a card for each creature destroyed this way.
|
// Destroy all creatures. They can't be regenerated. Draw a card for each creature destroyed this way.
|
||||||
// Cycling {3}{B}{B}
|
// Cycling {3}{B}{B}
|
||||||
// When you cycle Decree of Pain, all creatures get -2/-2 until end of turn.
|
// When you cycle Decree of Pain, all creatures get -2/-2 until end of turn.
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Decree of Pain");
|
addCard(Zone.GRAVEYARD, playerA, "Decree of Pain");
|
||||||
|
|
||||||
// Protection from black
|
// Protection from black
|
||||||
// Cycling {2} ({2}, Discard this card: Draw a card.)
|
// Cycling {2} ({2}, Discard this card: Draw a card.)
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Disciple of Grace");
|
addCard(Zone.BATTLEFIELD, playerB, "Disciple of Grace");
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling {3}{B}{B}");
|
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling", false);
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cycling {2}");
|
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.mage.test.cards.mana;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -18,22 +19,28 @@ public class ManaSourceTest extends CardTestPlayerBase {
|
||||||
@Test
|
@Test
|
||||||
public void testCantCastWithCreatureCard() {
|
public void testCantCastWithCreatureCard() {
|
||||||
// Exile Simian Spirit Guide from your hand: Add {R}.
|
// Exile Simian Spirit Guide from your hand: Add {R}.
|
||||||
addCard(Zone.HAND, playerB, "Simian Spirit Guide", 1);
|
addCard(Zone.HAND, playerA, "Simian Spirit Guide", 1);
|
||||||
// Spend only mana produced by creatures to cast Myr Superion.
|
// Spend only mana produced by creatures to cast Myr Superion.
|
||||||
addCard(Zone.HAND, playerB, "Myr Superion", 1); // {2}
|
addCard(Zone.HAND, playerA, "Myr Superion", 1); // {2}
|
||||||
|
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Manakin", 1);
|
addCard(Zone.BATTLEFIELD, playerA, "Manakin", 1);
|
||||||
|
|
||||||
activateManaAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Exile");
|
activateManaAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Exile");
|
||||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Myr Superion");
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Myr Superion");
|
||||||
|
|
||||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertExileCount("Simian Spirit Guide", 1);
|
assertExileCount("Simian Spirit Guide", 1);
|
||||||
|
|
||||||
assertPermanentCount(playerB, "Myr Superion", 0);
|
assertPermanentCount(playerA, "Myr Superion", 0);
|
||||||
assertHandCount(playerB, "Myr Superion", 1);
|
assertHandCount(playerA, "Myr Superion", 1);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
|
||||||
|
Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,36 +2,51 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DenseFoliage: Creatures can't be the targets of spells.
|
* {@link mage.cards.d.DenseFoliage Dense Foliage}
|
||||||
|
* {2}{G}
|
||||||
|
* Enchantment
|
||||||
|
* Creatures can't be the targets of spells.
|
||||||
*
|
*
|
||||||
* @author Quercitron
|
* @author Quercitron
|
||||||
*/
|
*/
|
||||||
public class DenseFoliageTest extends CardTestPlayerBase {
|
public class DenseFoliageTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test spell
|
* Test tagrgeting spell, it shouldn't work.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSpellCantTarget() {
|
public void testSpellCantTarget() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Dense Foliage");
|
|
||||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Dense Foliage");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Eager Cadet");
|
addCard(Zone.BATTLEFIELD, playerB, "Eager Cadet");
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Eager Cadet");
|
// setStrictChooseMode(true);
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt");
|
||||||
|
addTarget(playerA, "Eager Cadet");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
assertPermanentCount(playerB, "Eager Cadet", 1);
|
assertPermanentCount(playerB, "Eager Cadet", 1);
|
||||||
|
Assert.fail("must throw exception on execute");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!e.getMessage().contains("setup good targets")) {
|
||||||
|
Assert.fail("must throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests activated ability
|
* Tests targeting activated ability, it should work.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAbilityCanTarget() {
|
public void testAbilityCanTarget() {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import mage.constants.EmptyNames;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -13,12 +14,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
public class CantCastTest extends CardTestPlayerBase {
|
public class CantCastTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I control Void Winnower. But my opponent can cast Jayemdae Tome (that's
|
* I control Void Winnower.
|
||||||
* converted mana cost is even) They can cast other even spell. Test casting
|
* But my opponent can cast Jayemdae Tome (that's converted mana cost is even).
|
||||||
* cost 4
|
* They can cast other even spell.
|
||||||
|
* Test casting cost 4.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testVoidWinnower1() {
|
public void testVoidWinnowerEvenSpell() {
|
||||||
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
||||||
// Your opponents can't block with creatures with even converted mana costs.
|
// Your opponents can't block with creatures with even converted mana costs.
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
||||||
|
@ -30,19 +32,27 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jayemdae Tome"); // {4}
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jayemdae Tome"); // {4}
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
assertHandCount(playerA, "Jayemdae Tome", 1);
|
assertHandCount(playerA, "Jayemdae Tome", 1);
|
||||||
|
|
||||||
assertPermanentCount(playerA, "Jayemdae Tome", 0);
|
assertPermanentCount(playerA, "Jayemdae Tome", 0);
|
||||||
|
|
||||||
|
Assert.fail("must throw exception on execute");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
|
||||||
|
Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with X=3
|
* Test Blaze ({X}{R}) with X=3 so that it's total cost is even.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testVoidWinnower2() {
|
public void testVoidWinnowerEvenSpellWithX() {
|
||||||
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
||||||
// Your opponents can't block with creatures with even converted mana costs.
|
// Your opponents can't block with creatures with even converted mana costs.
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
||||||
|
@ -56,19 +66,30 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
setChoice(playerA, "X=3");
|
setChoice(playerA, "X=3");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
// TODO: Replace these with checkPlayableAbility when the effect has been implemented so that the card is no
|
||||||
|
// longer shown as castable.
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
assertHandCount(playerA, "Blaze", 1);
|
assertHandCount(playerA, "Blaze", 1);
|
||||||
|
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
Assert.fail("must throw exception on execute");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
|
||||||
|
Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with X=4
|
* Test Blaze ({X}{R}) with X=4 so that it's total cost is odd.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testVoidWinnower3() {
|
public void testVoidWinnowerUnevenSpellWithX() {
|
||||||
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
||||||
// Your opponents can't block with creatures with even converted mana costs.
|
// Your opponents can't block with creatures with even converted mana costs.
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
|
||||||
|
@ -91,6 +112,9 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test mmorphing a creature.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testVoidWinnowerWithMorph() {
|
public void testVoidWinnowerWithMorph() {
|
||||||
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
|
||||||
|
@ -110,11 +134,17 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
setChoice(playerA, true); // cast it face down as 2/2 creature
|
setChoice(playerA, true); // cast it face down as 2/2 creature
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||||
assertHandCount(playerA, "Pine Walker", 1);
|
assertHandCount(playerA, "Pine Walker", 1);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
|
||||||
|
Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,12 +162,16 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mox Opal");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mox Opal");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertHandCount(playerA, "Mox Opal", 1);
|
assertHandCount(playerA, "Mox Opal", 1);
|
||||||
|
} catch (Throwable e) {
|
||||||
assertLife(playerB, 20);
|
if (!e.getMessage().contains("Player PlayerA must have 0 actions but found 1")) {
|
||||||
|
Assert.fail("must not have throw error about bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +199,6 @@ public class CantCastTest extends CardTestPlayerBase {
|
||||||
assertHandCount(playerA, "Panic", 3);
|
assertHandCount(playerA, "Panic", 3);
|
||||||
assertHandCount(playerA, 4);
|
assertHandCount(playerA, 4);
|
||||||
assertGraveyardCount(playerA, "Panic", 1);
|
assertGraveyardCount(playerA, "Panic", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,9 +5,16 @@ 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link mage.cards.p.PowerWordKill Power Word Kill}
|
||||||
|
* {1}{B}
|
||||||
|
* Instant
|
||||||
|
* Destroy target non-Angel, non-Demon, non-Devil, non-Dragon creature.
|
||||||
|
*
|
||||||
|
* @author Ingmar Goudt
|
||||||
|
*/
|
||||||
public class PowerWordKillTest extends CardTestPlayerBase {
|
public class PowerWordKillTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
// Destroy target non-Angel, non-Demon, non-Devil, non-Dragon creature.
|
|
||||||
private final String powerWordKill = "Power Word Kill";
|
private final String powerWordKill = "Power Word Kill";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -28,9 +35,11 @@ public class PowerWordKillTest extends CardTestPlayerBase {
|
||||||
public void canNotTargetChangeling(){
|
public void canNotTargetChangeling(){
|
||||||
addCard(Zone.HAND, playerA, powerWordKill);
|
addCard(Zone.HAND, playerA, powerWordKill);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||||
|
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Avian Changeling");
|
addCard(Zone.BATTLEFIELD, playerB, "Avian Changeling");
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, powerWordKill, "Avian Changeling");
|
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Power", false);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
execute();
|
execute();
|
||||||
assertPermanentCount(playerB, "Avian Changeling", 1);
|
assertPermanentCount(playerB, "Avian Changeling", 1);
|
||||||
|
|
|
@ -2,10 +2,18 @@ package org.mage.test.cards.single.arb;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sen Triplets
|
||||||
|
* {2}{W}{U}{B}
|
||||||
|
* Legendary Artifact Creature — Human Wizard
|
||||||
|
* At the beginning of your upkeep, choose target opponent.
|
||||||
|
* This turn, that player can’t cast spells or activate abilities and plays with their hand revealed.
|
||||||
|
* You may play lands and cast spells from that player’s hand this turn.
|
||||||
|
*
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public class SenTripletsTest extends CardTestPlayerBase {
|
public class SenTripletsTest extends CardTestPlayerBase {
|
||||||
|
@ -17,12 +25,19 @@ public class SenTripletsTest extends CardTestPlayerBase {
|
||||||
private void initTriplets() {
|
private void initTriplets() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, triplets);
|
addCard(Zone.BATTLEFIELD, playerA, triplets);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Taiga");
|
addCard(Zone.BATTLEFIELD, playerB, "Taiga");
|
||||||
|
|
||||||
addCard(Zone.HAND, playerB, bolt);
|
addCard(Zone.HAND, playerB, bolt);
|
||||||
addCard(Zone.HAND, playerB, relic);
|
addCard(Zone.HAND, playerB, relic);
|
||||||
addCard(Zone.HAND, playerB, "Island");
|
addCard(Zone.HAND, playerB, "Island");
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Player who cast Sen Triplets must still be able to cast spells this turn, it's only playerB who can't.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCastSpell() {
|
public void testCastSpell() {
|
||||||
initTriplets();
|
initTriplets();
|
||||||
|
@ -43,6 +58,9 @@ public class SenTripletsTest extends CardTestPlayerBase {
|
||||||
assertLife(playerB, 20 - 3);
|
assertLife(playerB, 20 - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Target player (playerB) can't activate abilities on turn 1 since Sen Triplets was just cast.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCantActivate() {
|
public void testCantActivate() {
|
||||||
initTriplets();
|
initTriplets();
|
||||||
|
@ -50,11 +68,24 @@ public class SenTripletsTest extends CardTestPlayerBase {
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}");
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{T}");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
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 bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assertTapped("Taiga", false);
|
assertTapped("Taiga", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Target player (playerB) can't cast a spell on turn 1 since Sen Triplets was just cast.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCantCast() {
|
public void testCantCast() {
|
||||||
initTriplets();
|
initTriplets();
|
||||||
|
@ -62,7 +93,17 @@ public class SenTripletsTest extends CardTestPlayerBase {
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, bolt, playerA);
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, bolt, playerA);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.END_TURN);
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
|
||||||
|
try {
|
||||||
execute();
|
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 bad targets, but got:\n" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assertHandCount(playerB, bolt, 1);
|
assertHandCount(playerB, bolt, 1);
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class ChampionOfLambholtTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 5);
|
addCard(Zone.BATTLEFIELD, playerB, "Plains", 5);
|
||||||
addCard(Zone.HAND, playerB, "Increasing Devotion");
|
addCard(Zone.HAND, playerB, "Increasing Devotion");
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Increasing Devotion");
|
checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerB, "Cast Increasing", false);
|
||||||
|
// castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Increasing Devotion");
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
|
@ -6,15 +6,21 @@ import org.junit.Test;
|
||||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* {@link mage.cards.g.GrafdiggersCage Grafdigger's Cage}
|
||||||
|
* {1}
|
||||||
|
* Artifact
|
||||||
|
* Creature cards in graveyards and libraries can’t enter the battlefield.
|
||||||
|
* Players can’t cast spells from graveyards or libraries.
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
*/
|
*/
|
||||||
public class GrafdiggersCageTest extends CardTestPlayerBase {
|
public class GrafdiggersCageTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the flashback ability can't be used.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCard1() {
|
public void testFlashback() {
|
||||||
// Creature cards can't enter the battlefield from graveyards or libraries.
|
|
||||||
// Players can't cast cards in graveyards or libraries.
|
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||||
|
|
||||||
|
@ -22,30 +28,32 @@ public class GrafdiggersCageTest extends CardTestPlayerBase {
|
||||||
// Flashback {1}{B}
|
// Flashback {1}{B}
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Lingering Souls");
|
addCard(Zone.GRAVEYARD, playerA, "Lingering Souls");
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {1}{B}");
|
checkPlayableAbility("flashback", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback", false);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertLife(playerA, 20);
|
|
||||||
assertLife(playerB, 20);
|
|
||||||
assertPermanentCount(playerA, "Spirit Token", 0);
|
|
||||||
assertGraveyardCount(playerA, "Lingering Souls", 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that a creature can't be put onto the battlefield from the graveyard.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCard2() {
|
public void testBeingPutOnBattlefieldFromGraveyard() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||||
|
|
||||||
|
// Put target creature card from a graveyard onto the battlefield under your control.
|
||||||
|
// That creature is a black Zombie in addition to its other colors and types.
|
||||||
addCard(Zone.HAND, playerA, "Rise from the Grave", 1);
|
addCard(Zone.HAND, playerA, "Rise from the Grave", 1);
|
||||||
|
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Craw Wurm");
|
addCard(Zone.GRAVEYARD, playerA, "Craw Wurm");
|
||||||
|
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise from the Grave", "Craw Wurm");
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rise from the Grave", "Craw Wurm");
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertLife(playerA, 20);
|
|
||||||
assertLife(playerB, 20);
|
|
||||||
assertPermanentCount(playerA, "Craw Wurm", 0);
|
assertPermanentCount(playerA, "Craw Wurm", 0);
|
||||||
|
|
||||||
assertGraveyardCount(playerA, "Craw Wurm", 1);
|
assertGraveyardCount(playerA, "Craw Wurm", 1);
|
||||||
assertGraveyardCount(playerA, "Rise from the Grave", 1);
|
assertGraveyardCount(playerA, "Rise from the Grave", 1);
|
||||||
}
|
}
|
||||||
|
@ -59,24 +67,17 @@ public class GrafdiggersCageTest extends CardTestPlayerBase {
|
||||||
* Same thing goes for cards like Ethersworn Canonist, assuming that the flashback isn't the first non-artifact spell for the turn.
|
* Same thing goes for cards like Ethersworn Canonist, assuming that the flashback isn't the first non-artifact spell for the turn.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCard3() {
|
public void testFlashbackNonPermanent() {
|
||||||
// Creature cards can't enter the battlefield from graveyards or libraries.
|
|
||||||
// Players can't cast cards in graveyards or libraries.
|
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 2);
|
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||||
|
|
||||||
// Name a nonland card. Target player reveals their hand and discards all cards with that name.
|
// Name a nonland card. Target player reveals their hand and discards all cards with that name.
|
||||||
// Flashback-Sacrifice a creature. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
|
// Flashback - Sacrifice a creature. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
|
||||||
addCard(Zone.GRAVEYARD, playerA, "Cabal Therapy");
|
addCard(Zone.GRAVEYARD, playerA, "Cabal Therapy");
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback");
|
checkPlayableAbility("flashback", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback", false);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
assertLife(playerA, 20);
|
|
||||||
assertLife(playerB, 20);
|
|
||||||
assertPermanentCount(playerA, "Silvercoat Lion", 2);
|
|
||||||
assertGraveyardCount(playerA, "Cabal Therapy", 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class KeranosGodOfStormsTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Keranos, God of Storms");
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Keranos, God of Storms");
|
||||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Peek", playerA); // you won't do damage because it's not the first draw this turn - Draw in draw phase was the first
|
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Peek", playerA); // you won't do damage because it's not the first draw this turn - Draw in draw phase was the first
|
||||||
addTarget(playerB, playerA); // not needed if it works correct
|
|
||||||
|
|
||||||
setStopAt(2, PhaseStep.END_TURN);
|
setStopAt(2, PhaseStep.END_TURN);
|
||||||
execute();
|
execute();
|
||||||
|
|
|
@ -439,6 +439,24 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
check(checkName, turnNum, step, player, CHECK_COMMAND_ABILITY, permanentName, abilityClass.getName(), mustHave.toString());
|
check(checkName, turnNum, step, player, CHECK_COMMAND_ABILITY, permanentName, abilityClass.getName(), mustHave.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether or not a given playable ability (someting that lets you cast a card) is available.
|
||||||
|
* This function will only check IF the ability is available or not, it does not check the number of times that it's available.
|
||||||
|
*
|
||||||
|
* If using with mustHave = false be very careful about spelling and options, otherwise you may get a false negative.
|
||||||
|
* It is reccomended that you set up the test so that the ability is available at the point you wish to check it,
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @param checkName String to show up if the check fails, for display purposes only.
|
||||||
|
* @param turnNum The turn number to check on.
|
||||||
|
* @param step The step to check the ability on.
|
||||||
|
* @param player The player to be checked for the ability.
|
||||||
|
* @param abilityStartText The starting portion of the ability name.
|
||||||
|
* @param mustHave Whether the ability should be activatable of not
|
||||||
|
*/
|
||||||
public void checkPlayableAbility(String checkName, int turnNum, PhaseStep step, TestPlayer player, String abilityStartText, Boolean mustHave) {
|
public void checkPlayableAbility(String checkName, int turnNum, PhaseStep step, TestPlayer player, String abilityStartText, Boolean mustHave) {
|
||||||
check(checkName, turnNum, step, player, CHECK_COMMAND_PLAYABLE_ABILITY, abilityStartText, mustHave.toString());
|
check(checkName, turnNum, step, player, CHECK_COMMAND_PLAYABLE_ABILITY, abilityStartText, mustHave.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,10 @@ public class ProtectionFromColorTest extends CardTestPlayerBase {
|
||||||
// tapped White Knight with Protection from Black
|
// tapped White Knight with Protection from Black
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "White Knight", 1, true);
|
addCard(Zone.BATTLEFIELD, playerB, "White Knight", 1, true);
|
||||||
|
|
||||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Destroy target tapped creature.", "White Knight");
|
checkPlayableAbility("test", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}", false);
|
||||||
|
|
||||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
// no one should be destroyed
|
|
||||||
assertPermanentCount(playerB, "White Knight", 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue