diff --git a/Mage.Client/plugins/mage-deck-constructed.jar b/Mage.Client/plugins/mage-deck-constructed.jar index 8ea92082fa..0a82a522a7 100644 Binary files a/Mage.Client/plugins/mage-deck-constructed.jar and b/Mage.Client/plugins/mage-deck-constructed.jar differ diff --git a/Mage.Client/plugins/mage-deck-limited.jar b/Mage.Client/plugins/mage-deck-limited.jar index fd7b0a98b9..593fe72bfe 100644 Binary files a/Mage.Client/plugins/mage-deck-limited.jar and b/Mage.Client/plugins/mage-deck-limited.jar differ diff --git a/Mage.Client/plugins/mage-game-freeforall.jar b/Mage.Client/plugins/mage-game-freeforall.jar index a10ff5eeaf..bbebd426b0 100644 Binary files a/Mage.Client/plugins/mage-game-freeforall.jar and b/Mage.Client/plugins/mage-game-freeforall.jar differ diff --git a/Mage.Client/plugins/mage-game-twoplayerduel.jar b/Mage.Client/plugins/mage-game-twoplayerduel.jar index a02d71567e..b3edd0833b 100644 Binary files a/Mage.Client/plugins/mage-game-twoplayerduel.jar and b/Mage.Client/plugins/mage-game-twoplayerduel.jar differ diff --git a/Mage.Client/plugins/mage-player-ai-ma.jar b/Mage.Client/plugins/mage-player-ai-ma.jar index c2468a1b93..56cf3a297e 100644 Binary files a/Mage.Client/plugins/mage-player-ai-ma.jar and b/Mage.Client/plugins/mage-player-ai-ma.jar differ diff --git a/Mage.Client/plugins/mage-player-ai.jar b/Mage.Client/plugins/mage-player-ai.jar index 4eab33a758..13b01f158d 100644 Binary files a/Mage.Client/plugins/mage-player-ai.jar and b/Mage.Client/plugins/mage-player-ai.jar differ diff --git a/Mage.Client/plugins/mage-player-aimcts.jar b/Mage.Client/plugins/mage-player-aimcts.jar index 4670c0f7d5..091dfa8c63 100644 Binary files a/Mage.Client/plugins/mage-player-aimcts.jar and b/Mage.Client/plugins/mage-player-aimcts.jar differ diff --git a/Mage.Client/plugins/mage-player-aiminimax.jar b/Mage.Client/plugins/mage-player-aiminimax.jar index 437c1572c7..f468030b4d 100644 Binary files a/Mage.Client/plugins/mage-player-aiminimax.jar and b/Mage.Client/plugins/mage-player-aiminimax.jar differ diff --git a/Mage.Client/plugins/mage-player-human.jar b/Mage.Client/plugins/mage-player-human.jar index 9fd545ac09..67824ec068 100644 Binary files a/Mage.Client/plugins/mage-player-human.jar and b/Mage.Client/plugins/mage-player-human.jar differ diff --git a/Mage.Client/plugins/mage-tournament-booster-draft.jar b/Mage.Client/plugins/mage-tournament-booster-draft.jar index 6729138bfb..c08d257d6a 100644 Binary files a/Mage.Client/plugins/mage-tournament-booster-draft.jar and b/Mage.Client/plugins/mage-tournament-booster-draft.jar differ diff --git a/Mage.Client/plugins/mage-tournament-sealed.jar b/Mage.Client/plugins/mage-tournament-sealed.jar index cec9fec81b..e0897c3aa6 100644 Binary files a/Mage.Client/plugins/mage-tournament-sealed.jar and b/Mage.Client/plugins/mage-tournament-sealed.jar differ diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java index 478473896b..7285900479 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ComputerPlayer6.java @@ -118,6 +118,7 @@ public class ComputerPlayer6 extends ComputerPlayer implements @Override public boolean priority(Game game) { logState(game); + game.getState().setPriorityPlayerId(playerId); game.firePriorityEvent(playerId); switch (game.getTurn().getStepType()) { case UPKEEP: 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 358acceb39..ea4fab6727 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 @@ -87,6 +87,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 implements Player { logState(game); if (logger.isDebugEnabled()) logger.debug("Game State: Turn-" + game.getTurnNum() + " Step-" + game.getTurn().getStepType() + " ActivePlayer-" + game.getPlayer(game.getActivePlayerId()).getName() + " PriorityPlayer-" + name); + game.getState().setPriorityPlayerId(playerId); game.firePriorityEvent(playerId); switch (game.getTurn().getStepType()) { case UPKEEP: diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java index 8714801e5b..a64de1f832 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/ComputerPlayerMCTS.java @@ -27,11 +27,6 @@ */ package mage.player.ai; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import mage.Constants.PhaseStep; import mage.Constants.RangeOfInfluence; import mage.Constants.Zone; @@ -50,6 +45,12 @@ import mage.player.ai.MCTSPlayer.NextAction; import mage.players.Player; import org.apache.log4j.Logger; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + /** * * @author BetaSteward_at_googlemail.com @@ -91,6 +92,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer imple public boolean priority(Game game) { if (game.getStep().getType() == PhaseStep.PRECOMBAT_MAIN) logList("computer player " + name + " hand: ", new ArrayList(hand.getCards(game))); + game.getState().setPriorityPlayerId(playerId); game.firePriorityEvent(playerId); getNextAction(game, NextAction.PRIORITY); Ability ability = root.getAction(); diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java index d6f25af626..ca218d30eb 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer2.java @@ -133,6 +133,7 @@ public class ComputerPlayer2 extends ComputerPlayer implements @Override public boolean priority(Game game) { logState(game); + game.getState().setPriorityPlayerId(playerId); game.firePriorityEvent(playerId); switch (game.getTurn().getStepType()) { case UPKEEP: diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java index 83c9d01e0f..f5909fbb50 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/ComputerPlayer3.java @@ -28,9 +28,6 @@ package mage.player.ai; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; import mage.Constants.AbilityType; import mage.Constants.PhaseStep; import mage.Constants.RangeOfInfluence; @@ -41,26 +38,14 @@ import mage.game.Game; import mage.game.combat.Combat; import mage.game.combat.CombatGroup; import mage.game.events.GameEvent; -import mage.game.turn.BeginCombatStep; -import mage.game.turn.BeginningPhase; -import mage.game.turn.CleanupStep; -import mage.game.turn.CombatDamageStep; -import mage.game.turn.CombatPhase; -import mage.game.turn.DeclareAttackersStep; -import mage.game.turn.DeclareBlockersStep; -import mage.game.turn.DrawStep; -import mage.game.turn.EndOfCombatStep; -import mage.game.turn.EndPhase; -import mage.game.turn.EndStep; -import mage.game.turn.FirstCombatDamageStep; -import mage.game.turn.PostCombatMainPhase; -import mage.game.turn.PostCombatMainStep; -import mage.game.turn.Step; -import mage.game.turn.UntapStep; -import mage.game.turn.UpkeepStep; +import mage.game.turn.*; import mage.players.Player; import org.apache.log4j.Logger; +import java.util.LinkedList; +import java.util.List; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -100,6 +85,7 @@ public class ComputerPlayer3 extends ComputerPlayer2 implements Player { logState(game); if (logger.isDebugEnabled()) logger.debug("Game State: Turn-" + game.getTurnNum() + " Step-" + game.getTurn().getStepType() + " ActivePlayer-" + game.getPlayer(game.getActivePlayerId()).getName() + " PriorityPlayer-" + name); + game.getState().setPriorityPlayerId(playerId); game.firePriorityEvent(playerId); switch (game.getTurn().getStepType()) { case UPKEEP: diff --git a/Mage.Server/plugins/mage-deck-constructed.jar b/Mage.Server/plugins/mage-deck-constructed.jar index 0efd592ff1..0a82a522a7 100644 Binary files a/Mage.Server/plugins/mage-deck-constructed.jar and b/Mage.Server/plugins/mage-deck-constructed.jar differ diff --git a/Mage.Server/plugins/mage-deck-limited.jar b/Mage.Server/plugins/mage-deck-limited.jar index 4ba3991905..593fe72bfe 100644 Binary files a/Mage.Server/plugins/mage-deck-limited.jar and b/Mage.Server/plugins/mage-deck-limited.jar differ diff --git a/Mage.Server/plugins/mage-game-freeforall.jar b/Mage.Server/plugins/mage-game-freeforall.jar index 451a3fac56..bbebd426b0 100644 Binary files a/Mage.Server/plugins/mage-game-freeforall.jar and b/Mage.Server/plugins/mage-game-freeforall.jar differ diff --git a/Mage.Server/plugins/mage-game-twoplayerduel.jar b/Mage.Server/plugins/mage-game-twoplayerduel.jar index 6d7db63412..b3edd0833b 100644 Binary files a/Mage.Server/plugins/mage-game-twoplayerduel.jar and b/Mage.Server/plugins/mage-game-twoplayerduel.jar differ diff --git a/Mage.Server/plugins/mage-player-ai-ma.jar b/Mage.Server/plugins/mage-player-ai-ma.jar index d8c366969b..56cf3a297e 100644 Binary files a/Mage.Server/plugins/mage-player-ai-ma.jar and b/Mage.Server/plugins/mage-player-ai-ma.jar differ diff --git a/Mage.Server/plugins/mage-player-ai.jar b/Mage.Server/plugins/mage-player-ai.jar index 5f1e107417..13b01f158d 100644 Binary files a/Mage.Server/plugins/mage-player-ai.jar and b/Mage.Server/plugins/mage-player-ai.jar differ diff --git a/Mage.Server/plugins/mage-player-aimcts.jar b/Mage.Server/plugins/mage-player-aimcts.jar index 94c424de3a..091dfa8c63 100644 Binary files a/Mage.Server/plugins/mage-player-aimcts.jar and b/Mage.Server/plugins/mage-player-aimcts.jar differ diff --git a/Mage.Server/plugins/mage-player-aiminimax.jar b/Mage.Server/plugins/mage-player-aiminimax.jar index 9fedeec991..f468030b4d 100644 Binary files a/Mage.Server/plugins/mage-player-aiminimax.jar and b/Mage.Server/plugins/mage-player-aiminimax.jar differ diff --git a/Mage.Server/plugins/mage-player-human.jar b/Mage.Server/plugins/mage-player-human.jar index 8c88d8c21b..67824ec068 100644 Binary files a/Mage.Server/plugins/mage-player-human.jar and b/Mage.Server/plugins/mage-player-human.jar differ diff --git a/Mage.Server/plugins/mage-tournament-booster-draft.jar b/Mage.Server/plugins/mage-tournament-booster-draft.jar index 457cf53f7e..c08d257d6a 100644 Binary files a/Mage.Server/plugins/mage-tournament-booster-draft.jar and b/Mage.Server/plugins/mage-tournament-booster-draft.jar differ diff --git a/Mage.Server/plugins/mage-tournament-sealed.jar b/Mage.Server/plugins/mage-tournament-sealed.jar index ecc7ad1b17..e0897c3aa6 100644 Binary files a/Mage.Server/plugins/mage-tournament-sealed.jar and b/Mage.Server/plugins/mage-tournament-sealed.jar differ diff --git a/Mage.Server/src/main/java/mage/server/game/GameController.java b/Mage.Server/src/main/java/mage/server/game/GameController.java index c6b534be67..e4aed71cd6 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameController.java +++ b/Mage.Server/src/main/java/mage/server/game/GameController.java @@ -28,25 +28,8 @@ package mage.server.game; -import java.io.BufferedOutputStream; - -import mage.MageException; -import mage.server.*; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectOutput; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.zip.GZIPOutputStream; - import mage.Constants.Zone; +import mage.MageException; import mage.abilities.Ability; import mage.cards.Card; import mage.cards.Cards; @@ -59,14 +42,26 @@ import mage.game.events.PlayerQueryEvent; import mage.game.events.TableEvent; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.server.util.SystemUtil; +import mage.server.*; import mage.server.util.Splitter; +import mage.server.util.SystemUtil; import mage.server.util.ThreadExecutor; import mage.sets.Sets; -import mage.view.*; +import mage.view.AbilityPickerView; +import mage.view.CardsView; import mage.view.ChatMessage.MessageColor; +import mage.view.GameView; +import mage.view.PermanentView; import org.apache.log4j.Logger; +import java.io.*; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.zip.GZIPOutputStream; + /** * * @author BetaSteward_at_googlemail.com @@ -596,10 +591,17 @@ public class GameController implements GameCallback { else { //System.out.println("asThough: " + playerId + " " + game.getPriorityPlayerId()); Player player = game.getPlayer(playerId); + boolean found = false; for (UUID controlled : player.getPlayersUnderYourControl()) { - if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) + if (gameSessions.containsKey(controlled) && game.getPriorityPlayerId().equals(controlled)) { command.execute(controlled); + found = true; + } } + if (!found) { + // something wrong - it may cause game freezes + logger.warn("WARNING! GameController.sendMessage - couldn't find session for action execution."); + } } } else { // ignore - no control over the turn diff --git a/Mage.Tests/plugins/mage-deck-constructed.jar b/Mage.Tests/plugins/mage-deck-constructed.jar index 8dc0f0de54..0a82a522a7 100644 Binary files a/Mage.Tests/plugins/mage-deck-constructed.jar and b/Mage.Tests/plugins/mage-deck-constructed.jar differ diff --git a/Mage.Tests/plugins/mage-deck-limited.jar b/Mage.Tests/plugins/mage-deck-limited.jar index 6b6a5ef830..593fe72bfe 100644 Binary files a/Mage.Tests/plugins/mage-deck-limited.jar and b/Mage.Tests/plugins/mage-deck-limited.jar differ diff --git a/Mage.Tests/plugins/mage-game-twoplayerduel.jar b/Mage.Tests/plugins/mage-game-twoplayerduel.jar index bed9f04322..b3edd0833b 100644 Binary files a/Mage.Tests/plugins/mage-game-twoplayerduel.jar and b/Mage.Tests/plugins/mage-game-twoplayerduel.jar differ diff --git a/Mage.Tests/plugins/mage-player-ai-ma.jar b/Mage.Tests/plugins/mage-player-ai-ma.jar index 24f378eec6..56cf3a297e 100644 Binary files a/Mage.Tests/plugins/mage-player-ai-ma.jar and b/Mage.Tests/plugins/mage-player-ai-ma.jar differ diff --git a/Mage.Tests/plugins/mage-player-ai.jar b/Mage.Tests/plugins/mage-player-ai.jar index 4eab33a758..13b01f158d 100644 Binary files a/Mage.Tests/plugins/mage-player-ai.jar and b/Mage.Tests/plugins/mage-player-ai.jar differ diff --git a/Mage.Tests/plugins/mage-player-aiminimax.jar b/Mage.Tests/plugins/mage-player-aiminimax.jar index 6e81a10b5e..f468030b4d 100644 Binary files a/Mage.Tests/plugins/mage-player-aiminimax.jar and b/Mage.Tests/plugins/mage-player-aiminimax.jar differ diff --git a/Mage.Tests/plugins/mage-tournament-booster-draft.jar b/Mage.Tests/plugins/mage-tournament-booster-draft.jar index b0c5e1d280..c08d257d6a 100644 Binary files a/Mage.Tests/plugins/mage-tournament-booster-draft.jar and b/Mage.Tests/plugins/mage-tournament-booster-draft.jar differ