BWAPI
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes
UnitAgent Class Reference

#include <UnitAgent.h>

Inheritance diagram for UnitAgent:
Inheritance graph
[legend]
Collaboration diagram for UnitAgent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UnitAgent (Unit *mUnit)
 UnitAgent ()
void computeActions ()
void computeKitingActions ()
string getTypeName ()
virtual void setGoal (TilePosition goal)
virtual void clearGoal ()
int friendlyUnitsWithinRange ()
int friendlyUnitsWithinRange (int maxRange)
int friendlyUnitsWithinRange (TilePosition tilePos, int maxRange)
int enemyAttackingUnitsWithinRange ()
int enemyAttackingUnitsWithinRange (int maxRange, TilePosition center)
int enemyAttackingUnitsWithinRange (UnitType type)
int enemyUnitsWithinRange (int maxRange)
int enemyGroundUnitsWithinRange (int maxRange)
int enemySiegedTanksWithinRange (TilePosition center)
int enemyGroundAttackingUnitsWithinRange (TilePosition center, int maxRange)
int enemyAirUnitsWithinRange (int maxRange)
bool useDefensiveMode ()
int enemyAirToGroundUnitsWithinRange (int maxRange)
int enemyAirAttackingUnitsWithinRange (TilePosition center, int maxRange)
int getGroundRange ()
int getAirRange ()
void assignToExplore ()
void assignToAttack ()
void assignToDefend ()
bool isExploring ()
bool isAttacking ()
bool isDefending ()
bool isBunkered ()
UnitgetClosestOrganicEnemy (int maxRange)
UnitgetClosestShieldedEnemy (int maxRange)
UnitgetClosestEnemyTurret (int maxRange)
UnitgetClosestEnemyAirDefense (int maxRange)
bool chargeShields ()
virtual void printInfo ()

Static Public Member Functions

static int getGroundRange (UnitType type)
static bool canAttack (UnitType attacker, UnitType target)
static int getAirRange (UnitType type)

Public Attributes

int dropped

Protected Attributes

int currentState

Static Protected Attributes

static const int ATTACK = 1
static const int EXPLORE = 2
static const int DEFEND = 3
static const int BUNKERED = 4

Detailed Description

The UnitAgent is the base agent class for all agents handling mobile units. If a unit is created and no specific agent for that type is found, the unit is assigned to a UnitAgents. UnitAgents can attack and assist building under enemy fire, but cannot use any special abilities. To use abilities such as Terran Vultures dropping spider mines, an agent implementation for that unit type must be created.

Author: Johan Hagelback (johan.hagelback@gmail.com)


Constructor & Destructor Documentation

UnitAgent::UnitAgent ( Unit mUnit)

Here is the call graph for this function:


Member Function Documentation

void UnitAgent::assignToAttack ( ) [virtual]

Assigns this agent to be in the attack force.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

void UnitAgent::assignToDefend ( ) [virtual]

Assigns this agent to defend the base.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

void UnitAgent::assignToExplore ( ) [virtual]

Assigns this agent to explore the game world.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

bool UnitAgent::canAttack ( UnitType  attacker,
UnitType  target 
) [static]

Returns true if the attacker UnitType can attack target UnitType. Note: Does not take spells into account, only weapons.

Here is the call graph for this function:

Here is the caller graph for this function:

Orders a Protoss unit to recharge shields.

Here is the call graph for this function:

Here is the caller graph for this function:

void UnitAgent::clearGoal ( ) [virtual]

Clears the goal for this unit.

Reimplemented from BaseAgent.

Reimplemented in ReaverAgent.

void UnitAgent::computeActions ( ) [virtual]

Handles actions for kiting agents.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::enemyAirAttackingUnitsWithinRange ( TilePosition  center,
int  maxRange 
)

Returns the number of flying unit that are within maxRange of the center tile, and can attack the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the number of flying units that can target ground and are within maxRange of the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::enemyAirUnitsWithinRange ( int  maxRange)

Returns the number of flying units that are within maxRange of the agent.

Here is the call graph for this function:

Returns the number of enemy units and buildings that can attack and are within firerange of the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::enemyAttackingUnitsWithinRange ( int  maxRange,
TilePosition  center 
)

Returns the number of enemy units and buildings that can attack and are within range of the center tile.

Here is the call graph for this function:

Returns the number of enemy units and buildings that can attack and are within firerange of the specified unit type.

Here is the call graph for this function:

Returns the number of enemy ground units and buildings that are within maxRange of the center tile, and can attack the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the number of enemy ground units and buildings that are within maxRange of the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Calculates the number of enemy sieged Siege Tanks within Siege Tank range.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::enemyUnitsWithinRange ( int  maxRange)

Returns the number of enemy units and buildings that are within maxRange of the agent.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the number of own units that are within 6 tiles range of the agent.

int UnitAgent::friendlyUnitsWithinRange ( int  maxRange)

Returns the number of own units that are within maxRange of the agent.

Here is the call graph for this function:

int UnitAgent::friendlyUnitsWithinRange ( TilePosition  tilePos,
int  maxRange 
)

Returns the number of own units that are within maxRange of the specified tile.

Here is the call graph for this function:

Returns the max firerange of the air weapon this agent has, or -1 if it cannot attack air.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::getAirRange ( UnitType  type) [static]

Returns the max firerange of the ground weapon a unit of the specified type has, or -1 if it cannot attack air.

Here is the call graph for this function:

Returns the closest enemy turret, other attacking building or mechanical unit within maxRange that can attack air units, or NULL if not found.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the closest enemy turret or other attacking building within maxRange, or NULL if not found.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the closest organic enemy unit within maxRange, or NULL if not found.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the closest enemy unit that is shielded and within maxRange, or NULL if not found.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the max firerange of the ground weapon this agent has, or -1 if it cannot attack ground.

Here is the call graph for this function:

Here is the caller graph for this function:

int UnitAgent::getGroundRange ( UnitType  type) [static]

Returns the max firerange of the ground weapon a unit of the specified type has, or -1 if it cannot attack ground.

Here is the call graph for this function:

string UnitAgent::getTypeName ( ) [virtual]
bool UnitAgent::isAttacking ( ) [virtual]

Returns true if this agent is used to attack the enemy.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

Returns true if this agent is inside a Terran Bunker.

Reimplemented in MarineAgent, and FirebatAgent.

Here is the caller graph for this function:

bool UnitAgent::isDefending ( ) [virtual]

Returns true if this agent is defending the own base.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

bool UnitAgent::isExploring ( ) [virtual]

Returns true if this agent is used to explore the game world.

Reimplemented from BaseAgent.

Here is the caller graph for this function:

void UnitAgent::printInfo ( ) [virtual]

Used to print info about this agent to the screen.

Reimplemented from BaseAgent.

Here is the call graph for this function:

void UnitAgent::setGoal ( TilePosition  goal) [virtual]

Sets the goal for this unit. Goals are set from either the SquadCommander for attacking or defending units, or from ExplorationManager for explore units.

Reimplemented from BaseAgent.

Reimplemented in ReaverAgent.

Here is the call graph for this function:

Checks if a unit can be in defensive mode. This happens if 1) the unit is in cooldown and 2) there are opponent units that can attack it.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const int UnitAgent::ATTACK = 1 [static, protected]
const int UnitAgent::BUNKERED = 4 [static, protected]
int UnitAgent::currentState [protected]
const int UnitAgent::DEFEND = 3 [static, protected]
const int UnitAgent::EXPLORE = 2 [static, protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines