forked from dsuchka/tyrant_optimize_closed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.h
61 lines (56 loc) · 1.71 KB
/
card.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
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef CARD_H_INCLUDED
#define CARD_H_INCLUDED
#include <cstring>
#include <string>
#include <vector>
#include "tyrant.h"
class Card
{
public:
unsigned m_attack;
unsigned m_base_id; // The id of the original card if a card is unique and alt/upgraded. The own id of the card otherwise.
unsigned m_delay;
Faction m_faction;
unsigned m_health;
unsigned m_id;
unsigned m_level;
unsigned m_fusion_level;
std::string m_name;
unsigned m_rarity;
unsigned m_set;
std::vector<SkillSpec> m_skills;
unsigned m_skill_value[Skill::num_skills];
CardType::CardType m_type;
CardCategory::CardCategory m_category;
const Card* m_top_level_card; // [TU] corresponding full-level card
unsigned m_recipe_cost;
std::map<const Card*, unsigned> m_recipe_cards;
std::map<const Card*, unsigned> m_used_for_cards;
public:
Card() :
m_attack(0),
m_base_id(0),
m_delay(0),
m_faction(imperial),
m_health(0),
m_id(0),
m_level(1),
m_fusion_level(0),
m_name(""),
m_rarity(1),
m_set(0),
m_skills(),
m_type(CardType::assault),
m_category(CardCategory::normal),
m_top_level_card(this),
m_recipe_cost(0),
m_recipe_cards(),
m_used_for_cards()
{
std::memset(m_skill_value, 0, sizeof m_skill_value);
}
void add_skill(Skill::Skill id, unsigned x, Faction y, unsigned n, unsigned c, Skill::Skill s, Skill::Skill s2, bool all);
const Card* upgraded() const { return this == m_top_level_card ? this : m_used_for_cards.begin()->first; }
const Card* downgraded() const { return m_level == 1 ? this : m_recipe_cards.begin()->first; }
};
#endif