-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit.cpp
100 lines (87 loc) · 1.83 KB
/
Unit.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
//
// Created by Barlas on 5/13/2020.
//
#include "Unit.h"
Unit::Unit() {}
std::string Unit::getName() {
return name;
}
std::string Unit::getType() {
return type;
}
int Unit::getHp() {
return hp;
}
int Unit::getDodge() {
return dodge;
}
int Unit::getProt() {
return prot;
}
int Unit::getSpeed() {
return speed;
}
int Unit::getTemporalSpeed() {
return temporalSpeed;
}
int Unit::getAccMod() {
return accMod;
}
int Unit::getBaseCrit() {
return baseCrit;
}
int Unit::getMinDmg() {
return minDmg;
}
int Unit::getMaxDmg() {
return maxDmg;
}
int Unit::getStunResist() {
return stunResist;
}
int Unit::getPosition() {
return position;
}
void Unit::increaseSpeed(int speedIncrement) {
temporalSpeed = temporalSpeed + speedIncrement;
}
void Unit::increaseHp(int hpIncrement) {
hp = hp + hpIncrement;
if (hp > maxHp) {
hp = maxHp;
}
}
void Unit::setProt(int prot) {
this->prot = prot;
}
void Unit::setTemporalSpeed(int temporalSpeed) {
this->temporalSpeed = temporalSpeed;
}
void Unit::setPosition(int pst) {
position = pst;
}
bool Unit::isAlive() {
return alive;
}
bool Unit::isStun() {
return stun;
}
void Unit::setStun(int stun) {
this->stun = stun;
}
int Unit::getProtRound() {
return protRound;
}
void Unit::setProtRound(int protRound) {
this->protRound = protRound;
}
void Unit::getDamage(int damage) {
if(damage == 0){
damage = 1;
}
hp = hp - damage;
if (hp <= 0) {
hp = 0;
dying();
}
}