BWAPI
BTHAI/SCProjects/BTHAIModule/Source/WorkerAgent.h
Go to the documentation of this file.
00001 #ifndef __WORKERAGENT_H__
00002 #define __WORKERAGENT_H__
00003 
00004 #include "BaseAgent.h"
00005 using namespace BWAPI;
00006 using namespace std;
00007 
00014 class WorkerAgent : public BaseAgent {
00015 
00016 private:
00017         int currentState;
00018 
00019         UnitType toBuild;
00020         TilePosition buildSpot;
00021         TilePosition startSpot;
00022         bool buildSpotExplored();
00023         bool areaFree();
00024         bool isBuilt();
00025         int startBuildFrame;
00026 
00027         void handleKitingWorker();
00028         Unit* getEnemyUnit();
00029         Unit* getEnemyBuilding();
00030         Unit* getEnemyWorker();
00031 
00032         int lastFrame;
00033 
00034 public:
00036         static const int GATHER_MINERALS = 0;
00038         static const int GATHER_GAS = 1;
00040         static const int FIND_BUILDSPOT = 2;
00042         static const int MOVE_TO_SPOT = 3;
00044         static const int CONSTRUCT = 4;
00046         static const int REPAIRING = 5;
00048         static const int ATTACKING = 6;
00049 
00051         WorkerAgent(Unit* mUnit);
00052 
00054         void computeActions();
00055 
00057         string getTypeName();
00058 
00061         void setState(int state);
00062 
00064         int getState();
00065 
00067         bool canBuild(UnitType type);
00068 
00070         bool assignToRepair(Unit* building);
00071 
00073         bool assignToBuild(UnitType type);
00074 
00076         bool assignToFinishBuild(Unit* building);
00077 
00079         string getStateAsText();
00080 
00082         void destroyed();
00083 
00085         void reset();
00086 
00089         bool isConstructing(UnitType type);
00090 };
00091 
00092 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines