* Exile card and return it from exile - fixed rollback error on commander creature exile (#7250);

[CMR] fixed PromiseOfTomorrow - not working ability;
This commit is contained in:
Oleg Agafonov 2020-12-17 10:07:15 +04:00
parent a6f79580d7
commit 3f44d9eef3
19 changed files with 232 additions and 116 deletions

View file

@ -25,11 +25,9 @@ public class ExileTargetTest extends CardTestCommander4Players {
addCard(Zone.BATTLEFIELD, playerC, "Balduvian Bears", 1); // 2/2
// must select opponent's Balduvian Bears
// showAvailableAbilities("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oblivion Ring");
//addTarget(playerA, "Balduvian Bears"); // disable to activate AI target choose
// showAvailableAbilities("after", 1, PhaseStep.BEGIN_COMBAT, playerA);
//setStrictChooseMode(true); // disable strict mode to activate AI for choosing
setStopAt(1, PhaseStep.END_COMBAT);
execute();

View file

@ -0,0 +1,121 @@
package org.mage.test.cards.single.cmr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestCommander4Players;
/**
* @author JayDi85
*/
public class PromiseOfTomorrowTest extends CardTestCommander4Players {
@Test
public void test_NormalCard() {
// bug: https://github.com/magefree/mage/issues/7250
// Whenever a creature you control dies, exile it.
// At the beginning of each end step, if you control no creatures, sacrifice Promise of Tomorrow and return all
// cards exiled with it to the battlefield under your control.
addCard(Zone.BATTLEFIELD, playerA, "Promise of Tomorrow", 1);
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears@bear", 2);
// destroy two creatures
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "@bear.1");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "@bear.2");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkExileCount("after die", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 2);
// must return
checkPermanentCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 2);
checkGraveyardCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Promise of Tomorrow", 1);
setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
@Test
public void test_Commander_LeaveInZone() {
// bug: https://github.com/magefree/mage/issues/7250
// Whenever a creature you control dies, exile it.
// At the beginning of each end step, if you control no creatures, sacrifice Promise of Tomorrow and return all
// cards exiled with it to the battlefield under your control.
addCard(Zone.BATTLEFIELD, playerA, "Promise of Tomorrow", 1);
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
//
addCard(Zone.COMMAND, playerA, "Balduvian Bears", 1); // {1}{G}
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// prepare commander
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
// destroy creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkExileCount("after die", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
setChoice(playerA, "No"); // move commander from graveyard to command zone
setChoice(playerA, "No"); // move commander from exile to command zone
// must return
checkPermanentCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
checkGraveyardCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Promise of Tomorrow", 1);
setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
@Test
public void test_Commander_MoveToCommandZoneFirst() {
// bug: https://github.com/magefree/mage/issues/7250
// Whenever a creature you control dies, exile it.
// At the beginning of each end step, if you control no creatures, sacrifice Promise of Tomorrow and return all
// cards exiled with it to the battlefield under your control.
addCard(Zone.BATTLEFIELD, playerA, "Promise of Tomorrow", 1);
//
addCard(Zone.HAND, playerA, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
//
addCard(Zone.COMMAND, playerA, "Balduvian Bears", 1); // {1}{G}
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
// prepare commander
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}", 2);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
checkPermanentCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
// destroy creature
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Balduvian Bears");
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
checkExileCount("after die", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
// possible bug: Promise of Tomorrow tries to move commander card to exile from command zone with error
setChoice(playerA, "Yes"); // move commander from graveyard to command zone
setChoice(playerA, "No"); // move commander from exile to command zone
// must return
checkPermanentCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Balduvian Bears", 1);
checkGraveyardCount("after return", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Promise of Tomorrow", 1);
setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
}