|
BWAPI
|
00001 #pragma once 00002 00003 #include "Common.h" 00004 #include "Squad.h" 00005 #include "SquadData.h" 00006 #include "UnitInfoState.h" 00007 #include "HardCodedInfo.h" 00008 #include "StrategyManager.h" 00009 00010 class CombatCommander 00011 { 00012 SquadData squadData; 00013 00014 bool attacking; 00015 bool foundEnemy; 00016 00017 bool attackSent; 00018 00019 std::string currentAction; 00020 00021 BWAPI::Position enemyExpansion; 00022 00023 void assignDefenders(std::set<BWAPI::Unit *> & unitsToAssign); 00024 void assignAttackRegion(std::set<BWAPI::Unit *> & unitsToAssign, BWTA::Region * enemyRegion, SquadOrder & order); 00025 void assignAttackVisibleUnits(std::set<BWAPI::Unit *> & unitsToAssign, SquadOrder & order); 00026 void assignAttackKnownBuildings(std::set<BWAPI::Unit *> & unitsToAssign, SquadOrder & order); 00027 void assignAttackExplore(std::set<BWAPI::Unit *> & unitsToAssign, SquadOrder & order); 00028 00029 bool isBuildingAtBaselocation(BWTA::BaseLocation * baseLocation); 00030 bool squadUpdateFrame(); 00031 00032 void drawSquadInformation(int x, int y); 00033 int getNumType(UnitVector & units, BWAPI::UnitType type); 00034 00035 BWAPI::Unit * findClosestDefender(std::set<BWAPI::Unit *> & enemyUnitsInRegion, const std::set<BWAPI::Unit *> & units); 00036 00037 BWTA::Region * getClosestEnemyRegion(); 00038 00039 int selfTotalDeadUnits, numUnitsNeededForAttack; 00040 00041 BWAPI::Position getDefendLocation(); 00042 00043 public: 00044 00045 void update(const UnitVector & allCombatUnits); 00046 00047 CombatCommander(); 00048 00049 bool enemyInOurBase(); 00050 00051 void onRemoveUnit(BWAPI::Unit * unit); 00052 void onUnitShow(BWAPI::Unit * unit); 00053 void onUnitCreate(BWAPI::Unit * unit); 00054 void onUnitHide(BWAPI::Unit * unit) {} 00055 void onUnitMorph(BWAPI::Unit * unit) {} 00056 void onUnitRenegade(BWAPI::Unit * unit) {} 00057 void handleEvent(int eventType) {} 00058 00059 };
1.7.6.1