megamek.common
Class Game

java.lang.Object
  extended by megamek.common.Game
All Implemented Interfaces:
java.io.Serializable, IGame

public class Game
extends java.lang.Object
implements java.io.Serializable, IGame

The game class is the root of all data about the game in progress. Both the Client and the Server should have one of these objects and it is their job to keep it synched.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface megamek.common.IGame
IGame.Phase
 
Field Summary
 IBoard board
           
(package private)  java.util.Vector<Entity> vOutOfGame
          Track entities removed from the game (probably by death)
 
Constructor Summary
Game()
          Constructor
 
Method Summary
 int actionsSize()
           
 void addAction(EntityAction ea)
          Adds the specified action to the actions list for this phase.
 void addAttack(AttackHandler ah)
          add an AttackHandler to the attacks list
 void addCharge(AttackAction ea)
          Adds a pending displacement attack to the list for this phase.
 void addControlRoll(PilotingRollData control)
          Adds a pending Control roll to the list for this phase.
 void addEntity(int id, Entity entity)
           
 void addExtremeGravityPSR(PilotingRollData psr)
          Adds a pending extreme Gravity PSR to the list for this phase.
 void addFlare(Flare flare)
          Add a new flare
 void addGameListener(GameListener listener)
          Adds the specified game listener to receive board events from this board.
 void addInitiativeRerollRequest(Team t)
           
 void addMinefield(Minefield mf)
          Addds the specified minefield
protected  void addMinefieldHelper(Minefield mf)
           
 void addMinefields(java.util.Vector<Minefield> mines)
          Adds a number of minefields
 void addPlayer(int id, Player player)
           
 void addPSR(PilotingRollData psr)
          Adds a pending PSR to the list for this phase.
 void addRam(AttackAction ea)
          Adds a pending ramming attack to the list for this phase.
 void addReports(java.util.Vector<Report> v)
          Adds the given reports vector to the GameReport collection.
 void addSmokeCloud(SmokeCloud cloud)
          add a smoke cloud to the list of smoke clouds
 void addTagInfo(TagInfo info)
          add the results of one tag attack
 void addTeleMissileAttack(AttackAction ea)
          Adds a pending ramming attack to the list for this phase.
 void addVibrabomb(Minefield mf)
          Addds the specified vibrabomb
 java.util.Vector<Report> ageFlares()
          Age the flare list and remove any which have burnt out Artillery flares drift with wind.
 GameTurn changeToNextTurn()
          Changes to the next turn, returning it.
 void checkForCompleteDeployment()
          Checks to see if we've past our deployment completion
 boolean checkForMagneticClamp()
          Check each player for the presence of a Battle Armor squad equipped with a Magnetic Clamp.
 boolean checkForValidDropships(int playerId)
           
 boolean checkForValidJumpships(int playerId)
           
 boolean checkForValidNonInfantryAndOrProtomechs(int playerId)
          Returns true if the player has any valid units this turn that are not infantry, not protomechs, or not either of those.
 boolean checkForValidSmallCraft(int playerId)
           
 boolean checkForValidSpaceStations(int playerId)
          A set of checks for aero units to make sure that the movement order is maintained
 boolean checkForValidWarships(int playerId)
           
 void clearAllReports()
          Clears out all the current reports, paving the way for a new game.
 void clearDeploymentThisRound()
          Clear this round from this list of entities to deploy
 void clearMinefields()
          Removes all minefields
protected  void clearMinefieldsHelper()
           
 void clearTagInfoShots(Entity ae, Coords tc)
          clears the "shots" attribute of all TagInfos where attacker is on same team as ae and target is on same mapsheet as tc
 boolean containsMinefield(Coords coords)
          Check if there is a minefield at given coords
 boolean containsVibrabomb(Minefield mf)
          Checks if the game contains the specified Vibrabomb
 void createVictoryConditions()
          use victoryfactory to generate a new victorycondition checker provided that the victorycontext is saved properly, calling this method at any time is ok and should not affect anything unless the victorycondition-configoptions have changed.
 void end(int winner, int winnerTeam)
           
 boolean gameTimerIsExpired()
           
 java.util.Enumeration<EntityAction> getActions()
          Returns an Enumeration of actions scheduled for this phase.
 java.util.Vector<EntityAction> getActionsVector()
          Returns the actions vector.
 Entity getAffaTarget(Coords c, Entity ignore)
          Returns a Target for an Accidental Fall From above, or null if no possible target is there
 int getAllEntitiesOwnedBy(Player player)
          Returns the number of entities owned by the player, regardless of their status.
 java.util.Vector<java.util.Vector<Report>> getAllReports()
          Returns a vector of all the reports.
 java.util.Enumeration<ArtilleryAttackAction> getArtilleryAttacks()
           
 int getArtillerySize()
           
 java.util.Enumeration<AttackHandler> getAttacks()
          get the attacks
 java.util.Vector<AttackHandler> getAttacksVector()
          get the attacks vector
 IBoard getBoard()
           
 java.util.Vector<Entity> getC3NetworkMembers(Entity entity)
          Returns a Vector containing the Entitys that are in the same C3 network as the passed-in unit.
 java.util.Vector<Entity> getC3SubNetworkMembers(Entity entity)
          Returns a Vector containing the Entitys that are in the C3 sub-network under the passed-in unit.
 java.util.Enumeration<AttackAction> getCharges()
          Returns an Enumeration of displacement attacks scheduled for the end of the physical phase.
 java.util.Vector<AttackAction> getChargesVector()
          Returns the charges vector.
 java.util.Enumeration<PilotingRollData> getControlRolls()
          Returns an Enumeration of pending Control rolls.
 java.util.Enumeration<Entity> getDevastatedEntities()
          Returns an enumeration of entities that were utterly destroyed
 java.util.Enumeration<Entity> getEnemyEntities(Coords c, Entity currentEntity)
          Returns an Enumeration of the enemy's active entities at the given coordinates.
 java.util.Enumeration<Entity> getEntities()
          Returns an enumeration of all the entites in the game.
 java.util.Enumeration<Entity> getEntities(Coords c)
          Returns an Enumeration of the active entities at the given coordinates.
 int getEntitiesOwnedBy(Player player)
          Returns the number of entities owned by the player, regardless of their status, as long as they are in the game.
 java.util.Vector<Entity> getEntitiesVector()
          Returns the actual vector for the entities
 java.util.Vector<Entity> getEntitiesVector(Coords c)
          Return a Vector of Entites at Coords c
 Entity getEntity(int id)
          Returns the entity with the given id number, if any.
 int getExternalGameId()
           
 java.util.Enumeration<PilotingRollData> getExtremeGravityPSRs()
          Returns an Enumeration of pending extreme GravityPSRs.
 int getFirstDeployableEntityNum()
          Returns the number of the first deployable entity
 int getFirstDeployableEntityNum(GameTurn turn)
           
 Entity getFirstEnemyEntity(Coords c, Entity currentEntity)
          Returns the first enemy entity at the given coordinate, if any.
 Entity getFirstEntity()
          Returns the first entity that can act in the present turn, or null if none can.
 Entity getFirstEntity(Coords c)
          Returns the first entity at the given coordinate, if any.
 Entity getFirstEntity(GameTurn turn)
          Returns the first entity that can act in the specified turn, or null if none can.33
 int getFirstEntityNum()
          Returns the id of the first entity that can act in the current turn, or -1 if none can.
 int getFirstEntityNum(GameTurn turn)
          Returns the id of the first entity that can act in the specified turn, or -1 if none can.
 java.util.Vector<Flare> getFlares()
          Get a list of flares
 java.util.Enumeration<Entity> getFriendlyEntities(Coords c, Entity currentEntity)
          Returns an Enumeration of friendly active entities at the given coordinates.
 java.util.Vector<GameListener> getGameListeners()
          Returns all the GameListeners.
 java.util.Enumeration<Entity> getGraveyardEntities()
          Returns an enumeration of salvagable entities.
 java.util.Vector<GunEmplacement> getGunEmplacements(Coords c)
          Return a Vector of gun emplacements at Coords c
 int getInfantryLeft(int playerId)
          Returns the number of remaining selectable infantry owned by a player.
 IGame.Phase getLastPhase()
           
 int getLiveCommandersOwnedBy(Player player)
          Returns the number of non-destroyed deployed entities owned by the player.
 int getLiveDeployedEntitiesOwnedBy(Player player)
          Returns the number of non-destroyed entities owned by the player, including entities not yet deployed.
 int getLiveEntitiesOwnedBy(Player player)
          Returns the number of non-destroyed entityes owned by the player
 java.util.Enumeration<Coords> getMinedCoords()
          Get the coordinates of all mined hexes in the game.
 java.util.Vector<Minefield> getMinefields(Coords coords)
          Get the minefields at specified coords
 int getNbrMinefields(Coords coords)
          Get the number of the minefields at specified coords
 java.util.Enumeration<Entity> getNemesisTargets(Entity attacker, Coords target)
          Get Entities that have have a iNarc Nemesis pod attached and are situated between two Coords
 int getNextDeployableEntityNum(GameTurn turn, int start)
           
 int getNextDeployableEntityNum(int entityId)
          Returns the number of the next deployable entity
 Entity getNextEntity(int start)
          Returns the next selectable entity that can act this turn, or null if none can.
 Entity getNextEntityFromList(Entity current)
          Returns the next entity from the master list of entities.
 int getNextEntityId()
           
 int getNextEntityNum(GameTurn turn, int start)
          Returns the entity id of the next entity that can move during the specified
 int getNextEntityNum(int start)
          Returns the next selectable entity ID that can act this turn, or null if none can.
 int getNoOfEntities()
          Return the current number of entities in the game.
 int getNoOfInitiativeRerollRequests()
           
 int getNoOfPlayers()
          Return the current number of active players in the game.
 int getNoOfTeams()
          Return the current number of teams in the game.
 GameOptions getOptions()
           
 java.util.Vector<Entity> getOutOfGameEntitiesVector()
          Returns the actual vector for the out-of-game entities
 Entity getOutOfGameEntity(int id)
          Returns an out-of-game entity.
 IGame.Phase getPhase()
           
 PlanetaryConditions getPlanetaryConditions()
           
 Player getPlayer(int id)
          Returns the individual player assigned the id parameter.
 java.util.ArrayList<Entity> getPlayerEntities(Player player, boolean hide)
          Get the entities for the player.
 java.util.Enumeration<Player> getPlayers()
          Return an enumeration of player in the game
 java.util.Vector<Player> getPlayersVector()
          Return the players vector
 java.util.Hashtable<Coords,java.util.Vector<Entity>> getPositionMap()
          Returns a Hashtable that maps the Coords of each unit in this Game to a Vector of Entitys at that positions.
 Entity getPreviousEntityFromList(Entity current)
          Returns the previous entity from the master list of entities.
 int getProtomechsLeft(int playerId)
          Returns the number of remaining selectable Protomechs owned by a player.
 java.util.Enumeration<PilotingRollData> getPSRs()
          Returns an Enumeration of pending PSRs.
 java.util.Enumeration<AttackAction> getRams()
          Returns an Enumeration of ramming attacks scheduled for the end of the physical phase.
 java.util.Vector<AttackAction> getRamsVector()
          Returns the rams vector.
 java.util.Vector<Report> getReports(int r)
          Returns a vector of reports for the given round.
 java.util.Enumeration<Entity> getRetreatedEntities()
          Returns an enumeration of entities that have retreated
 int getRoundCount()
          Getter for property roundCount.
 java.util.Enumeration<Entity> getSelectedEntities(EntitySelector selector)
          Get all Entitys that pass the given selection criteria.
 int getSelectedEntityCount(EntitySelector selector)
          Count all Entitys that pass the given selection criteria.
 java.util.Enumeration<Entity> getSelectedOutOfGameEntities(EntitySelector selector)
          Get all out-of-game Entitys that pass the given selection criteria.
 int getSelectedOutOfGameEntityCount(EntitySelector selector)
          Count all out-of-gameEntitys that pass the given selection criteria.
 java.util.List<SmokeCloud> getSmokeCloudList()
          get the list of smokeclouds
 java.util.Vector<TagInfo> getTagInfo()
          Returns this turn's tag information
 Targetable getTarget(int nType, int nID)
          Returns the appropriate target for this game given a type and id
 Team getTeamForPlayer(Player p)
          Return a players team Note: may return null if player has no team
 java.util.Enumeration<Team> getTeams()
          Return an enumeration of teams in the game
 java.util.Vector<Team> getTeamsVector()
          This returns a clone of the vector of teams.
 java.util.Enumeration<AttackAction> getTeleMissileAttacks()
          Returns an Enumeration of ramming attacks scheduled for the end of the physical phase.
 java.util.Vector<AttackAction> getTeleMissileAttacksVector()
          Returns the rams vector.
 GameTurn getTurn()
          Returns the current GameTurn object
 GameTurn getTurnForPlayer(int pn)
           
 int getTurnIndex()
          Returns the current turn index
 java.util.Enumeration<GameTurn> getTurns()
          Returns an Enumeration of the current turn list
 java.util.Vector<GameTurn> getTurnVector()
          Returns the current turn vector
 java.util.Vector<Entity> getUndeployedEntities()
          Returns a vector of entities that have not yet deployed
 java.util.Vector<Entity> getValidTargets(Entity entity)
          Get a vector of entity objects that are "acceptable" to attack with this entity
 int getVehiclesLeft(int playerId)
          Returns the number of Vehicles that playerId has not moved yet this turn.
 java.util.Vector<Minefield> getVibrabombs()
           
 Victory getVictory()
           
 java.util.HashMap<java.lang.String,java.lang.Object> getVictoryContext()
           
 int getVictoryPlayerId()
          Getter for property victoryPlayerId.
 int getVictoryTeam()
          Getter for property victoryTeam.
 java.util.Enumeration<Entity> getWreckedEntities()
          Returns an enumeration of wrecked entities.
 boolean hasEntity(int entityId)
          Returns true if an entity with the specified id number exists in this game.
 boolean hasMoreTurns()
          Returns true if there is a turn after the current one
 boolean hasTacticalGenius(Player player)
          Returns true if the player has a valid unit with the Tactical Genius pilot special ability.
 void incrementRoundCount()
          Increments the round counter
 void insertNextTurn(GameTurn turn)
          Inserts a turn that will come directly after the current one
 boolean isDeploymentComplete()
           
 boolean isEntityStranded(Entity entity)
          Determines if the indicated entity is stranded on a transport that can't move.
 boolean isForceVictory()
          Getter for property forceVictory.
 boolean isOutOfGame(Entity entity)
          See if the Entity is out of the game.
 boolean isOutOfGame(int id)
          See if the Entity with the given ID is out of the game.
 boolean isPhaseSimultaneous()
           
 boolean isPlayerVictor(int playerId)
          Shortcut to isPlayerVictor(Player player)
 boolean isPlayerVictor(Player player)
          Returns true if the specified player is either the victor, or is on the winning team.
 boolean isPositionIlluminated(Coords c)
          returns true if the hex is illuminated by a flare
 void moveToGraveyard(int id)
          Moves an entity into the graveyard so it stops getting sent out every phase.
 boolean phaseHasTurns(IGame.Phase thisPhase)
          Returns true if this phase has turns.
 void processGameEvent(GameEvent event)
          Processes game events occurring on this connection by dispatching them to any registered GameListener objects.
 void purgeGameListeners()
          purges all Game Listener objects.
 void removeAction(java.lang.Object o)
          Remove a specified action
 void removeActionsFor(int entityId)
          Removes all actions by the specified entity
 void removeAttack(AttackHandler ah)
          remove an AttackHandler from the attacks list
 void removeEntity(int id, int condition)
          Remove an entity from the master list.
 GameTurn removeFirstTurnFor(Entity entity)
          Removes the first turn found that the specified entity can move in.
 void removeGameListener(GameListener listener)
          Removes the specified game listener.
 void removeMinefield(Minefield mf)
          Removes the specified minefield
 void removeMinefieldHelper(Minefield mf)
           
 void removePlayer(int id)
           
 void removeTurnFor(Entity entity)
          Removes the last, next turn found that the specified entity can move in.
 void removeVibrabomb(Minefield mf)
          Removes the specified Vibrabomb
 void reset()
          Resets this game.
 void resetActions()
          Resets the actions list.
 void resetArtilleryAttacks()
           
 void resetAttacks()
          reset the attacks vector
 void resetCharges()
          Resets the pending charges list.
 void resetControlRolls()
          Resets the PSR list.
 void resetControlRolls(Entity entity)
          Resets the Control Roll list for a given entity.
 void resetExtremeGravityPSRs()
          Resets the extreme Gravity PSR list.
 void resetExtremeGravityPSRs(Entity entity)
          Resets the extreme Gravity PSR list for a given entity.
 void resetMinefieldDensity(java.util.Vector<Minefield> newMinefields)
          Resets the minefield density for a given Vector of minefields
 void resetPSRs()
          Resets the PSR list.
 void resetPSRs(Entity entity)
          Resets the PSR list for a given entity.
 void resetRams()
          Resets the pending rams list.
 void resetTagInfo()
          Reset tag information
 void resetTeleMissileAttacks()
          Resets the pending rams list.
 void resetTurnIndex()
          Resets the turn index to -1 (awaiting first turn)
 void rollInitAndResolveTies()
           
 void setAllReports(java.util.Vector<java.util.Vector<Report>> v)
          Used to populate previous game reports, e.g. after a client connects to an existing game.
 void setArtilleryVector(java.util.Vector<ArtilleryAttackAction> v)
           
 void setAttacksVector(java.util.Vector<AttackHandler> v)
          set the attacks vector
 void setBoard(IBoard board)
          Sets the new game board
 void setDeploymentComplete(boolean deploymentComplete)
           
 void setEntitiesVector(java.util.Vector<Entity> entities)
           
 void setEntity(int id, Entity entity)
           
 void setEntity(int id, Entity entity, java.util.Vector<UnitLocation> movePath)
           
 void setExternalGameId(int value)
           
 void setFlares(java.util.Vector<Flare> flares)
          Set the list of flares
 void setForceVictory(boolean forceVictory)
          Setter for property forceVictory.
 void setLastPhase(IGame.Phase lastPhase)
           
 void setMinefields(java.util.Vector<Minefield> minefields)
          Sets the minefields to the given Vector of the minefields
 void setOptions(GameOptions options)
          sets the game options
 void setOutOfGameEntitiesVector(java.util.Vector<Entity> vOutOfGame)
          Swap out the current list of dead (or fled) units for a new one.
 void setPhase(IGame.Phase phase)
           
 void setPlanetaryConditions(PlanetaryConditions conditions)
           
 void setPlayer(int id, Player player)
           
 void setRoundCount(int roundCount)
           
 void setTurnIndex(int turnIndex)
          Sets the current turn index
 void setTurnVector(java.util.Vector<GameTurn> turnVector)
          Sets the current turn vector
 void setupRoundDeployment()
          Sets up up the hashtable of who deploys when
 void setupTeams()
          Set up the teams vector.
 void setVictoryContext(java.util.HashMap<java.lang.String,java.lang.Object> ctx)
          set the game victory state.
 void setVictoryPlayerId(int victoryPlayerId)
          Setter for property victoryPlayerId.
 void setVictoryTeam(int victoryTeam)
          Setter for property victoryTeam.
 boolean shouldDeployForRound(int round)
           
 boolean shouldDeployThisRound()
          Check to see if we should deploy this round
protected  void updatePlayer(Player player)
           
 boolean useVectorMove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

board

public IBoard board

vOutOfGame

java.util.Vector<Entity> vOutOfGame
Track entities removed from the game (probably by death)

Constructor Detail

Game

public Game()
Constructor

Method Detail

getExternalGameId

public int getExternalGameId()
Specified by:
getExternalGameId in interface IGame

setExternalGameId

public void setExternalGameId(int value)
Specified by:
setExternalGameId in interface IGame

getBoard

public IBoard getBoard()
Specified by:
getBoard in interface IGame
Returns:
the game board

setBoard

public void setBoard(IBoard board)
Description copied from interface: IGame
Sets the new game board

Specified by:
setBoard in interface IGame

containsMinefield

public boolean containsMinefield(Coords coords)
Description copied from interface: IGame
Check if there is a minefield at given coords

Specified by:
containsMinefield in interface IGame
Parameters:
coords - coords to check
Returns:
true if there is a minefield at given coords or false otherwise

getMinefields

public java.util.Vector<Minefield> getMinefields(Coords coords)
Description copied from interface: IGame
Get the minefields at specified coords

Specified by:
getMinefields in interface IGame
Returns:
the Vector of minefields at specified coord

getNbrMinefields

public int getNbrMinefields(Coords coords)
Description copied from interface: IGame
Get the number of the minefields at specified coords

Specified by:
getNbrMinefields in interface IGame
Returns:
the number of the minefields at specified coord

getMinedCoords

public java.util.Enumeration<Coords> getMinedCoords()
Get the coordinates of all mined hexes in the game.

Specified by:
getMinedCoords in interface IGame
Returns:
an Enumeration of the Coords containing minefields. This will not be null.

addMinefield

public void addMinefield(Minefield mf)
Description copied from interface: IGame
Addds the specified minefield

Specified by:
addMinefield in interface IGame
Parameters:
mf - minefield to add

addMinefields

public void addMinefields(java.util.Vector<Minefield> mines)
Description copied from interface: IGame
Adds a number of minefields

Specified by:
addMinefields in interface IGame
Parameters:
mines - the Vector of the minefields to add

setMinefields

public void setMinefields(java.util.Vector<Minefield> minefields)
Description copied from interface: IGame
Sets the minefields to the given Vector of the minefields

Specified by:
setMinefields in interface IGame

resetMinefieldDensity

public void resetMinefieldDensity(java.util.Vector<Minefield> newMinefields)
Description copied from interface: IGame
Resets the minefield density for a given Vector of minefields

Specified by:
resetMinefieldDensity in interface IGame

addMinefieldHelper

protected void addMinefieldHelper(Minefield mf)

removeMinefield

public void removeMinefield(Minefield mf)
Description copied from interface: IGame
Removes the specified minefield

Specified by:
removeMinefield in interface IGame
Parameters:
mf - minefield to remove

removeMinefieldHelper

public void removeMinefieldHelper(Minefield mf)

clearMinefields

public void clearMinefields()
Description copied from interface: IGame
Removes all minefields

Specified by:
clearMinefields in interface IGame

clearMinefieldsHelper

protected void clearMinefieldsHelper()

getVibrabombs

public java.util.Vector<Minefield> getVibrabombs()
Specified by:
getVibrabombs in interface IGame
Returns:
the Vector of the vibrabombs

addVibrabomb

public void addVibrabomb(Minefield mf)
Description copied from interface: IGame
Addds the specified vibrabomb

Specified by:
addVibrabomb in interface IGame
Parameters:
mf - Vibrabomb to add

removeVibrabomb

public void removeVibrabomb(Minefield mf)
Description copied from interface: IGame
Removes the specified Vibrabomb

Specified by:
removeVibrabomb in interface IGame
Parameters:
mf - Vibrabomb to remove

containsVibrabomb

public boolean containsVibrabomb(Minefield mf)
Description copied from interface: IGame
Checks if the game contains the specified Vibrabomb

Specified by:
containsVibrabomb in interface IGame
Parameters:
mf - the Vibrabomb to ceck
Returns:
true iff the minefield contains a vibrabomb.

getOptions

public GameOptions getOptions()
Specified by:
getOptions in interface IGame
Returns:
game options

setOptions

public void setOptions(GameOptions options)
Description copied from interface: IGame
sets the game options

Specified by:
setOptions in interface IGame

getTeams

public java.util.Enumeration<Team> getTeams()
Return an enumeration of teams in the game

Specified by:
getTeams in interface IGame

getNoOfTeams

public int getNoOfTeams()
Return the current number of teams in the game.

Specified by:
getNoOfTeams in interface IGame

getTeamsVector

public java.util.Vector<Team> getTeamsVector()
This returns a clone of the vector of teams. Each element is one of the teams in the game.

Specified by:
getTeamsVector in interface IGame

getTeamForPlayer

public Team getTeamForPlayer(Player p)
Return a players team Note: may return null if player has no team

Specified by:
getTeamForPlayer in interface IGame

setupTeams

public void setupTeams()
Set up the teams vector. Each player on a team (Team 1 .. Team X) is placed in the appropriate vector. Any player on 'No Team', is placed in their own object

Specified by:
setupTeams in interface IGame

getPlayers

public java.util.Enumeration<Player> getPlayers()
Return an enumeration of player in the game

Specified by:
getPlayers in interface IGame

getPlayersVector

public java.util.Vector<Player> getPlayersVector()
Return the players vector

Specified by:
getPlayersVector in interface IGame

getNoOfPlayers

public int getNoOfPlayers()
Return the current number of active players in the game.

Specified by:
getNoOfPlayers in interface IGame

getPlayer

public Player getPlayer(int id)
Returns the individual player assigned the id parameter.

Specified by:
getPlayer in interface IGame

addPlayer

public void addPlayer(int id,
                      Player player)
Specified by:
addPlayer in interface IGame

setPlayer

public void setPlayer(int id,
                      Player player)
Specified by:
setPlayer in interface IGame

updatePlayer

protected void updatePlayer(Player player)

removePlayer

public void removePlayer(int id)
Specified by:
removePlayer in interface IGame

getEntitiesOwnedBy

public int getEntitiesOwnedBy(Player player)
Returns the number of entities owned by the player, regardless of their status, as long as they are in the game.

Specified by:
getEntitiesOwnedBy in interface IGame

getAllEntitiesOwnedBy

public int getAllEntitiesOwnedBy(Player player)
Returns the number of entities owned by the player, regardless of their status.

Specified by:
getAllEntitiesOwnedBy in interface IGame

getLiveEntitiesOwnedBy

public int getLiveEntitiesOwnedBy(Player player)
Returns the number of non-destroyed entityes owned by the player

Specified by:
getLiveEntitiesOwnedBy in interface IGame

getLiveDeployedEntitiesOwnedBy

public int getLiveDeployedEntitiesOwnedBy(Player player)
Returns the number of non-destroyed entities owned by the player, including entities not yet deployed. Ignore offboard units and captured Mek pilots.

Specified by:
getLiveDeployedEntitiesOwnedBy in interface IGame

getLiveCommandersOwnedBy

public int getLiveCommandersOwnedBy(Player player)
Returns the number of non-destroyed deployed entities owned by the player. Ignore offboard units and captured Mek pilots.

Specified by:
getLiveCommandersOwnedBy in interface IGame

hasTacticalGenius

public boolean hasTacticalGenius(Player player)
Returns true if the player has a valid unit with the Tactical Genius pilot special ability.

Specified by:
hasTacticalGenius in interface IGame

getValidTargets

public java.util.Vector<Entity> getValidTargets(Entity entity)
Get a vector of entity objects that are "acceptable" to attack with this entity

Specified by:
getValidTargets in interface IGame

phaseHasTurns

public boolean phaseHasTurns(IGame.Phase thisPhase)
Returns true if this phase has turns. If false, the phase is simply waiting for everybody to declare "done".

Specified by:
phaseHasTurns in interface IGame

isPhaseSimultaneous

public boolean isPhaseSimultaneous()
Specified by:
isPhaseSimultaneous in interface IGame
Returns:
true if the current phase can be played simultaneously

getTurn

public GameTurn getTurn()
Returns the current GameTurn object

Specified by:
getTurn in interface IGame

getTurnForPlayer

public GameTurn getTurnForPlayer(int pn)
Specified by:
getTurnForPlayer in interface IGame
Returns:
the first GameTurn object for the specified player, or null if the player has no turns to play

changeToNextTurn

public GameTurn changeToNextTurn()
Changes to the next turn, returning it.

Specified by:
changeToNextTurn in interface IGame

resetTurnIndex

public void resetTurnIndex()
Resets the turn index to -1 (awaiting first turn)

Specified by:
resetTurnIndex in interface IGame

hasMoreTurns

public boolean hasMoreTurns()
Returns true if there is a turn after the current one

Specified by:
hasMoreTurns in interface IGame

insertNextTurn

public void insertNextTurn(GameTurn turn)
Inserts a turn that will come directly after the current one

Specified by:
insertNextTurn in interface IGame

getTurns

public java.util.Enumeration<GameTurn> getTurns()
Returns an Enumeration of the current turn list

Specified by:
getTurns in interface IGame

getTurnIndex

public int getTurnIndex()
Returns the current turn index

Specified by:
getTurnIndex in interface IGame

setTurnIndex

public void setTurnIndex(int turnIndex)
Sets the current turn index

Specified by:
setTurnIndex in interface IGame

getTurnVector

public java.util.Vector<GameTurn> getTurnVector()
Returns the current turn vector

Specified by:
getTurnVector in interface IGame

setTurnVector

public void setTurnVector(java.util.Vector<GameTurn> turnVector)
Sets the current turn vector

Specified by:
setTurnVector in interface IGame

getPhase

public IGame.Phase getPhase()
Specified by:
getPhase in interface IGame

setPhase

public void setPhase(IGame.Phase phase)
Specified by:
setPhase in interface IGame

getLastPhase

public IGame.Phase getLastPhase()
Specified by:
getLastPhase in interface IGame

setLastPhase

public void setLastPhase(IGame.Phase lastPhase)
Specified by:
setLastPhase in interface IGame

setDeploymentComplete

public void setDeploymentComplete(boolean deploymentComplete)
Specified by:
setDeploymentComplete in interface IGame

isDeploymentComplete

public boolean isDeploymentComplete()
Specified by:
isDeploymentComplete in interface IGame

setupRoundDeployment

public void setupRoundDeployment()
Sets up up the hashtable of who deploys when

Specified by:
setupRoundDeployment in interface IGame

checkForCompleteDeployment

public void checkForCompleteDeployment()
Checks to see if we've past our deployment completion

Specified by:
checkForCompleteDeployment in interface IGame

shouldDeployThisRound

public boolean shouldDeployThisRound()
Check to see if we should deploy this round

Specified by:
shouldDeployThisRound in interface IGame

shouldDeployForRound

public boolean shouldDeployForRound(int round)
Specified by:
shouldDeployForRound in interface IGame

clearDeploymentThisRound

public void clearDeploymentThisRound()
Clear this round from this list of entities to deploy

Specified by:
clearDeploymentThisRound in interface IGame

getUndeployedEntities

public java.util.Vector<Entity> getUndeployedEntities()
Returns a vector of entities that have not yet deployed

Specified by:
getUndeployedEntities in interface IGame

getEntities

public java.util.Enumeration<Entity> getEntities()
Returns an enumeration of all the entites in the game.

Specified by:
getEntities in interface IGame

getPreviousEntityFromList

public Entity getPreviousEntityFromList(Entity current)
Description copied from interface: IGame
Returns the previous entity from the master list of entities. Will wrap around to the end of the list if necessary.

Specified by:
getPreviousEntityFromList in interface IGame
Parameters:
current - The Entity whose list position you wish to start from.
Returns:
The previous Entity in the list.

getNextEntityFromList

public Entity getNextEntityFromList(Entity current)
Description copied from interface: IGame
Returns the next entity from the master list of entities. Will wrap around to the begining of the list if necessary.

Specified by:
getNextEntityFromList in interface IGame
Parameters:
current - The Entity whose list position you wish to start from.
Returns:
The next Entity in the list.

getEntitiesVector

public java.util.Vector<Entity> getEntitiesVector()
Returns the actual vector for the entities

Specified by:
getEntitiesVector in interface IGame

setEntitiesVector

public void setEntitiesVector(java.util.Vector<Entity> entities)
Specified by:
setEntitiesVector in interface IGame

getOutOfGameEntitiesVector

public java.util.Vector<Entity> getOutOfGameEntitiesVector()
Returns the actual vector for the out-of-game entities

Specified by:
getOutOfGameEntitiesVector in interface IGame

setOutOfGameEntitiesVector

public void setOutOfGameEntitiesVector(java.util.Vector<Entity> vOutOfGame)
Swap out the current list of dead (or fled) units for a new one.

Specified by:
setOutOfGameEntitiesVector in interface IGame
Parameters:
vOutOfGame - - the new Vector of dead or fled units. This value should not be null.
Throws:
java.lang.IllegalArgumentException - if the new list is null.

getOutOfGameEntity

public Entity getOutOfGameEntity(int id)
Returns an out-of-game entity.

Specified by:
getOutOfGameEntity in interface IGame
Parameters:
id - the int ID of the out-of-game entity.
Returns:
the out-of-game Entity with that ID. If no out-of-game entity has that ID, returns a null.

getC3NetworkMembers

public java.util.Vector<Entity> getC3NetworkMembers(Entity entity)
Returns a Vector containing the Entitys that are in the same C3 network as the passed-in unit. The output will contain the passed-in unit, if the unit has a C3 computer. If the unit has no C3 computer, the output will be empty (but it will never be null).

Specified by:
getC3NetworkMembers in interface IGame
Parameters:
entity - - the Entity whose C3 network co- members is required. This value may be null.
Returns:
a Vector that will contain all other Entitys that are in the same C3 network as the passed-in unit. This Vector may be empty, but it will not be null.
See Also:
getC3SubNetworkMembers( Entity )

getC3SubNetworkMembers

public java.util.Vector<Entity> getC3SubNetworkMembers(Entity entity)
Returns a Vector containing the Entitys that are in the C3 sub-network under the passed-in unit. The output will contain the passed-in unit, if the unit has a C3 computer. If the unit has no C3 computer, the output will be empty (but it will never be null). If the passed-in unit is a company commander or a member of a C3i network, this call is the same as getC3NetworkMembers.

Specified by:
getC3SubNetworkMembers in interface IGame
Parameters:
entity - - the Entity whose C3 network sub- members is required. This value may be null.
Returns:
a Vector that will contain all other Entitys that are in the same C3 network under the passed-in unit. This Vector may be empty, but it will not be null.
See Also:
getC3NetworkMembers( Entity )

getPositionMap

public java.util.Hashtable<Coords,java.util.Vector<Entity>> getPositionMap()
Returns a Hashtable that maps the Coords of each unit in this Game to a Vector of Entitys at that positions. Units that have no position (e.g. loaded units) will not be in the map.

Specified by:
getPositionMap in interface IGame
Returns:
a Hashtable that maps the Coords positions or each unit in the game to a Vector of Entitys at that position.

getGraveyardEntities

public java.util.Enumeration<Entity> getGraveyardEntities()
Returns an enumeration of salvagable entities.

Specified by:
getGraveyardEntities in interface IGame

getWreckedEntities

public java.util.Enumeration<Entity> getWreckedEntities()
Returns an enumeration of wrecked entities.

Specified by:
getWreckedEntities in interface IGame

getRetreatedEntities

public java.util.Enumeration<Entity> getRetreatedEntities()
Returns an enumeration of entities that have retreated

Specified by:
getRetreatedEntities in interface IGame

getDevastatedEntities

public java.util.Enumeration<Entity> getDevastatedEntities()
Returns an enumeration of entities that were utterly destroyed

Specified by:
getDevastatedEntities in interface IGame

getNoOfEntities

public int getNoOfEntities()
Return the current number of entities in the game.

Specified by:
getNoOfEntities in interface IGame

getTarget

public Targetable getTarget(int nType,
                            int nID)
Returns the appropriate target for this game given a type and id

Specified by:
getTarget in interface IGame

getEntity

public Entity getEntity(int id)
Returns the entity with the given id number, if any.

Specified by:
getEntity in interface IGame

addEntity

public void addEntity(int id,
                      Entity entity)
Specified by:
addEntity in interface IGame

setEntity

public void setEntity(int id,
                      Entity entity)
Specified by:
setEntity in interface IGame

setEntity

public void setEntity(int id,
                      Entity entity,
                      java.util.Vector<UnitLocation> movePath)
Specified by:
setEntity in interface IGame

getNextEntityId

public int getNextEntityId()
Specified by:
getNextEntityId in interface IGame
Returns:
int containing an unused entity id

hasEntity

public boolean hasEntity(int entityId)
Returns true if an entity with the specified id number exists in this game.

Specified by:
hasEntity in interface IGame
Returns:
true if an entity with the specified id number exists in this game.

removeEntity

public void removeEntity(int id,
                         int condition)
Remove an entity from the master list. If we can't find that entity, (probably due to double-blind) ignore it.

Specified by:
removeEntity in interface IGame

reset

public void reset()
Resets this game.

Specified by:
reset in interface IGame

getFirstEntity

public Entity getFirstEntity(Coords c)
Returns the first entity at the given coordinate, if any. Only returns targetable (non-dead) entities.

Specified by:
getFirstEntity in interface IGame
Parameters:
c - the coordinates to search at

getFirstEnemyEntity

public Entity getFirstEnemyEntity(Coords c,
                                  Entity currentEntity)
Returns the first enemy entity at the given coordinate, if any. Only returns targetable (non-dead) entities.

Specified by:
getFirstEnemyEntity in interface IGame
Parameters:
c - the coordinates to search at
currentEntity - the entity that is firing

getEntities

public java.util.Enumeration<Entity> getEntities(Coords c)
Returns an Enumeration of the active entities at the given coordinates.

Specified by:
getEntities in interface IGame

getEntitiesVector

public java.util.Vector<Entity> getEntitiesVector(Coords c)
Return a Vector of Entites at Coords c

Specified by:
getEntitiesVector in interface IGame
Parameters:
c -
Returns:
Vector

getGunEmplacements

public java.util.Vector<GunEmplacement> getGunEmplacements(Coords c)
Return a Vector of gun emplacements at Coords c

Specified by:
getGunEmplacements in interface IGame
Parameters:
c -
Returns:
Vector

getAffaTarget

public Entity getAffaTarget(Coords c,
                            Entity ignore)
Returns a Target for an Accidental Fall From above, or null if no possible target is there

Specified by:
getAffaTarget in interface IGame
Parameters:
c - The Coords of the hex in which the accidental fall from above happens
ignore - The entity who is falling
Returns:
The Entity that should be an AFFA target.

getEnemyEntities

public java.util.Enumeration<Entity> getEnemyEntities(Coords c,
                                                      Entity currentEntity)
Returns an Enumeration of the enemy's active entities at the given coordinates.

Specified by:
getEnemyEntities in interface IGame
Parameters:
c - the Coords of the hex being examined.
currentEntity - the Entity whose enemies are needed.
Returns:
an Enumeration of Entitys at the given coordinates who are enemies of the given unit.

getFriendlyEntities

public java.util.Enumeration<Entity> getFriendlyEntities(Coords c,
                                                         Entity currentEntity)
Returns an Enumeration of friendly active entities at the given coordinates.

Specified by:
getFriendlyEntities in interface IGame
Parameters:
c - the Coords of the hex being examined.
currentEntity - the Entity whose friends are needed.
Returns:
an Enumeration of Entitys at the given coordinates who are friends of the given unit.

moveToGraveyard

public void moveToGraveyard(int id)
Moves an entity into the graveyard so it stops getting sent out every phase.

Specified by:
moveToGraveyard in interface IGame

isOutOfGame

public boolean isOutOfGame(int id)
See if the Entity with the given ID is out of the game.

Specified by:
isOutOfGame in interface IGame
Parameters:
id - - the ID of the Entity to be checked.
Returns:
true if the Entity is in the graveyard, false otherwise.

isOutOfGame

public boolean isOutOfGame(Entity entity)
See if the Entity is out of the game.

Specified by:
isOutOfGame in interface IGame
Parameters:
entity - - the Entity to be checked.
Returns:
true if the Entity is in the graveyard, false otherwise.

getFirstEntity

public Entity getFirstEntity()
Returns the first entity that can act in the present turn, or null if none can.

Specified by:
getFirstEntity in interface IGame

getFirstEntity

public Entity getFirstEntity(GameTurn turn)
Returns the first entity that can act in the specified turn, or null if none can.33

Specified by:
getFirstEntity in interface IGame

getFirstEntityNum

public int getFirstEntityNum()
Returns the id of the first entity that can act in the current turn, or -1 if none can.

Specified by:
getFirstEntityNum in interface IGame

getFirstEntityNum

public int getFirstEntityNum(GameTurn turn)
Returns the id of the first entity that can act in the specified turn, or -1 if none can.

Specified by:
getFirstEntityNum in interface IGame

getNextEntity

public Entity getNextEntity(int start)
Returns the next selectable entity that can act this turn, or null if none can.

Specified by:
getNextEntity in interface IGame
Parameters:
start - the index number to start at

getNextEntityNum

public int getNextEntityNum(int start)
Description copied from interface: IGame
Returns the next selectable entity ID that can act this turn, or null if none can.

Specified by:
getNextEntityNum in interface IGame
Parameters:
start - the index number to start at

getNextEntityNum

public int getNextEntityNum(GameTurn turn,
                            int start)
Returns the entity id of the next entity that can move during the specified

Specified by:
getNextEntityNum in interface IGame
Parameters:
turn - the turn to use
start - the entity id to start at

getFirstDeployableEntityNum

public int getFirstDeployableEntityNum()
Returns the number of the first deployable entity

Specified by:
getFirstDeployableEntityNum in interface IGame

getFirstDeployableEntityNum

public int getFirstDeployableEntityNum(GameTurn turn)
Specified by:
getFirstDeployableEntityNum in interface IGame

getNextDeployableEntityNum

public int getNextDeployableEntityNum(int entityId)
Returns the number of the next deployable entity

Specified by:
getNextDeployableEntityNum in interface IGame

getNextDeployableEntityNum

public int getNextDeployableEntityNum(GameTurn turn,
                                      int start)
Specified by:
getNextDeployableEntityNum in interface IGame

getPlayerEntities

public java.util.ArrayList<Entity> getPlayerEntities(Player player,
                                                     boolean hide)
Get the entities for the player.

Specified by:
getPlayerEntities in interface IGame
Parameters:
player - - the Player whose entities are required.
hide - - should fighters loaded into squadrons be excluded?
Returns:
a Vector of Entitys.

isEntityStranded

public boolean isEntityStranded(Entity entity)
Determines if the indicated entity is stranded on a transport that can't move.

According to Randall Bills, the "minimum move" rule allow stranded units to dismount at the start of the turn.

Specified by:
isEntityStranded in interface IGame
Parameters:
entity - the Entity that may be stranded
Returns:
true if the entity is stranded false otherwise.

getInfantryLeft

public int getInfantryLeft(int playerId)
Returns the number of remaining selectable infantry owned by a player.

Specified by:
getInfantryLeft in interface IGame

getProtomechsLeft

public int getProtomechsLeft(int playerId)
Returns the number of remaining selectable Protomechs owned by a player.

Specified by:
getProtomechsLeft in interface IGame

getVehiclesLeft

public int getVehiclesLeft(int playerId)
Returns the number of Vehicles that playerId has not moved yet this turn.

Specified by:
getVehiclesLeft in interface IGame
Parameters:
playerId -
Returns:
number of vehicles playerId has not moved yet this turn

removeFirstTurnFor

public GameTurn removeFirstTurnFor(Entity entity)
Removes the first turn found that the specified entity can move in. Used when a turn is played out of order

Specified by:
removeFirstTurnFor in interface IGame

removeTurnFor

public void removeTurnFor(Entity entity)
Removes the last, next turn found that the specified entity can move in. Used when, say, an entity dies mid-phase.

Specified by:
removeTurnFor in interface IGame

checkForMagneticClamp

public boolean checkForMagneticClamp()
Check each player for the presence of a Battle Armor squad equipped with a Magnetic Clamp. If one unit is found, update that player's units to allow the squad to be transported.

This method should be called *ONCE* per game, after all units for all players have been loaded.

Specified by:
checkForMagneticClamp in interface IGame
Returns:
true if a unit was updated, false if no player has a Battle Armor squad equipped with a Magnetic Clamp.

addAction

public void addAction(EntityAction ea)
Adds the specified action to the actions list for this phase.

Specified by:
addAction in interface IGame

setArtilleryVector

public void setArtilleryVector(java.util.Vector<ArtilleryAttackAction> v)
Specified by:
setArtilleryVector in interface IGame

resetArtilleryAttacks

public void resetArtilleryAttacks()

getArtilleryAttacks

public java.util.Enumeration<ArtilleryAttackAction> getArtilleryAttacks()
Specified by:
getArtilleryAttacks in interface IGame

getArtillerySize

public int getArtillerySize()
Specified by:
getArtillerySize in interface IGame

getActions

public java.util.Enumeration<EntityAction> getActions()
Returns an Enumeration of actions scheduled for this phase.

Specified by:
getActions in interface IGame

resetActions

public void resetActions()
Resets the actions list.

Specified by:
resetActions in interface IGame

removeActionsFor

public void removeActionsFor(int entityId)
Removes all actions by the specified entity

Specified by:
removeActionsFor in interface IGame

removeAction

public void removeAction(java.lang.Object o)
Remove a specified action

Specified by:
removeAction in interface IGame
Parameters:
o - The action to remove.

actionsSize

public int actionsSize()
Specified by:
actionsSize in interface IGame

getActionsVector

public java.util.Vector<EntityAction> getActionsVector()
Returns the actions vector. Do not use to modify the actions; I will be angry. >:[ Used for sending all actions to the client.

Specified by:
getActionsVector in interface IGame

addInitiativeRerollRequest

public void addInitiativeRerollRequest(Team t)
Specified by:
addInitiativeRerollRequest in interface IGame

rollInitAndResolveTies

public void rollInitAndResolveTies()
Specified by:
rollInitAndResolveTies in interface IGame

getNoOfInitiativeRerollRequests

public int getNoOfInitiativeRerollRequests()
Specified by:
getNoOfInitiativeRerollRequests in interface IGame

addCharge

public void addCharge(AttackAction ea)
Adds a pending displacement attack to the list for this phase.

Specified by:
addCharge in interface IGame

getCharges

public java.util.Enumeration<AttackAction> getCharges()
Returns an Enumeration of displacement attacks scheduled for the end of the physical phase.

Specified by:
getCharges in interface IGame

resetCharges

public void resetCharges()
Resets the pending charges list.

Specified by:
resetCharges in interface IGame

getChargesVector

public java.util.Vector<AttackAction> getChargesVector()
Returns the charges vector. Do not modify. >:[ Used for sending all charges to the client.

Specified by:
getChargesVector in interface IGame

addRam

public void addRam(AttackAction ea)
Adds a pending ramming attack to the list for this phase.

Specified by:
addRam in interface IGame

getRams

public java.util.Enumeration<AttackAction> getRams()
Returns an Enumeration of ramming attacks scheduled for the end of the physical phase.

Specified by:
getRams in interface IGame

resetRams

public void resetRams()
Resets the pending rams list.

Specified by:
resetRams in interface IGame

getRamsVector

public java.util.Vector<AttackAction> getRamsVector()
Returns the rams vector. Do not modify. >:[ Used for sending all charges to the client.

Specified by:
getRamsVector in interface IGame

addTeleMissileAttack

public void addTeleMissileAttack(AttackAction ea)
Adds a pending ramming attack to the list for this phase.

Specified by:
addTeleMissileAttack in interface IGame

getTeleMissileAttacks

public java.util.Enumeration<AttackAction> getTeleMissileAttacks()
Returns an Enumeration of ramming attacks scheduled for the end of the physical phase.

Specified by:
getTeleMissileAttacks in interface IGame

resetTeleMissileAttacks

public void resetTeleMissileAttacks()
Resets the pending rams list.

Specified by:
resetTeleMissileAttacks in interface IGame

getTeleMissileAttacksVector

public java.util.Vector<AttackAction> getTeleMissileAttacksVector()
Returns the rams vector. Do not modify. >:[ Used for sending all charges to the client.

Specified by:
getTeleMissileAttacksVector in interface IGame

addPSR

public void addPSR(PilotingRollData psr)
Adds a pending PSR to the list for this phase.

Specified by:
addPSR in interface IGame

getPSRs

public java.util.Enumeration<PilotingRollData> getPSRs()
Returns an Enumeration of pending PSRs.

Specified by:
getPSRs in interface IGame

addExtremeGravityPSR

public void addExtremeGravityPSR(PilotingRollData psr)
Adds a pending extreme Gravity PSR to the list for this phase.

Specified by:
addExtremeGravityPSR in interface IGame

getExtremeGravityPSRs

public java.util.Enumeration<PilotingRollData> getExtremeGravityPSRs()
Returns an Enumeration of pending extreme GravityPSRs.

Specified by:
getExtremeGravityPSRs in interface IGame

resetPSRs

public void resetPSRs(Entity entity)
Resets the PSR list for a given entity.

Specified by:
resetPSRs in interface IGame

resetExtremeGravityPSRs

public void resetExtremeGravityPSRs()
Resets the extreme Gravity PSR list.

Specified by:
resetExtremeGravityPSRs in interface IGame

resetExtremeGravityPSRs

public void resetExtremeGravityPSRs(Entity entity)
Resets the extreme Gravity PSR list for a given entity.

Specified by:
resetExtremeGravityPSRs in interface IGame

resetPSRs

public void resetPSRs()
Resets the PSR list.

Specified by:
resetPSRs in interface IGame

addAttack

public void addAttack(AttackHandler ah)
add an AttackHandler to the attacks list

Specified by:
addAttack in interface IGame
Parameters:
ah - - The AttackHandler to add

removeAttack

public void removeAttack(AttackHandler ah)
remove an AttackHandler from the attacks list

Specified by:
removeAttack in interface IGame
Parameters:
ah - - The AttackHandler to remove

getAttacks

public java.util.Enumeration<AttackHandler> getAttacks()
get the attacks

Specified by:
getAttacks in interface IGame
Returns:
a Enumeration of all AttackHandlers

getAttacksVector

public java.util.Vector<AttackHandler> getAttacksVector()
get the attacks vector

Specified by:
getAttacksVector in interface IGame
Returns:
the Vector containing the attacks

resetAttacks

public void resetAttacks()
reset the attacks vector

Specified by:
resetAttacks in interface IGame

setAttacksVector

public void setAttacksVector(java.util.Vector<AttackHandler> v)
set the attacks vector

Specified by:
setAttacksVector in interface IGame
Parameters:
v - - the Vector that should be the new attacks vector

getRoundCount

public int getRoundCount()
Getter for property roundCount.

Specified by:
getRoundCount in interface IGame
Returns:
Value of property roundCount.

setRoundCount

public void setRoundCount(int roundCount)
Specified by:
setRoundCount in interface IGame

incrementRoundCount

public void incrementRoundCount()
Increments the round counter

Specified by:
incrementRoundCount in interface IGame

isForceVictory

public boolean isForceVictory()
Getter for property forceVictory.

Specified by:
isForceVictory in interface IGame
Returns:
Value of property forceVictory.

setForceVictory

public void setForceVictory(boolean forceVictory)
Setter for property forceVictory.

Specified by:
setForceVictory in interface IGame
Parameters:
forceVictory - New value of property forceVictory.

addReports

public void addReports(java.util.Vector<Report> v)
Description copied from interface: IGame
Adds the given reports vector to the GameReport collection.

Specified by:
addReports in interface IGame
Parameters:
v - Vector of reports

getReports

public java.util.Vector<Report> getReports(int r)
Description copied from interface: IGame
Returns a vector of reports for the given round.

Specified by:
getReports in interface IGame
Parameters:
r - Round number

getAllReports

public java.util.Vector<java.util.Vector<Report>> getAllReports()
Description copied from interface: IGame
Returns a vector of all the reports.

Specified by:
getAllReports in interface IGame

setAllReports

public void setAllReports(java.util.Vector<java.util.Vector<Report>> v)
Description copied from interface: IGame
Used to populate previous game reports, e.g. after a client connects to an existing game.

Specified by:
setAllReports in interface IGame

clearAllReports

public void clearAllReports()
Description copied from interface: IGame
Clears out all the current reports, paving the way for a new game.

Specified by:
clearAllReports in interface IGame

end

public void end(int winner,
                int winnerTeam)
Specified by:
end in interface IGame

getVictoryPlayerId

public int getVictoryPlayerId()
Getter for property victoryPlayerId.

Specified by:
getVictoryPlayerId in interface IGame
Returns:
Value of property victoryPlayerId.

setVictoryPlayerId

public void setVictoryPlayerId(int victoryPlayerId)
Setter for property victoryPlayerId.

Specified by:
setVictoryPlayerId in interface IGame
Parameters:
victoryPlayerId - New value of property victoryPlayerId.

getVictoryTeam

public int getVictoryTeam()
Getter for property victoryTeam.

Specified by:
getVictoryTeam in interface IGame
Returns:
Value of property victoryTeam.

setVictoryTeam

public void setVictoryTeam(int victoryTeam)
Setter for property victoryTeam.

Specified by:
setVictoryTeam in interface IGame
Parameters:
victoryTeam - New value of property victoryTeam.

isPlayerVictor

public boolean isPlayerVictor(Player player)
Returns true if the specified player is either the victor, or is on the winning team. Best to call during PHASE_VICTORY.

Specified by:
isPlayerVictor in interface IGame

getVictoryContext

public java.util.HashMap<java.lang.String,java.lang.Object> getVictoryContext()
Specified by:
getVictoryContext in interface IGame
Returns:
the currently active context-object for victorycondition checking. This should be a mutable object and it will be modified by the victory condition checkers. whoever saves the game state when doing saves, is also responsible of saving this state. at the start of the game this should be initialized to an empty hashmap

setVictoryContext

public void setVictoryContext(java.util.HashMap<java.lang.String,java.lang.Object> ctx)
Description copied from interface: IGame
set the game victory state.

Specified by:
setVictoryContext in interface IGame

isPlayerVictor

public boolean isPlayerVictor(int playerId)
Shortcut to isPlayerVictor(Player player)

Specified by:
isPlayerVictor in interface IGame

getSelectedEntities

public java.util.Enumeration<Entity> getSelectedEntities(EntitySelector selector)
Get all Entitys that pass the given selection criteria.

Specified by:
getSelectedEntities in interface IGame
Parameters:
selector - the EntitySelector that implements test that an entity must pass to be included. This value may be null (in which case all entities in the game will be returned).
Returns:
an Enumeration of all entities that the selector accepts. This value will not be null but it may be empty.

getSelectedEntityCount

public int getSelectedEntityCount(EntitySelector selector)
Count all Entitys that pass the given selection criteria.

Specified by:
getSelectedEntityCount in interface IGame
Parameters:
selector - the EntitySelector that implements test that an entity must pass to be included. This value may be null (in which case the count of all entities in the game will be returned).
Returns:
the int count of all entities that the selector accepts. This value will not be null but it may be empty.

getSelectedOutOfGameEntities

public java.util.Enumeration<Entity> getSelectedOutOfGameEntities(EntitySelector selector)
Get all out-of-game Entitys that pass the given selection criteria.

Specified by:
getSelectedOutOfGameEntities in interface IGame
Parameters:
selector - the EntitySelector that implements test that an entity must pass to be included. This value may be null (in which case all entities in the game will be returned).
Returns:
an Enumeration of all entities that the selector accepts. This value will not be null but it may be empty.

getSelectedOutOfGameEntityCount

public int getSelectedOutOfGameEntityCount(EntitySelector selector)
Count all out-of-gameEntitys that pass the given selection criteria.

Specified by:
getSelectedOutOfGameEntityCount in interface IGame
Parameters:
selector - the EntitySelector that implements test that an entity must pass to be included. This value may be null (in which case the count of all out-of-game entities will be returned).
Returns:
the int count of all entities that the selector accepts. This value will not be null but it may be empty.

checkForValidNonInfantryAndOrProtomechs

public boolean checkForValidNonInfantryAndOrProtomechs(int playerId)
Returns true if the player has any valid units this turn that are not infantry, not protomechs, or not either of those. This method is utitilized by the "A players Infantry moves after that players other units", and "A players Protomechs move after that players other units" options.

Specified by:
checkForValidNonInfantryAndOrProtomechs in interface IGame

getNemesisTargets

public java.util.Enumeration<Entity> getNemesisTargets(Entity attacker,
                                                       Coords target)
Get Entities that have have a iNarc Nemesis pod attached and are situated between two Coords

Specified by:
getNemesisTargets in interface IGame
Parameters:
attacker - The attacking Entity.
target - The Coords of the original target.
Returns:
a Enumeration of entities that have nemesis pods attached and are located between attacker and target and are friendly with the attacker.

addGameListener

public void addGameListener(GameListener listener)
Adds the specified game listener to receive board events from this board.

Specified by:
addGameListener in interface IGame
Parameters:
listener - the game listener.

removeGameListener

public void removeGameListener(GameListener listener)
Removes the specified game listener.

Specified by:
removeGameListener in interface IGame
Parameters:
listener - the game listener.

getGameListeners

public java.util.Vector<GameListener> getGameListeners()
Returns all the GameListeners.

Specified by:
getGameListeners in interface IGame
Returns:

purgeGameListeners

public void purgeGameListeners()
purges all Game Listener objects.

Specified by:
purgeGameListeners in interface IGame

processGameEvent

public void processGameEvent(GameEvent event)
Processes game events occurring on this connection by dispatching them to any registered GameListener objects.

Specified by:
processGameEvent in interface IGame
Parameters:
event - the game event.

getTagInfo

public java.util.Vector<TagInfo> getTagInfo()
Returns this turn's tag information

Specified by:
getTagInfo in interface IGame

addTagInfo

public void addTagInfo(TagInfo info)
Description copied from interface: IGame
add the results of one tag attack

Specified by:
addTagInfo in interface IGame

resetTagInfo

public void resetTagInfo()
Description copied from interface: IGame
Reset tag information

Specified by:
resetTagInfo in interface IGame

clearTagInfoShots

public void clearTagInfoShots(Entity ae,
                              Coords tc)
Description copied from interface: IGame
clears the "shots" attribute of all TagInfos where attacker is on same team as ae and target is on same mapsheet as tc

Specified by:
clearTagInfoShots in interface IGame

getFlares

public java.util.Vector<Flare> getFlares()
Get a list of flares

Specified by:
getFlares in interface IGame

setFlares

public void setFlares(java.util.Vector<Flare> flares)
Set the list of flares

Specified by:
setFlares in interface IGame

addFlare

public void addFlare(Flare flare)
Add a new flare

Specified by:
addFlare in interface IGame

isPositionIlluminated

public boolean isPositionIlluminated(Coords c)
returns true if the hex is illuminated by a flare

Specified by:
isPositionIlluminated in interface IGame

ageFlares

public java.util.Vector<Report> ageFlares()
Age the flare list and remove any which have burnt out Artillery flares drift with wind. (called at end of turn)

Specified by:
ageFlares in interface IGame

gameTimerIsExpired

public boolean gameTimerIsExpired()
Specified by:
gameTimerIsExpired in interface IGame

createVictoryConditions

public void createVictoryConditions()
use victoryfactory to generate a new victorycondition checker provided that the victorycontext is saved properly, calling this method at any time is ok and should not affect anything unless the victorycondition-configoptions have changed.

Specified by:
createVictoryConditions in interface IGame

getVictory

public Victory getVictory()
Specified by:
getVictory in interface IGame

useVectorMove

public boolean useVectorMove()
Specified by:
useVectorMove in interface IGame

addControlRoll

public void addControlRoll(PilotingRollData control)
Adds a pending Control roll to the list for this phase.

Specified by:
addControlRoll in interface IGame

getControlRolls

public java.util.Enumeration<PilotingRollData> getControlRolls()
Returns an Enumeration of pending Control rolls.

Specified by:
getControlRolls in interface IGame

resetControlRolls

public void resetControlRolls(Entity entity)
Resets the Control Roll list for a given entity.

Specified by:
resetControlRolls in interface IGame

resetControlRolls

public void resetControlRolls()
Resets the PSR list.

Specified by:
resetControlRolls in interface IGame

checkForValidSpaceStations

public boolean checkForValidSpaceStations(int playerId)
A set of checks for aero units to make sure that the movement order is maintained

Specified by:
checkForValidSpaceStations in interface IGame

checkForValidJumpships

public boolean checkForValidJumpships(int playerId)
Specified by:
checkForValidJumpships in interface IGame

checkForValidWarships

public boolean checkForValidWarships(int playerId)
Specified by:
checkForValidWarships in interface IGame

checkForValidDropships

public boolean checkForValidDropships(int playerId)
Specified by:
checkForValidDropships in interface IGame

checkForValidSmallCraft

public boolean checkForValidSmallCraft(int playerId)
Specified by:
checkForValidSmallCraft in interface IGame

getPlanetaryConditions

public PlanetaryConditions getPlanetaryConditions()
Specified by:
getPlanetaryConditions in interface IGame

setPlanetaryConditions

public void setPlanetaryConditions(PlanetaryConditions conditions)
Specified by:
setPlanetaryConditions in interface IGame

addSmokeCloud

public void addSmokeCloud(SmokeCloud cloud)
Description copied from interface: IGame
add a smoke cloud to the list of smoke clouds

Specified by:
addSmokeCloud in interface IGame

getSmokeCloudList

public java.util.List<SmokeCloud> getSmokeCloudList()
Description copied from interface: IGame
get the list of smokeclouds

Specified by:
getSmokeCloudList in interface IGame