BWAPI
BTHAI/SCProjects/BTHAIModule/Source/UnitAgent.h
Go to the documentation of this file.
00001 #ifndef __UNITAGENT_H__
00002 #define __UNITAGENT_H__
00003 
00004 #include <BWAPI.h>
00005 #include "BaseAgent.h"
00006 using namespace BWAPI;
00007 using namespace std;
00008 
00009 #define DISABLE_UNIT_AI 0
00010 
00018 class UnitAgent : public BaseAgent {
00019 
00020 protected:
00021         int currentState;
00022         static const int ATTACK = 1;
00023         static const int EXPLORE = 2;
00024         static const int DEFEND = 3;
00025         static const int BUNKERED = 4;
00026         
00027 public:
00028         UnitAgent(Unit* mUnit);
00029         UnitAgent();
00030 
00031         int dropped;
00032 
00034         void computeActions();
00035 
00037         void computeKitingActions();
00038 
00040         string getTypeName();
00041 
00044         virtual void setGoal(TilePosition goal);
00045 
00047         virtual void clearGoal();
00048 
00050         int friendlyUnitsWithinRange();
00051 
00053         int friendlyUnitsWithinRange(int maxRange);
00054 
00056         int friendlyUnitsWithinRange(TilePosition tilePos, int maxRange);
00057 
00059         int enemyAttackingUnitsWithinRange();
00060 
00062         int enemyAttackingUnitsWithinRange(int maxRange, TilePosition center);
00063 
00065         int enemyAttackingUnitsWithinRange(UnitType type);
00066 
00068         int enemyUnitsWithinRange(int maxRange);
00069 
00071         int enemyGroundUnitsWithinRange(int maxRange);
00072 
00074         int enemySiegedTanksWithinRange(TilePosition center);
00075 
00077         int enemyGroundAttackingUnitsWithinRange(TilePosition center, int maxRange);
00078 
00080         int enemyAirUnitsWithinRange(int maxRange);
00081 
00084         bool useDefensiveMode();
00085 
00087         int enemyAirToGroundUnitsWithinRange(int maxRange);
00088 
00090         int enemyAirAttackingUnitsWithinRange(TilePosition center, int maxRange);
00091 
00093         int getGroundRange();
00094 
00096         static int getGroundRange(UnitType type);
00097 
00099         static bool canAttack(UnitType attacker, UnitType target);
00100 
00102         int getAirRange();
00103 
00105         static int getAirRange(UnitType type);
00106 
00108         void assignToExplore();
00109 
00111         void assignToAttack();
00112 
00114         void assignToDefend();
00115 
00117         bool isExploring();
00118 
00120         bool isAttacking();
00121 
00123         bool isDefending();
00124 
00126         bool isBunkered();
00127         
00129         Unit* getClosestOrganicEnemy(int maxRange);
00130 
00132         Unit* getClosestShieldedEnemy(int maxRange);
00133 
00135         Unit* getClosestEnemyTurret(int maxRange);
00136 
00139         Unit* getClosestEnemyAirDefense(int maxRange);
00140 
00142         bool chargeShields();
00143 
00145         virtual void printInfo();
00146 };
00147 
00148 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines