-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.cpp
57 lines (53 loc) · 1.05 KB
/
player.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
#include "player.h"
Player::Player(string name, Race race, int hitPoints, int magicPoints){
this->name = name;
this->race = race;
this->hitPoints = hitPoints;
this->magicPoints = magicPoints;
}
Player::~Player(){
cout << "Object is being destroyed " <<endl;
}
string Player::getName() const{
return name;
}
Race Player::getRace() const{
return race;
}
string Player::whatRace() const{
string value;
if(race==Human){
value = "Human";
}
else if(race==Elf){
value = "Elf";
}
else if(race==Dwarf){
value = "Dwarf";
}
else if(race==Orc){
value = "Orc";
}
else if(race==Troll){
value = "Troll";
}
return value;
}
int Player::getHitpoints() const{
return hitPoints;
}
int Player::getMagicpoints() const{
return magicPoints;
}
void Player::setName(string name){
this->name = name;
}
void Player::setRace(Race race){
this->race = race;
}
void Player::setHitpoints(int hitPoints){
this->hitPoints = hitPoints;
}
void Player::setMagicpoints(int magicPoints){
this->magicPoints = magicPoints;
}