-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.cpp
90 lines (69 loc) · 1.44 KB
/
Card.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//Kanellaki Maria Anna - 1115201400060
//Matanis Panagiotis - 1115201400297
#include <iostream>
#include "Card.hpp"
#include "Follower.hpp"
#include "Item.hpp"
#include "Personality.hpp"
#include "Holding.hpp"
Card::Card(string n, int t)
{
name = n;
tapped = false;
type = Type(t);
}
void Card::PrintCardStats() //defines type of card and calls proper print function for that type
{
if (type == FOLLOWER)
{
Follower * fol = reinterpret_cast<Follower *> (this);
fol->PrintFollower();
fol = nullptr;
delete fol;
}
else if (type == ITEM)
{
Item * item = reinterpret_cast<Item *> (this);
item->PrintItem();
item = nullptr;
delete item;
}
else 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
Card::Type Card::getType() const
{
return type;
}
bool Card::isTapped() const
{
return tapped;
}
const string &Card::getName() const
{
return name;
}
int Card::getCost() const
{
return cost;
}
//setters
void Card::setTapped(bool tapped)
{
Card::tapped = tapped;
}