Package megamek.common.autoResolve.acar
Class SimulationManager
java.lang.Object
megamek.server.AbstractGameManager
megamek.common.autoResolve.acar.SimulationManager
- All Implemented Interfaces:
IGameManager
-
Field Summary
Fields inherited from class megamek.server.AbstractGameManager
autoSaveService, packetHelper, saveHandler, scriptedEventHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddMoraleCheck(MoraleCheckAction acsMoraleCheckAction, Formation formation) voidaddMovement(MoveAction moveAction, Formation activeFormation) voidaddNerveRecovery(RecoveringNerveAction recoveringNerveAction) voidaddPhaseHandler(PhaseHandler phaseHandler) voidvoidaddWithdraw(WithdrawAction acsWithdrawAction) voidCalculates and sets any initial unit counts and BV/PV for all players, and thus should only be called at the start of a game.voiddisconnect(Player player) Handles housekeeping for a disconnected player.protected voidEnds this phase and moves on to the next.execute()voidDo anything we need to work through the current phase, such as give a turn to the first player to play.voidgetCommandList(Server server) Returns the victory result.getGame()voidHandle CFR packets.booleanbooleanvoidPrepares for the game's current phase.voidremoveAllEntitiesOwnedBy(Player player) voidrequestGameMaster(Player player) voidrequestTeamChangeForPlayer(int teamID, Player player) Requests a team change for a player.voidvoidvoidResets thegameinstance.voidvoidCalled at the beginning of certain phases to make every player ready.voidRolls initiative for all teams.voidSends the given packet to the given connection (= player ID).voidSends the given packet to all connections (all connected Clients = players).voidsendCurrentInfo(int connId) Sends a player all information they need to update their Client game state to the GameManager's game state.protected voidvoidsetFormationAt(Formation formation, BoardLocation position) voidSets the currentgameinstance.Methods inherited from class megamek.server.AbstractGameManager
autoSave, changePhase, checkReady, getAutoSaveService, getPacketHelper, handlePacket, incrementAndSendGameRound, isEmptyLobby, saveGame, sendChat, sendChat, sendCurrentTurns, sendGhostSkipMessage, sendSaveGame, sendServerChat, sendServerChat, transmitAllPlayerDones, transmitAllPlayerUpdates, transmitPlayerUpdateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.server.IGameManager
saveGame
-
Constructor Details
-
SimulationManager
-
-
Method Details
-
execute
-
addPhaseHandler
-
getGameLogger
-
getConclusionEvent
-
setFormationAt
-
endCurrentPhase
protected void endCurrentPhase()Description copied from class:AbstractGameManagerEnds this phase and moves on to the next.- Specified by:
endCurrentPhasein classAbstractGameManager
-
prepareForCurrentPhase
public void prepareForCurrentPhase()Description copied from class:AbstractGameManagerPrepares for the game's current phase. This typically involves resetting the states of units in the game and making sure the clients have the information they need for the new phase.- Specified by:
prepareForCurrentPhasein classAbstractGameManager
-
executeCurrentPhase
public void executeCurrentPhase()Description copied from class:AbstractGameManagerDo anything we need to work through the current phase, such as give a turn to the first player to play.- Specified by:
executeCurrentPhasein classAbstractGameManager
-
resetPlayersDone
public void resetPlayersDone()Called at the beginning of certain phases to make every player ready. -
resetFormationsDone
public void resetFormationsDone() -
resetFormations
public void resetFormations() -
rollInitiative
public void rollInitiative()Rolls initiative for all teams. -
resetInitiative
public void resetInitiative() -
getCurrentVictoryResult
Returns the victory result. -
isVictory
public boolean isVictory() -
getGame
- Returns:
- The current
gameinstance.
-
setGame
Description copied from interface:IGameManagerSets the currentgameinstance. -
getInitiativeHelper
-
getActionsProcessor
-
addMovement
-
addMoraleCheck
-
addAttack
-
addNerveRecovery
-
addWithdraw
-
flushPendingReports
public void flushPendingReports() -
sendPhaseChange
protected void sendPhaseChange()- Overrides:
sendPhaseChangein classAbstractGameManager
-
getCommandList
-
addReport
-
calculatePlayerInitialCounts
public void calculatePlayerInitialCounts()Description copied from interface:IGameManagerCalculates and sets any initial unit counts and BV/PV for all players, and thus should only be called at the start of a game. The initial values are supposed to be stored for later comparison so that BV or unit losses over the course of the game can be calculated. -
isLogSuppressed
public boolean isLogSuppressed() -
requestTeamChangeForPlayer
Description copied from interface:IGameManagerRequests a team change for a player.- Parameters:
teamID- ID of the team the player will be passed toplayer- player
-
removeAllEntitiesOwnedBy
-
resetGame
public void resetGame()Description copied from interface:IGameManagerResets thegameinstance. Resetting the game removes all content and returns to the lobby but keeps connected players. -
disconnect
Description copied from interface:IGameManagerHandles housekeeping for a disconnected player. Removes player from the game in the lounge or victory phase, or during other phases if the player has no units. Otherwise, the player becomes a ghost.- Parameters:
player- The player that disconnected.
-
sendCurrentInfo
public void sendCurrentInfo(int connId) Description copied from interface:IGameManagerSends a player all information they need to update their Client game state to the GameManager's game state. This should always include units, forces, map info, active attacks, round reports, among others. This is triggered when a player first connects to the server. When the game is past the lobby phase, this also triggers generating and sending a current player turn or advancing the phase if there are no remaining turns; in other words, this sets the game in motion when the first player connects. A game starts past the lobby phase when it is loaded from a save.- Parameters:
connId- The id of the player to update
-
handleCfrPacket
Description copied from interface:IGameManagerHandle CFR packets. //TODO: This concerns multi-threaded code and should be centralized!- Parameters:
rp- the CFR packet returned from a client
-
requestGameMaster
-
send
Description copied from class:AbstractGameManagerSends the given packet to all connections (all connected Clients = players).- Specified by:
sendin interfaceIGameManager- Overrides:
sendin classAbstractGameManager- See Also:
-
send
Description copied from class:AbstractGameManagerSends the given packet to the given connection (= player ID).- Specified by:
sendin interfaceIGameManager- Overrides:
sendin classAbstractGameManager- See Also:
-