-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminionComponent.cc
51 lines (35 loc) · 2.17 KB
/
minionComponent.cc
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
#include "minionComponent.h"
#include "activatedAbility.h"
MinionComponent::MinionComponent(string cardName): Card{cardName}{}
void MinionComponent::useActivatedAbility(Player *active, Player *other) {
ActivatedAbility *aa = getActivatedAbility();
if (aa) {
aa->apply(active, other);
}
}
void MinionComponent::useActivatedAbility_target(Player *active, Player *other, MinionComponent *mc) {
ActivatedAbility *aa = getActivatedAbility();
if (aa) {
aa->apply(active, other, mc);
}
}
char MinionComponent::cardAt(int x, int y) const { //be careful when used from other class
//x and y start from 0, are relatvie to the card itself not the board
//Minions
if (getMCardDesc() == "") return display_minion_no_ability(getMCardName(), getMCost(), getAttack(), getDefense())[x][y];
if (getMCardName() == "Novice Pyromancer" || //cards with activated abilties
getMCardName() == "Apprentice Summoner" ||
getMCardName() == "Master Summoner") return display_minion_activated_ability(getMCardName(), getMCost(), getAttack(), getDefense(), getActivateCost(), getMCardDesc())[x][y];
return display_minion_triggered_ability(getMCardName(), getMCost(), getAttack(), getDefense(), getMCardDesc())[x][y];
}
char MinionComponent::cardAtMinion(int x, int y) const { //be careful when used from other class
//x and y start from 0, are relatvie to the card itself not the board
//Minions
if (getMCardDesc() == "") return display_minion_no_ability(getMCardName(), getMCost(), getAttack(), getDefense())[x][y];
if (getMCardName() == "Novice Pyromancer" || //cards with activated abilties
getMCardName() == "Apprentice Summoner" ||
getMCardName() == "Master Summoner") return display_minion_activated_ability(getMCardName(), getMCost(), getAttack(), getDefense(), getActivateCost(), getMCardDesc())[x][y];
return display_minion_triggered_ability(getMCardName(), getMCost(), getAttack(), getDefense(), getMCardDesc())[x][y];
}
MinionComponent::~MinionComponent() {
}