public class RealServerGameManager extends ServerGameManager implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.lang.Boolean> |
discardList |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
playerIndexLookup |
private boolean |
randomNumbers |
private boolean |
randomPorts |
private boolean |
randomTiles |
private static long |
serialVersionUID |
gameBank, gameID, gameState, gameTitle, log, map, offeredTrade, playerCanMoveRobber, playerColors, players, version, victoryPointManager, waterCooler| Constructor and Description |
|---|
RealServerGameManager(java.lang.String name,
boolean randomTiles,
boolean randomNumbers,
boolean randomPorts) |
| Modifier and Type | Method and Description |
|---|---|
int |
AddPlayer(java.lang.String name,
CatanColor color,
boolean isHuman,
int playerID)
Adds a players to the game
|
int |
GetPlayerIndexByID(int playerID)
Returns the player index by id
|
protected void |
initDiscard(boolean shouldBeBlank)
Initializes the discard list.
|
private boolean |
IsPlayerRobot(int index)
Checks if a player is a robot
|
void |
reset()
Resets a game to default state
|
boolean |
ServerAcceptTrade(int playerIndex,
boolean willAccept)
accepts a trade
|
boolean |
ServerBuildCity(int playerIndex,
Coordinate p)
builds a city
|
boolean |
ServerBuildRoad(int playerID,
Coordinate start,
Coordinate end,
boolean free)
builds a road
|
boolean |
ServerBuildSettlement(int playerIndex,
Coordinate p,
boolean free)
builds settlement
|
boolean |
ServerBuyDevCard(int playerID)
Buys a dev card
|
private void |
ServerChatCommand(int playerIndex,
java.lang.String message) |
boolean |
ServerDiscardCards(int playerIndex,
java.util.List<java.lang.Integer> resourceList)
discards cards
|
private boolean |
ServerExecuteRob(int playerIndex,
int victimIndex,
Coordinate location)
Actually executes the robbing action.
|
boolean |
ServerFinishTurn(int playerID)
Ends a player's turn
|
GameModel |
ServerGetModel()
Gets the current game model
|
boolean |
ServerMaritimeTrading(int playerIndex,
int ratio,
ResourceType input,
ResourceType output)
trades in the maritime
|
boolean |
ServerMonopoly(int playerIndex,
ResourceType res1)
plays a monopoly card
|
boolean |
ServerMonument(int playerIndex)
plays a monument card
|
boolean |
ServerOfferTrade(int playerIndexOffering,
int playerIndexReceiving,
java.util.List<java.lang.Integer> resourceList)
offers a trade
|
boolean |
ServerRoadBuilding(int playerIndex,
Coordinate start1,
Coordinate end1,
Coordinate start2,
Coordinate end2)
plays a road building card
|
boolean |
ServerRobPlayer(int playerIndex,
int victimIndex,
Coordinate location) |
boolean |
ServerRollNumber(int playerIndex,
int number) |
boolean |
ServerSendChat(int playerID,
java.lang.String message)
Sends a chat for the user
|
boolean |
ServerSoldier(int playerID,
Coordinate location,
int victimIndex)
plays a solider card
|
boolean |
ServerYearOfPlenty(int playerIndex,
ResourceType res1,
ResourceType res2)
plays a year of plenty card
|
protected ResourceType |
takeRandomResourceCard(int receiver,
int giver)
takes a random resource from one player and gives it to another
|
protected void |
updateVersion()
Updates the version when doing an action
|
ServerGetSerializableModel, SetGameIDAddPlayer, allCurrentPlayers, BuildCity, BuildRoad, BuildSettlement, BuyDevCard, canAcceptTrade, CanBuildCity, CanBuildCity, CanBuildRoad, CanBuildRoad, CanBuildSettlement, CanBuildSettlement, CanBuyDevCard, canChat, CanDiscardCards, CanFinishTurn, CanFinishTurn, CanMaritimeTrade, CanOfferTrade, CanPlaceRobber, CanPlayDevCard, CanPlayerPlay, CanRollNumber, CanUseMonopoly, CanUseMonument, CanUseRoadBuilder, CanUseSoldier, CanUseYearOfPlenty, CurrentPlayerChat, CurrentPlayersTurn, CurrentState, DiceRoll, FinishTurn, getBankResourceCount, getChat, GetCurrentPlayer, getCurrentPlayerName, getGameActionLog, GetGameID, GetGameTitle, getNumberPlayers, GetPlayer, getPlayerColorByIndex, GetPlayerIDbyIndex, getPlayerIndexByColor, getPlayerNameByIndex, getTradeRatio, GetVersion, getVictoryPointManager, hasGameStarted, LogAction, NeedToDiscardAfterRoll, NumberActivePlayers, payDayForDayz, placeRobber, playDevCard, PlayerChat, playerDevCardCount, playerDevCardCount, playerPieceCount, playerResourceCount, removeTradeOffer, RollDice, SetPlayers, setTradeOffer, StartGameprivate static final long serialVersionUID
private boolean randomTiles
private boolean randomNumbers
private boolean randomPorts
private java.util.Map<java.lang.Integer,java.lang.Integer> playerIndexLookup
private java.util.List<java.lang.Boolean> discardList
public RealServerGameManager(java.lang.String name,
boolean randomTiles,
boolean randomNumbers,
boolean randomPorts)
protected void initDiscard(boolean shouldBeBlank)
initDiscard in class ServerGameManagershouldBeBlank - whether to set all values to falseprotected void updateVersion()
updateVersion in class ServerGameManagerpublic int GetPlayerIndexByID(int playerID)
GetPlayerIndexByID in class ServerGameManagerplayerID - public void reset()
GameManagerreset in class GameManagerpublic int AddPlayer(java.lang.String name,
CatanColor color,
boolean isHuman,
int playerID)
throws ModelException
GameManagerAddPlayer in class GameManagername - The name of the playercolor - The piece colorisHuman - True if human, else AIplayerID - The id of the playerModelException - Thrown if the player can't be addedpublic boolean ServerSendChat(int playerID,
java.lang.String message)
ServerSendChat in class ServerGameManagerplayerID - by Player IDmessage - to chat withpublic boolean ServerRollNumber(int playerIndex,
int number)
ServerRollNumber in class ServerGameManagerplayerID - number - public boolean ServerRobPlayer(int playerIndex,
int victimIndex,
Coordinate location)
ServerRobPlayer in class ServerGameManagerplayerID - the ID of the player who is moving the robbervictimIndex - the index of the victimlocation - the new location of the robberprivate boolean ServerExecuteRob(int playerIndex,
int victimIndex,
Coordinate location)
playerIndex - victimIndex - location - public boolean ServerFinishTurn(int playerID)
ServerFinishTurn in class ServerGameManagerplayerID - private boolean IsPlayerRobot(int index)
index - the player indexpublic boolean ServerBuyDevCard(int playerID)
ServerBuyDevCard in class ServerGameManagerplayerID - private void ServerChatCommand(int playerIndex,
java.lang.String message)
public boolean ServerYearOfPlenty(int playerIndex,
ResourceType res1,
ResourceType res2)
ServerGameManagerServerYearOfPlenty in class ServerGameManagerplayerIndex - res1 - res2 - public boolean ServerMonopoly(int playerIndex,
ResourceType res1)
ServerGameManagerServerMonopoly in class ServerGameManagerplayerIndex - res1 - public boolean ServerMonument(int playerIndex)
ServerGameManagerServerMonument in class ServerGameManagerplayerIndex - public boolean ServerRoadBuilding(int playerIndex,
Coordinate start1,
Coordinate end1,
Coordinate start2,
Coordinate end2)
ServerGameManagerServerRoadBuilding in class ServerGameManagerplayerIndex - start1 - end1 - start2 - end2 - public boolean ServerSoldier(int playerID,
Coordinate location,
int victimIndex)
ServerGameManagerServerSoldier in class ServerGameManagerplayerID - location - victimIndex - the victimpublic boolean ServerBuildRoad(int playerID,
Coordinate start,
Coordinate end,
boolean free)
ServerGameManagerServerBuildRoad in class ServerGameManagerplayerID - p - public boolean ServerBuildCity(int playerIndex,
Coordinate p)
ServerGameManagerServerBuildCity in class ServerGameManagerplayerIndex - p - public boolean ServerBuildSettlement(int playerIndex,
Coordinate p,
boolean free)
ServerGameManagerServerBuildSettlement in class ServerGameManagerplayerIndex - p - public boolean ServerOfferTrade(int playerIndexOffering,
int playerIndexReceiving,
java.util.List<java.lang.Integer> resourceList)
ServerGameManagerServerOfferTrade in class ServerGameManagerplayerIndexOffering - playerIndexReceiving - resourceList - public boolean ServerAcceptTrade(int playerIndex,
boolean willAccept)
ServerGameManagerServerAcceptTrade in class ServerGameManagerplayerIndex - willAccept - public boolean ServerMaritimeTrading(int playerIndex,
int ratio,
ResourceType input,
ResourceType output)
ServerGameManagerServerMaritimeTrading in class ServerGameManagerplayerIndex - ratio - input - output - public boolean ServerDiscardCards(int playerIndex,
java.util.List<java.lang.Integer> resourceList)
ServerGameManagerServerDiscardCards in class ServerGameManagerplayerIndex - resourceList - protected ResourceType takeRandomResourceCard(int receiver, int giver)
ServerGameManagertakeRandomResourceCard in class ServerGameManagerreceiver - giver - public GameModel ServerGetModel()
ServerGetModel in class ServerGameManager