|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javabot.JBot
public class JBot
Based on DefCon JavaBot v0.9
Nested Class Summary | |
---|---|
static class |
JBot.EventData
|
static class |
JBot.FleetData
|
static class |
JBot.UnitData
|
Constructor Summary | |
---|---|
JBot()
|
Method Summary | |
---|---|
static void |
addEvent(int _eventType,
int _causeObjectId,
int _targetObjectId,
int _unitType,
float _longitude,
float _latitude)
|
static boolean |
DebugIsReplayingGame()
True if the game is currently replayed (Timeline has been clicked). |
static void |
DebugLog(String entry)
Prints a line in the debug console in the specified color |
static void |
DebugLog(String entry,
int objectId)
Prints a line in the debug console in the specified color. |
static void |
DebugLog(String entry,
int objectId,
String tags)
Prints a line in the debug console. |
static void |
DebugLog(String entry,
int objectId,
String tags,
int colorR,
int colorG,
int colorB)
Prints a line in the debug console in the specified color. |
static void |
DebugLog(String entry,
int objectId,
String tags,
int colorR,
int colorG,
int colorB,
int colorAlpha)
Prints a line in the debug console in the specified color. |
static int[] |
GetActionQueue(int unitId)
Array of unitIds of currently queued actions, for example nukes in a silo or planes on a carrier |
static List<JBot.FleetData> |
GetAllFleetData()
Data about all visible fleets, contained in the struct fleetData (see enums). |
static int |
GetAllianceId(int teamId)
Id of alliance. |
static List<JBot.UnitData> |
GetAllUnitData()
Data about all visible units, contained in the struct unitData (see enums). |
static int[] |
GetAllUnits()
All visible unit ids. |
static float[] |
GetBomberNukeTarget(int _unitId)
Target of the nuke carried by given bomber. |
static int[] |
GetCityIds()
Array of City Ids. |
static int |
GetCityPopulation(int cityId)
Population (in millions) |
static int |
GetCollateralDamage(int teamId)
Sum of collateral damage deaths (deaths in own population) of the given team. |
static int |
GetCurrentState(int unitId)
State of unit, specified in enum STATE_*. |
static int |
GetCurrentTargetId(int unitId)
Current target id. -1 if no target is set or target is location. |
static int |
GetDefcon()
Current Defcon Stage, game starts with 5 |
static int |
GetDesiredGameSpeed(int teamId)
Currently requested game speed of given team. |
static float |
GetDistance(float longitude1,
float latitude1,
float longitude2,
float latitude2)
Distance in game between given coordinates. |
static int |
GetEnemyKills(int teamId)
Sum of enemy kills of the given team (for scoring). |
static int |
GetFleetId(int unitId)
Id of fleet of given unit. |
static float[] |
GetFleetMemberOffset(int memberCount,
int memberId)
Offset of ship number memberId from center of fleet, given fleet has memberCount ships |
static int[] |
GetFleetMembers(int _fleetId)
Ids of ships in given fleet. |
static int[] |
GetFleets(int teamId)
Fleet ids of given team. |
static int |
GetFriendlyDeaths(int teamId)
Sum of friendly deaths (deaths in allied populations) of the given team. |
static int |
GetGameSpeed()
Current speed-up factor of the game over the real time passed. |
static int |
GetGameTick()
Amount of update cycles (ticks) passed since game start |
static float |
GetGameTime()
Current Game Time, measured in seconds. |
static float |
GetLatitude(int id)
Latitude of given unit, city, or event. |
static float |
GetLongitude(int id)
Longitude of given unit, city, or event. |
static float[] |
GetMovementTargetLocation(int unitId)
Current target location. (0,0) if no target location is set. |
static int |
GetNukeSupply(int _unitId)
Number of available nukes. |
static int |
GetOptionValue(String name)
Value of certain option |
static int[] |
GetOwnFleets()
Own fleet ids. |
static int |
GetOwnTeamId()
Own team id. |
static int[] |
GetOwnUnits()
All own unit ids. |
static float |
GetRange(int unitId)
Remaining range of unit. |
static int |
GetRemainingPopulation(int teamId)
Remaining population of given team |
static int |
GetRemainingUnits(int typeId)
Amount of remaining units of given type that can be placed. |
static float |
GetSailDistance(float longitude1,
float latitude1,
float longitude2,
float latitude2)
Distance in game between given coordinates on sea (performs pathfinding). |
static int |
GetStateCount(int unitId,
int stateId)
Number of activations of given state in given unit |
static float |
GetStateTimer(int unitId)
Time until current state is active. |
static int[] |
GetSuccessfulCommands()
CommandIds of all commands that have been executed in previous cycle. |
static int |
GetTeamId(int id)
Team Id of given unit. |
static int[] |
GetTeamIds()
List of Team Ids in the game. |
static String |
GetTeamName(int teamId)
Name of the given team. |
static int[] |
GetTeamTerritories(int teamId)
Territory Ids of territories that the given team owns. |
static int |
GetTeamTerritoriesCount(int teamId)
Number of territories for given team, usually 1. |
static int[] |
GetTeamUnits(int teamId)
All visible units of a given team. |
static int |
GetTerritoryId(float longitude,
float latitude)
Territory Id of territory at given coordinates. |
static int |
GetType(int id)
Type of unit, event or team, specified in enum TYPE_*, EVENT_* or TEAM_TYPE_*. |
static int |
GetUnitCredits()
Credits available for placement (if in variable unit mode). |
static int |
GetUnitValue(int _typeId)
Value of given unit type (if in variable unit mode). |
static float[] |
GetVelocity(int unitId)
Movement direction of given unit, in longitude and latitude parts. |
static float |
GetVictoryTimer()
Time remaining in game, if victory timer was started. |
static boolean |
initialise(String[][] _commandLineOptions)
|
static boolean |
IsBorder(float longitude,
float latitude)
True if given coordinates are on the border. |
static boolean |
IsCeaseFire(int teamId1,
int teamId2)
True iff the first team is in cease fire mode with the second team. |
static boolean |
IsRetaliating(int _unitId)
True iff given unit is automatically retaliating an earlier attack. |
static boolean |
IsSharingRadar(int teamId1,
int teamId2)
True iff the first team is sharing its radar with the second team. |
static boolean |
IsValidPlacementLocation(float longitude,
float latitude,
int typeId)
True iff given location is valid for placement of given type. |
static boolean |
IsValidTerritory(int teamId,
float longitude,
float latitude,
boolean seaArea)
True if the given coordinates belong to the given Team. |
static boolean |
IsVictoryTimerActive()
True iff the victory-timer has been started |
static boolean |
IsVisible(int _unitId,
int _byTeamId)
True iff given unit is visible to given team. |
static void |
PlaceFleet(float longitude,
float latitude,
int[] shipTypes)
Tries to place a given amount of battlecruisers, carriers and subs into a fleet at the given location. |
static void |
PlaceStructure(int typeId,
float longitude,
float latitude)
Tries to place a given structure to the given coordinates. |
static void |
RequestAlliance(int allianceId)
Sends requests to the alliance members to join alliance. |
static void |
RequestCeaseFire(int teamId)
Send request to cease fire with given team. |
static void |
RequestGameSpeed(int requestedSpeedIdentifier)
Send request to change game speed to given speed. |
static void |
RequestShareRadar(int teamId)
Send request to share radar with given team. |
static void |
SendChatMessage(String chatMessage,
int receiverId)
Sends a chat message. |
static void |
SendVote(int _voteId,
int _vote)
TODO: documentation? |
static void |
SetActionTarget(int _unitId,
int _targetUnitId,
float _longitude,
float _latitude)
Set target location for given unit. |
static void |
SetLandingTarget(int _unitId,
int _targetUnitId)
TODO: what's this? |
static void |
SetMovementTarget(int unitId,
float longitude,
float latitude)
TODO: do the movement? |
static void |
SetState(int unitId,
int stateId)
Set state of given unit. |
static boolean |
update()
|
static void |
WhiteboardClear()
Clears the whiteboard. |
static void |
WhiteboardDraw(float longitude1,
float latitude1,
float longitude2,
float latitude2)
Draws a line on the whiteboard. |
static void |
WriteToConsole(String logLine)
Outputs a string to console |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATE_AIRBASEFIGHTERLAUNCH
public static final int STATE_AIRBASEBOMBERLAUNCH
public static final int STATE_BATTLESHIPATTACK
public static final int STATE_BOMBERATTACK
public static final int STATE_BOMBERNUKE
public static final int STATE_BOMBERINQUEUE
public static final int STATE_CARRIERFIGHTERLAUNCH
public static final int STATE_CARRIERBOMBERLAUNCH
public static final int STATE_CARRIERANTISUB
public static final int STATE_FIGHTERATTACK
public static final int STATE_FIGHTERINQUEUE
public static final int STATE_NUKEONTARGET
public static final int STATE_NUKEDISARM
public static final int STATE_RADARACTIVE
public static final int STATE_SILONUKE
public static final int STATE_SILOAIRDEFENSE
public static final int STATE_SUBPASSIVESONAR
public static final int STATE_SUBACTIVESONAR
public static final int STATE_SUBNUKE
public static final int CHATCHANNEL_PUBLIC
public static final int CHATCHANNEL_ALLIANCE
public static final int CHATCHANNEL_SPECTATORS
public static final int TerritoryNorthAmerica
public static final int TerritorySouthAmerica
public static final int TerritoryEurope
public static final int TerritoryRussia
public static final int TerritorySouthAsia
public static final int TerritoryAfrica
public static final int NumTerritories
public static final int EventPingSub
public static final int EventPingCarrier
public static final int EventNukeLaunchSilo
public static final int EventNukeLaunchSub
public static final int EventHit
public static final int EventDestroyed
public static final int EventPingDetection
public static final int EventCeasedFire
public static final int EventUnceasedFire
public static final int EventSharedRadar
public static final int EventUnsharedRadar
public static final int EventNewVote
public static final int EventTeamVoted
public static final int EventTeamRetractedVote
public static final int EventVoteFinishedYes
public static final int EventVoteFinishedNo
public static final int TypeInvalid
public static final int TypeCity
public static final int TypeSilo
public static final int TypeRadarStation
public static final int TypeNuke
public static final int TypeExplosion
public static final int TypeSub
public static final int TypeBattleShip
public static final int TypeAirBase
public static final int TypeFighter
public static final int TypeBomber
public static final int TypeCarrier
public static final int TypeTornado
public static final int TypeSaucer
public static final int TypeFleet
public static final int TypeGunshot
public static final int TypeQueueItem
public static final int NumObjectTypes
public static final int VoteTypeInvalid
public static final int VoteTypeJoinAlliance
public static final int VoteTypeKickPlayer
public static final int VoteTypeLeaveAlliance
public static final int VoteUnknown
public static final int VoteYes
public static final int VoteNo
public static final int VoteAbstain
Constructor Detail |
---|
public JBot()
Method Detail |
---|
public static int GetDefcon()
public static float GetGameTime()
public static int GetGameTick()
public static int GetGameSpeed()
public static float GetVictoryTimer()
public static boolean IsVictoryTimerActive()
public static int GetOptionValue(String name)
name
-
public static int[] GetCityIds()
public static int GetCityPopulation(int cityId)
cityId
-
public static int GetRemainingPopulation(int teamId)
teamId
-
public static boolean IsValidTerritory(int teamId, float longitude, float latitude, boolean seaArea)
teamId
- longitude
- latitude
- seaArea
-
public static boolean IsBorder(float longitude, float latitude)
longitude
- latitude
-
public static int GetTerritoryId(float longitude, float latitude)
longitude
- latitude
-
public static int GetOwnTeamId()
public static int[] GetTeamIds()
public static int GetTeamTerritoriesCount(int teamId)
public static int[] GetTeamTerritories(int teamId)
teamId
-
public static int GetAllianceId(int teamId)
teamId
-
public static int GetDesiredGameSpeed(int teamId)
teamId
-
public static int GetEnemyKills(int teamId)
teamId
-
public static int GetFriendlyDeaths(int teamId)
teamId
-
public static int GetCollateralDamage(int teamId)
teamId
-
public static String GetTeamName(int teamId)
teamId
-
public static boolean IsSharingRadar(int teamId1, int teamId2)
teamId1
- teamId2
-
public static boolean IsCeaseFire(int teamId1, int teamId2)
teamId1
- teamId2
-
public static void RequestAlliance(int allianceId)
allianceId
- public static void RequestCeaseFire(int teamId)
teamId
- public static void RequestShareRadar(int teamId)
teamId
- public static void RequestGameSpeed(int requestedSpeedIdentifier)
requestedSpeedIdentifier
- public static int[] GetAllUnits()
public static int[] GetOwnUnits()
public static int[] GetTeamUnits(int teamId)
teamId
-
public static int GetType(int id)
id
-
public static int GetTeamId(int id)
id
-
public static int[] GetOwnFleets()
public static int[] GetFleets(int teamId)
teamId
-
public static int[] GetFleetMembers(int _fleetId)
_fleetId
-
public static int GetFleetId(int unitId)
unitId
-
public static int GetCurrentState(int unitId)
unitId
-
public static int GetStateCount(int unitId, int stateId)
unitId
- stateId
-
public static float GetStateTimer(int unitId)
unitId
-
public static int[] GetActionQueue(int unitId)
unitId
-
public static int GetCurrentTargetId(int unitId)
unitId
-
public static float[] GetMovementTargetLocation(int unitId)
unitId
-
public static int GetNukeSupply(int _unitId)
_unitId
-
public static float[] GetBomberNukeTarget(int _unitId)
_unitId
-
public static boolean IsRetaliating(int _unitId)
_unitId
-
public static boolean IsVisible(int _unitId, int _byTeamId)
_unitId
- _byTeamId
-
public static void SetState(int unitId, int stateId)
unitId
- stateId
- public static void SetMovementTarget(int unitId, float longitude, float latitude)
unitId
- longitude
- latitude
- public static void SetActionTarget(int _unitId, int _targetUnitId, float _longitude, float _latitude)
_unitId
- _targetUnitId
- _longitude
- _latitude
- public static void SetLandingTarget(int _unitId, int _targetUnitId)
_unitId
- _targetUnitId
- public static float GetLongitude(int id)
id
-
public static float GetLatitude(int id)
id
-
public static float[] GetVelocity(int unitId)
unitId
-
public static float GetRange(int unitId)
unitId
-
public static int GetRemainingUnits(int typeId)
typeId
-
public static boolean IsValidPlacementLocation(float longitude, float latitude, int typeId)
longitude
- latitude
- typeId
-
public static float[] GetFleetMemberOffset(int memberCount, int memberId)
memberCount
- memberId
-
public static void PlaceStructure(int typeId, float longitude, float latitude)
typeId
- longitude
- latitude
- public static void PlaceFleet(float longitude, float latitude, int[] shipTypes)
longitude
- latitude
- typeShip1
- public static int GetUnitCredits()
public static int GetUnitValue(int _typeId)
_typeId
-
public static void SendVote(int _voteId, int _vote)
_voteId
- _vote
- public static void SendChatMessage(String chatMessage, int receiverId)
chatMessage
- receiverId
- public static float GetDistance(float longitude1, float latitude1, float longitude2, float latitude2)
longitude1
- latitude1
- longitude2
- latitude2
-
public static float GetSailDistance(float longitude1, float latitude1, float longitude2, float latitude2)
longitude1
- latitude1
- longitude2
- latitude2
-
public static void DebugLog(String entry)
entry
- public static void DebugLog(String entry, int objectId)
entry
- objectId
- public static void DebugLog(String entry, int objectId, String tags)
entry
- objectId
- tags
- public static void DebugLog(String entry, int objectId, String tags, int colorR, int colorG, int colorB)
entry
- objectId
- tags
- colorR
- colorG
- colorB
- public static void DebugLog(String entry, int objectId, String tags, int colorR, int colorG, int colorB, int colorAlpha)
entry
- objectId
- tags
- colorR
- colorG
- colorB
- colorAlpha
- public static boolean DebugIsReplayingGame()
public static void WhiteboardDraw(float longitude1, float latitude1, float longitude2, float latitude2)
longitude1
- latitude1
- longitude2
- latitude2
- public static void WhiteboardClear()
public static int[] GetSuccessfulCommands()
public static void WriteToConsole(String logLine)
logLine
- public static List<JBot.UnitData> GetAllUnitData()
Parse the unit data into a proper object array.
public static List<JBot.FleetData> GetAllFleetData()
Parse the unit data into a proper object array.
public static boolean update()
public static boolean initialise(String[][] _commandLineOptions)
public static void addEvent(int _eventType, int _causeObjectId, int _targetObjectId, int _unitType, float _longitude, float _latitude)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |