Repository navigation
Expand file tree
/
Copy pathMonster.cpp
More file actions
89 lines (68 loc) · 2.35 KB
/
Copy pathMonster.cpp
File metadata and controls
89 lines (68 loc) · 2.35 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
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 "Monster.h"
using namespace std;
Monster::Monster(string _nom, string _categorie, int _pvMax,
int _attaque, int _defense, int _objectifMercy)
: Entity(_nom, _pvMax, _attaque, _defense)
{
this->categorie = _categorie;
this->jaugeMercy = 0;
this->objectifMercy = _objectifMercy;
}
string Monster::obtenirCategorie() const {
return this->categorie;
}
int Monster::obtenirJaugeMercy() const {
return this->jaugeMercy;
}
int Monster::obtenirObjectifMercy() const {
return this->objectifMercy;
}
vector<string> Monster::obtenirIdsActions() const {
return this->idsActions;
}
void Monster::afficherInfo() const {
cout << "[" << this->categorie << "] " << this->obtenirNom()
<< " | PV: " << this->obtenirPv() << "/" << this->obtenirPvMax()
<< " | MERCY: " << this->jaugeMercy << "/" << this->objectifMercy
<< endl;
}
void Monster::modifierMercy(int _delta) {
this->jaugeMercy += _delta;
if (this->jaugeMercy < 0) {
this->jaugeMercy = 0;
}
if (this->jaugeMercy > this->objectifMercy) {
this->jaugeMercy = this->objectifMercy;
}
}
bool Monster::estEpargnable() const {
return this->jaugeMercy >= this->objectifMercy;
}
void Monster::ajouterActionAct(string _idAction) {
this->idsActions.push_back(_idAction);
}
vector<string> Monster::obtenirActDisponibles() const {
vector<string> disponibles;
int nombre = this->obtenirNombreActions();
for (int i = 0; i < nombre && i < (int)this->idsActions.size(); i++) {
if (this->idsActions[i] != "-") {
disponibles.push_back(this->idsActions[i]);
}
}
return disponibles;
}
NormalMonster::NormalMonster(string _nom, int _pvMax, int _atk, int _def, int _objectifMercy)
: Monster(_nom, "NORMAL", _pvMax, _atk, _def, _objectifMercy) {}
int NormalMonster::obtenirNombreActions() const {
return 2;
}
MiniBossMonster::MiniBossMonster(string _nom, int _pvMax, int _atk, int _def, int _objectifMercy)
: Monster(_nom, "MINIBOSS", _pvMax, _atk, _def, _objectifMercy) {}
int MiniBossMonster::obtenirNombreActions() const {
return 3;
}
BossMonster::BossMonster(string _nom, int _pvMax, int _atk, int _def, int _objectifMercy)
: Monster(_nom, "BOSS", _pvMax, _atk, _def, _objectifMercy) {}
int BossMonster::obtenirNombreActions() const {
return 4;
}