public class Game
extends java.lang.Object
Variant
this class holds information about an ongoing game
and its status.Modifier and Type | Field and Description |
---|---|
protected Battle |
battle |
private BattleStrike |
battleStrike |
private Caretaker |
caretaker
The caretaker takes care of managing the available and dead creatures.
|
private Engagement |
engagement |
private boolean |
gameOver
Status 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 java.lang.String |
gameOverMessage |
private static java.util.logging.Logger |
LOGGER |
private int |
movementRoll
Last movement roll for any player.
|
protected Phase |
phase
The current game phase (Split, Move, Fight, Muster)
|
protected java.util.List<Player> |
players
The state of the different players in the game.
|
protected int |
turnNumber
The current turn number.
|
private Variant |
variant
The variant played in this game.
|
Constructor and Description |
---|
Game(Variant variant,
java.lang.String[] playerNames)
Create a Game object.
|
Modifier and Type | Method and Description |
---|---|
void |
addPlayer(Player p) |
void |
clearEngagementData() |
boolean |
containsOpposingLegions(MasterHex hex)
Return set of hexLabels for engagements found.
|
void |
createEngagement(MasterHex hex,
Legion attacker,
Legion defender) |
(package private) java.util.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 caretaker
|
java.util.Set<MasterHex> |
findEngagements()
Return a set of all hexes with engagements.
|
java.util.List<Legion> |
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).
|
java.util.List<Legion> |
getAllLegions()
Return a list of all legions of all players.
|
Legion |
getAttacker() |
Battle |
getBattle() |
Legion |
getBattleActiveLegion() |
MasterHex |
getBattleSite() |
BattleStrike |
getBattleStrike() |
int |
getBattleTurnNumber() |
Caretaker |
getCaretaker() |
Legion |
getDefender() |
java.util.List<Legion> |
getEnemyLegions(MasterHex hex,
Player player) |
java.util.List<Legion> |
getEnemyLegions(Player player)
Return a list of all legions not belonging to player.
|
Engagement |
getEngagement() |
Legion |
getFirstEnemyLegion(MasterHex masterHex,
Player player)
Finds the first legion in a hex not belonging to a certain player.
|
Legion |
getFirstFriendlyLegion(MasterHex masterHex,
Player player) |
Legion |
getFirstLegion(MasterHex masterHex) |
java.util.List<Legion> |
getFriendlyLegions(MasterHex hex,
Player player) |
java.lang.String |
getGameOverMessage() |
Legion |
getLegionByMarkerId(java.lang.String markerId) |
java.util.List<Legion> |
getLegionsByHex(MasterHex masterHex) |
int |
getMovementRoll() |
int |
getNumEnemyLegions(MasterHex masterHex,
Player player) |
int |
getNumFriendlyLegions(MasterHex masterHex,
Player player) |
protected int |
getNumHumansRemaining()
Returns the number of real players (Human or Network)
which are still alive.
|
int |
getNumLegions(MasterHex masterHex) |
int |
getNumLivingCreatures(CreatureType type) |
int |
getNumLivingPlayers() |
int |
getNumPlayers() |
int |
getNumRemoteRemaining() |
Phase |
getPhase() |
java.util.Collection<Player> |
getPlayers() |
java.util.Collection<java.lang.String> |
getPreliminaryPlayerNames()
Get a list of preliminary player names, during game startup / clients
connecting.
|
int |
getTurnNumber()
Returns the current turn in the game
|
Variant |
getVariant() |
boolean |
isEngagementInProgress() |
boolean |
isEngagementOngoing() |
boolean |
isGameOver() |
boolean |
isOccupied(MasterHex masterHex) |
boolean |
isPhase(Phase phase) |
boolean |
onlyAIsRemain() |
void |
setGameOver(boolean gameOver,
java.lang.String message) |
void |
setMovementRoll(int roll) |
void |
setPhase(Phase phase) |
void |
setTurnNumber(int turn)
Set the current turn number.
|
private static final java.util.logging.Logger LOGGER
private final Variant variant
protected final java.util.List<Player> players
private final Caretaker caretaker
protected int turnNumber
protected Phase phase
private int movementRoll
private boolean gameOver
private java.lang.String gameOverMessage
private Engagement engagement
protected Battle battle
private final BattleStrike battleStrike
public Game(Variant variant, java.lang.String[] playerNames)
variant
- The variant object, not nullplayerNames
- Names of the players, not used yetpublic Variant getVariant()
public void addPlayer(Player p)
public java.util.Collection<Player> getPlayers()
public java.util.Collection<java.lang.String> getPreliminaryPlayerNames()
public int getNumPlayers()
public int getNumLivingPlayers()
public boolean onlyAIsRemain()
protected int getNumHumansRemaining()
public int getNumRemoteRemaining()
public Caretaker getCaretaker()
public int getMovementRoll()
public void setMovementRoll(int roll)
public boolean isGameOver()
public java.lang.String getGameOverMessage()
public void setGameOver(boolean gameOver, java.lang.String message)
public void clearEngagementData()
public boolean isEngagementInProgress()
public Engagement getEngagement()
public Battle getBattle()
public Legion getBattleActiveLegion()
public MasterHex getBattleSite()
public Legion getDefender()
public Legion getAttacker()
java.util.List<CreatureType> findAvailableEligibleAngels(MasterBoardTerrain terrain, int score)
terrain
- The terrain in which this legion wants to acquirescore
- A acquring threshold, e.g. in Default 100, ..., 400, 500public java.util.List<Legion> getAllLegions()
public int getNumLivingCreatures(CreatureType type)
public int getNumLegions(MasterHex masterHex)
public java.util.List<Legion> getEnemyLegions(Player player)
public boolean isOccupied(MasterHex masterHex)
public Legion getFirstEnemyLegion(MasterHex masterHex, Player player)
masterHex
- the hex where to look for enemy regions. Not null.player
- the player whose enemies we are looking for. Not null.public java.util.Set<MasterHex> findEngagements()
public boolean containsOpposingLegions(MasterHex hex)
public java.util.List<Legion> findLegionsWithSummonables(Legion summoner)
public Legion getLegionByMarkerId(java.lang.String markerId)
public void setTurnNumber(int turn)
turn
- Set this number as current turn numberpublic int getTurnNumber()
public boolean isPhase(Phase phase)
public void setPhase(Phase phase)
public Phase getPhase()
public boolean isEngagementOngoing()
public int getBattleTurnNumber()
public BattleStrike getBattleStrike()