From 0d46c68924f2ded27760c52d15ceb16b56d8a645 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 4 Nov 2017 18:19:41 +0100 Subject: [PATCH] * Fixed some problems for handling concede during game init. --- .../src/mage/player/ai/ComputerPlayer7.java | 5 ++--- .../src/mage/player/human/HumanPlayer.java | 4 +++- Mage/src/main/java/mage/game/GameImpl.java | 7 ++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java index 48f46b53f5..28cd4879ae 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer7.java @@ -161,10 +161,9 @@ public class ComputerPlayer7 extends ComputerPlayer6 { Game sim = createSimulation(game); SimulationNode2.resetCount(); root = new SimulationNode2(null, sim, maxDepth, playerId); - addActionsTimed(); - logger.trace("After add actions timed: root.children.size = " + root.children.size()); - if (!root.children.isEmpty()) { + if (root.children != null && !root.children.isEmpty()) { + logger.trace("After add actions timed: root.children.size = " + root.children.size()); root = root.children.get(0); // int bestScore = root.getScore(); // if (bestScore > currentScore || allowBadMoves) { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 06a4778646..97fa23bab8 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -205,7 +205,9 @@ public class HumanPlayer extends PlayerImpl { return; } response.clear(); - loop = true; + if (isInGame()) { + loop = true; + } } } if (recordingMacro && !macroTriggeredSelectionFlag) { diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index e181422a82..9e07a84e34 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -563,7 +563,12 @@ public abstract class GameImpl implements Game, Serializable { // } @Override public void setConcedingPlayer(UUID playerId) { - Player player = getPlayer(state.getPriorityPlayerId()); + Player player = null; + if (state.getChoosingPlayerId() != null) { + player = getPlayer(state.getChoosingPlayerId()); + } else if (state.getPriorityPlayerId() != null) { + player = getPlayer(state.getPriorityPlayerId()); + } if (player != null) { if (!player.hasLeft() && player.isHuman()) { if (!concedingPlayers.contains(playerId)) {