forked from yanntm/YoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TechTree.h
48 lines (39 loc) · 1.84 KB
/
TechTree.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
42
43
44
45
46
47
48
#pragma once
#include "Common.h"
//class CCBot; //replace with YoBot or YoAgent??
class BuildType;
struct TypeData
{
sc2::Race race = sc2::Race::Random; // the race of this item
int mineralCost = 0; // mineral cost of the item
int gasCost = 0; // gas cost of the item
int supplyCost = 0; // supply cost of the item
int buildTime = 0; // build time of the item
bool isUnit = false;
bool isBuilding = false;
bool isWorker = false;
bool isRefinery = false;
bool isSupplyDepot = false;
bool isTownHall = false;
bool isAddon = false;
sc2::AbilityID buildAbility = 0; // the ability that creates this item
sc2::AbilityID warpAbility = 0; // the ability that creates this item via warp-in
std::vector<sc2::UnitTypeID> whatBuilds; // any of these units can build the item
std::vector<sc2::UnitTypeID> requiredUnits; // owning ONE of these is required to make
std::vector<sc2::UpgradeID> requiredUpgrades; // having ALL of these is required to make
};
class TechTree
{
sc2::Agent & m_bot;
std::map<sc2::UnitTypeID, TypeData> m_unitTypeData;
std::map<sc2::UpgradeID, TypeData> m_upgradeData;
void initUnitTypeData();
void initUpgradeData();
void outputJSON(const std::string & filename) const;
public:
TechTree(sc2::Agent & bot);
void onStart();
const TypeData & getData(const sc2::UnitTypeID & type) const;
const TypeData & getData(const sc2::UpgradeID & type) const;
const TypeData & getData(const BuildType & type) const;
};