-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlackCard.cpp
71 lines (53 loc) · 1.15 KB
/
BlackCard.cpp
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
//Kanellaki Maria Anna - 1115201400060
//Matanis Panagiotis - 1115201400297
#include "BlackCard.hpp"
#include "Personality.hpp"
#include "Holding.hpp"
BlackCard::BlackCard(string n, int t): Card{n, t}
{
name = n;
tapped = false;
revealed = false;
type = Type(t);
}
void BlackCard::PrintCardStats() //defines type of card and calls proper print function for that type
{
if (type == PERSONALITY)
{
Personality* pers = reinterpret_cast<Personality*>(this);
pers->PrintPersonality();
pers = nullptr;
delete pers;
}
else if (type == HOLDING)
{
Holding * hold = reinterpret_cast<Holding*>(this);
hold->PrintHolding();
hold = nullptr;
delete hold;
}
else
exit(-1);
}
//getters
bool BlackCard::isRevealed() const
{
return revealed;
}
bool BlackCard::isTapped() const
{
return tapped;
}
const string &BlackCard::getName() const
{
return name;
}
//setters
void BlackCard::setRevealed(bool revealed)
{
BlackCard::revealed = revealed;
}
void BlackCard::setTapped(bool tapped)
{
BlackCard::tapped = tapped;
}