-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cleric.cpp
89 lines (77 loc) · 1.88 KB
/
Cleric.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
#include "Cleric.h"
Cleric::Cleric(string name_in, int hitPoints_in, int strength_in, int speed_in, int magic_in):Fighter(name_in, hitPoints_in, strength_in, speed_in, magic_in)
{
mana = magic * 5;
}
int Cleric::getDamage()
{
// cout << "\nCleric dealt " << magic << " damage.";
return magic;
}
void Cleric::reset()
{
mana = magic * 5;
currentHP = Fighter::hitPoints;
}
void Cleric::regenerate()
{
//cout << "\nstrength is currently " << strength;
// cout << "\ncurrentHP is currently " << currentHP;
int hp_before = currentHP;
if ((strength / 6) < 1)
{
//cout << "\nStrength / 6 is less than 1, prior to addition. currentHP is " << currentHP;
currentHP += 1;
//cout << "\nafter addition, currentHP is now " << currentHP;
}
else
{
//cout << "\nprior to else addition, currentHP is " << currentHP;
currentHP += (strength / 6);
//cout << "\nafter else addition, currentHP is now " << currentHP;
}
// cout << "\ncurrentHP and hitPoints: " << currentHP << ", " << hitPoints;
if (currentHP > hitPoints)
{
// cout << "\nequalized currentHP and hitPoints: " << currentHP << ", " << hitPoints;
currentHP = hitPoints;
}
// cout << "\nCurrentHP became " << currentHP;
if (hp_before > currentHP)
{
// cout << "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
}
if ((magic / 5) < 1)
{
mana++;
}
else mana = mana + (magic / 5);
if (mana > (magic * 5))
{
mana = magic * 5;
}
}
bool Cleric::useAbility()
{
// cout << "\nCleric::useAbility triggered";
// cout << "\nCleric Mana is " << mana;
if (mana >= CLERIC_ABILITY_COST)
{
mana -= CLERIC_ABILITY_COST;
currentHP += magic / 3;
if (currentHP > hitPoints)
{
currentHP = hitPoints;
}
// cout << "\nCleric returning True";
return true;
}
else
{
// cout << "\nCleric returning False";
return false;
}
}
Cleric::~Cleric()
{
}