mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
* Tests - Use logname to check for objects.
This commit is contained in:
parent
60fd0ed1b4
commit
7dbf265fd5
4 changed files with 55 additions and 21 deletions
|
|
@ -82,8 +82,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPowerToughness(playerA, "", 2, 2);
|
||||
assertPermanentCount(playerA, "face down creature", 1);
|
||||
assertPowerToughness(playerA, "face down creature", 2, 2);
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
@ -97,7 +97,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, "face down creature");
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
|
@ -105,7 +105,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, "face down creature", 0);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 5, 5);
|
||||
assertTapped("Pine Walker", false);
|
||||
|
|
@ -129,8 +129,8 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Icefeather Aven");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "");
|
||||
attack(3, playerA, "face down creature");
|
||||
attack(3, playerA, "face down creature");
|
||||
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
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerA, "Icefeather Aven", 0);
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, "face down creature", 1);
|
||||
assertPermanentCount(playerA, "Icefeather Aven", 1);
|
||||
assertTapped("Icefeather Aven", true);
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerB, 20); // and not 21
|
||||
|
||||
assertPermanentCount(playerA, "", 1);
|
||||
assertPermanentCount(playerA, "face down creature", 1);
|
||||
assertPermanentCount(playerB, "Soldier of the Pantheon", 1);
|
||||
|
||||
}
|
||||
|
|
@ -199,17 +199,17 @@ 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, "face down creature"); // 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, "face down creature", 1);
|
||||
assertPowerToughness(playerA, "face down creature", 2,2);
|
||||
assertPermanentCount(playerB, "a creature without name", 1);
|
||||
assertPowerToughness(playerB, "a creature without name", 2,2);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Pine Walker", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, "face down creature", 0);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
assertPowerToughness(playerA, "Pine Walker", 4,4);
|
||||
|
|
@ -284,7 +284,7 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
assertHandCount(playerA, "Ponyback Brigade", 0);
|
||||
assertHandCount(playerB, "Doomwake Giant", 0);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
assertPermanentCount(playerA, "face down creature", 0);
|
||||
assertPermanentCount(playerA, "Goblin", 3);
|
||||
assertPowerToughness(playerA, "Goblin", 1,1,Filter.ComparisonScope.Any);
|
||||
assertPermanentCount(playerB, "Doomwake Giant", 1);
|
||||
|
|
@ -324,5 +324,39 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Sagu Mauler", 6,6,Filter.ComparisonScope.Any);
|
||||
|
||||
}
|
||||
/**
|
||||
* Check that you can't counter a creature cast for it morph costs
|
||||
* with Disdainful Stroke if it's normal cmc > 3
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testCounterCastWithMorphEffect() {
|
||||
// Sagu Mauler 6/6 - Creature - Beast
|
||||
// Trample, hexproof
|
||||
// Morph {3}{G}{B} (You may cast this card face down as a 2/2 creature for . Turn it face up any time for its morph cost.)
|
||||
addCard(Zone.HAND, playerA, "Sagu Mauler");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
|
||||
// Disdainful Stroke {1}{U}
|
||||
// Instant
|
||||
// Counter target spell with converted mana cost 4 or greater.
|
||||
addCard(Zone.HAND, playerB, "Disdainful Stroke");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sagu Mauler");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Disdainful Stroke", "Sagu Mauler");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertHandCount(playerA, "Sagu Mauler", 0);
|
||||
assertHandCount(playerB, "Disdainful Stroke", 1); // can't be cast
|
||||
|
||||
assertPermanentCount(playerA, "face down creature", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
if (group.startsWith("planeswalker=")) {
|
||||
String planeswalkerName = group.substring(group.indexOf("planeswalker=") + 13);
|
||||
for (Permanent permanent :game.getBattlefield().getAllActivePermanents(new FilterPlaneswalkerPermanent(), game)) {
|
||||
if (permanent.getName().equals(planeswalkerName)) {
|
||||
if (permanent.getLogName().equals(planeswalkerName)) {
|
||||
defenderId = permanent.getId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
int foundToughness = 0;
|
||||
int found = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
|
||||
if (permanent.getName().equals(cardName) && permanent.getControllerId().equals(player.getId())) {
|
||||
if (permanent.getLogName().equals(cardName) && permanent.getControllerId().equals(player.getId())) {
|
||||
count++;
|
||||
if (scope.equals(Filter.ComparisonScope.All)) {
|
||||
Assert.assertEquals("Power is not the same (" + power + " vs. " + permanent.getPower().getValue() + ")",
|
||||
|
|
@ -449,7 +449,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
int actualCount = 0;
|
||||
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
|
||||
if (permanent.getControllerId().equals(player.getId())) {
|
||||
if (permanent.getName().equals(cardName)) {
|
||||
if (permanent.getLogName().equals(cardName)) {
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue