Package megamek.common.alphaStrike
Class ASGame
java.lang.Object
megamek.common.AbstractGame
megamek.common.alphaStrike.ASGame
- All Implemented Interfaces:
IGame
This is an Alpha Strike game object that holds all game information. This is intentionally a stub and
currently only intended to see how to work with MM's interfaces. In the future, it could be completed
to support AS games.
-
Field Summary
Fields inherited from class megamek.common.AbstractGame
currentRound, forces, gameListeners, groundObjects, inGameObjects, pendingActions, players, scriptedEvents, teams, turnIndex
Fields inherited from interface megamek.common.IGame
DEFAULT_BOARD_ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given Player to the game with the given game-unique id.getNewReport
(int messageId) Returns a new ReportEntry with the given report message Id.getPhase()
getTurn()
boolean
Returns true when the current game phase should be played, meaning it is played in the current type of game and there are possible actions in it in the present game state.boolean
void
removePlayer
(int id) Removes the player with the id from the game.void
replaceUnits
(List<InGameObject> units) This is a Client-side method to replace or add units that are sent from the server.void
setLastPhase
(GamePhase lastPhase) Sets the previous game phase to the given phase.void
Sets the current game phase to the given phase.void
Sets the given Player to the given game-unique id.void
Methods inherited from class megamek.common.AbstractGame
addAction, addGameListener, addScriptedEvent, canFleeFrom, clearActions, clearDeploymentThisRound, clearScriptedEvents, deployableInGameObjects, fireGameEvent, getActionsVector, getBoardIds, getBoards, getCurrentRound, getFleeZone, getForces, getGameListeners, getGroundObjects, getGroundObjects, getInGameObjects, getNextEntityId, getNoOfPlayers, getNoOfTeams, getPlayer, getPlayersList, getTeams, getTurnIndex, incrementCurrentRound, isDeploymentComplete, lastDeploymentRound, placeGroundObject, receiveBoard, receiveBoards, removeAction, removeActionsFor, removeGameListener, removeGroundObject, reset, resetTurnIndex, scriptedEvents, setBoard, setCurrentRound, setForces, setGroundObjects, setTurnIndex, setupDeployment, shouldDeployForRound, shouldDeployThisRound
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface megamek.common.IGame
areConnectedBoards, boardExists, commonEnclosingBoard, connectBoards, getAllEnclosingBoards, getBoard, getBoard, getBoard, getBoard, getEnclosingBoard, getEnclosingBoard, getEntitiesOwnedBy, getEntityFromAllSources, getHex, getHex, getHexOf, getInGameObject, getInGameObjects, getOutOfGameUnit, getTeamByPlayer, getTeamForPlayer, hasBoard, hasBoard, hasBoardLocation, hasBoardLocation, hasBoardLocationOf, hasConnectedBoard, hasEnclosingBoard, hasGroundBoard, hasMoreTurns, hasNonSpaceBoard, hasPlayer, hasSpaceAndAtmosphericBoards, hasSpaceBoard, isOnAtmosphericMap, isOnAtmosphericMap, isOnGroundMap, isOnGroundMap, isOnSpaceMap, isOnSpaceMap, onConnectedBoards, onDirectlyConnectedBoards, onTheSameBoard, receivePhase, shouldSkipCurrentPhase
-
Constructor Details
-
ASGame
public ASGame()
-
-
Method Details
-
getTurn
-
getTurnsList
- Returns:
- the current list of turns. If you're not the GameManager, don't even think about changing any of the turns.
-
getOptions
-
getPhase
- Returns:
- The current phase of this game.
-
setPhase
Description copied from interface:IGame
Sets the current game phase to the given phase. May perform phase-dependent cleanup. This method is intended for the GameManager.- Parameters:
phase
- The new phase
-
setLastPhase
Description copied from interface:IGame
Sets the previous game phase to the given phase. This method is intended for the GameManager.- Parameters:
lastPhase
- The phase to be remembered as the previous phase.
-
isForceVictory
public boolean isForceVictory()- Returns:
- Whether there is an active claim for victory.
-
addPlayer
Description copied from interface:IGame
Adds the given Player to the game with the given game-unique id. // TODO : Can this be made a default method?- Specified by:
addPlayer
in interfaceIGame
- Overrides:
addPlayer
in classAbstractGame
- Parameters:
id
- The game-unique id of this playerplayer
- The Player object
-
isCurrentPhasePlayable
public boolean isCurrentPhasePlayable()Description copied from interface:IGame
Returns true when the current game phase should be played, meaning it is played in the current type of game and there are possible actions in it in the present game state. The result may be different in other rounds.- Returns:
- True when the current phase should be skipped entirely in this round
- See Also:
-
setPlayer
Description copied from interface:IGame
Sets the given Player to the given game-unique id. // TODO : Is this method useful? Why not use addPlayer that also sets single-blind info?- Parameters:
id
- The game-unique id of this playerplayer
- The Player object
-
removePlayer
public void removePlayer(int id) Description copied from interface:IGame
Removes the player with the id from the game.- Parameters:
id
- The player id
-
setupTeams
public void setupTeams() -
replaceUnits
Description copied from interface:IGame
This is a Client-side method to replace or add units that are sent from the server. Adds the given units to the list of units or objects in the current game. When a unit's ID is already present the currently assigned unit will be replaced with the given new one.- Parameters:
units
- The units to add or use as a replacement for current units.
-
getGraveyard
- Returns:
- a list of units that are destroyed or otherwise no longer part of the game. These should have a reason for their removal set.
-
getNewReport
Description copied from interface:IGame
Returns a new ReportEntry with the given report message Id. The ReportEntry subclass returned depends on the implementation in the IGame subclass.- Parameters:
messageId
- The message Id from report-messages.properties- Returns:
- A new report of an appropriate type and message
-