-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumanPlayer.cpp
More file actions
47 lines (34 loc) · 985 Bytes
/
HumanPlayer.cpp
File metadata and controls
47 lines (34 loc) · 985 Bytes
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
#include "HumanPlayer.h"
// Default constructor
HumanPlayer::HumanPlayer() : Player()
{
skillLevel = 0;
roundsPlayed = 0;
}
// Usual creation constructor
HumanPlayer::HumanPlayer(std::string name, short level) : Player(name)
{
skillLevel = level;
roundsPlayed = 0;
}
// Destructor
HumanPlayer::~HumanPlayer() {}
// ACCESSOR FUNCTIONS
// Returns the player's name
std::string HumanPlayer::getName() const { return name; }
// Returns the player's skill level, as a number
short HumanPlayer::getLevel() const { return skillLevel; }
// Returns the current number of rounds played
short HumanPlayer::getRoundsPlayed() const { return roundsPlayed; }
// MUTATOR FUNCTIONS
// Resets human player's stats (except for skillLevel)
void HumanPlayer::resetStats()
{
Player::resetStats();
roundsPlayed = 0;
}
// Add 1 to the number of rounds played
void HumanPlayer::incrementRoundsPlayed()
{
roundsPlayed++;
}