mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Fixed potential NPE errors in getPhase usage (fixed Berserker's Frenzy, etc)
This commit is contained in:
parent
cfd7464b49
commit
a15a0daa04
81 changed files with 162 additions and 130 deletions
|
|
@ -48,6 +48,6 @@ public class PhageTheUntouchableTest extends CardTestPlayerBase {
|
|||
|
||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||
assertWonTheGame(playerA);
|
||||
Assert.assertTrue("Game ist At end phase", currentGame.getPhase().getType() == TurnPhase.END);
|
||||
Assert.assertTrue("Game ist At end phase", currentGame.getTurnPhaseType() == TurnPhase.END);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ public class TestPlayer implements Player {
|
|||
if (actionsToRemoveLater.size() > 0) {
|
||||
List<PlayerAction> removed = new ArrayList<>();
|
||||
actionsToRemoveLater.forEach((action, step) -> {
|
||||
if (game.getStep().getType() != step) {
|
||||
if (game.getTurnStepType() != step) {
|
||||
action.onActionRemovedLater(game, this);
|
||||
actions.remove(action);
|
||||
removed.add(action);
|
||||
|
|
@ -584,7 +584,7 @@ public class TestPlayer implements Player {
|
|||
List<PlayerAction> tempActions = new ArrayList<>();
|
||||
tempActions.addAll(actions);
|
||||
for (PlayerAction action : tempActions) {
|
||||
if (action.getTurnNum() == game.getTurnNum() && action.getStep() == game.getStep().getType()) {
|
||||
if (action.getTurnNum() == game.getTurnNum() && action.getStep() == game.getTurnStepType()) {
|
||||
|
||||
if (action.getAction().startsWith(ACTIVATE_ABILITY)) {
|
||||
String command = action.getAction();
|
||||
|
|
@ -677,9 +677,8 @@ public class TestPlayer implements Player {
|
|||
printEnd();
|
||||
// TODO: enable assert and rewrite failed activateManaAbility tests
|
||||
// (must use checkAbility instead multiple mana calls)
|
||||
LOGGER.warn("WARNING, test must be rewritten to use checkAbility instead multiple mana calls");
|
||||
//Assert.fail("Can't find mana ability to activate command: " + command);
|
||||
new Exception("WARNING, test must be rewritten to use checkAbility instead multiple mana calls")
|
||||
.printStackTrace();
|
||||
} else if (action.getAction().startsWith("addCounters:")) {
|
||||
String command = action.getAction();
|
||||
command = command.substring(command.indexOf("addCounters:") + 12);
|
||||
|
|
@ -748,7 +747,7 @@ public class TestPlayer implements Player {
|
|||
// play step
|
||||
if (command.equals(AI_COMMAND_PLAY_STEP)) {
|
||||
AIRealGameSimulation = true; // disable on action's remove
|
||||
actionsToRemoveLater.put(action, game.getStep().getType());
|
||||
actionsToRemoveLater.put(action, game.getTurnStepType());
|
||||
computerPlayer.priority(game);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1966,7 +1965,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
Assert.fail("Missing " + choiceType.toUpperCase(Locale.ENGLISH) + " def for"
|
||||
+ " turn " + game.getTurnNum()
|
||||
+ ", step " + (game.getStep() != null ? game.getStep().getType().name() : "not started")
|
||||
+ ", step " + (game.getStep() != null ? game.getTurnStepType().name() : "not started")
|
||||
+ ", " + this.getName()
|
||||
+ "\n" + reason);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue