-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHumain.cpp
64 lines (43 loc) · 1.14 KB
/
Humain.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
/**
* @file Humain.hpp
* @author DROMIGNY--CHEVREUIL Ivan, FRETAUD Killian
* @date 06/10/2016
* @brief Header de Humain.tpp
*
**/
#include <iostream>
#include "Humain.hpp"
using namespace std;
// ---------------------------------------------------------------------------- Constructeur / Destructeur
Humain::Humain() : Chose(), inventaire_(Inventaire(5)){
arme_ = nullptr;
}
Humain::~Humain(){
arme_ = nullptr;
}
// ---------------------------------------------------------------------------- Méthodes d'interaction
void Humain::recevoir_degat(int d){
pdv_ -= d;
}
void Humain::attaquer(Chose &cible) const{
cible.recevoir_degat(attaque_);
}
void Humain::mouvement(){}
void Humain::prendre_objet(Stuff obj){
inventaire_.ajouter_objet(obj);
}
void Humain::rentrer_bat(){};
void Humain::manger(Aliment a){
set_pdv(a.get_soin()+get_pdv());
}
// ---------------------------------------------------------------------------- Getteur / Setteur
Arme Humain::get_arme() const{
return *arme_;
}
void Humain::set_arme(Arme& a){
arme_ = &a;
set_attaque(a.get_deg());
}
void Humain::set_pdv(int pdv){
pdv_ = (pdv > maxPdvH) ? maxPdvH : pdv;
}