mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed a critical bug that caused game freezes. Updated plugin jars.
This commit is contained in:
parent
f94c529410
commit
0ef737fe20
35 changed files with 39 additions and 46 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -118,6 +118,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
|||
@Override
|
||||
public boolean priority(Game game) {
|
||||
logState(game);
|
||||
game.getState().setPriorityPlayerId(playerId);
|
||||
game.firePriorityEvent(playerId);
|
||||
switch (game.getTurn().getStepType()) {
|
||||
case UPKEEP:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<ComputerPlayerMCTS> 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();
|
||||
|
|
|
@ -133,6 +133,7 @@ public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements
|
|||
@Override
|
||||
public boolean priority(Game game) {
|
||||
logState(game);
|
||||
game.getState().setPriorityPlayerId(playerId);
|
||||
game.firePriorityEvent(playerId);
|
||||
switch (game.getTurn().getStepType()) {
|
||||
case UPKEEP:
|
||||
|
|
|
@ -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:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue