-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriest.cpp
More file actions
41 lines (35 loc) · 978 Bytes
/
Priest.cpp
File metadata and controls
41 lines (35 loc) · 978 Bytes
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
#include <cstdlib>
#include<iostream>
#include "./Priest.hpp"
#include "./Menu.hpp"
using namespace std;
Priest::Priest(string name) : Character(name,Job::PriestJob,25,100,50,200,120), maxMp(100), Mp(100){}
bool Priest::tryUsingMp(int Mp){
if(this->Mp < Mp){
return false;
}
this->Mp -= Mp;
return true;
}
void Priest::healSpell(Character& other){
if(!tryUsingMp(this->maxMp*0.10f)){
return;
}
int healValue = (rand() % ( magicAttack*2 - magicAttack)+magicAttack );
other.heal(healValue);
Menu::toScreen(
"",
this->name + " soigne " + other.name,
other.name + " est à " + to_string(other.getCurrentHp()) + " pv."
);
}
string Priest::getSpecialActionName() {
if(tryUsingMp(0)) {
return "Soignez un allié";
} else {
return "Soignez un allié (plus assez de point magique...)";
}
}
void Priest::launchSpecialAction(Character& target) {
healSpell(target);
}