-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.cpp
217 lines (182 loc) · 5.88 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/***************************************************************************
** Author: Sunghoon Cho
** Date: 12/4/18
** Program name: Player class
****************************************************************************/
#include "player.hpp"
#include "inputValidation.hpp"
#include <iostream>
#include <string>
using std::cout;
using std::endl;
//************************************************************************
// Default constructor for Player class
//************************************************************************
Player::Player()
{
confidence = 100;
haveDate = 0;
movementCount = 5;
}
//************************************************************************
// hasConfidence checks whether player still has any confidence
//************************************************************************
bool Player::hasConfidence()
{
if(confidence > 0)
{
return true;
}
else
{
return false;
}
}
//************************************************************************
// printInventory prints the list of skills the player has
//************************************************************************
void Player::printSkillSet()
{
if(skillSet.empty())
{
cout << "\n>> Your skillset is empty!" << endl;
cout << "\n>> Hint: interact with the lobby to learn a skill!" << endl;
}
else
{
cout << "\n>> Here are your current skills" << endl;
for (int i = 0; i < skillSet.size(); i++)
{
cout << " " << i+1 << ". " << skillSet[i] << endl;
}
}
return;
}
//************************************************************************
// getConfidence returns confidence level
//************************************************************************
int Player::getConfidence()
{
return confidence;
}
//************************************************************************
// addSkill adds any skills picked up during the date
//************************************************************************
void Player::addSkill(string skill)
{
if(skillSet.size() < 5)
{
//skill is added to skillset
skillSet.push_back(skill);
}
else
{
cout << "\n>> You cannot have any more skills" << endl;
}
}
//************************************************************************
// setConfidence is a game kill function by setting confidence to 0
//************************************************************************
void Player::setConfidence()
{
confidence = 0;
}
//************************************************************************
// getaDate tracks whether the player gets any dates lined up
//************************************************************************
void Player::getaDate()
{
haveDate = haveDate + 1;
}
//************************************************************************
// dateCheck outputs two statements based on the quantity of dates lined up
//************************************************************************
void Player::dateCheck()
{
if(haveDate > 0)
{
cout << "\n>> Good job! You won the game!" << endl;
}
else
{
cout << "\n>> Sorry you lost the game" << endl;
}
}
//************************************************************************
// checkFutureDate is the final output after checking room count
//************************************************************************
void Player::checkFutureDate()
{
if(haveDate > 0)
{
cout << "You currently have " << haveDate << " date(s) for the future" << endl;
}
else
{
cout << "You have no future dates lined up." << endl;
}
}
//************************************************************************
// searchSkill searches for a skill to be used during date when available
//************************************************************************
bool Player::searchSkill(string skill)
{
for (int i = 0; i < skillSet.size(); i++)
{
if(skillSet[i] == skill)
{
return true;
}
}
return false;
}
//************************************************************************
// loseConfidence subtracts an int from the confidence depending on date
//************************************************************************
void Player::loseConfidence(int number)
{
confidence -= number;
}
//************************************************************************
// loseConfidence adds an int to the confidence depending on date
//************************************************************************
void Player::gainConfidence(int number)
{
confidence += number;
}
//************************************************************************
// removeSkill removes any skills that are used during the date
//************************************************************************
void Player::removeSkill(string skill)
{
for (int i = 0; i < skillSet.size(); i++)
{
if (skillSet[i] == skill)
{
skillSet.erase(skillSet.begin() + i);
return;
}
}
return;
}
//************************************************************************
// reduceMovementCount reduces the number of rooms that can be visited
//************************************************************************
void Player::reduceMovementCount()
{
movementCount = movementCount-1;
}
//************************************************************************
// showMovementCount shows the number of rooms that can be visited
//************************************************************************
void Player::showMovementCount()
{
cout << "\nYou have " << movementCount << " remaining rooms to visit" << endl;
}
//************************************************************************
// getMovement returns the int movementCount
//************************************************************************
int Player::getMovement()
{
return movementCount;
}