This repository has been archived by the owner on May 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPlayer.h
140 lines (104 loc) · 2.7 KB
/
CPlayer.h
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//Header CPlayer
// @Author = Jan van Dick
#ifndef CPLAYER_H
#define CPLAYER_H
class CQuest;
class CQuestStep;
#include <map>
#include "CRoom.h"
#include "CFunctions.h"
#include "CColor.h"
#include "CInventory.h"
#include "CQuest.h"
#include "CQuestStep.h"
using namespace std;
//Forward declarations:
class CInventory;
class CPlayer
{
private:
//Attributes
char m_chName[128]; //Name of Player (can be chosen at the beginning of the game)
unsigned int m_maxLife; //maximum of life
unsigned int m_Life; //Lifepoints
unsigned int m_Strength; //Strength
unsigned int m_Skill; //Skill
int m_Morality; //Moralpoints
//Money and items
int m_Gold; //Gold
CInventory* m_Inventory; //Player's inventory
CRoom* m_curRoom; //The room the player is currently in
//Players functions:
typedef void(CPlayer::*m_PlayerFunction)(char*); //Function-pointer points to various player
//functions
map<char*, pair<m_PlayerFunction, const char*> > *m_FunctionMap; //Map containing all player functions
CList<CQuest>* m_quests; //Quests
public:
//Constructor
CPlayer(char* chName, CRoom* curRoom, CInventory* Inventory);
//Getter
//Get player's name
char* getName() {
return m_chName;
}
//get maximum life
unsigned int getMaxLife() {
return m_maxLife;
}
//get life
unsigned int getLife() {
return m_Life;
}
//get strength
unsigned int getStrength() {
return m_Strength;
}
//get skill
unsigned int getSkill() {
return m_Skill;
}
//get moral
int getMoral() {
return m_Morality;
}
//get gold
int getGold() {
return m_Gold;
}
//get player's items
CInventory* getInventory() {
return m_Inventory;
}
//Get player's curren room
CRoom* getCurRoom() {
return m_curRoom;
}
//Setter
//set life
void setLife(unsigned int newLife) {
m_Life = newLife;
}
//set strength
void setStrength(unsigned int newStrength) {
m_Strength = newStrength;
}
//set skill
void setSkill(unsigned int newSkill) {
m_Skill = newSkill;
}
//Set Room
void setCurRoom(CRoom* newRoom)
{
m_curRoom = newRoom;
}
void addQuest(CQuest* quest);
//Functions:
//printMainAtts: print life, gold and moral
void printMainAtts();
//Prints all attributes of player
void showAttributes();
//Quests
void showActiveQuests();
void showSolvedQuests();
};
#endif