-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.cpp
More file actions
43 lines (34 loc) · 1.01 KB
/
Player.cpp
File metadata and controls
43 lines (34 loc) · 1.01 KB
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
//
// Created by Nativ on 18/01/2025.
//
#include "Player.h"
Player::~Player() = default;
Player& Player::operator=(const Player& other) {
if (this == &other)
return *this;
this->roundCounter = other.roundCounter;
this->readyForSpecialAttack = other.readyForSpecialAttack;
Entity::operator=(other);
return *this;
}
void Player::addToRoundCounter() {
roundCounter++;
}
void Player::resetRoundCounter() {
roundCounter = 0;
}
bool Player::IsItPossibleUseTheSpecialAttack() const {
if (roundCounter == 4 || roundCounter == 0)
return true;
return false;
}
bool Player::operator<(const Entity &other) const {
return Entity::operator<(other);
}
bool Player::operator>(const Entity &other) const {
return Entity::operator>(other);
}
ostream& operator<<(ostream& os, const Player& other) {
os << other.name << " (" << other.currentAmountOfLife << "/" << other.maxAmountOfLife << ")" << " - " << other.attackValue;
return os;
}