TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cherrypi::HarassTask Class Reference

Inherits cherrypi::MasterHarassTask.

Public Member Functions

 HarassTask (UpcId upcId, Position nmyLocation, Unit *u, Module *owner)
 
void postCommand (State *state, HarassModule *module) override
 
void update (State *state) override
 
bool attacking () const
 
bool moving () const
 
bool fleeing () const
 
bool building () const
 
UnittargetUnit () const
 
Position const & targetPos () const
 
void attack (State *state, Unit *target)
 
void move (State *state, Position tgtPos)
 
bool shouldMove (State *state)
 
void flee (State *state, const Position &tgtPos)
 
void build (State *state, BuildType const *buildtype, Unit *gas)
 
virtual const char * getName () const override
 A name for this task, for debugging purposes. More...
 
- Public Member Functions inherited from cherrypi::MasterHarassTask
 MasterHarassTask (UpcId upcId, Position nmyLocation, Unit *u)
 
Position const & location () const
 
Unitunitp () const
 
Position pos () const
 
- Public Member Functions inherited from cherrypi::Task
 Task (UpcId upcId, std::unordered_set< Unit * > units={})
 
virtual ~Task ()
 
virtual void cancel (State *)
 
TaskStatus status () const
 
void setStatus (TaskStatus status)
 
bool finished () const
 
UpcId upcId () const
 UPC id in Blackboard that caused this Task to be spawned. More...
 
std::unordered_set< Unit * > const & units () const
 A set of units occupied performing this task. More...
 
void removeUnit (Unit *unit)
 
virtual std::unordered_set< Unit * > const & proxiedUnits () const
 A set of units occupied performing this task. More...
 

Protected Member Functions

void initiateAction (State *state)
 
void checkAttack (State *state)
 
void checkFlee (State *state)
 
void checkBuild (State *state)
 
- Protected Member Functions inherited from cherrypi::Task
std::unordered_set< Unit * > & units ()
 
virtual void removeDeadOrReassignedUnits (State *state)
 Remove units that have been assigned to another task and units that have died. More...
 

Protected Attributes

Moduleowner_
 
Position targetPos_ = Position(-1, -1)
 
UnittargetUnit_ = nullptr
 
bool attacking_ = false
 
bool fleeing_ = false
 
int shouldMove_ = -1
 
bool building_ = false
 
- Protected Attributes inherited from cherrypi::MasterHarassTask
Position location_
 

Constructor & Destructor Documentation

cherrypi::HarassTask::HarassTask ( UpcId  upcId,
Position  nmyLocation,
Unit u,
Module owner 
)
inline

Member Function Documentation

void cherrypi::HarassTask::attack ( State state,
Unit target 
)
inline
bool cherrypi::HarassTask::attacking ( ) const
inline
void cherrypi::HarassTask::build ( State state,
BuildType const *  buildtype,
Unit gas 
)
inline
bool cherrypi::HarassTask::building ( ) const
inline
void cherrypi::HarassTask::checkAttack ( State state)
inlineprotected
void cherrypi::HarassTask::checkBuild ( State state)
inlineprotected
void cherrypi::HarassTask::checkFlee ( State state)
inlineprotected
void cherrypi::HarassTask::flee ( State state,
const Position tgtPos 
)
inline
bool cherrypi::HarassTask::fleeing ( ) const
inline
virtual const char* cherrypi::HarassTask::getName ( ) const
inlineoverridevirtual

A name for this task, for debugging purposes.

Reimplemented from cherrypi::MasterHarassTask.

void cherrypi::HarassTask::initiateAction ( State state)
inlineprotected
void cherrypi::HarassTask::move ( State state,
Position  tgtPos 
)
inline
bool cherrypi::HarassTask::moving ( ) const
inline
void cherrypi::HarassTask::postCommand ( State state,
HarassModule module 
)
inlineoverridevirtual
bool cherrypi::HarassTask::shouldMove ( State state)
inline
Position const& cherrypi::HarassTask::targetPos ( ) const
inline
Unit* cherrypi::HarassTask::targetUnit ( ) const
inline
void cherrypi::HarassTask::update ( State state)
inlineoverridevirtual

Reimplemented from cherrypi::MasterHarassTask.

Member Data Documentation

bool cherrypi::HarassTask::attacking_ = false
protected
bool cherrypi::HarassTask::building_ = false
protected
bool cherrypi::HarassTask::fleeing_ = false
protected
Module* cherrypi::HarassTask::owner_
protected
int cherrypi::HarassTask::shouldMove_ = -1
protected
Position cherrypi::HarassTask::targetPos_ = Position(-1, -1)
protected
Unit* cherrypi::HarassTask::targetUnit_ = nullptr
protected

The documentation for this class was generated from the following file: