mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Refactor: extract card names compare logic (is empty name, is same name)
Fixed last broken tests
This commit is contained in:
parent
96187ad3c0
commit
02b7e2cf10
63 changed files with 614 additions and 466 deletions
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -10,7 +10,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ManifestTest extends CardTestPlayerBase {
|
||||
|
|
@ -34,15 +33,16 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// not tapped
|
||||
assertTapped("", false);
|
||||
assertTapped(EmptyNames.FACE_DOWN_CREATURE.toString(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,13 +66,14 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// PlayerB's Silvercoat Lion should not have get -1/-1/
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 1);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 2, 2);
|
||||
|
|
@ -101,6 +102,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -108,8 +110,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
// PlayerA's Pillarfield Ox should not have get -1/-1/
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 1);
|
||||
assertPowerToughness(playerB, "Pillarfield Ox", 2, 4);
|
||||
|
|
@ -137,6 +139,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -144,8 +147,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +176,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -180,8 +184,8 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Reality Shift", 1);
|
||||
assertExileCount("Silvercoat Lion", 1);
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
assertPowerToughness(playerA, "Foundry Street Denizen", 1, 1);
|
||||
|
||||
}
|
||||
|
|
@ -199,7 +203,6 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
// Strive — Silence the Believers costs more to cast for each target beyond the first.
|
||||
// Exile any number of target creatures and all Auras attached to them.
|
||||
addCard(Zone.HAND, playerB, "Silence the Believers");
|
||||
addTarget(playerB, "");
|
||||
// Gore Swine {2}{R}
|
||||
// 4/1
|
||||
addCard(Zone.LIBRARY, playerA, "Gore Swine");
|
||||
|
|
@ -210,10 +213,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Reality Shift", "Silvercoat Lion");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Silence the Believers", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
showBattlefield("B battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerB);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Silence the Believers", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -222,7 +228,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertExileCount("Silvercoat Lion", 1);
|
||||
assertExileCount("Gore Swine", 1);
|
||||
// no facedown creature is on the battlefield
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals("Gore Swine")) {
|
||||
|
|
@ -248,10 +254,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -261,7 +268,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
// a facedown creature is on the battlefield
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -284,12 +291,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{5}{G}: Turn");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -297,7 +305,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
assertPermanentCount(playerB, "", 0);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerB, "Aerie Bowmasters", 1);
|
||||
assertPowerToughness(playerB, "Aerie Bowmasters", 4, 5); // 3/4 and the +1/+1 counter from Megamorph
|
||||
Permanent aerie = getPermanent("Aerie Bowmasters", playerB);
|
||||
|
|
@ -308,7 +316,6 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* When a Forest came manifested into play my Courser of Kruphix gained me a
|
||||
* life.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testManifestForest() {
|
||||
|
|
@ -328,10 +335,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
skipInitShuffling();
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}, {T}, Sacrifice another creature");
|
||||
addTarget(playerB, "Silvercoat Lion");
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -339,13 +347,12 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Whisperwood Elemental - Its sacrifice ability doesn't work..
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testWhisperwoodElemental() {
|
||||
|
|
@ -365,6 +372,7 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
@ -374,14 +382,13 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Whisperwood Elemental", 1);
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 2);
|
||||
|
||||
assertPermanentCount(playerB, "", 2);
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 2);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* I sacrificed a manifested face-down Smothering Abomination to Nantuko
|
||||
* Husk and it made me draw a card.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDiesTriggeredAbilitiesOfManifestedCreatures() {
|
||||
|
|
@ -409,10 +416,11 @@ public class ManifestTest extends CardTestPlayerBase {
|
|||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice a creature");
|
||||
setChoice(playerB, "");
|
||||
setChoice(playerB, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
// no life gain
|
||||
assertLife(playerA, 20);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.Filter;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
|
|
@ -57,8 +54,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +70,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
|
@ -81,7 +78,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
|
|
@ -106,8 +103,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Icefeather Aven", NO_TARGET, "Pine Walker", StackClause.WHILE_NOT_ON_STACK);
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
activateAbility(3, PhaseStep.DECLARE_BLOCKERS, playerA, "{1}{G}{U}: Turn this face-down permanent face up.");
|
||||
setChoice(playerA, "No"); // Don't use return permanent to hand effect
|
||||
|
||||
|
|
@ -119,7 +116,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerA, "Icefeather Aven", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPermanentCount(playerA, "Icefeather Aven", 1);
|
||||
assertTapped("Icefeather Aven", true);
|
||||
|
||||
|
|
@ -151,7 +148,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 20); // and not 21
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPermanentCount(playerB, "Soldier of the Pantheon", 1);
|
||||
|
||||
}
|
||||
|
|
@ -176,22 +173,21 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
|
||||
setChoice(playerB, "Yes"); // use to copy a nonland permanent
|
||||
addTarget(playerB, ""); // Morphed creature
|
||||
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString()); // Morphed creature
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPowerToughness(playerB, "", 2, 2);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
|
|
@ -223,7 +219,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 4, 4);
|
||||
|
|
@ -264,7 +260,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Ponyback Brigade", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Goblin", 3);
|
||||
assertPowerToughness(playerA, "Goblin", 1, 1, Filter.ComparisonScope.Any);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
|
|
@ -337,7 +333,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, "Sagu Mauler", 0);
|
||||
assertHandCount(playerB, "Disdainful Stroke", 1); // can't be cast
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -366,18 +362,23 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler", NO_TARGET, "Sagu Mauler", StackClause.WHILE_NOT_ON_STACK);
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Echoing Decay", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Echoing Decay", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
showBattlefield("A battle after", 1, PhaseStep.END_TURN, playerA);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertHandCount(playerB, "Echoing Decay", 0);
|
||||
assertGraveyardCount(playerB, "Echoing Decay", 1);
|
||||
|
||||
assertHandCount(playerA, "Sagu Mauler", 0);
|
||||
assertHandCount(playerB, "Echoing Decay", 0);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertGraveyardCount(playerA, "Sagu Mauler", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -462,7 +463,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ashcloud Phoenix");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
|
@ -503,7 +504,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(2, playerB, "Mirri, Cat Warrior");
|
||||
block(2, playerA, "", "Mirri, Cat Warrior");
|
||||
block(2, playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), "Mirri, Cat Warrior");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
|
@ -539,20 +540,27 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Akroma, Angel of Fury");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Supplant Form", "");
|
||||
showBattlefield("A battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
showBattlefield("B battle", 1, PhaseStep.POSTCOMBAT_MAIN, playerB);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Supplant Form");
|
||||
addTarget(playerB, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
showBattlefield("A battle end", 1, PhaseStep.END_TURN, playerA);
|
||||
showBattlefield("B battle end", 1, PhaseStep.END_TURN, playerB);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertGraveyardCount(playerB, "Supplant Form", 1);
|
||||
assertHandCount(playerA, "Akroma, Angel of Fury", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Akroma, Angel of Fury", 0);
|
||||
assertGraveyardCount(playerB, "Supplant Form", 1);
|
||||
|
||||
assertPermanentCount(playerB, "Akroma, Angel of Fury", 0);
|
||||
assertPermanentCount(playerB, "", 1);
|
||||
assertPowerToughness(playerB, "", 2, 2);
|
||||
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_TOKEN.toString(), 1);
|
||||
assertPowerToughness(playerB, EmptyNames.FACE_DOWN_TOKEN.toString(), 2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -578,7 +586,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -603,7 +611,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
|
@ -611,7 +619,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
|
|
@ -656,7 +664,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Reflector Mage", 1);
|
||||
assertPermanentCount(playerB, "Rattleclaw Mystic", 0);
|
||||
assertHandCount(playerB, "Rattleclaw Mystic", 0); // should have been replayed
|
||||
assertPermanentCount(playerB, "", 1); // Rattleclaw played as a morph
|
||||
assertPermanentCount(playerB, EmptyNames.FACE_DOWN_CREATURE.toString(), 1); // Rattleclaw played as a morph
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -779,7 +787,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertGraveyardCount(playerB, "Fatal Push", 1);
|
||||
assertGraveyardCount(playerA, "Pine Walker", 1);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -813,7 +821,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertHandCount(playerA, 0);
|
||||
|
||||
assertTappedCount("Island", true, 3);
|
||||
|
|
@ -848,7 +856,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Quicksilver Dragon");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", EmptyNames.FACE_DOWN_CREATURE.toString());
|
||||
|
||||
setStopAt(2, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.control;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
|
|
@ -9,7 +10,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
/**
|
||||
* Tests the effect: - Exile target creature you control, then return that card
|
||||
* to the battlefield under your control
|
||||
*
|
||||
* <p>
|
||||
* This effect grants you permanent control over the returned creature. So you
|
||||
* mail steal opponent's creature with "Act of Treason" and then use this effect
|
||||
* for permanent control effect.
|
||||
|
|
@ -103,8 +104,8 @@ public class ExileAndReturnUnderYourControl extends CardTestPlayerBase {
|
|||
assertExileCount("Secret Plans", 0);
|
||||
assertPermanentCount(playerA, "Secret Plans", 1);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 3);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package org.mage.test.cards.copy;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CopySpellTest extends CardTestPlayerBase {
|
||||
|
|
@ -17,29 +16,38 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
public void copyChainOfVapor() {
|
||||
// Return target nonland permanent to its owner's hand. Then that permanent's controller may sacrifice a land. If the player does, he or she may copy this spell and may choose a new target for that copy.
|
||||
addCard(Zone.HAND, playerA, "Chain of Vapor", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 10);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 10);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 10);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 10);
|
||||
|
||||
// start chain from A - return pillar to hand
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chain of Vapor", "Pillarfield Ox");
|
||||
//setChoice(playerB, "Yes"); // want to sacrifice
|
||||
// chain 1 - B can return
|
||||
addTarget(playerB, "Island"); // select a land to sacrifice
|
||||
setChoice(playerB, "Yes"); // want to copy spell
|
||||
setChoice(playerB, "Yes"); // want to change target
|
||||
addTarget(playerB, "Silvercoat Lion"); // new target after copy
|
||||
// stop the chain on 0 land
|
||||
addTarget(playerB, "");
|
||||
// chain 2 - A can return
|
||||
addTarget(playerA, "Island"); // select a land to sacrifice
|
||||
setChoice(playerA, "Yes"); // want to copy spell
|
||||
setChoice(playerA, "Yes"); // want to change target
|
||||
addTarget(playerA, "Pillarfield Ox"); // new target after copy
|
||||
// stop the chain by B
|
||||
addTarget(playerB, TestPlayer.TARGET_SKIP);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerB, "Island", 1);
|
||||
assertHandCount(playerB, "Pillarfield Ox", 1);
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
assertHandCount(playerB, "Pillarfield Ox", 2);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 10 - 1);
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 10 - 2);
|
||||
assertGraveyardCount(playerA, "Island", 1);
|
||||
assertGraveyardCount(playerB, "Island", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -141,7 +149,7 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
* before it is cast and therefore before Zada's ability triggers, e.g.
|
||||
* Desperate Ritual spliced onto Into the Fray should generate 3 red mana
|
||||
* for every creature i control.
|
||||
*
|
||||
* <p>
|
||||
* 702.46a Splice is a static ability that functions while a card is in your
|
||||
* hand. “Splice onto [subtype] [cost]” means “You may reveal this card from
|
||||
* your hand as you cast a [subtype] spell. If you do, copy this card's text
|
||||
|
|
@ -190,7 +198,7 @@ public class CopySpellTest extends CardTestPlayerBase {
|
|||
* {4}{U} Enchantment (Enchant Player) Whenever enchanted player casts an
|
||||
* instant or sorcery spell, each other player may copy that spell and may
|
||||
* choose new targets for the copy he or she controls.
|
||||
*
|
||||
* <p>
|
||||
* Reported bug: "A player with Curse of Echoes attached to them played
|
||||
* Bribery and the player who controlled the curse had control of all 3
|
||||
* copies. This seems to be the case for all spells."
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.mage.test.cards.dynamicvalue;
|
|||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
|
|
@ -80,10 +81,11 @@ public class SweepTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plow Through Reito");
|
||||
addTarget(playerA, "Raging Goblin"); // target to boost
|
||||
addTarget(playerA, ""); // targets to sweep (zero)
|
||||
addTarget(playerA, TestPlayer.TARGET_SKIP); // targets to sweep (zero)
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Raging Goblin", 1);
|
||||
assertPermanentCount(playerA, "Plains", 5);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.enchantments;
|
||||
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
|
|
@ -11,7 +11,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
||||
|
|
@ -22,7 +21,6 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
* Starfield of Nyx not only turned both of them into creatures (it
|
||||
* shouldn't, because they're auras), but it also destroyed them. The
|
||||
* manifests stayed on the battlefield without Flying or Hexproof.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testCloudform() {
|
||||
|
|
@ -49,7 +47,7 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Thopter Spy Network", 0);
|
||||
assertPowerToughness(playerA, "", 2, 2, Filter.ComparisonScope.All); // the manifested cards
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2, Filter.ComparisonScope.All); // the manifested cards
|
||||
assertPermanentCount(playerA, "Starfield of Nyx", 1);
|
||||
assertPowerToughness(playerA, "Thopter Spy Network", 4, 4, Filter.ComparisonScope.All);
|
||||
assertPermanentCount(playerA, "Cloudform", 2);
|
||||
|
|
@ -97,19 +95,19 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
Assert.assertEquals("Singing Bell Strike not on the battlefield", false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStarfieldOfNyxLayers() {
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Starfield of Nyx"); // enchantments you control become creatures
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Humility"); // creatures lose all abilities and are 1/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Pharika, God of Affliction"); // enchantment
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Emrakul, the Aeons Torn"); //15/15 creature
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Crusade", 4); // enchantments to fulfill requirement of Starfield of Nyx
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
|
||||
assertPowerToughness(playerA, "Pharika, God of Affliction", 3, 3, Filter.ComparisonScope.All);
|
||||
assertPowerToughness(playerA, "Humility", 4, 4, Filter.ComparisonScope.All);
|
||||
// Humility loses its ability in layer 6. Layer 7 never gets Humility's effect
|
||||
|
|
@ -117,6 +115,6 @@ public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
|||
Permanent emrakul = getPermanent("Emrakul, the Aeons Torn", playerA.getId());
|
||||
Assert.assertNotNull(emrakul);
|
||||
Assert.assertFalse(emrakul.getAbilities().contains(FlyingAbility.getInstance())); // loses flying though
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.facedown;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
|
|
@ -13,13 +14,12 @@ 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
|
||||
* 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() {
|
||||
|
|
@ -36,9 +36,9 @@ public class GhastlyConscriptionTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertGraveyardCount(playerA, 2);
|
||||
assertPermanentCount(playerA, "", 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
package org.mage.test.cards.facedown;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ObscuringAetherTest extends CardTestPlayerBase {
|
||||
|
|
@ -15,7 +14,6 @@ public class ObscuringAetherTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Obscuring Aether cannot turn into a face down 2/2 like it should. When
|
||||
* activating the ability to turn it over it, it dies immediately.
|
||||
*
|
||||
*/
|
||||
// test that cards exiled using Ghastly Conscription return face down
|
||||
@Test
|
||||
|
|
@ -35,8 +33,8 @@ public class ObscuringAetherTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, "Obscuring Aether", 0);
|
||||
assertGraveyardCount(playerA, "Obscuring Aether", 0);
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package org.mage.test.cards.rules;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -8,7 +8,6 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CantCastTest extends CardTestPlayerBase {
|
||||
|
|
@ -113,7 +112,7 @@ public class CantCastTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 0);
|
||||
assertHandCount(playerA, "Pine Walker", 1);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.mage.test.cards.single.fut;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
|
|
@ -50,8 +51,8 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 4, 4);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 4, 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -69,8 +70,8 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
assertPowerToughness(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 2, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -155,7 +156,7 @@ public class MuragandaPetroglyphsTest extends CardTestPlayerBase {
|
|||
// Enchanted creature doesn't untap during itscontroller's untap step.
|
||||
addCard(Zone.HAND, playerA, "Dehydration");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA,"Rancor", "Grizzly Bears");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rancor", "Grizzly Bears");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Dehydration", "Runeclaw Bear");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package org.mage.test.cards.single.ths;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -10,26 +10,25 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
||||
/**
|
||||
* I had a situation come up today where I had a Purphoros on the field
|
||||
* and 5 devotion with an Eidolon and Phoenix. My opponent killed the
|
||||
* and 5 devotion with an Eidolon and Phoenix. My opponent killed the
|
||||
* Phoenix, but Purphoros still was "turned on".
|
||||
*/
|
||||
@Test
|
||||
public void testFacedownNotCountedForDevotion1() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerB, "Reach of Shadows");
|
||||
|
||||
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
// {2}{R}: Creatures you control get +1/+0 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Purphoros, God of the Forge");
|
||||
|
||||
|
||||
// Whenever a player casts a spell with converted mana cost 3 or less,
|
||||
// Eidolon of the Great Revel deals 2 damage to that player.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Eidolon of the Great Revel");
|
||||
|
|
@ -46,24 +45,24 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 18); // 2 damage from the returning Phoenix
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Reach of Shadows", 1);
|
||||
assertPermanentCount(playerA, "Ashcloud Phoenix", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertFalse("Purphoros may not be a creature but it is", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFacedownNotCountedForDevotion2() {
|
||||
public void testFacedownNotCountedForDevotion2() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
// {2}{R}: Creatures you control get +1/+0 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Purphoros, God of the Forge");
|
||||
|
||||
|
||||
// Whenever a player casts a spell with converted mana cost 3 or less,
|
||||
// Eidolon of the Great Revel deals 2 damage to that player.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Eidolon of the Great Revel");
|
||||
|
|
@ -81,18 +80,18 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Ashcloud Phoenix", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
|
||||
assertLife(playerA, 18); // 2 damage from Eidolon of the Great Revel
|
||||
assertLife(playerB, 18); // 2 damage from Purphoros for the morphed Phoenix
|
||||
|
||||
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertFalse("Purphoros may not be a creature but it is", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHybridManaCostsForDevotion() {
|
||||
|
||||
|
||||
// Indestructible
|
||||
// As long as your devotion to red is less than five, Purphoros isn't a creature.
|
||||
// Whenever another creature enters the battlefield under your control, Purphoros deals 2 damage to each opponent.
|
||||
|
|
@ -101,11 +100,11 @@ public class PurphorosGodOfTheForgeTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Goblin Guide", 1); // {R}
|
||||
addCard(Zone.HAND, playerA, "Boros Reckoner", 1); // {R/W}{R/W}{R/W}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Boros Reckoner");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertLife(playerB, 18);
|
||||
Permanent purphorosGodOfTheForge = getPermanent("Purphoros, God of the Forge", playerA);
|
||||
Assert.assertTrue("Purphoros should be a creature now but is not", purphorosGodOfTheForge.getCardType().contains(CardType.CREATURE));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package org.mage.test.cards.triggers.dies;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
|
|
@ -18,7 +18,6 @@ public class WhisperwoodElementalTest extends CardTestPlayerBase {
|
|||
/**
|
||||
* Tests that the dies triggered ability of silvercoat lion (gained by sacrificed Whisperwood Elemental)
|
||||
* triggers as he dies from Ligning Bolt
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testDiesTriggeredAbility() {
|
||||
|
|
@ -30,17 +29,20 @@ public class WhisperwoodElementalTest extends CardTestPlayerBase {
|
|||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sacrifice {this}: Until end of turn, face-up, nontoken creatures you control gain \"When this creature dies, manifest the top card of your library.");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", "Silvercoat Lion");
|
||||
|
||||
showBattlefield("A battle", 1, PhaseStep.END_TURN, playerA);
|
||||
showGraveyard("A grave", 1, PhaseStep.END_TURN, playerA);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertGraveyardCount(playerA, "Whisperwood Elemental", 1);
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
// Manifested creature from dying Silvercoat Lion
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, EmptyNames.FACE_DOWN_CREATURE.toString(), 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import mage.players.Player;
|
|||
import mage.players.net.UserData;
|
||||
import mage.target.*;
|
||||
import mage.target.common.*;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
|
@ -69,6 +70,8 @@ public class TestPlayer implements Player {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(TestPlayer.class);
|
||||
|
||||
public static final String TARGET_SKIP = "[skip]";
|
||||
|
||||
private int maxCallsWithoutAction = 100;
|
||||
private int foundNoAction = 0;
|
||||
private boolean AIPlayer;
|
||||
|
|
@ -218,7 +221,7 @@ public class TestPlayer implements Player {
|
|||
filteredName = indexedMatcher.group(1);
|
||||
index = Integer.valueOf(indexedMatcher.group(2));
|
||||
}
|
||||
filter.add(new NamePredicate(filteredName));
|
||||
filter.add(new NamePredicate(filteredName, true)); // must find any cards even without names
|
||||
List<Permanent> allPermanents = game.getBattlefield().getAllActivePermanents(filter, controllerID, game);
|
||||
if (allPermanents.isEmpty()) {
|
||||
if (failOnNotFound) {
|
||||
|
|
@ -350,7 +353,8 @@ public class TestPlayer implements Player {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (nameOrAliase.isEmpty() && object.getName().isEmpty()) {
|
||||
// must search any names, even empty
|
||||
if (CardUtil.haveSameNames(nameOrAliase, object.getName(), true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1519,7 +1523,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
// do not select
|
||||
if (targets.get(0).equals("")) {
|
||||
if (targets.get(0).equals(TARGET_SKIP)) {
|
||||
Assert.assertEquals("found empty choice, but target is not support 0 choice", 0, target.getMinNumberOfTargets());
|
||||
targets.remove(0);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.ManaPool;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.mage.test.player.PlayerAction;
|
||||
|
|
@ -267,6 +268,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkPT(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer power, Integer toughness) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_PT, permanentName, power.toString(), toughness.toString());
|
||||
}
|
||||
|
||||
|
|
@ -275,14 +277,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkAbility(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Class<?> abilityClass, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_ABILITY, permanentName, abilityClass.getName(), mustHave.toString());
|
||||
}
|
||||
|
||||
public void checkPermanentCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer count) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_PERMANENT_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
public void checkExileCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, Integer count) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_EXILE_COUNT, permanentName, count.toString());
|
||||
}
|
||||
|
||||
|
|
@ -291,14 +296,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void checkHandCardCount(String checkName, int turnNum, PhaseStep step, TestPlayer player, String cardName, Integer count) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_HAND_CARD_COUNT, cardName, count.toString());
|
||||
}
|
||||
|
||||
public void checkColor(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, String colors, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_COLOR, permanentName, colors, mustHave.toString());
|
||||
}
|
||||
|
||||
public void checkSubType(String checkName, int turnNum, PhaseStep step, TestPlayer player, String permanentName, SubType subType, Boolean mustHave) {
|
||||
//Assert.assertNotEquals("", permanentName);
|
||||
check(checkName, turnNum, step, player, CHECK_COMMAND_SUBTYPE, permanentName, subType.toString(), mustHave.toString());
|
||||
}
|
||||
|
||||
|
|
@ -494,7 +502,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
*/
|
||||
@Override
|
||||
public void setLife(TestPlayer player, int life) {
|
||||
getCommands(player).put(Zone.OUTSIDE, "life:" + String.valueOf(life));
|
||||
getCommands(player).put(Zone.OUTSIDE, "life:" + life);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -596,6 +604,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
@Override
|
||||
public void assertPowerToughness(Player player, String cardName, int power, int toughness, Filter.ComparisonScope scope)
|
||||
throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int count = 0;
|
||||
int fit = 0;
|
||||
int foundPower = 0;
|
||||
|
|
@ -650,6 +659,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
@Override
|
||||
public void assertAbilities(Player player, String cardName, List<Ability> abilities)
|
||||
throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int count = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||
|
|
@ -685,6 +695,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @throws AssertionError
|
||||
*/
|
||||
public void assertAbility(Player player, String cardName, Ability ability, boolean mustHave, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int foundCount = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||
|
|
@ -735,6 +746,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
*/
|
||||
@Override
|
||||
public void assertPermanentCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getControllerId().equals(player.getId())) {
|
||||
|
|
@ -748,6 +760,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
|
||||
@Override
|
||||
public void assertCommandZoneCount(Player player, String commandZoneObjectName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", commandZoneObjectName);
|
||||
int actualCount = 0;
|
||||
for (CommandObject commandObject : currentGame.getState().getCommand()) {
|
||||
if (commandObject.getControllerId().equals(player.getId()) && commandObject.getName().equals(commandZoneObjectName)) {
|
||||
|
|
@ -787,6 +800,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void assertCounterCount(Player player, String cardName, CounterType type, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName) && (player == null || permanent.getControllerId().equals(player.getId()))) {
|
||||
|
|
@ -806,11 +820,12 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertCounterOnExiledCardCount(String cardName, CounterType type, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Card found = null;
|
||||
|
||||
if (found == null) {
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
found = card;
|
||||
break;
|
||||
}
|
||||
|
|
@ -840,6 +855,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param mustHave true if creature should have type, false if it should not
|
||||
*/
|
||||
public void assertType(String cardName, CardType type, boolean mustHave) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
|
@ -862,6 +878,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertType(String cardName, CardType type, SubType subType) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||
if (subType != null) {
|
||||
|
|
@ -876,6 +893,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param type A type to test for
|
||||
*/
|
||||
public void assertNotType(String cardName, CardType type) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
|
||||
}
|
||||
|
|
@ -887,6 +905,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param subType a subtype to test for
|
||||
*/
|
||||
public void assertNotSubtype(String cardName, SubType subType) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = getPermanent(cardName);
|
||||
if (subType != null) {
|
||||
Assert.assertFalse("(Battlefield) card sub-type equal (" + cardName + ':' + subType.getDescription() + ')', found.getSubtype(currentGame).contains(subType));
|
||||
|
|
@ -902,6 +921,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param mustHave must or not must have that colors
|
||||
*/
|
||||
public void assertColor(Player player, String cardName, ObjectColor searchColors, boolean mustHave) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Assert.assertNotEquals("must setup colors to search", 0, searchColors.getColorCount());
|
||||
|
||||
Permanent card = getPermanent(cardName, player);
|
||||
|
|
@ -936,6 +956,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param tapped Whether the permanent is tapped or not
|
||||
*/
|
||||
public void assertTapped(String cardName, boolean tapped) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
|
@ -961,6 +982,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count The amount of this permanents that should be tapped
|
||||
*/
|
||||
public void assertTappedCount(String cardName, boolean tapped, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int tappedAmount = 0;
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
|
|
@ -982,6 +1004,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param attacking Whether the permanent is attacking or not
|
||||
*/
|
||||
public void assertAttacking(String cardName, boolean attacking) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent found = null;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
|
|
@ -1013,17 +1036,18 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertHandCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actual;
|
||||
if (cardName.contains("//")) { // special logic for cheched split cards, because in game logic of card name filtering is different than for test
|
||||
actual = 0;
|
||||
for (Card card : currentGame.getPlayer(player.getId()).getHand().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actual++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new NamePredicate(cardName));
|
||||
filter.add(new NamePredicate(cardName, true)); // must find any cards even without names
|
||||
actual = currentGame.getPlayer(player.getId()).getHand().count(filter, player.getId(), currentGame);
|
||||
}
|
||||
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
|
||||
|
|
@ -1072,10 +1096,11 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertExileCount(String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (ExileZone exile : currentGame.getExile().getExileZones()) {
|
||||
for (Card card : exile.getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1111,6 +1136,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertExileCount(Player owner, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (ExileZone exile : currentGame.getExile().getExileZones()) {
|
||||
for (Card card : exile.getCards(currentGame)) {
|
||||
|
|
@ -1130,9 +1156,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertGraveyardCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Card card : player.getGraveyard().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1147,7 +1174,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertLibraryCount(Player player, int count) throws AssertionError {
|
||||
|
||||
List<Card> libraryList = player.getLibrary().getCards(currentGame);
|
||||
int actualCount = libraryList != null && !libraryList.isEmpty() ? libraryList.size() : 0;
|
||||
Assert.assertEquals("(Library " + player.getName() + ") counts are not equal", count, actualCount);
|
||||
|
|
@ -1161,9 +1187,10 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param count Expected count.
|
||||
*/
|
||||
public void assertLibraryCount(Player player, String cardName, int count) throws AssertionError {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
int actualCount = 0;
|
||||
for (Card card : player.getLibrary().getCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (CardUtil.haveSameNames(card.getName(), cardName, true)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1232,18 +1259,22 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void playLand(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Play " + cardName);
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName);
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName());
|
||||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, Player target, int manaInPool) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$targetPlayer=" + target.getName() + "$manaInPool=" + manaInPool);
|
||||
}
|
||||
|
||||
|
|
@ -1280,6 +1311,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* multiple targets can be seperated by ^
|
||||
*/
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName + "$target=" + targetName);
|
||||
}
|
||||
|
||||
|
|
@ -1318,6 +1350,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
* @param clause
|
||||
*/
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, StackClause clause) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
if (StackClause.WHILE_ON_STACK == clause) {
|
||||
player.addAction(turnNum, step, "activate:Cast " + cardName
|
||||
+ '$' + (targetName != null && targetName.startsWith("target") ? targetName : "target=" + targetName)
|
||||
|
|
@ -1330,6 +1363,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void castSpell(int turnNum, PhaseStep step, TestPlayer player, String cardName, String targetName, String spellOnStack, String spellOnTopOfStack) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
String action = "activate:Cast " + cardName + "$target=" + targetName;
|
||||
if (spellOnStack != null && !spellOnStack.isEmpty()) {
|
||||
action += "$spellOnStack=" + spellOnStack;
|
||||
|
|
@ -1398,22 +1432,28 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void addCounters(int turnNum, PhaseStep step, TestPlayer player, String cardName, CounterType type, int count) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
player.addAction(turnNum, step, "addCounters:" + cardName + '$' + type.getName() + '$' + count);
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, "attack:" + attacker);
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker, TestPlayer defendingPlayer) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, "attack:" + attacker + "$defendingPlayer=" + defendingPlayer.getName());
|
||||
}
|
||||
|
||||
public void attack(int turnNum, TestPlayer player, String attacker, String planeswalker) {
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_ATTACKERS, new StringBuilder("attack:").append(attacker).append("$planeswalker=").append(planeswalker).toString());
|
||||
}
|
||||
|
||||
public void block(int turnNum, TestPlayer player, String blocker, String attacker) {
|
||||
//Assert.assertNotEquals("", blocker);
|
||||
//Assert.assertNotEquals("", attacker);
|
||||
player.addAction(turnNum, PhaseStep.DECLARE_BLOCKERS, "block:" + blocker + '$' + attacker);
|
||||
}
|
||||
|
||||
|
|
@ -1507,6 +1547,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
}
|
||||
|
||||
public void assertDamageReceived(Player player, String cardName, int expected) {
|
||||
//Assert.assertNotEquals("", cardName);
|
||||
Permanent p = getPermanent(cardName, player.getId());
|
||||
if (p != null) {
|
||||
Assert.assertEquals("Wrong damage received: ", expected, p.getDamage());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package org.mage.test.testapi;
|
||||
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.util.CardUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -11,6 +14,39 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
public class TestAliases extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_NamesEquals() {
|
||||
// empty names for face down cards
|
||||
Assert.assertTrue(CardUtil.haveEmptyName(""));
|
||||
Assert.assertTrue(CardUtil.haveEmptyName(EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName(" "));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName("123"));
|
||||
Assert.assertFalse(CardUtil.haveEmptyName("Sample Name"));
|
||||
|
||||
// same names (empty names can't be same)
|
||||
Assert.assertFalse(CardUtil.haveSameNames("", ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_TOKEN.toString(), ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_TOKEN.toString(), EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertTrue(CardUtil.haveSameNames("Name", "Name"));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", ""));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", " "));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "123"));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", EmptyNames.FACE_DOWN_CREATURE.toString()));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name1", "Name2"));
|
||||
|
||||
// ignore mtg rules (empty names must be same)
|
||||
Assert.assertTrue(CardUtil.haveSameNames("", "", true));
|
||||
Assert.assertTrue(CardUtil.haveSameNames(EmptyNames.FACE_DOWN_CREATURE.toString(), EmptyNames.FACE_DOWN_CREATURE.toString(), true));
|
||||
Assert.assertTrue(CardUtil.haveSameNames("Name", "Name", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", " ", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", "123", true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name", EmptyNames.FACE_DOWN_CREATURE.toString(), true));
|
||||
Assert.assertFalse(CardUtil.haveSameNames("Name1", "Name2", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_DifferentZones() {
|
||||
addCard(Zone.LIBRARY, playerA, "Swamp@lib", 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue