-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cpp
executable file
·96 lines (73 loc) · 1.46 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
//
// Created by ben on 27/03/2020.
//
#include "Player.h"
#include <string>
typedef unsigned short ushort;
string Player::GetName() {
return _name;
}
void Player::SetName(string name) {
if (name == "") return;
_name = name;
}
ushort Player::GetAccuracy() {
return _accuracy;
}
void Player::SetAccuracy(ushort accuracy) {
_accuracy = accuracy;
}
short Player::GetScore() {
return _score;
}
void Player::SetScore(short score) {
_score = score;
}
void Player::ReduceScore(ushort score) {
_score -= score;
}
void Player::Reset(bool resetScore) {
if (resetScore) _score = 501;
_bust = false;
_miss = false;
_nonDoubleEnd = false;
_lastHit = Target(0);
_lastTarget = Target(0);
}
bool Player::IsCPU() {
return _isCPU;
}
void Player::SetCPU(bool value) {
if (value) _name = "CPU " + _name;
_isCPU = value;
}
Target Player::GetLastTarget() {
return _lastTarget;
}
void Player::SetLastTarget(Target target) {
_lastTarget = target;
}
Target Player::GetLastHit() {
return _lastHit;
}
void Player::SetLastHit(Target hit) {
_lastHit = hit;
}
bool Player::isBust() const {
return _bust;
}
void Player::setBust(bool bust) {
_bust = bust;
}
bool Player::isMiss() const {
return _miss;
}
void Player::setMiss(bool miss) {
_miss = miss;
}
bool Player::isNonDoubleEnd() const {
return _nonDoubleEnd;
}
void Player::setNonDoubleEnd(bool nonDoubleEnd) {
_nonDoubleEnd = nonDoubleEnd;
}