BWAPI
|
00001 #ifndef __SQUAD_H__ 00002 #define __SQUAD_H__ 00003 00004 #include "BaseAgent.h" 00005 #include "Squad.h" 00006 #include "UnitSetup.h" 00007 00008 using namespace BWAPI; 00009 using namespace std; 00010 00017 class Squad { 00018 00019 protected: 00020 vector<BaseAgent*> agents; 00021 vector<UnitSetup> setup; 00022 00023 TilePosition goal; 00024 00025 void setMemberGoals(); 00026 void setMemberState(BaseAgent* agent); 00027 Unit* findTarget(); 00028 00029 int id; 00030 bool active; 00031 int type; 00032 int priority; 00033 int activePriority; 00034 int moveType; 00035 bool required; 00036 string name; 00037 int goalSetFrame; 00038 00039 void checkAttack(); 00040 bool isVisible(TilePosition pos); 00041 TilePosition getNextStartLocation(); 00042 vector<TilePosition> hasVisited; 00043 00044 public: 00046 Squad(); 00047 00054 Squad(int mId, int mType, int mMoveType, string mName, int mPriority); 00055 00057 int getID(); 00058 00061 void addRequirement(UnitType type, int no); 00062 00064 string getName(); 00065 00067 bool isRequired(); 00068 00070 void setRequired(bool mRequired); 00071 00073 int getPriority(); 00074 00076 void setPriority(int mPriority); 00077 00079 void setActivePriority(int mPriority); 00080 00083 void addSetup(UnitType type, int no); 00084 00087 vector<UnitSetup> getSetup(); 00088 00092 virtual bool isActive(); 00093 00095 void forceActive(); 00096 00099 bool isFull(); 00100 00102 int size(); 00103 00107 int getHealthPct(); 00108 00110 virtual void computeActions(); 00111 00114 bool isGathered(); 00115 00117 bool isAttacking(); 00118 00120 bool isUnderAttack(); 00121 00123 bool needUnit(UnitType type); 00124 00126 bool addMember(BaseAgent* agent); 00127 00129 vector<BaseAgent*> getMembers(); 00130 00132 void removeMember(BaseAgent* agent); 00133 00136 BaseAgent* removeMember(UnitType type); 00137 00139 virtual void setGoal(TilePosition mGoal); 00140 00143 virtual void clearGoal(); 00144 00146 virtual TilePosition getGoal(); 00147 00149 virtual bool hasGoal(); 00150 00153 bool isThisGoal(TilePosition mGoal); 00154 00156 bool isCloseTo(TilePosition mGoal); 00157 00160 TilePosition getCenter(); 00161 00163 BaseAgent* getCenterAgent(); 00164 00166 bool isOffensive(); 00167 00169 bool isDefensive(); 00170 00172 bool isExplorer(); 00173 00175 bool isBunkerDefend(); 00176 00178 bool isShuttle(); 00179 00181 bool isKite(); 00182 00184 bool isRush(); 00185 00188 bool isSupport(); 00189 00191 bool isGround(); 00192 00194 bool isAir(); 00195 00198 int getSize(); 00199 00201 int getTotalUnits(); 00202 00205 int getStrength(); 00206 00209 void disband(TilePosition retreatPoint); 00210 00212 virtual void printInfo(); 00213 00217 void printFullInfo(); 00218 00221 bool canMerge(Squad* squad); 00222 00225 bool hasUnits(UnitType type, int no); 00226 00228 bool contains(UnitType type); 00229 00231 TilePosition getClosestStartLocation(TilePosition pos); 00232 00234 static const int OFFENSIVE = 0; 00236 static const int DEFENSIVE = 1; 00238 static const int EXPLORER = 2; 00240 static const int SUPPORT = 3; 00242 static const int BUNKER = 4; 00244 static const int SHUTTLE = 5; 00246 static const int KITE = 6; 00248 static const int RUSH = 7; 00250 static const int CHOKEHARASS = 8; 00252 static const int GROUND = 0; 00254 static const int AIR = 1; 00255 00256 00257 }; 00258 00259 #endif