moved faceDown property from Card to CardState

This commit is contained in:
betasteward 2015-03-12 22:09:12 -04:00
parent d7b9a4a979
commit 9ad8530dee
61 changed files with 378 additions and 224 deletions

View file

@ -247,7 +247,7 @@ public class ManifestTest extends CardTestPlayerBase {
for (Card card :currentGame.getExile().getAllCards(currentGame)){
if (card.getName().equals("Gore Swine")) {
Assert.assertTrue("Gore Swine may not be face down in exile", !card.isFaceDown());
Assert.assertTrue("Gore Swine may not be face down in exile", !card.isFaceDown(currentGame));
}
}

View file

@ -0,0 +1,55 @@
package org.mage.test.cards.facedown;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.ExileZone;
import org.junit.Assert;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author BetaSteward
*/
public class BaneAlleyBrokerTest extends CardTestPlayerBase {
/**
* Bane Alley Broker
* Creature Human Rogue 0/3, 1UB (3)
* {T}: Draw a card, then exile a card from your hand face down.
* You may look at cards exiled with Bane Alley Broker.
* {U}{B}, {T}: Return a card exiled with Bane Alley Broker to its owner's hand.
*
*/
// test that cards exiled using Bane Alley Broker are face down
@Test
public void testBaneAlleyBroker() {
addCard(Zone.BATTLEFIELD, playerA, "Bane Alley Broker");
addCard(Zone.HAND, playerA, "Goblin Roughrider");
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
addCard(Zone.BATTLEFIELD, playerA, "Island");
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then exile a card from your hand face down.");
addTarget(playerA, "Goblin Roughrider");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerA, 2);
assertHandCount(playerA, "Sejiri Merfolk", 1);
assertHandCount(playerA, "Goblin Roughrider", 0);
assertExileCount("Goblin Roughrider", 1);
for (Card card :currentGame.getExile().getAllCards(currentGame)){
if (card.getName().equals("Goblin Roughrider")) {
Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame));
}
}
}
}

View file

@ -0,0 +1,45 @@
package org.mage.test.cards.facedown;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author BetaSteward
*/
public class GhastlyConscriptionTest extends CardTestPlayerBase {
/**
* Ghastly Conscription
* Sorcery, 5BB (7)
* Exile all creature cards from target player's graveyard in a face-down pile,
* shuffle that pile, then manifest those cards. (To manifest a card, put it
* onto the battlefield face down as a 2/2 creature. Turn it face up any time
* for its mana cost if it's a creature card.)
*
*/
// test that cards exiled using Ghastly Conscription return face down
@Test
public void testGhastlyConscription() {
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
addCard(Zone.HAND, playerA, "Ghastly Conscription");
addCard(Zone.GRAVEYARD, playerA, "Ashcloud Phoenix");
addCard(Zone.GRAVEYARD, playerA, "Goblin Roughrider");
addCard(Zone.GRAVEYARD, playerA, "Island");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ghastly Conscription", playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 2);
assertPermanentCount(playerA, "face down creature", 2);
}
}

View file

@ -0,0 +1,117 @@
package org.mage.test.cards.facedown;
import mage.cards.Card;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author BetaSteward
*/
public class SummonersEggTest extends CardTestPlayerBase {
/**
* Summoner's Egg
* Artifact Creature Construct 0/4, 4 (4)
* Imprint When Summoner's Egg enters the battlefield, you may exile a
* card from your hand face down.
* When Summoner's Egg dies, turn the exiled card face up. If it's a creature
* card, put it onto the battlefield under your control.
*
*/
// test that cards imprinted using Summoner's Egg are face down
@Test
public void testSummonersEggImprint() {
addCard(Zone.HAND, playerA, "Summoner's Egg");
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
addCard(Zone.HAND, playerA, "Goblin Roughrider");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertHandCount(playerA, 1);
assertHandCount(playerA, "Sejiri Merfolk", 1);
assertHandCount(playerA, "Goblin Roughrider", 0);
assertExileCount("Goblin Roughrider", 1);
for (Card card :currentGame.getExile().getAllCards(currentGame)){
if (card.getName().equals("Goblin Roughrider")) {
Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame));
}
}
}
// test that creature cards imprinted using Summoner's Egg are put in play face up
@Test
public void testSummonersEggDies() {
addCard(Zone.HAND, playerA, "Summoner's Egg");
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
addCard(Zone.HAND, playerA, "Goblin Roughrider");
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerB, "Char");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Char", "Summoner's Egg");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerA, 1);
assertHandCount(playerA, "Sejiri Merfolk", 1);
assertHandCount(playerA, "Goblin Roughrider", 0);
assertGraveyardCount(playerA, "Summoner's Egg", 1);
assertExileCount("Goblin Roughrider", 0);
assertPermanentCount(playerA, "Goblin Roughrider", 1);
for (Permanent p :currentGame.getBattlefield().getAllActivePermanents()){
if (p.getName().equals("Goblin Roughrider")) {
Assert.assertTrue("Permanent is not face up", !p.isFaceDown(currentGame));
}
}
}
// test that non-creature cards imprinted using Summoner's Egg are left in exile face up
@Test
public void testSummonersEggDies2() {
addCard(Zone.HAND, playerA, "Summoner's Egg");
addCard(Zone.HAND, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.HAND, playerB, "Char");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Summoner's Egg");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Char", "Summoner's Egg");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertHandCount(playerA, 1);
assertHandCount(playerA, "Forest", 1);
assertGraveyardCount(playerA, "Summoner's Egg", 1);
assertExileCount("Forest", 1);
for (Card card :currentGame.getExile().getAllCards(currentGame)){
if (card.getName().equals("Forest")) {
Assert.assertTrue("Exiled card is not face up", !card.isFaceDown(currentGame));
}
}
}
}