BTHAI 2.3
Public Member Functions | Static Public Member Functions | Protected Attributes
BaseAgent Class Reference

#include <BaseAgent.h>

Inheritance diagram for BaseAgent:
StructureAgent UnitAgent WorkerAgent BunkerAgent CommandCenterAgent FleetBeaconAgent HatcheryAgent NexusAgent RefineryAgent ArbiterAgent BattlecruiserAgent CarrierAgent CorsairAgent DarkTemplarAgent DefilerAgent DevourerAgent DragoonAgent DropshipAgent FirebatAgent GhostAgent GoliathAgent GuardianAgent HighTemplarAgent HydraliskAgent InfestedTerranAgent LurkerAgent MarineAgent MedicAgent MutaliskAgent ObserverAgent OverlordAgent QueenAgent ReaverAgent ScienceVesselAgent ScourgeAgent ScoutAgent ShuttleAgent SiegeTankAgent UltraliskAgent ValkyrieAgent VultureAgent WraithAgent ZealotAgent ZerglingAgent

List of all members.

Public Member Functions

 BaseAgent ()
 BaseAgent (Unit *mUnit)
 ~BaseAgent ()
virtual void computeActions ()
int noUnitsInWeaponRange ()
bool canAttack (Unit *target)
bool canAttack (UnitType type)
virtual void setGoal (TilePosition goal)
virtual void clearGoal ()
TilePosition getGoal ()
void setActionFrame ()
int getLastActionFrame ()
virtual string getTypeName ()
virtual bool assignToBuild (UnitType type)
virtual bool assignToRepair (Unit *building)
virtual bool assignToFinishBuild (Unit *building)
virtual void assignToExplore ()
virtual void assignToAttack ()
virtual void assignToDefend ()
virtual bool isExploring ()
virtual bool isAttacking ()
virtual bool isDefending ()
virtual void printInfo ()
void setInfo (string mInfo)
virtual bool canBuild (UnitType type)
int getUnitID ()
UnitType getUnitType ()
Unit * getUnit ()
virtual void destroyed ()
bool isAlive ()
bool matches (Unit *mUnit)
bool isOfType (UnitType type)
bool isDetectorWithinRange (TilePosition pos, int range)
bool isBuilding ()
bool isWorker ()
bool isFreeWorker ()
bool isUnit ()
bool isUnderAttack ()
bool isDamaged ()
void setSquadID (int id)
int getSquadID ()

Static Public Member Functions

static bool isOfType (Unit *mUnit, UnitType type)
static bool isOfType (UnitType mType, UnitType toCheckType)
static bool doScannerSweep (TilePosition pos)
static bool doEnsnare (TilePosition pos)

Protected Attributes

Unit * unit
TilePosition goal
int unitID
int squadID
bool alive
int lastActionFrame
string info
bool bBlock

Detailed Description

The BaseAgent is the base agent class all agent classes directly or indirectly must extend. It contains some common logic that is needed for several other agent implementations.

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


Constructor & Destructor Documentation

BaseAgent::BaseAgent ( )

Default constructor. Not used.

BaseAgent::BaseAgent ( Unit *  mUnit)

Constructor.

BaseAgent::~BaseAgent ( )

Destructor.


Member Function Documentation

virtual void BaseAgent::assignToAttack ( ) [inline, virtual]

Assigns this agent to be in the attack force.

Reimplemented in UnitAgent.

virtual bool BaseAgent::assignToBuild ( UnitType  type) [inline, virtual]

Assigns the agent to build the specified type of unit.

Reimplemented in WorkerAgent.

virtual void BaseAgent::assignToDefend ( ) [inline, virtual]

Assigns this agent to defend the base.

Reimplemented in UnitAgent.

virtual void BaseAgent::assignToExplore ( ) [inline, virtual]

Assigns this agent to explore the game world.

Reimplemented in UnitAgent.

virtual bool BaseAgent::assignToFinishBuild ( Unit *  building) [inline, virtual]

Assigns the agent to continue building a non-finished building.

Reimplemented in WorkerAgent.

virtual bool BaseAgent::assignToRepair ( Unit *  building) [inline, virtual]

Assigns the agent to repair a unit.

Reimplemented in WorkerAgent.

bool BaseAgent::canAttack ( Unit *  target)

Checks if this unit can attack the specified target unit.

bool BaseAgent::canAttack ( UnitType  type)

Checks if this unit can attack the specified unit type.

bool BaseAgent::canBuild ( UnitType  type) [virtual]

Returns true if this agent can build units of the specified type.

Reimplemented in WorkerAgent.

void BaseAgent::clearGoal ( ) [virtual]

Clears the goal for this unit.

Reimplemented in ReaverAgent, and UnitAgent.

virtual void BaseAgent::computeActions ( ) [inline, virtual]
void BaseAgent::destroyed ( ) [virtual]

Called when the unit assigned to this agent is destroyed.

Reimplemented in WorkerAgent.

bool BaseAgent::doEnsnare ( TilePosition  pos) [static]

Orders the Zerg Queen to do an Ensnare at the specified area.

bool BaseAgent::doScannerSweep ( TilePosition  pos) [static]

Orders the Terran Comsat Station to do a Scanner Sweep at the specified area.

TilePosition BaseAgent::getGoal ( )

Returns the current goal for this unit.

int BaseAgent::getLastActionFrame ( )

Returns the last frame this agent was issued an order.

int BaseAgent::getSquadID ( )

Returns the squad this agent belongs to, or -1 if it doesnt belong to any squad.

virtual string BaseAgent::getTypeName ( ) [inline, virtual]
Unit * BaseAgent::getUnit ( )

Returns a reference to the unit assigned to this agent.

int BaseAgent::getUnitID ( )

Returns the unique id for this agent. Agent id is the same as the id of the unit assigned to the agent.

UnitType BaseAgent::getUnitType ( )

Returns the type for the unit handled by this agent.

bool BaseAgent::isAlive ( )

Returns true if this agent is active, i.e. the unit is not destroyed.

virtual bool BaseAgent::isAttacking ( ) [inline, virtual]

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

Reimplemented in UnitAgent.

bool BaseAgent::isBuilding ( )

Returns true if this agent is a building.

bool BaseAgent::isDamaged ( )

Returns true if this agent is damaged.

virtual bool BaseAgent::isDefending ( ) [inline, virtual]

Returns true if this agent is defending the own base.

Reimplemented in UnitAgent.

bool BaseAgent::isDetectorWithinRange ( TilePosition  pos,
int  range 
)

Checks if there are any enemy detector units withing range of the specified position. True if there is, false if not.

virtual bool BaseAgent::isExploring ( ) [inline, virtual]

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

Reimplemented in UnitAgent.

bool BaseAgent::isFreeWorker ( )

Returns true if this agent is a free worker, i.e. is idle or is gathering minerals.

bool BaseAgent::isOfType ( UnitType  mType,
UnitType  toCheckType 
) [static]

Returns true if mType is the same UnitType as toCheckType.

bool BaseAgent::isOfType ( UnitType  type)

Returns true if the agent is of the specified type.

bool BaseAgent::isOfType ( Unit *  mUnit,
UnitType  type 
) [static]

Returns true if the unit is of the specified type.

bool BaseAgent::isUnderAttack ( )

Returns true if this agent is under attack, i.e. lost hitpoints since last check.

bool BaseAgent::isUnit ( )

Returns true if this agent is a combat unit.

bool BaseAgent::isWorker ( )

Returns true if this agent is a worker.

bool BaseAgent::matches ( Unit *  mUnit)

Returns true if the specified unit is the same unit assigned to this agent.

int BaseAgent::noUnitsInWeaponRange ( )

Returns the number of enemy units within weapon range of the agent.

void BaseAgent::printInfo ( ) [virtual]

Used to print info about this agent to the screen.

Reimplemented in BunkerAgent, StructureAgent, and UnitAgent.

void BaseAgent::setActionFrame ( )

Sets the current frame when this agent is issued an order.

void BaseAgent::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 in ReaverAgent, and UnitAgent.

void BaseAgent::setInfo ( string  mInfo)

Sets additional information about this agent to be shown when using printInfo().

void BaseAgent::setSquadID ( int  id)

Assigns this agent to the squad with the specified id.


The documentation for this class was generated from the following files:
 All Classes Functions Variables