-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.cc
74 lines (56 loc) · 1.22 KB
/
board.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "board.h"
#include "card.h"
#include "ritual.h"
#include "minion.h"
#include "player.h"
#include <utility>
#include <iostream>
using namespace std;
Board:: Board(): state{"None"},active{nullptr},inactive{nullptr}{}
Board:: ~Board() {
}
void Board::notifyObservers(const string event){
if (active->minionSize() > 0) {
for (auto n: active->getMinion()) {
n->notify(event);
}
}
if (inactive->minionSize() >0) {
for (auto n: inactive->getMinion()) {
n->notify(event);
}
}
if (active->getRitual()) {
active->getRitual()->notify(event);}
if (inactive->getRitual()){
inactive->getRitual()->notify(event);
}
}
string Board::getState() {
return state;
}
void Board::changeState(const string event) {
//state = event;
notifyObservers(event);
}
Player *Board::getActive() {
return active;
}
Player *Board::getInactive() {
return inactive;
}
void Board::setActPlayer(Player *p) {
active = p;
}
void Board::setInActPlayer(Player *p) {
inactive = p;
}
void Board::setActRitual(shared_ptr<Card> r) {
active->setRitual(r);
}
void Board::setInRitual(shared_ptr<Card> r) {
inactive->setRitual(r);
}
void Board::swapTurn() {
swap(active,inactive);
}