-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.cpp
More file actions
49 lines (44 loc) · 1.31 KB
/
Copy pathEnemy.cpp
File metadata and controls
49 lines (44 loc) · 1.31 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
44
45
46
47
48
49
#include "Enemy.h"
Enemy::Enemy(std::string name, int level)
{
//initialize for debug
//surface level stuff
this->currency = this->level * 10;
this->name = name;
this->level = level;
this->exp = static_cast<int>(pow(level, 3) + 11);
this->hpMax = this->level * 8;
this->hp = this->hpMax;
this->ppMax = this->level * 5;
this->pp = this->ppMax;
this->offense = this->level * 2;
this->defense = this->level * 2;
this->iq = this->level * 2;
this->dropChance = rand() % 100;
//this->speed = this->level * 2;
}
Enemy::~Enemy() //virtual deconstructor
{
//something is supposed to go here :P
}
std::string Enemy::getAsString() const
{
//print
return "Name: " + this->name + '\n' +
"Level: " + std::to_string(this->level) + '\n' +
"HP: " + std::to_string(this->hp) + " / " + std::to_string(this->hpMax) + '\n' +
"PP: " + std::to_string(this->pp) + " / " + std::to_string(this->ppMax) + '\n' +
"Offense: " + std::to_string(this->offense) + '\n' +
"Defense: " + std::to_string(this->defense) + '\n' +
"IQ: " + std::to_string(this->iq) + '\n' +
//"Speed: " + std::to_string(this->speed) + '\n' +
"Drop chance: " + std::to_string(this->dropChance) + '%' + '\n';
}
void Enemy::takeDamage(int damage)
{
this->hp -= damage;
if (this->hp <= 0)
{
this->hp = 0;
}
}