-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboss.cpp
52 lines (47 loc) · 988 Bytes
/
boss.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
#include "boss.h"
Boss::~Boss()
{
//delete[] this->name;
}
Boss::Boss(int health, int attackPower,
int defense, const char* name)
{
this->name=nullptr;
this->setHealth(health);
this->setMaxHealth(health);
this->setAttackPower(attackPower);
this->setDefense(defense);
this->setName(name);
}
Boss::Boss()
{
this->setHealth(0);
this->setMaxHealth(0);
this->setAttackPower(0);
this->setDefense(0);
this->name=nullptr;
}
void Boss::hit(Monster& other)
{
if (this->isAlive()) {
if (this->getAttackPower()>other.getDefense())
{
other.setHealth(other.getHealth()+other.getDefense()-(this->getAttackPower()));
hitPrint(other);
if (other.isAlive()) {
other.setHealth(other.getHealth()+other.getDefense()-(this->getAttackPower()));
hitPrint(other);
}
}
else
{
successfullBlock(other);
other.setHealth(other.getHealth());
}
}
}
void Boss::enrage()
{
this->setAttackPower(this->getAttackPower()*4);
cout << "ENRAGE" << endl;
}