* Fixed problems with win / lose restrictions in relation to empty draw condition (fixes #1681 #6553).

This commit is contained in:
LevelX2 2020-05-26 16:38:01 +02:00
parent 37f7389c17
commit 3aefbfb360
13 changed files with 107 additions and 34 deletions

View file

@ -38,6 +38,10 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
/**
* Tests multiplayer effects Player order: A -> D -> C -> B
*/
/**
* Test that players out of range do not lose the game if effect from Approach of the Seconnd Sun takes effect.
*/
@Test
public void ApproachOfTheSecondSunTest() {
@ -54,11 +58,103 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
assertLife(playerA, 47);
assertLife(playerC, 40);
Assert.assertTrue("Player D has lost the game", !playerD.isInGame());
Assert.assertTrue("Player B has lost the game", !playerB.isInGame());
Assert.assertTrue("Player D still alive but should have lost the game", !playerD.isInGame());
Assert.assertTrue("Player B still alive but should have lost the game", !playerB.isInGame());
Assert.assertTrue("Player C is in the game", playerC.isInGame());
Assert.assertTrue("Player A is in the game", playerA.isInGame());
}
/**
* Test that players out of range do not lose the game if effect from Laboratory Maniac takes effect.
*/
@Test
public void LaboratoryManiacWinsTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
removeAllCardsFromLibrary(playerA);
addCard(Zone.LIBRARY, playerA, "Mountain");
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Laboratory Maniac", 1);
assertHandCount(playerA, "Mountain", 1);
assertLibraryCount(playerA, 0);
Assert.assertTrue("Player D still alive but should have lost the game", !playerD.isInGame());
Assert.assertTrue("Player B still alive but should have lost the game", !playerB.isInGame());
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());
Assert.assertTrue("Player A should be in the game but has lost", playerA.isInGame());
}
/**
* Test that player can't win while Platinium Angel ist in range.
*/
@Test
public void LaboratoryManiacAndPlatinumAngelInRangeTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
removeAllCardsFromLibrary(playerA);
// You can't lose the game and your opponents can't win the game.
addCard(Zone.HAND, playerD, "Platinum Angel", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerD, "Island", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
addCard(Zone.LIBRARY, playerA, "Mountain");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Platinum Angel");
setStopAt(9, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Laboratory Maniac", 1);
assertHandCount(playerA, "Mountain", 1);
assertLibraryCount(playerA, 0);
assertPermanentCount(playerD, "Platinum Angel", 1);
Assert.assertTrue("Player D should be in the game but has lost", playerD.isInGame());
Assert.assertTrue("Player B should be in the game but has lost", playerB.isInGame());
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());
Assert.assertTrue("Player A should be in the game but has lost", playerA.isInGame());
}
/**
* Test that player can't win while Platinium Angel ist in range.
*/
@Test
public void LaboratoryManiacAndPlatinumAngelFirstOutOfRangeTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
removeAllCardsFromLibrary(playerA);
// You can't lose the game and your opponents can't win the game.
addCard(Zone.HAND, playerC, "Platinum Angel", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerC, "Island", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
addCard(Zone.LIBRARY, playerA, "Mountain");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerC, "Platinum Angel");
setStopAt(9, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Laboratory Maniac", 1);
assertHandCount(playerA, "Mountain", 1);
assertLibraryCount(playerA, 0);
assertPermanentCount(playerC, "Platinum Angel", 1);
Assert.assertTrue("Player D still alive but should have lost the gamet", !playerD.isInGame());
Assert.assertTrue("Player B still alive but should have lost the game", !playerB.isInGame());
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());
Assert.assertTrue("Player A should be in the game but has lost", playerA.isInGame());
}
}

View file

@ -2952,11 +2952,6 @@ public class TestPlayer implements Player {
computerPlayer.pass(game);
}
@Override
public boolean isEmptyDraw() {
return computerPlayer.isEmptyDraw();
}
@Override
public void resetPassed() {
computerPlayer.resetPassed();

View file

@ -288,11 +288,6 @@ public class PlayerStub implements Player {
return false;
}
@Override
public boolean isEmptyDraw() {
return false;
}
@Override
public void pass(Game game) {