blob: cb5e7691fe6f7d490943477f35d26fa295508f1e (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#ifndef TECH_H
#define TECH_H
#include <vector>
#include <unordered_map>
#include <string>
#include "../umath/vec2.h"
class TechBonus {
public:
float attack { 0 };
float defence { 0 };
int sight { 0 };
int range { 0 };
int move { 0 };
std::vector<float> cost { 0, 0 };
std::vector<float> cost_abs { 0, 0 };
std::vector<float> prod { 0, 0 };
int trade;
int improved_heal;
int improved_convert;
int req_range { 999 };
std::vector<int> aff_id;
std::vector<int> aff_class;
int aff_level;
int aff_all { 0 };
TechBonus operator+(const TechBonus &rhs) {
TechBonus b;
b.attack = attack + rhs.attack;
b.defence = defence + rhs.defence;
b.sight = sight + rhs.sight;
b.move = move + rhs.move;
for (int i=0; i<b.cost.size(); i++) {
b.cost[i] = cost[i] + rhs.cost[i];
b.cost_abs[i] = cost_abs[i] + rhs.cost_abs[i];
b.prod[i] = prod[i] + rhs.prod[i];
}
b.trade = trade + rhs.trade;
b.improved_heal = improved_heal + rhs.improved_heal;
b.improved_convert = improved_convert + rhs.improved_convert;
return b;
}
};
class TechLookup {
public:
TechLookup() {}
TechBonus id (int i) { return map_id[i]; }
std::unordered_map<int, TechBonus> map_id;
};
class Tech {
public:
Tech() {}
std::string name;
int id;
int level;
int req_id;
std::vector<float> cost { 0, 0 };
TechBonus bonus;
vec2 spritebounds { 0, 0 };
};
#endif
|