forked from yanntm/YoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CombatCommander.h
42 lines (28 loc) · 1.06 KB
/
CombatCommander.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "Common.h"
#include "Squad.h"
#include "SquadData.h"
class YoAgent;
class CombatCommander
{
YoAgent & m_bot;
SquadData m_squadData;
std::vector<const sc2::Unit *> m_combatUnits;
bool m_initialized;
bool m_attackStarted;
void updateScoutDefenseSquad();
void updateDefenseSquads();
void updateAttackSquads();
void updateIdleSquad();
bool isSquadUpdateFrame();
const sc2::Unit * findClosestDefender(const Squad & defenseSquad, const sc2::Point2D & pos);
const sc2::Unit * findClosestWorkerTo(std::vector<const sc2::Unit *> & unitsToAssign, const sc2::Point2D & target);
sc2::Point2D getMainAttackLocation();
void updateDefenseSquadUnits(Squad & defenseSquad, const size_t & flyingDefendersNeeded, const size_t & groundDefendersNeeded);
bool shouldWeStartAttacking();
public:
CombatCommander(YoAgent & bot);
void onStart();
void onFrame(const std::vector<const sc2::Unit *> & combatUnits);
void drawSquadInformation();
};