BWAPI
BTHAI/SCProjects/BTHAIModule/Source/BaseAgent.h
Go to the documentation of this file.
00001 #ifndef __BASEAGENT_H__
00002 #define __BASEAGENT_H__
00003 
00004 #include <windows.h>
00005 #include <BWAPI.h>
00006 #include <BWTA.h>
00007 #include "BWTAExtern.h"
00008 using namespace BWAPI;
00009 using namespace std;
00010 
00016 class BaseAgent {
00017 
00018 private:
00019 
00020 protected:
00021         Unit* unit;
00022         TilePosition goal;
00023         int unitID;
00024         int squadID;
00025         bool alive;
00026         int lastActionFrame;
00027         string info;
00028         bool bBlock;
00029 
00030 public:
00032         BaseAgent();
00034         BaseAgent(Unit* mUnit);
00036         ~BaseAgent();
00037 
00039         virtual void computeActions() {
00040         }
00041 
00043         int noUnitsInWeaponRange();
00044 
00046         bool canAttack(Unit* target);
00047 
00049         bool canAttack(UnitType type);
00050 
00053         virtual void setGoal(TilePosition goal);
00054 
00056         virtual void clearGoal();
00057 
00059         TilePosition getGoal();
00060 
00062         void setActionFrame();
00063 
00065         int getLastActionFrame();
00066 
00068         virtual string getTypeName() {
00069                 return "BaseAgent";
00070         }
00071 
00073         virtual bool assignToBuild(UnitType type) {
00074                 return false;
00075         }
00076 
00078         virtual bool assignToRepair(Unit* building) {
00079                 return false;
00080         }
00081 
00083         virtual bool assignToFinishBuild(Unit* building) {
00084                 return false;
00085         }
00086 
00088         virtual void assignToExplore() {
00089         }
00090 
00092         virtual void assignToAttack() {
00093         }
00094 
00096         virtual void assignToDefend() {
00097         }
00098 
00100         virtual bool isExploring() {
00101                 return false;
00102         }
00103 
00105         virtual bool isAttacking() {
00106                 return false;
00107         }
00108 
00110         virtual bool isDefending() {
00111                 return false;
00112         }
00113 
00115         virtual void printInfo();
00116 
00118         void setInfo(string mInfo);
00119 
00121         virtual bool canBuild(UnitType type);
00122 
00125         int getUnitID();
00126 
00128         UnitType getUnitType();
00129 
00131         Unit* getUnit();
00132 
00134         virtual void destroyed();
00135 
00137         bool isAlive();
00138 
00140         bool matches(Unit* mUnit);
00141 
00143         bool isOfType(UnitType type);
00144 
00146         static bool isOfType(Unit* mUnit, UnitType type);
00147 
00149         static bool isOfType(UnitType mType, UnitType toCheckType);
00150 
00153         bool isDetectorWithinRange(TilePosition pos, int range);
00154 
00156         bool isBuilding();
00157 
00159         bool isWorker();
00160 
00162         bool isFreeWorker();
00163 
00165         bool isUnit();
00166 
00168         bool isUnderAttack();
00169 
00171         bool isDamaged();
00172 
00174         static bool doScannerSweep(TilePosition pos);
00175 
00177         static bool doEnsnare(TilePosition pos);
00178 
00180         void setSquadID(int id);
00181 
00184         int getSquadID();
00185 
00186 };
00187 
00188 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines