moved Watchers to Ability and moved Counters to CardState

This commit is contained in:
betasteward 2015-03-01 21:17:23 -05:00
parent 620a3b9a52
commit 632573fc3e
204 changed files with 1516 additions and 347 deletions

View file

@ -0,0 +1,73 @@
package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class CascadeTest extends CardTestPlayerBase {
/*
* Maelstrom Nexus {WUBRG}
* Enchantment
* The first spell you cast each turn has cascade. (When you cast your first
* 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.)
*
* Predatory Advantage {3RG}
* Enchantment
* At the beginning of each opponent's end step, if that player didn't cast
* a creature spell this turn, put a 2/2 green Lizard creature token onto
* the battlefield.
*/
// test that Predatory Advantage gains Cascade when cast
@Test
public void testGainsCascade() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus");
addCard(Zone.HAND, playerA, "Predatory Advantage");
addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Predatory Advantage", 1);
assertPermanentCount(playerA, "Sejiri Merfolk", 1);
assertPermanentCount(playerA, "Lizard", 1);
}
// test that 2nd spell cast (Nacatl Outlander) does not gain Cascade
@Test
public void testLosesCascade() {
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Zone.BATTLEFIELD, playerA, "Maelstrom Nexus");
addCard(Zone.HAND, playerA, "Predatory Advantage");
addCard(Zone.HAND, playerA, "Nacatl Outlander");
addCard(Zone.LIBRARY, playerA, "Arbor Elf");
addCard(Zone.LIBRARY, playerA, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Predatory Advantage");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Nacatl Outlander");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Predatory Advantage", 1);
assertPermanentCount(playerA, "Sejiri Merfolk", 1);
assertPermanentCount(playerA, "Nacatl Outlander", 1);
assertPermanentCount(playerA, "Arbor Elf", 0);
}
}

View file

@ -0,0 +1,61 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class AggravateTest extends CardTestPlayerBase {
/*
* Aggravate
* Instant, 3RR (5)
* Aggravate deals 1 damage to each creature target player controls. Each
* creature dealt damage this way attacks this turn if able.
*
*/
// test that creatures damaged by Aggravate attack
@Test
public void testDamagedCreaturesAttack() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerB, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Aggravate");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, "Aggravate", playerB);
setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
execute();
assertAttacking("Craw Wurm", true);
assertAttacking("Goblin Roughrider", true);
}
// test that creatures not damaged by Aggravate don't attack
@Test
public void testUndamagedCreaturesDontAttack() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerB, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Aggravate");
addCard(Zone.HAND, playerB, "Raging Goblin");
castSpell(2, PhaseStep.UPKEEP, playerA, "Aggravate", playerB);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Raging Goblin");
setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
execute();
assertAttacking("Craw Wurm", true);
assertAttacking("Goblin Roughrider", true);
assertAttacking("Raging Goblin", false);
}
}

View file

@ -0,0 +1,55 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class AzoriusHeraldTest extends CardTestPlayerBase {
/*
* Azorius Herald
* Creature Spirit 2/1, 2W (3)
* Azorius Herald can't be blocked.
* When Azorius Herald enters the battlefield, you gain 4 life.
* When Azorius Herald enters the battlefield, sacrifice it unless {U} was spent to cast it.
*
*/
// When Azorius Herald enters the battlefield, sacrifice it unless {U} was spent to cast it.
@Test
public void testBlueManaWasPaid() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island");
addCard(Zone.HAND, playerA, "Azorius Herald");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Azorius Herald");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Azorius Herald", 1);
}
@Test
public void testNoBlueManaWasPaid() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.HAND, playerA, "Azorius Herald");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Azorius Herald");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Azorius Herald", 0);
assertGraveyardCount(playerA, "Azorius Herald", 1);
}
}

View file

@ -0,0 +1,60 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class BoseijuTest extends CardTestPlayerBase {
/*
* Boseiju, Who Shelters All
* Legendary Land
* Boseiju, Who Shelters All enters the battlefield tapped.
* {T}, Pay 2 life: Add {1} to your mana pool. If that mana is spent on an
* instant or sorcery spell, that spell can't be countered by spells or abilities.
*
*/
// test that instants and soceries can't be countered when Boseiju mana is used
@Test
public void testCantCounter() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.BATTLEFIELD, playerA, "Boseiju, Who Shelters All");
addCard(Zone.HAND, playerA, "Brilliant Plan");
addCard(Zone.HAND, playerA, "Counterspell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brilliant Plan");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counterspell", "Brilliant Plan");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertHandCount(playerA, 3);
this.assertGraveyardCount(playerA, "Counterspell", 1);
}
// test that instants and soceries can be countered when Boseiju mana is not used
@Test
public void testCanCounter() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.BATTLEFIELD, playerA, "Boseiju, Who Shelters All");
addCard(Zone.HAND, playerA, "Mental Note");
addCard(Zone.HAND, playerA, "Counterspell");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mental Note");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counterspell", "Mental Note");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertHandCount(playerA, 0);
this.assertGraveyardCount(playerA, 2);
}
}

View file

@ -0,0 +1,141 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class DiesExiledTest extends CardTestPlayerBase {
/*
* Kumano's Blessing
* Enchantment Aura, 2R (3)
* Flash
* Enchant creature
* If a creature dealt damage by enchanted creature this turn would die, exile it instead.
*
*/
// test that when creature damaged by enchanted creature dies it is exiled
@Test
public void testKumanosBlessing() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, "Kumano's Blessing");
addCard(Zone.BATTLEFIELD, playerA, "Prodigal Pyromancer");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Kumano's Blessing", "Prodigal Pyromancer");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: {source} deals 1 damage to target creature or player.", "Sejiri Merfolk");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertExileCount("Sejiri Merfolk", 1);
}
/*
* Frostwielder
* Creature Human Shaman 1/2, 2RR (4)
* {T}: Frostwielder deals 1 damage to target creature or player.
* If a creature dealt damage by Frostwielder this turn would die, exile it instead.
*
*/
// test that when creature damaged by Frostwielder dies it is exiled
@Test
public void testFrostwielder() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Frostwielder");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 1 damage to target creature or player.", "Sejiri Merfolk");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertExileCount("Sejiri Merfolk", 1);
}
/*
* Kumano, Master Yamabushi
* Legendary Creature Human Shaman 4/4, 3RR (5)
* {1}{R}: Kumano, Master Yamabushi deals 1 damage to target creature or player.
* If a creature dealt damage by Kumano this turn would die, exile it instead.
*
*/
// test that when creature damaged by Kumano, Master Yamabushi dies it is exiled
@Test
public void testKumanoMasterYamabushi() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Kumano, Master Yamabushi");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{R}: {source} deals 1 damage to target creature or player.", "Sejiri Merfolk");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertExileCount("Sejiri Merfolk", 1);
}
/*
* Yamabushi's Flame
* Instant, 2R (3)
* Yamabushi's Flame deals 3 damage to target creature or player. If a
* creature dealt damage this way would die this turn, exile it instead.
*
*/
// test that when creature damaged by Yamabushi's Flame dies it is exiled
@Test
public void testYamabushisFlame() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, "Yamabushi's Flame");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Yamabushi's Flame", "Sejiri Merfolk");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertExileCount("Sejiri Merfolk", 1);
}
/*
* Yamabushi's Storm
* Sorcery, 1R (2)
* Yamabushi's Storm deals 1 damage to each creature. If a creature dealt
* damage this way would die this turn, exile it instead.
*
*/
// test that when creatures damaged by Yamabushi's Storm die they are exiled
@Test
public void testYamabushisStorm() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.HAND, playerA, "Yamabushi's Storm");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Yamabushi's Storm");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertExileCount("Sejiri Merfolk", 2);
}
}

View file

@ -0,0 +1,53 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class EpharaGodOfThePolisTest extends CardTestPlayerBase {
/*
* Ephara, God of the Polis
* Legendary Enchantment Creature God 6/5, 2WU (4)
* Indestructible
* As long as your devotion to white and blue is less than seven, Ephara
* isn't a creature.
* At the beginning of each upkeep, if you had another creature enter the
* battlefield under your control last turn, draw a card.
*
*/
// test that an extra card is drawn
@Test
public void testDrawCard() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis");
addCard(Zone.HAND, playerA, "Goblin Roughrider");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Roughrider");
setStopAt(3, PhaseStep.UPKEEP);
execute();
this.assertHandCount(playerA, 1);
}
// test that an extra card is not drawn
@Test
public void testNotDrawCard() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Ephara, God of the Polis");
setStopAt(3, PhaseStep.UPKEEP);
execute();
this.assertHandCount(playerA, 0);
}
}

View file

@ -0,0 +1,46 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class FellShepherdTest extends CardTestPlayerBase {
/*
* Fell Shepherd
* Creature Avatar 8/6, 5BB (7)
* Whenever Fell Shepherd deals combat damage to a player, you may return to
* your hand all creature cards that were put into your graveyard from the battlefield this turn.
* {B}, Sacrifice another creature: Target creature gets -2/-2 until end of turn.
*
*/
// test that creatures are returned to hand
@Test
public void testCreaturesReturn() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.BATTLEFIELD, playerA, "Fell Shepherd");
playerA.addChoice("Craw Wurm");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{B},Sacrifice another creature: Target creature gets -2/-2 until end of turn.", "Raging Goblin");
attack(3, playerA, "Fell Shepherd");
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerB, 12);
assertPermanentCount(playerA, "Goblin Roughrider", 1);
assertPermanentCount(playerA, "Raging Goblin", 0);
assertPermanentCount(playerA, "Craw Wurm", 0);
assertHandCount(playerA, "Craw Wurm", 1);
assertHandCount(playerA, "Raging Goblin", 1);
}
}

View file

@ -0,0 +1,78 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class FuryOfTheHordeTest extends CardTestPlayerBase {
/*
* Fury of the Horde
* Sorcery, 5RR (7)
* You may exile two red cards from your hand rather than pay Fury of the
* Horde's mana cost.
* Untap all creatures that attacked this turn. After this main phase, there
* is an additional combat phase followed by an additional main phase.
*
*/
// test that creatures attack twice
@Test
public void testCreaturesAttackTwice() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
attack(3, playerA, "Goblin Roughrider");
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Fury of the Horde");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 2);
}
// test that creatures attack once
@Test
public void testCreaturesAttackOnce() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
attack(3, playerA, "Goblin Roughrider");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 11);
}
// test that only creatures that attacked attack twice
@Test
public void testCreaturesThatAttacked() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
addCard(Zone.BATTLEFIELD, playerA, "Craw Wurm");
addCard(Zone.BATTLEFIELD, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Fury of the Horde");
attack(3, playerA, "Craw Wurm");
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Fury of the Horde");
setStopAt(3, PhaseStep.END_TURN);
execute();
this.assertLife(playerB, 8);
}
}

View file

@ -0,0 +1,53 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @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.
*
*/
// test that Goblin Cohort can attack
@Test
public void testCanAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Goblin Cohort");
addCard(Zone.HAND, playerB, "Goblin Roughrider");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Goblin Roughrider");
attack(2, playerB, "Goblin Cohort");
setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
execute();
assertAttacking("Goblin Cohort", true);
}
// test that Goblin Cohort can't attack
@Test
public void testCantAttack() {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerB, "Goblin Cohort");
addCard(Zone.HAND, playerB, "Goblin Roughrider");
attack(2, playerB, "Goblin Cohort");
setStopAt(2, PhaseStep.DECLARE_BLOCKERS);
execute();
assertAttacking("Goblin Cohort", false);
}
}

View file

@ -0,0 +1,55 @@
package org.mage.test.cards.watchers;
import mage.abilities.keyword.HasteAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class HallOfTheBanditLordTest extends CardTestPlayerBase {
/*
* Hall of the Bandit Lord
* Legendary Land
* Hall of the Bandit Lord enters the battlefield tapped.
* {T}, Pay 3 life: Add {1} to your mana pool. If that mana is spent on a
* creature spell, it gains haste.
*
*/
// test that a creature cast using Hall of the Bandit Lord mana gains haste
@Test
public void testGainsHaste() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Hall of the Bandit Lord");
addCard(Zone.HAND, playerA, "Goblin Roughrider");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Goblin Roughrider");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertAbility(playerA, "Goblin Roughrider", HasteAbility.getInstance(), true);
}
// test that a creature cast not using Hall of the Bandit Lord mana does not gain haste
@Test
public void testNotGainsHaste() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Hall of the Bandit Lord");
addCard(Zone.HAND, playerA, "Ember Hauler");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ember Hauler");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertAbility(playerA, "Ember Hauler", HasteAbility.getInstance(), false);
}
}

View file

@ -0,0 +1,74 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class KaradorGhostChieftainTest extends CardTestPlayerBase {
/*
* Karador, Ghost Chieftain
* Legendary Creature Centaur Spirit 3/4, 5WBG (8)
* Karador, Ghost Chieftain costs {1} less to cast for each creature card in your graveyard.
* During each of your turns, you may cast one creature card from your graveyard.
*
*/
// test that can play spell from graveyard
@Test
public void testPlayFromGraveyard() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Karador, Ghost Chieftain");
addCard(Zone.GRAVEYARD, playerA, "Raging Goblin");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raging Goblin");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertPermanentCount(playerA, "Raging Goblin", 1);
this.assertGraveyardCount(playerA, "Raging Goblin", 0);
}
// test that can only play one spell from graveyard
@Test
public void testPlayOneFromGraveyard() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Karador, Ghost Chieftain");
addCard(Zone.GRAVEYARD, playerA, "Raging Goblin", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raging Goblin");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raging Goblin");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertPermanentCount(playerA, "Raging Goblin", 1);
this.assertGraveyardCount(playerA, "Raging Goblin", 1);
}
// test that can only play one spell from graveyard per turn
@Test
public void testPlayOneFromGraveyardPerTurn() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Karador, Ghost Chieftain");
addCard(Zone.GRAVEYARD, playerA, "Raging Goblin", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Raging Goblin");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Raging Goblin");
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
this.assertPermanentCount(playerA, "Raging Goblin", 2);
this.assertGraveyardCount(playerA, "Raging Goblin", 0);
}
}

View file

@ -0,0 +1,66 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class OvermasterTest extends CardTestPlayerBase {
/*
* Overmaster
* Sorcery, R (1)
* The next instant or sorcery spell you cast this turn can't be countered by spells or abilities.
* Draw a card.
*
*/
// test that next spell can't be countered
@Test
public void testCantCounter() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.HAND, playerA, "Lightning Bolt");
addCard(Zone.HAND, playerA, "Counterspell");
addCard(Zone.HAND, playerA, "Overmaster");
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Overmaster");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Raging Goblin");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Counterspell", "Lightning Bolt");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Raging Goblin", 0);
assertGraveyardCount(playerA, "Raging Goblin", 1);
}
// test that second spell can be countered
@Test
public void testCanCounter() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.HAND, playerA, "Counterspell");
addCard(Zone.HAND, playerA, "Overmaster");
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Overmaster");
castSpell(1, PhaseStep.DECLARE_ATTACKERS, playerA, "Lightning Bolt", "Raging Goblin");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Raging Goblin");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Counterspell", "Lightning Bolt");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Raging Goblin", 1);
assertGraveyardCount(playerA, "Raging Goblin", 1);
}
}

View file

@ -0,0 +1,82 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class SiftThroughSandsTest extends CardTestPlayerBase {
/*
* Sift Through Sands
* Instant Arcane, 1UU (3)
* Draw two cards, then discard a card.
* If you've cast a spell named Peer Through Depths and a spell named Reach
* Through Mists this turn, you may search your library for a card named
* The Unspeakable, put it onto the battlefield, then shuffle your library.
*
* Peer Through Depths
* Instant Arcane, 1U (2)
* Look at the top five cards of your library. You may reveal an instant or
* sorcery card from among them and put it into your hand. Put the rest on
* the bottom of your library in any order.
*
* Reach Through Mists
* Instant Arcane, U (1)
* Draw a card.
*
* The Unspeakable
* Legendary Creature Spirit 6/7, 6UUU (9)
* Flying, trample
* Whenever The Unspeakable deals combat damage to a player, you may return
* target Arcane card from your graveyard to your hand.
*
*/
// test that The Unspeakable is put onto the battlefield
@Test
public void testTheUnspeakable() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.HAND, playerA, "Sift Through Sands");
addCard(Zone.HAND, playerA, "Peer Through Depths");
addCard(Zone.HAND, playerA, "Reach Through Mists");
addCard(Zone.LIBRARY, playerA, "The Unspeakable");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reach Through Mists");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Peer Through Depths");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sift Through Sands");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "The Unspeakable", 1);
assertHandCount(playerA, 2);
}
// test that The Unspeakable is not put onto the battlefield
@Test
public void testNotTheUnspeakable() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.HAND, playerA, "Sift Through Sands");
addCard(Zone.HAND, playerA, "Peer Through Depths");
addCard(Zone.HAND, playerA, "Reach Through Mists");
addCard(Zone.LIBRARY, playerA, "The Unspeakable");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reach Through Mists");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Sift Through Sands");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "The Unspeakable", 0);
assertHandCount(playerA, 3);
}
}

View file

@ -0,0 +1,37 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class SpiritOfTheLabyrinthTest extends CardTestPlayerBase {
/*
* Spirit of the Labyrinth
* Enchantment Creature Spirit 3/1, 1W (2)
* Each player can't draw more than one card each turn.
*
*/
// test that only 1 card is drawn
@Test
public void testDrawCard() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerA, "Spirit of the Labyrinth");
addCard(Zone.HAND, playerA, "Brilliant Plan");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brilliant Plan");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
this.assertHandCount(playerA, 1);
}
}

View file

@ -0,0 +1,38 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TunnelIgnusTest extends CardTestPlayerBase {
/*
* Tunnel Ignus
* Creature Elemental 2/1, 1R (2)
* Whenever a land enters the battlefield under an opponent's control, if
* that player had another land enter the battlefield under his or her
* control this turn, Tunnel Ignus deals 3 damage to that player.
*
*/
// test extra lands damage controller
@Test
public void testExtraLandsDamage() {
addCard(Zone.BATTLEFIELD, playerB, "Tunnel Ignus");
addCard(Zone.HAND, playerA, "Scalding Tarn");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Scalding Tarn");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}, Pay 1 life, Sacrifice {this}: Search your library for a Island or Mountain and put it onto the battlefield. Then shuffle your library.");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertLife(playerA, 16);
assertGraveyardCount(playerA, "Scalding Tarn", 1);
}
}

View file

@ -0,0 +1,66 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class UnscytheKillerOfKingsTest extends CardTestPlayerBase {
/*
* Unscythe, Killer of Kings
* Legendary Artifact Equipment, UBBR (4)
* Equipped creature gets +3/+3 and has first strike.
* Whenever a creature dealt damage by equipped creature this turn dies, you
* may exile that card. If you do, put a 2/2 black Zombie creature token onto
* the battlefield.
* Equip {2}
*
*/
// test that when creature damaged by equipped creature dies a Zombie token is created
@Test
public void testDamagedCreatureDies() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Unscythe, Killer of Kings");
addCard(Zone.BATTLEFIELD, playerA, "Prodigal Pyromancer");
addCard(Zone.BATTLEFIELD, playerB, "Sejiri Merfolk");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip", "Prodigal Pyromancer");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: {source} deals 1 damage to target creature or player.", "Sejiri Merfolk");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Sejiri Merfolk", 0);
assertPermanentCount(playerA, "Zombie", 1);
assertExileCount("Sejiri Merfolk", 1);
}
// test that when creature damaged by equipped creature dies a Zombie token is created
@Test
public void testDamagedCreatureDiesAfterEquipped() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Unscythe, Killer of Kings");
addCard(Zone.BATTLEFIELD, playerA, "Prodigal Pyromancer");
addCard(Zone.HAND, playerA, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerB, "Craw Wurm");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 1 damage to target creature or player.", "Craw Wurm");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Equip", "Prodigal Pyromancer");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Craw Wurm");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerB, "Craw Wurm", 0);
assertPermanentCount(playerA, "Zombie", 1);
assertExileCount("Craw Wurm", 1);
}
}

View file

@ -0,0 +1,70 @@
package org.mage.test.cards.watchers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class ZuberasTest extends CardTestPlayerBase {
/*
* Ashen-Skin Zubera
* Creature Zubera Spirit 1/2, 1B (2)
* When Ashen-Skin Zubera dies, target opponent discards a card for each
* Zubera that died this turn.
* Dripping-Tongue Zubera
* Creature Zubera Spirit 1/2, 1G (2)
* When Dripping-Tongue Zubera dies, put a 1/1 colorless Spirit creature
* token onto the battlefield for each Zubera that died this turn.
* Ember-Fist Zubera
* Creature Zubera Spirit 1/2, 1R (2)
* When Ember-Fist Zubera dies, it deals damage to target creature or player
* equal to the number of Zubera that died this turn.
* Floating-Dream Zubera
* Creature Zubera Spirit 1/2, 1U (2)
* When Floating-Dream Zubera dies, draw a card for each Zubera that died
* this turn.
* Silent-Chant Zubera
* Creature Zubera Spirit 1/2, 1W (2)
* When Silent-Chant Zubera dies, you gain 2 life for each Zubera that died this turn.
*/
// test that creatures damaged by Aggravate attack
@Test
public void testZuberas() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
addCard(Zone.BATTLEFIELD, playerA, "Ashen-Skin Zubera");
addCard(Zone.BATTLEFIELD, playerA, "Dripping-Tongue Zubera");
addCard(Zone.BATTLEFIELD, playerA, "Ember-Fist Zubera");
addCard(Zone.BATTLEFIELD, playerA, "Floating-Dream Zubera");
addCard(Zone.BATTLEFIELD, playerA, "Silent-Chant Zubera");
addCard(Zone.HAND, playerA, "Lightning Bolt", 5);
addCard(Zone.HAND, playerB, "Island", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Silent-Chant Zubera");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Floating-Dream Zubera");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Ember-Fist Zubera");
addTarget(playerA, playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Ashen-Skin Zubera");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Dripping-Tongue Zubera");
setStopAt(1, PhaseStep.DECLARE_BLOCKERS);
execute();
assertPermanentCount(playerA, "Spirit", 1);
assertHandCount(playerB, 1);
assertHandCount(playerA, 4);
assertLife(playerB, 17);
assertLife(playerA, 30);
}
}