|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.amis.pogamut.defcon.agent.module.sensor.GameInfo
public class GameInfo
This class implements functionality that is not present within standard worldview, but it is important since it provides crucial information about the games' state.
Nested Class Summary | |
---|---|
class |
GameInfo.LocationPair
|
Constructor Summary | |
---|---|
GameInfo()
Instantiates and prepares GameInfo for operation. |
Method Summary | |
---|---|
boolean |
canCreateFleet(UnitType[] ships)
Checks whether are there enough units of each type to create a fleet of a given composition. |
boolean |
debugIsReplayingGame()
True if the game is currently replayed (Timeline has been clicked). |
int[] |
getActionQueue(int unitId)
Array of unitIds of currently queued actions, for example nukes in a silo or planes on a carrier |
LinkedList<Location> |
getAIPlacementPoints()
Returns current set of AI placement points. |
LinkedList<Integer> |
getAllEnemyTerritories()
Returns a flat list of territories possessed by enemies. |
int |
getAllianceId(int teamId)
Id of alliance. |
SortedMap<Integer,LinkedList<Integer>> |
getAlliancesWithTeamIds()
List of Alliances Team Ids in the game. |
double |
getBomberRange()
Returns range of a bomber. |
DefConLocation |
getCitiesGravityCenter(int teamId)
Returns center of gravity of given enemy's cities. |
int[] |
getCityIds()
Gets a list of cities. |
DefConLocation |
getCityLocation(int cityId)
Returns location of the given city. |
GameInfo.LocationPair |
getClosestSailDistance(List<Location> borderA,
List<Location> borderB)
Finds a closest point on given border to a given point. |
cz.cuni.amis.pogamut.defcon.agent.module.sensor.GameInfo.LocationWithDistance |
getClosestSailTarget(Location location,
List<Location> border)
Finds a closest point on given border to a given point. |
int |
getCollateralDamage(int teamId)
Sum of collateral damage deaths (deaths in own population) of the given team. |
int |
getDefconLevel()
Current Defcon Stage, game starts with 5 |
int |
getDesiredGameSpeed(int teamId)
Currently requested game speed of given team. |
SortedMap<Integer,List<Integer>> |
getEnemiesCityIds()
List of Enemies city Ids in the game. |
List<Integer> |
getEnemyCityIds()
List of Enemies city Ids in the game. |
List<Integer> |
getEnemyCityIds(int enemyId)
List of Enemy city Ids in the game. |
int |
getEnemyKills(int teamId)
Sum of enemy kills of the given team (for scoring). |
int[] |
getEnemyTeamIds()
List of Enemy Team Ids in the game. |
LinkedList<IDefConBasicEvent> |
getEvents()
Updates all flags, which in turn generates events, which are then returned in a form of LinkedList |
double |
getFighterRange()
Returns range of a fighter. |
double |
getFleetDiameter(int fleetSize)
Gets the smallest circle diameter, which could contain the whole fleet. |
int |
getFleetId(int unitId)
Id of fleet of given unit. |
Location |
getFleetMemberOffset(int memberCount,
int memberId)
Offset of ship number memberId from center of fleet, given fleet has memberCount ships |
int[] |
getFleetMembers(int fleetId)
Ids of ships in given fleet. |
int[] |
getFleets(int teamId)
Fleet ids of given team. |
int |
getFriendlyDeaths(int teamId)
Sum of friendly deaths (deaths in allied populations) of the given team. |
GameSpeed |
getGameSpeed()
Current speed-up factor of the game over the real time passed. |
int |
getGameTick()
Amount of update cycles (ticks) passed since game start |
float |
getGameTime()
Current Game Time, measured in seconds. |
int |
getNukeSupply(int unitId)
Returns amount of nukes present in the given unit. |
Location |
getObjectLocation(int objectId)
Returns a location of the given object. |
int |
getOptionValue(String name)
Value of certain option. |
int[] |
getOwnFleets()
Own fleet ids. |
int |
getOwnTeamId()
Own team id. |
int[] |
getOwnTeamTerritories()
Territory Ids of territories that the team the player is in owns. |
double |
getRadarRange()
Returns range of a single radar. |
float |
getRange(int unitId)
Remaining range of unit. |
int |
getRemainingUnits(UnitType typeId)
Amount of remaining units of given type that can be placed. |
boolean |
getRunning()
Queries gameRunning flag. |
float |
getSailDistance(double locationA_x,
double locationA_y,
double locationB_x,
double locationB_y)
Distance in game between given coordinates on sea (performs pathfinding). |
float |
getSailDistance(float locationA_x,
float locationA_y,
float locationB_x,
float locationB_y)
Distance in game between given coordinates on sea (performs pathfinding). |
float |
getSailDistance(Location locationA,
Location locationB)
Distance in game between given coordinates on sea (performs pathfinding). |
double |
getSiloRange()
Returns range of AA mode of a silo. |
int |
getStateCount(int unitId,
int stateId)
Returns number of activations of this state for this unit. |
int |
getStateCount(int unitId,
IState state)
Returns number of activations of this state for this unit. |
float |
getStateTimer(int unitId)
Time until current state is active. |
double |
getSubNukeRange()
Returns range of submarine nukes (SRBM). |
LinkedList<Location> |
getTargetCoords()
Returns current set of AI target points. |
int |
getTeamId(int id)
Team Id of given unit. |
int[] |
getTeamIds()
List of Team Ids in the game. |
String |
getTeamName(int teamId)
Name of the given team. |
int[] |
getTeamTerritories(int teamId)
Territory Ids of territories that the given team owns. |
int |
getTeamTerritoriesCount(int teamId)
Number of territories for given team, usually 1. |
int |
getTerritoriesCount()
Returns the number of territories. |
int |
getTerritoryId(double longitude,
double latitude)
Territory Id of territory at given coordinates. |
int |
getTerritoryId(float longitude,
float latitude)
Territory Id of territory at given coordinates. |
int |
getTerritoryId(Location location)
Get id of a land territory at a given location. |
int |
getTerritoryOwner(double longitude,
double latitude)
Returns the owner of a land territory, which contains given location or -1 if noone owns it. |
int |
getTerritoryOwner(int territoryId)
Returns the owner of a territory with a given Id. |
int |
getTerritoryOwner(Location center)
Returns the owner of a land territory, which contains given location or -1 if noone owns it. |
int[] |
getTerritoryOwners()
Returns the territory to owner mapping array. |
UnitType |
getType(int unitId)
Returns type of unit with this id. |
int |
getUnitCredits()
Credits available for placement (if in variable unit mode). |
int |
getUnitValue(UnitType typeId)
Value of given unit type (if in variable unit mode). |
Location |
getVelocity(int unitId)
Movement direction of given unit, in longitude and latitude parts. |
float |
getVictoryTimer()
Time remaining in game, if victory timer was started. |
boolean |
isBorder(float longitude,
float latitude)
True if given coordinates are on the border. |
boolean |
isCeaseFire(int teamId1,
int teamId2)
True iff the first team is in cease fire mode with the second team. |
boolean |
isRetaliating(int unitId)
True iff given unit is automatically retaliating an earlier attack. |
boolean |
isSharingRadar(int teamId1,
int teamId2)
True iff the first team is sharing its radar with the second team. |
boolean |
isValidBuildingPlacementLocation(double longitude,
double latitude)
True iff given location is valid for building placement. |
boolean |
isValidBuildingPlacementLocation(Location location)
True iff given location is valid for building placement. |
boolean |
isValidFleetPlacement(Location placement,
int fleetSize)
Simplifies queries for possibility of placing a fleet. |
boolean |
isValidFleetPlacementLocation(float longitude,
float latitude,
int fleetSize)
|
boolean |
isValidPlacementLocation(double longitude,
double latitude,
UnitType typeId)
True iff given location is valid for placement of given type. |
boolean |
isValidPlacementLocation(float longitude,
float latitude,
UnitType typeId)
True iff given location is valid for placement of given type. |
boolean |
isValidShipPlacementLocation(double longitude,
double latitude)
True iff given location is valid for ship placement. |
boolean |
isValidShipPlacementLocation(Location location)
True iff given location is valid for ship placement. |
boolean |
isValidStructureLocation(Location placement)
Checks validity of placement for structures. |
boolean |
isValidTerritory(int teamId,
double longitude,
double latitude,
boolean seaArea)
True if the given coordinates belong to the given Team. |
boolean |
isValidTerritory(int teamId,
float longitude,
float latitude,
boolean seaArea)
True if the given coordinates belong to the given Team. |
boolean |
isValidTerritory(int teamId,
Location location,
boolean seaArea)
True if the given coordinates belong to the given Team. |
boolean |
isVictoryTimerActive()
True iff the victory-timer has been started |
boolean |
isVisible(int unitId,
int byTeamId)
True iff given unit is visible to given team. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GameInfo()
Method Detail |
---|
public LinkedList<IDefConBasicEvent> getEvents()
public final LinkedList<Location> getAIPlacementPoints()
public final LinkedList<Location> getTargetCoords()
public int getDefconLevel()
public float getGameTime()
public int getGameTick()
public GameSpeed getGameSpeed()
public float getVictoryTimer()
public boolean isVictoryTimerActive()
public int getOptionValue(String name)
Black_Hand: no idea what it does, might be related to the game settings (advanced options in game hosting) like CityPopulations. Expected to be called like: getOptionValue("CityPopulations").
name
-
public boolean debugIsReplayingGame()
public int getTeamId(int id)
id
-
public int[] getOwnFleets()
public int[] getFleets(int teamId)
teamId
-
public int[] getFleetMembers(int fleetId)
fleetId
-
public int getFleetId(int unitId)
unitId
-
public float getStateTimer(int unitId)
unitId
-
public int[] getActionQueue(int unitId)
unitId
-
public boolean isRetaliating(int unitId)
unitId
-
public boolean isVisible(int unitId, int byTeamId)
unitId
- byTeamId
-
public Location getVelocity(int unitId)
unitId
-
public float getRange(int unitId)
unitId
-
public int getRemainingUnits(UnitType typeId)
typeId
-
public boolean isValidPlacementLocation(float longitude, float latitude, UnitType typeId)
longitude
- latitude
- typeId
-
public boolean isValidPlacementLocation(double longitude, double latitude, UnitType typeId)
longitude
- latitude
- typeId
-
public boolean isValidShipPlacementLocation(Location location)
longitude
- latitude
-
public boolean isValidShipPlacementLocation(double longitude, double latitude)
longitude
- latitude
-
public boolean isValidBuildingPlacementLocation(Location location)
location
-
public boolean isValidBuildingPlacementLocation(double longitude, double latitude)
longitude
- latitude
-
public boolean isValidFleetPlacementLocation(float longitude, float latitude, int fleetSize)
public int getUnitCredits()
public int getUnitValue(UnitType typeId)
typeId
-
public float getSailDistance(Location locationA, Location locationB)
locationA
- locationB
-
public float getSailDistance(double locationA_x, double locationA_y, double locationB_x, double locationB_y)
locationA
- locationB
-
public float getSailDistance(float locationA_x, float locationA_y, float locationB_x, float locationB_y)
locationA_x
- locationB_x
-
public cz.cuni.amis.pogamut.defcon.agent.module.sensor.GameInfo.LocationWithDistance getClosestSailTarget(Location location, List<Location> border)
location
- border
-
public GameInfo.LocationPair getClosestSailDistance(List<Location> borderA, List<Location> borderB)
borderA
- borderB
-
public boolean isValidTerritory(int teamId, float longitude, float latitude, boolean seaArea)
teamId
- longitude
- latitude
- seaArea
-
public boolean isValidTerritory(int teamId, double longitude, double latitude, boolean seaArea)
teamId
- longitude
- latitude
- seaArea
-
public boolean isValidTerritory(int teamId, Location location, boolean seaArea)
teamId
- location
- seaArea
-
public boolean isBorder(float longitude, float latitude)
longitude
- latitude
-
public int getTerritoryId(float longitude, float latitude)
longitude
- latitude
-
public int getTerritoryId(double longitude, double latitude)
longitude
- latitude
-
public int getOwnTeamId()
public int[] getTeamIds()
public SortedMap<Integer,LinkedList<Integer>> getAlliancesWithTeamIds()
public int[] getEnemyTeamIds()
public SortedMap<Integer,List<Integer>> getEnemiesCityIds()
public List<Integer> getEnemyCityIds()
public List<Integer> getEnemyCityIds(int enemyId)
public int getTeamTerritoriesCount(int teamId)
public int[] getTeamTerritories(int teamId)
teamId
-
public int[] getOwnTeamTerritories()
public int getAllianceId(int teamId)
teamId
-
public int getDesiredGameSpeed(int teamId)
teamId
-
public int getEnemyKills(int teamId)
teamId
-
public int getFriendlyDeaths(int teamId)
teamId
-
public int getCollateralDamage(int teamId)
teamId
-
public String getTeamName(int teamId)
teamId
-
public boolean isSharingRadar(int teamId1, int teamId2)
teamId1
- teamId2
-
public boolean isCeaseFire(int teamId1, int teamId2)
teamId1
- teamId2
-
public Location getFleetMemberOffset(int memberCount, int memberId)
memberCount
- memberId
-
public boolean getRunning()
public boolean isValidFleetPlacement(Location placement, int fleetSize)
placement
- location, where to check the placement validity.fleetSize
- number of units in the fleet.
public double getFleetDiameter(int fleetSize)
fleetSize
-
public LinkedList<Integer> getAllEnemyTerritories()
public boolean isValidStructureLocation(Location placement)
placement
- location, where to check the placement validity.
public int getNukeSupply(int unitId)
unitId
-
public UnitType getType(int unitId)
unitId
- id of unit
public int getStateCount(int unitId, IState state)
unitId
- id of unitstate
- state for the unit
public int getStateCount(int unitId, int stateId)
unitId
- id of unitstateId
- stateId for the unit
public int[] getTerritoryOwners()
public int getTerritoryOwner(Location center)
center
-
public int getTerritoryOwner(double longitude, double latitude)
longitude
- latitude
-
public int getTerritoryOwner(int territoryId)
territoryId
-
public int getTerritoryId(Location location)
location
-
public int getTerritoriesCount()
public int[] getCityIds()
public Location getObjectLocation(int objectId)
objectId
-
public boolean canCreateFleet(UnitType[] ships)
ships
-
public double getSubNukeRange()
public double getBomberRange()
public double getRadarRange()
public double getFighterRange()
public double getSiloRange()
public DefConLocation getCitiesGravityCenter(int teamId)
teamId
-
public DefConLocation getCityLocation(int cityId)
cityId
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |