megamek.common
Interface IGame

All Known Implementing Classes:
Game

public interface IGame

This interface 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. note from itmo: this needs WAY MORE javadoc. also preferably remove the abstract-modifiers and divide this interface into two subinterfaces for reading and modifying. -stuff should be documented as contracts. bad example of javadoccing found in getVictory* ... also phases should be documented. wtf is an exchange-phase?


Nested Class Summary
static class IGame.Phase
           
 
Method Summary
 int actionsSize()
           
 void addAction(EntityAction ea)
          Adds the specified action to the actions list for this phase.
 void addAttack(AttackHandler ah)
           
 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 Game.
 void addInitiativeRerollRequest(Team t)
           
 void addMinefield(Minefield mf)
          Addds the specified minefield
 void addMinefields(java.util.Vector<Minefield> minefields)
          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 ram 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 tele-missile 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)
           
 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
 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()
           
 java.util.Vector<AttackHandler> getAttacksVector()
           
 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 roll.
 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)
          Returns a Vector of the active entities at the given coordinates.
 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)
          Returns a Vector of the gun emplacements at the given coordinates.
 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 deployed entities owned by the player.
 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 ram attacks scheduled for the end of the physical phase.
 java.util.Vector<AttackAction> getRamsVector()
          Returns the ram 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()
          Return the immutable vector of teams
 java.util.Enumeration<AttackAction> getTeleMissileAttacks()
          Returns an Enumeration of telemissile attacks scheduled for the end of the physical phase.
 java.util.Vector<AttackAction> getTeleMissileAttacksVector()
          Returns the telemissile attack 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 remaining selectable Vehicles owned by a player.
 java.util.Vector<Minefield> getVibrabombs()
           
 Victory getVictory()
           
 java.util.HashMap<java.lang.String,java.lang.Object> getVictoryContext()
           
 int getVictoryPlayerId()
          Getter for property victoryPlayerId. itmo: apparently this is the guy who claims to have won the game also used to tell who won when the game is won
 int getVictoryTeam()
          Getter for property victoryTeam. corresponding claiming/winning team if the player is in a team
 java.util.Enumeration<Entity> getWreckedEntities()
          Returns an enumeration of wrecked entities.
 boolean hasEntity(int entityId)
           
 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. this tells us that a claim for victory is active.
 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 phase)
          Returns true if this phase has turns.
 void processGameEvent(GameEvent event)
          Processes game events 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)
           
 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 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 by removing all entities.
 void resetActions()
          Resets the actions list.
 void resetAttacks()
           
 void resetCharges()
          Resets the pending charges list.
 void resetControlRolls()
          Resets the Control Roll 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 ram list.
 void resetTagInfo()
          Reset tag information
 void resetTeleMissileAttacks()
          Resets the pending telemissile attack 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)
           
 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
 boolean useVectorMove()
           
 

Method Detail

getExternalGameId

int getExternalGameId()

setExternalGameId

void setExternalGameId(int value)

getVictoryContext

java.util.HashMap<java.lang.String,java.lang.Object> getVictoryContext()
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

void setVictoryContext(java.util.HashMap<java.lang.String,java.lang.Object> ctx)
set the game victory state.


addGameListener

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

Parameters:
listener - the game listener.

removeGameListener

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

Parameters:
listener - the game listener.

getGameListeners

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

Returns:

purgeGameListeners

void purgeGameListeners()
purges all Game Listener objects.


processGameEvent

void processGameEvent(GameEvent event)
Processes game events by dispatching them to any registered GameListener objects.

Parameters:
event - the game event.

containsMinefield

boolean containsMinefield(Coords coords)
Check if there is a minefield at given coords

Parameters:
coords - coords to check
Returns:
true if there is a minefield at given coords or false otherwise

getMinefields

java.util.Vector<Minefield> getMinefields(Coords coords)
Get the minefields at specified coords

Parameters:
coords -
Returns:
the Vector of minefields at specified coord

getNbrMinefields

int getNbrMinefields(Coords coords)
Get the number of the minefields at specified coords

Parameters:
coords -
Returns:
the number of the minefields at specified coord

getMinedCoords

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

Returns:
an Enumeration of the Coords containing minefilds. This will not be null.

addMinefield

void addMinefield(Minefield mf)
Addds the specified minefield

Parameters:
mf - minefield to add

addMinefields

void addMinefields(java.util.Vector<Minefield> minefields)
Adds a number of minefields

Parameters:
minefields - the Vector of the minefields to add

setMinefields

void setMinefields(java.util.Vector<Minefield> minefields)
Sets the minefields to the given Vector of the minefields

Parameters:
minefields -

resetMinefieldDensity

void resetMinefieldDensity(java.util.Vector<Minefield> newMinefields)
Resets the minefield density for a given Vector of minefields

Parameters:
newMinefields -

removeMinefield

void removeMinefield(Minefield mf)
Removes the specified minefield

Parameters:
mf - minefield to remove

clearMinefields

void clearMinefields()
Removes all minefields


getVibrabombs

java.util.Vector<Minefield> getVibrabombs()
Returns:
the Vector of the vibrabombs

addVibrabomb

void addVibrabomb(Minefield mf)
Addds the specified vibrabomb

Parameters:
mf - Vibrabomb to add

removeVibrabomb

void removeVibrabomb(Minefield mf)
Removes the specified Vibrabomb

Parameters:
mf - Vibrabomb to remove

containsVibrabomb

boolean containsVibrabomb(Minefield mf)
Checks if the game contains the specified Vibrabomb

Parameters:
mf - the Vibrabomb to ceck
Returns:
true iff the minefield contains a vibrabomb.

getOptions

GameOptions getOptions()
Returns:
game options

setOptions

void setOptions(GameOptions options)
sets the game options

Parameters:
options -

getBoard

IBoard getBoard()
Returns:
the game board

setBoard

void setBoard(IBoard board)
Sets the new game board

Parameters:
board -

getTeams

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


getNoOfTeams

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


getTeamsVector

java.util.Vector<Team> getTeamsVector()
Return the immutable vector of teams


getTeamForPlayer

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


setupTeams

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


getPlayers

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


getPlayersVector

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


getNoOfPlayers

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


getPlayer

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


addPlayer

void addPlayer(int id,
               Player player)

setPlayer

void setPlayer(int id,
               Player player)

removePlayer

void removePlayer(int id)

getEntitiesOwnedBy

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.


getAllEntitiesOwnedBy

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


getLiveEntitiesOwnedBy

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


getLiveDeployedEntitiesOwnedBy

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


getLiveCommandersOwnedBy

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


hasTacticalGenius

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


getValidTargets

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


phaseHasTurns

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


isPhaseSimultaneous

boolean isPhaseSimultaneous()
Returns:
true if the current phase can be played simultaneously

getTurn

GameTurn getTurn()
Returns the current GameTurn object


getTurnForPlayer

GameTurn getTurnForPlayer(int pn)
Returns:
the first GameTurn object for the specified player, or null if the player has no turns to play

changeToNextTurn

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


resetTurnIndex

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


hasMoreTurns

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


insertNextTurn

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


getTurns

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


getTurnIndex

int getTurnIndex()
Returns the current turn index


setTurnIndex

void setTurnIndex(int turnIndex)
Sets the current turn index


getTurnVector

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


setTurnVector

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


getPhase

IGame.Phase getPhase()

setPhase

void setPhase(IGame.Phase phase)

getLastPhase

IGame.Phase getLastPhase()

setLastPhase

void setLastPhase(IGame.Phase lastPhase)

setDeploymentComplete

void setDeploymentComplete(boolean deploymentComplete)

isDeploymentComplete

boolean isDeploymentComplete()

setupRoundDeployment

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


checkForCompleteDeployment

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


shouldDeployThisRound

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


shouldDeployForRound

boolean shouldDeployForRound(int round)

clearDeploymentThisRound

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


getUndeployedEntities

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


getEntities

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


getEntitiesVector

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


setEntitiesVector

void setEntitiesVector(java.util.Vector<Entity> entities)

getOutOfGameEntitiesVector

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


getOutOfGameEntity

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

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.

setOutOfGameEntitiesVector

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

Parameters:
vOutOfGame - - the new Vector of dead or fled units. This value should not be null.

getC3NetworkMembers

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).

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

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.

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

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.

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

getGraveyardEntities

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


getWreckedEntities

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


getRetreatedEntities

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


getDevastatedEntities

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


getNoOfEntities

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


getTarget

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


getEntity

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


addEntity

void addEntity(int id,
               Entity entity)

setEntity

void setEntity(int id,
               Entity entity)

setEntity

void setEntity(int id,
               Entity entity,
               java.util.Vector<UnitLocation> movePath)

getNextEntityId

int getNextEntityId()
Returns:
int containing an unused entity id

hasEntity

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

removeEntity

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.


reset

void reset()
Resets this game by removing all entities.


addSmokeCloud

void addSmokeCloud(SmokeCloud cloud)
add a smoke cloud to the list of smoke clouds


getSmokeCloudList

java.util.List<SmokeCloud> getSmokeCloudList()
get the list of smokeclouds


getFirstEntity

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

Parameters:
c - the coordinates to search at

getFirstEnemyEntity

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

Parameters:
c - the coordinates to search at
currentEntity - the entity that is firing

getEntities

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


getEntitiesVector

java.util.Vector<Entity> getEntitiesVector(Coords c)
Returns a Vector of the active entities at the given coordinates.


getGunEmplacements

java.util.Vector<GunEmplacement> getGunEmplacements(Coords c)
Returns a Vector of the gun emplacements at the given coordinates.


getAffaTarget

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

Parameters:
c - The Coords of the hex in which the accidental fall from above happens
ignore - The entity who is falling, so shouldn't be returned
Returns:
The Entity that should be an AFFA target.

getEnemyEntities

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

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

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

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

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


isOutOfGame

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

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

isOutOfGame

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

Parameters:
entity - - the Entity to be checked.
Returns:
true if the Entity is in the graveyard, false otherwise.

getFirstEntity

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


getFirstEntity

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


getFirstEntityNum

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


getFirstEntityNum

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


getNextEntity

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

Parameters:
start - the index number to start at

getNextEntityNum

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

Parameters:
start - the index number to start at

getNextEntityNum

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

Parameters:
turn - the turn to use
start - the entity id to start at

getFirstDeployableEntityNum

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


getFirstDeployableEntityNum

int getFirstDeployableEntityNum(GameTurn turn)

getNextDeployableEntityNum

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


getNextDeployableEntityNum

int getNextDeployableEntityNum(GameTurn turn,
                               int start)

getPlayerEntities

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

Parameters:
player - - the Player whose entities are required.
hide - - should fighters loaded into squadrons be excluded from this list?
Returns:
a Vector of Entitys.

isEntityStranded

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.

Parameters:
entity - the Entity that may be stranded
Returns:
true if the entity is stranded false otherwise.

getInfantryLeft

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


getProtomechsLeft

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


getVehiclesLeft

int getVehiclesLeft(int playerId)
Returns the number of remaining selectable Vehicles owned by a player.


removeTurnFor

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.


removeFirstTurnFor

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


checkForMagneticClamp

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.

Returns:
true if a unit was updated, false if no player has a Battle Armor squad equipped with a Magnetic Clamp.

addAction

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


addAttack

void addAttack(AttackHandler ah)

removeAttack

void removeAttack(AttackHandler ah)

getAttacks

java.util.Enumeration<AttackHandler> getAttacks()

getAttacksVector

java.util.Vector<AttackHandler> getAttacksVector()

resetAttacks

void resetAttacks()

getArtillerySize

int getArtillerySize()

setArtilleryVector

void setArtilleryVector(java.util.Vector<ArtilleryAttackAction> v)

getArtilleryAttacks

java.util.Enumeration<ArtilleryAttackAction> getArtilleryAttacks()

setAttacksVector

void setAttacksVector(java.util.Vector<AttackHandler> v)

getActions

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


resetActions

void resetActions()
Resets the actions list.


removeActionsFor

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


removeAction

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

Parameters:
o - The action to remove.

actionsSize

int actionsSize()

getActionsVector

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.


addInitiativeRerollRequest

void addInitiativeRerollRequest(Team t)

rollInitAndResolveTies

void rollInitAndResolveTies()

getNoOfInitiativeRerollRequests

int getNoOfInitiativeRerollRequests()

addCharge

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


getCharges

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


resetCharges

void resetCharges()
Resets the pending charges list.


getChargesVector

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


addRam

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


getRams

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


resetRams

void resetRams()
Resets the pending ram list.


getRamsVector

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


addTeleMissileAttack

void addTeleMissileAttack(AttackAction ea)
Adds a pending tele-missile attack to the list for this phase.


getTeleMissileAttacks

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


resetTeleMissileAttacks

void resetTeleMissileAttacks()
Resets the pending telemissile attack list.


getTeleMissileAttacksVector

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


addPSR

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


getPSRs

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


addExtremeGravityPSR

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


getExtremeGravityPSRs

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


resetPSRs

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


resetExtremeGravityPSRs

void resetExtremeGravityPSRs()
Resets the extreme Gravity PSR list.


resetExtremeGravityPSRs

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


resetPSRs

void resetPSRs()
Resets the PSR list.


getRoundCount

int getRoundCount()
Getter for property roundCount.

Returns:
Value of property roundCount.

setRoundCount

void setRoundCount(int roundCount)

incrementRoundCount

void incrementRoundCount()
Increments the round counter


isForceVictory

boolean isForceVictory()
Getter for property forceVictory. this tells us that a claim for victory is active.

Returns:
Value of property forceVictory.

setForceVictory

void setForceVictory(boolean forceVictory)
Setter for property forceVictory.

Parameters:
forceVictory - New value of property forceVictory.

addReports

void addReports(java.util.Vector<Report> v)
Adds the given reports vector to the GameReport collection.

Parameters:
v - Vector of reports

getReports

java.util.Vector<Report> getReports(int r)
Returns a vector of reports for the given round.

Parameters:
r - Round number

getAllReports

java.util.Vector<java.util.Vector<Report>> getAllReports()
Returns a vector of all the reports.


setAllReports

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.


clearAllReports

void clearAllReports()
Clears out all the current reports, paving the way for a new game.


end

void end(int winner,
         int winnerTeam)

getVictoryPlayerId

int getVictoryPlayerId()
Getter for property victoryPlayerId. itmo: apparently this is the guy who claims to have won the game also used to tell who won when the game is won

Returns:
Value of property victoryPlayerId.

setVictoryPlayerId

void setVictoryPlayerId(int victoryPlayerId)
Setter for property victoryPlayerId.

Parameters:
victoryPlayerId - New value of property victoryPlayerId.

getVictoryTeam

int getVictoryTeam()
Getter for property victoryTeam. corresponding claiming/winning team if the player is in a team

Returns:
Value of property victoryTeam.

setVictoryTeam

void setVictoryTeam(int victoryTeam)
Setter for property victoryTeam.

Parameters:
victoryTeam - New value of property victoryTeam.

isPlayerVictor

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.


isPlayerVictor

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


getSelectedEntities

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

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

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

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

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

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

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

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

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.


getNemesisTargets

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

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.

getPreviousEntityFromList

Entity getPreviousEntityFromList(Entity current)
Returns the previous entity from the master list of entities. Will wrap around to the end of the list if necessary.

Parameters:
current - The Entity whose list position you wish to start from.
Returns:
The previous Entity in the list.

getNextEntityFromList

Entity getNextEntityFromList(Entity current)
Returns the next entity from the master list of entities. Will wrap around to the begining of the list if necessary.

Parameters:
current - The Entity whose list position you wish to start from.
Returns:
The next Entity in the list.

getTagInfo

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


addTagInfo

void addTagInfo(TagInfo info)
add the results of one tag attack


clearTagInfoShots

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


resetTagInfo

void resetTagInfo()
Reset tag information


getFlares

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


setFlares

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


addFlare

void addFlare(Flare flare)
Add a new flare


isPositionIlluminated

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


ageFlares

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)


gameTimerIsExpired

boolean gameTimerIsExpired()

createVictoryConditions

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.


getVictory

Victory getVictory()

useVectorMove

boolean useVectorMove()

addControlRoll

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


getControlRolls

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


resetControlRolls

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


resetControlRolls

void resetControlRolls()
Resets the Control Roll list.


checkForValidSpaceStations

boolean checkForValidSpaceStations(int playerId)

checkForValidJumpships

boolean checkForValidJumpships(int playerId)

checkForValidWarships

boolean checkForValidWarships(int playerId)

checkForValidDropships

boolean checkForValidDropships(int playerId)

checkForValidSmallCraft

boolean checkForValidSmallCraft(int playerId)

getPlanetaryConditions

PlanetaryConditions getPlanetaryConditions()

setPlanetaryConditions

void setPlanetaryConditions(PlanetaryConditions conditions)