forked from External/mage
Tests: added more tests with continuous effects and game leaving by players
This commit is contained in:
parent
9ef2e0bda7
commit
3beac51ebf
3 changed files with 77 additions and 12 deletions
|
|
@ -152,4 +152,5 @@ public class EndOfTurnMultiOpponentsTest extends CardTestMultiPlayerBaseWithRang
|
|||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ public class EndOfTurnOneOpponentTest extends CardTestPlayerBase {
|
|||
|
||||
public static String cardBear2 = "Balduvian Bears"; // 2/2
|
||||
|
||||
public static void prepareStepChecks(CardTestPlayerAPIImpl testEngine, String testName, int turnNum, TestPlayer player, boolean willBeBattle, PhaseStep mustExistUntilStep) {
|
||||
public static void prepareStepChecks(CardTestPlayerAPIImpl testEngine, String testName, int turnNum, TestPlayer player,
|
||||
boolean willBeBattle, PhaseStep mustExistUntilStep) {
|
||||
for (PhaseStep step : PhaseStep.values()) {
|
||||
// skip auto-steps without priority/checks
|
||||
switch (step) {
|
||||
|
|
|
|||
|
|
@ -71,21 +71,23 @@ public class PlayerLeavesGameTest extends CardTestMultiPlayerBaseWithRangeAll {
|
|||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
private void prepareAndRunLeaveGameWithEffectTest(Duration duration) {
|
||||
private void prepareAndRunLeaveGameWithLongEffectTest(Duration duration) {
|
||||
// Player order: A -> D -> C -> B
|
||||
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
|
||||
addCustomCardWithAbility("effect", playerA, new SimpleStaticAbility(new BoostAllEffect(1, 1, duration)));
|
||||
|
||||
// B must checks A for online status
|
||||
|
||||
// 1
|
||||
checkPlayerInGame(duration.toString() + " - turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, true);
|
||||
checkPermanentCount(duration.name() + " - turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, cardBear2, 1);
|
||||
checkPT(duration.name() + " - turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
//
|
||||
// 2
|
||||
checkPlayerInGame(duration.name() + " - turn 2", 2, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, true);
|
||||
checkPermanentCount(duration.name() + " - turn 2", 2, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, cardBear2, 1);
|
||||
checkPT(duration.name() + " - turn 2", 2, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
//
|
||||
// 3
|
||||
checkPlayerInGame(duration.name() + " - turn 3 before", 3, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, true);
|
||||
checkPermanentCount(duration.name() + " - turn 3 before", 3, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, cardBear2, 1);
|
||||
checkPT(duration.name() + " - turn 3 before", 3, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
|
|
@ -95,7 +97,7 @@ public class PlayerLeavesGameTest extends CardTestMultiPlayerBaseWithRangeAll {
|
|||
checkPlayerInGame(duration.name() + " - turn 3 after", 3, PhaseStep.END_TURN, playerD, playerA, false);
|
||||
checkPermanentCount(duration.name() + " - turn 3 after", 3, PhaseStep.END_TURN, playerD, playerA, cardBear2, 0);
|
||||
checkPT(duration.name() + " - turn 3 after", 3, PhaseStep.END_TURN, playerD, cardBear2, 2, 2);
|
||||
//
|
||||
// 4
|
||||
checkPlayerInGame(duration.name() + " - turn 4", 4, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, false);
|
||||
checkPermanentCount(duration.name() + " - turn 4", 4, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, cardBear2, 0);
|
||||
checkPT(duration.name() + " - turn 4", 4, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 2, 2);
|
||||
|
|
@ -108,25 +110,86 @@ public class PlayerLeavesGameTest extends CardTestMultiPlayerBaseWithRangeAll {
|
|||
|
||||
@Test
|
||||
public void test_PlayerLeaveGameWithOwnPermanentAndCustomEffect() {
|
||||
prepareAndRunLeaveGameWithEffectTest(Duration.Custom);
|
||||
prepareAndRunLeaveGameWithLongEffectTest(Duration.Custom);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PlayerLeaveGameWithOwnPermanentAndWhileOnBattlefieldEffect() {
|
||||
prepareAndRunLeaveGameWithEffectTest(Duration.WhileOnBattlefield);
|
||||
prepareAndRunLeaveGameWithLongEffectTest(Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PlayerLeaveGameWithOwnPermanentAndEndOfGameEffect() {
|
||||
prepareAndRunLeaveGameWithEffectTest(Duration.EndOfGame);
|
||||
prepareAndRunLeaveGameWithLongEffectTest(Duration.EndOfGame);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PlayerLeaveGameWithOwnPermanentAndUntilSourceLeavesBattlefielEffect() {
|
||||
prepareAndRunLeaveGameWithEffectTest(Duration.UntilSourceLeavesBattlefield);
|
||||
prepareAndRunLeaveGameWithLongEffectTest(Duration.UntilSourceLeavesBattlefield);
|
||||
}
|
||||
|
||||
// TODO: add leave tests for end of step
|
||||
// TODO: add leave tests for end of turn
|
||||
// TODO: add leave tests for end of your turn
|
||||
@Test
|
||||
public void test_EndOfTurnMultiLeave() {
|
||||
// Player order: A -> D -> C -> B
|
||||
addCustomCardWithAbility("boost", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, Duration.EndOfTurn)));
|
||||
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
|
||||
|
||||
// player A leaves game on turn 1 - postcombat
|
||||
// end of turn effect must continue until end of turn
|
||||
concede(1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
checkPT("turn 1", 1, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPT("turn 1", 1, PhaseStep.POSTCOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPT("turn 1", 1, PhaseStep.END_TURN, playerD, cardBear2, 3, 3);
|
||||
checkPT("turn 2", 2, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 2, 2);
|
||||
|
||||
setStopAt(2, PhaseStep.CLEANUP);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
|
||||
private void prepareAndRunUntilYourTurnLeaveTest(Duration duration) {
|
||||
// Player order: A -> D -> C -> B
|
||||
addCustomCardWithAbility("boost", playerA, new SimpleStaticAbility(Zone.ALL, new BoostAllEffect(1, 1, duration)));
|
||||
addCard(Zone.BATTLEFIELD, playerA, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerC, cardBear2, 1);
|
||||
addCard(Zone.BATTLEFIELD, playerD, cardBear2, 1);
|
||||
|
||||
// 800.4k When a player leaves the game, any continuous effects with durations that last until
|
||||
// that player’s next turn or until a specific point in that turn will last until that turn would have begun.
|
||||
// They neither expire immediately nor last indefinitely.
|
||||
|
||||
// player A leaves game on turn 1 - postcombat
|
||||
// until your next turn effect must continue until START of your possible next turn
|
||||
concede(1, PhaseStep.POSTCOMBAT_MAIN, playerA);
|
||||
checkPT(duration.name() + " - turn 1 pre", 1, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPermanentCount(duration.name() + " - perm A must exists before leave", 1, PhaseStep.PRECOMBAT_MAIN, playerD, playerA, "boost", 1);
|
||||
checkPT(duration.name() + " - turn 1 post", 1, PhaseStep.POSTCOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPermanentCount(duration.name() + " - perm A must removed after leave", 1, PhaseStep.POSTCOMBAT_MAIN, playerD, playerA, "boost", 0);
|
||||
checkPT(duration.name() + " - turn 1 end", 1, PhaseStep.END_TURN, playerD, cardBear2, 3, 3);
|
||||
checkPT(duration.name() + " - turn 2", 2, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPT(duration.name() + " - turn 3", 3, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPT(duration.name() + " - turn 4", 4, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 3, 3);
|
||||
checkPT(duration.name() + " - turn 5 (possible A)", 5, PhaseStep.PRECOMBAT_MAIN, playerD, cardBear2, 2, 2);
|
||||
|
||||
setStopAt(5, PhaseStep.CLEANUP);
|
||||
setStrictChooseMode(true);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_UntilYourNextTurnMultiLeave() {
|
||||
prepareAndRunUntilYourTurnLeaveTest(Duration.UntilYourNextTurn);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_UntilEndOfYourNextTurnMultiLeave() {
|
||||
prepareAndRunUntilYourTurnLeaveTest(Duration.UntilEndOfYourNextTurn);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue