Questing Beast - fixed rollback error on damage prevent (#6116);

This commit is contained in:
Oleg Agafonov 2019-12-24 10:53:51 +04:00
parent 5cb040607e
commit 9cf1ee2f42
32 changed files with 260 additions and 223 deletions

View file

@ -134,4 +134,60 @@ public class ConditionalPreventionTest extends CardTestPlayerBase {
assertHandCount(playerA, "Lightning Bolt", 0);
}
@Test
public void test_PrentableCombatDamage() {
// Prevent all damage that would be dealt to creatures.
addCard(Zone.BATTLEFIELD, playerA, "Bubble Matrix", 1);
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
//
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1);
// player A must do damage
attack(1, playerA, "Balduvian Bears", playerB);
// player B can't do damage (bears must block and safe)
attack(4, playerB, "Balduvian Bears", playerA);
block(4, playerA, "Balduvian Bears", "Balduvian Bears");
setStrictChooseMode(true);
setStopAt(4, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Balduvian Bears", 1);
assertPermanentCount(playerB, "Balduvian Bears", 1);
assertLife(playerA, 20);
assertLife(playerB, 20 - 2);
}
@Test
public void test_UnpreventableCombatDamage() {
// Combat damage that would be dealt by creatures you control can't be prevented.
addCard(Zone.BATTLEFIELD, playerB, "Questing Beast", 1);
//
// Prevent all damage that would be dealt to creatures.
addCard(Zone.BATTLEFIELD, playerA, "Bubble Matrix", 1);
addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 1);
//
addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears", 1);
// player A must do damage
attack(1, playerA, "Balduvian Bears", playerB);
// player B must be prevented by Bubble Matrix, but can't (Questing Beast)
// a -> b -- can't do damage (matrix)
// b -> a -- can do damage (matrix -> quest)
attack(4, playerB, "Balduvian Bears", playerA);
block(4, playerA, "Balduvian Bears", "Balduvian Bears");
setStrictChooseMode(true);
setStopAt(4, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Balduvian Bears", 0);
assertPermanentCount(playerB, "Balduvian Bears", 1);
assertLife(playerA, 20);
assertLife(playerB, 20 - 2);
}
}

View file

@ -260,17 +260,16 @@ public class LoadTest {
@Ignore
public void test_TwoAIPlayGame_Multiple() {
int singleGameSID = -1554824422; // for one game test with same deck
int singleGamePlaysAmount = 1000; // multiple run of one game test
int singleGameSID = 0; // for one game test with same deck
int gamesAmount = 1000; // multiple run of one game test
// save random seeds for repeated results (in decks generating)
List<Integer> seedsList = new ArrayList<>();
if (singleGameSID != 0) {
for (int i = 1; i <= singleGamePlaysAmount; i++) {
for (int i = 1; i <= gamesAmount; i++) {
seedsList.add(singleGameSID);
}
} else {
int gamesAmount = 1000;
for (int i = 1; i <= gamesAmount; i++) {
seedsList.add(RandomUtil.nextInt());
}