Class Game
java.lang.Object
net.sf.colossus.game.Game
- Direct Known Subclasses:
GameClientSide, GameServerSide
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Battleprivate final BattleStrikeprivate final CaretakerThe caretaker takes care of managing the available and dead creatures.private Engagementprivate booleanStatus for Game is over and message for it On client side this also implies: If the game is over, then quitting does not require confirmation.private Stringprivate static final Loggerprivate intLast movement roll for any player.protected PhaseThe current game phase (Split, Move, Fight, Muster)The state of the different players in the game.protected intThe current turn number.private final VariantThe variant played in this game. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbooleanReturn set of hexLabels for engagements found.voidcreateEngagement(MasterHex hex, Legion attacker, Legion defender) (package private) List<CreatureType> findAvailableEligibleAngels(MasterBoardTerrain terrain, int score) Return a list of angel types that can be acquired based on the hex in which legion is, when reaching given score threshold, and if they are still available from caretakerReturn a set of all hexes with engagements.findLegionsWithSummonables(Legion summoner) Return a set of all other unengaged legions of the legion's player that have summonables (not sorted in any particular order).Return a list of all legions of all players.intgetEnemyLegions(Player player) Return a list of all legions not belonging to player.getEnemyLegions(MasterHex hex, Player player) getFirstEnemyLegion(MasterHex masterHex, Player player) Finds the first legion in a hex not belonging to a certain player.getFirstFriendlyLegion(MasterHex masterHex, Player player) getFirstLegion(MasterHex masterHex) getFriendlyLegions(MasterHex hex, Player player) getLegionByMarkerId(String markerId) getLegionsByHex(MasterHex masterHex) intintgetNumEnemyLegions(MasterHex masterHex, Player player) intgetNumFriendlyLegions(MasterHex masterHex, Player player) protected intReturns the number of real players (Human or Network) which are still alive.intgetNumLegions(MasterHex masterHex) intintintintgetPhase()Get a list of preliminary player names, during game startup / clients connecting.intReturns the current turn in the gamebooleanbooleanbooleanbooleanisOccupied(MasterHex masterHex) booleanbooleanvoidsetGameOver(boolean gameOver, String message) voidsetMovementRoll(int roll) voidvoidsetTurnNumber(int turn) Set the current turn number.
-
Field Details
-
LOGGER
-
variant
The variant played in this game. -
players
-
caretaker
The caretaker takes care of managing the available and dead creatures. -
turnNumber
protected int turnNumberThe current turn number. Advance when every player has done his move -
phase
The current game phase (Split, Move, Fight, Muster) -
movementRoll
private int movementRollLast movement roll for any player. -
gameOver
private boolean gameOverStatus for Game is over and message for it On client side this also implies: If the game is over, then quitting does not require confirmation. -
gameOverMessage
-
engagement
-
battle
-
battleStrike
-
-
Constructor Details
-
Game
-
-
Method Details
-
getVariant
-
addPlayer
-
getPlayers
-
getPreliminaryPlayerNames
Get a list of preliminary player names, during game startup / clients connecting. Preliminary, because some of them might change their name later (e.g. the "byColor" ones).- Returns:
- List of player names
-
getNumPlayers
public int getNumPlayers() -
getNumLivingPlayers
public int getNumLivingPlayers() -
onlyAIsRemain
public boolean onlyAIsRemain()- Returns:
- Returns true if all still alive players are AIs
-
getNumHumansRemaining
protected int getNumHumansRemaining()Returns the number of real players (Human or Network) which are still alive. TODO partly same idea as "onlyAIsRemain()" -
getNumRemoteRemaining
public int getNumRemoteRemaining() -
getCaretaker
-
getMovementRoll
public int getMovementRoll() -
setMovementRoll
public void setMovementRoll(int roll) -
isGameOver
public boolean isGameOver() -
getGameOverMessage
-
setGameOver
-
createEngagement
-
clearEngagementData
public void clearEngagementData() -
isEngagementInProgress
public boolean isEngagementInProgress() -
getEngagement
-
getBattle
-
getBattleActiveLegion
-
getBattleSite
-
getDefender
-
getAttacker
-
findAvailableEligibleAngels
Return a list of angel types that can be acquired based on the hex in which legion is, when reaching given score threshold, and if they are still available from caretaker- Parameters:
terrain- The terrain in which this legion wants to acquirescore- A acquring threshold, e.g. in Default 100, ..., 400, 500- Returns:
- list of acquirables
-
getAllLegions
-
getNumLivingCreatures
-
getLegionsByHex
-
getNumEnemyLegions
-
getNumLegions
-
getFriendlyLegions
-
getEnemyLegions
-
getEnemyLegions
-
getFirstFriendlyLegion
-
isOccupied
-
getFirstLegion
-
getNumFriendlyLegions
-
getFirstEnemyLegion
Finds the first legion in a hex not belonging to a certain player. Note that there is no assumption that the player has a legion in that location itself. This method is e.g. used to evaluate moves in the AI.- Parameters:
masterHex- the hex where to look for enemy regions. Not null.player- the player whose enemies we are looking for. Not null.- Returns:
- the first legion that is in the specified hex and does not belong to the given player, null if no such legion exists
-
findEngagements
-
containsOpposingLegions
Return set of hexLabels for engagements found. -
findLegionsWithSummonables
-
getLegionByMarkerId
-
setTurnNumber
public void setTurnNumber(int turn) Set the current turn number. Used only on client side; server side increments directly.- Parameters:
turn- Set this number as current turn number
-
getTurnNumber
public int getTurnNumber()Returns the current turn in the game- Returns:
- returns the current turn number
-
isPhase
-
setPhase
-
getPhase
-
isEngagementOngoing
public boolean isEngagementOngoing() -
getBattleTurnNumber
public int getBattleTurnNumber() -
getBattleStrike
-