* Commander: added support of lands as commander (#5795);

This commit is contained in:
Oleg Agafonov 2019-05-23 12:40:45 +04:00
parent b3e7c4f136
commit 42ed14df52
18 changed files with 441 additions and 201 deletions

View file

@ -27,6 +27,7 @@ public class CommandersCastTest extends CardTestCommander4Players {
assertCommandZoneCount(playerA, "Balduvian Bears", 0);
assertPermanentCount(playerA, "Balduvian Bears", 1);
assertTappedCount("Forest", true, 2);
}
@Test
@ -62,5 +63,67 @@ public class CommandersCastTest extends CardTestCommander4Players {
assertCommandZoneCount(playerA, "Balduvian Bears", 0);
assertPermanentCount(playerA, "Balduvian Bears", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertTappedCount("Forest", true, 2 + 4);
}
@Test
public void test_PlayAsLandOneTime() {
addCard(Zone.COMMAND, playerA, "Academy Ruins", 1);
showAvaileableAbilities("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins");
//castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins");
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertCommandZoneCount(playerA, "Academy Ruins", 0);
assertPermanentCount(playerA, "Academy Ruins", 1);
}
@Test
public void test_PlayAsLandTwoTimes() {
// Player order: A -> D -> C -> B
addCard(Zone.COMMAND, playerA, "Academy Ruins", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); // 0 + 2
//
addCard(Zone.HAND, playerA, "Pillage", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
// cast 1
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("after play 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins", 1);
// destroy commander land
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pillage", "Academy Ruins");
setChoice(playerA, "Yes"); // put to command zone again
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkPermanentCount("after destroy", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins", 0);
// remove unnecessary mana, only 2 forest need (workaround to remove random mana payments)
activateManaAbility(5, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(5, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
activateManaAbility(5, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
// cast 2
playLand(5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Academy Ruins");
waitStackResolved(5, PhaseStep.POSTCOMBAT_MAIN);
checkPermanentCount("after cast 2", 5, PhaseStep.POSTCOMBAT_MAIN, playerA, "Academy Ruins", 1);
showBattlefield("end battlefield", 5, PhaseStep.END_TURN, playerA);
setStopAt(5, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertCommandZoneCount(playerA, "Academy Ruins", 0);
assertPermanentCount(playerA, "Academy Ruins", 1);
assertGraveyardCount(playerA, "Pillage", 1);
assertTappedCount("Forest", true, 2);
assertTappedCount("Mountain", true, 3);
}
}

View file

@ -1,4 +1,3 @@
package org.mage.test.commander.duel;
import mage.constants.PhaseStep;
@ -8,7 +7,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestCommanderDuelBase;
/**
*
* @author LevelX2
*/
public class OpalPalaceTest extends CardTestCommanderDuelBase {
@ -29,10 +27,19 @@ public class OpalPalaceTest extends CardTestCommanderDuelBase {
// equal to the number of times it's been cast from the command zone this game.
addCard(Zone.BATTLEFIELD, playerA, "Opal Palace", 1);
showHand("hand", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
showCommand("command", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
showAvaileableAbilities("abi", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}");
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}, {T}");
setChoice(playerA, "Opal Palace"); // activate mana replace effect first (+3 counters)
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ob Nixilis of the Black Oath"); // {3}{B}{B}
setStrictChooseMode(true);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertLife(playerA, 40);
assertLife(playerB, 40);