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, SetGameID
AddPlayer, 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, StartGame
private 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 ServerGameManager
shouldBeBlank
- whether to set all values to falseprotected void updateVersion()
updateVersion
in class ServerGameManager
public int GetPlayerIndexByID(int playerID)
GetPlayerIndexByID
in class ServerGameManager
playerID
- public void reset()
GameManager
reset
in class GameManager
public int AddPlayer(java.lang.String name, CatanColor color, boolean isHuman, int playerID) throws ModelException
GameManager
AddPlayer
in class GameManager
name
- 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 ServerGameManager
playerID
- by Player IDmessage
- to chat withpublic boolean ServerRollNumber(int playerIndex, int number)
ServerRollNumber
in class ServerGameManager
playerID
- number
- public boolean ServerRobPlayer(int playerIndex, int victimIndex, Coordinate location)
ServerRobPlayer
in class ServerGameManager
playerID
- 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 ServerGameManager
playerID
- private boolean IsPlayerRobot(int index)
index
- the player indexpublic boolean ServerBuyDevCard(int playerID)
ServerBuyDevCard
in class ServerGameManager
playerID
- private void ServerChatCommand(int playerIndex, java.lang.String message)
public boolean ServerYearOfPlenty(int playerIndex, ResourceType res1, ResourceType res2)
ServerGameManager
ServerYearOfPlenty
in class ServerGameManager
playerIndex
- res1
- res2
- public boolean ServerMonopoly(int playerIndex, ResourceType res1)
ServerGameManager
ServerMonopoly
in class ServerGameManager
playerIndex
- res1
- public boolean ServerMonument(int playerIndex)
ServerGameManager
ServerMonument
in class ServerGameManager
playerIndex
- public boolean ServerRoadBuilding(int playerIndex, Coordinate start1, Coordinate end1, Coordinate start2, Coordinate end2)
ServerGameManager
ServerRoadBuilding
in class ServerGameManager
playerIndex
- start1
- end1
- start2
- end2
- public boolean ServerSoldier(int playerID, Coordinate location, int victimIndex)
ServerGameManager
ServerSoldier
in class ServerGameManager
playerID
- location
- victimIndex
- the victimpublic boolean ServerBuildRoad(int playerID, Coordinate start, Coordinate end, boolean free)
ServerGameManager
ServerBuildRoad
in class ServerGameManager
playerID
- p
- public boolean ServerBuildCity(int playerIndex, Coordinate p)
ServerGameManager
ServerBuildCity
in class ServerGameManager
playerIndex
- p
- public boolean ServerBuildSettlement(int playerIndex, Coordinate p, boolean free)
ServerGameManager
ServerBuildSettlement
in class ServerGameManager
playerIndex
- p
- public boolean ServerOfferTrade(int playerIndexOffering, int playerIndexReceiving, java.util.List<java.lang.Integer> resourceList)
ServerGameManager
ServerOfferTrade
in class ServerGameManager
playerIndexOffering
- playerIndexReceiving
- resourceList
- public boolean ServerAcceptTrade(int playerIndex, boolean willAccept)
ServerGameManager
ServerAcceptTrade
in class ServerGameManager
playerIndex
- willAccept
- public boolean ServerMaritimeTrading(int playerIndex, int ratio, ResourceType input, ResourceType output)
ServerGameManager
ServerMaritimeTrading
in class ServerGameManager
playerIndex
- ratio
- input
- output
- public boolean ServerDiscardCards(int playerIndex, java.util.List<java.lang.Integer> resourceList)
ServerGameManager
ServerDiscardCards
in class ServerGameManager
playerIndex
- resourceList
- protected ResourceType takeRandomResourceCard(int receiver, int giver)
ServerGameManager
takeRandomResourceCard
in class ServerGameManager
receiver
- giver
- public GameModel ServerGetModel()
ServerGetModel
in class ServerGameManager