-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinion.h
137 lines (101 loc) · 3.23 KB
/
Minion.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//
// Created by michael on 19/07/19.
//
#ifndef CS246A5_MINION_H
#define CS246A5_MINION_H
#include "Card.h"
#include "Enchantment.h"
#include "Spell.h"
#include "Ritual.h"
struct Info{
// Card Name
std::string name;
// Combat strength
int def = 0, atk = 0;
// Number of actions it is allowed
int act = 0;
int ab_cost = 0;
int amount;
// Active skill
Effect* activeSkill;
};
/*
* Max of 5 are allowed to be played, if 5 are already played,
* no more minion should be played.
*
* When a new minion is placed on the board, it will occupy the
* currently left-most position in the board.
* #### Notice that the board is DIFFERENT from Grid.
*
* -> To attack the opposing player. The opposing player loses
* life equal to the attack value of the minion.
* -> To attack an opposing minion. Both minion damage one another:
* minion A reduces minion B's defence by A's attack and vise versa
* -> To use an activated ability
*
* ===================================================================
*
* -> Activated abilities cost magic and an action point to use, and
* work similar to playing a spell card
* -> Triggered abilities are activated for free whenever a certain
* condition is met.
*
* ===================================================================
* -> A minion can only have one ability of each type.
*/
class Minion : public Card{
private:
// Combat strength
int def = 0, atk = 0;
// Action every round
int act_round = 0;
// Number of actions it is allowed
int act = -1;
int ab_cost = -1;
// Enchantments that might be removed, stats
int last_added = 0;
std::vector<Enchantment*> enchantments;
// If silent
bool silent;
// Trigger
Trigger trigger;
// Active skill
const Effect* activeSkill;
// If it can summon
Info * summon_info = nullptr;
bool summon;
// Functions
void apply(const Minion * const min);
void apply(const Ritual * const ritual);
void apply(const Spell * const spell);
void apply(Enchantment * enchantment);
bool getSilence() const;
public:
// Constructor
Minion(const Player* sec, const std::string &name, const std::string &description,
int cost, int def, int atk, Trigger tr, const Effect *trigger = nullptr,
const Effect *actEff = nullptr, int ab_cost = 0, Info* summon_info = nullptr);
// We note that the enchantments are stored only in here,
// and is unique to each particular minion, that is, an enchantment
// can only be applied to a specific minion. When the minion is dead,
// the minion should take care of the cards
~Minion();
// Getters and determining functions
void resurrect();
void restoreAct();
bool isDead() const ;
bool getAct();
int getActCost() const ;
int getAtk() const ;
int getDef() const;
const Effect * const getActiveSkill() const ;
std::vector<Enchantment*> getEnchantments();
bool canSummon() const;
Info * getInfo() const;
void apply(Card * card);
void action();
void collision( const Minion * const from);
Minion* notify(const Trigger trig);
card_template_t drawThis();
};
#endif //CS246A5_MINION_H