-
Notifications
You must be signed in to change notification settings - Fork 1
/
pers.cpp
37 lines (33 loc) · 811 Bytes
/
pers.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
#include "pers.h"
#include <cmath>
#include "objet.h"
bool person::assezproche(person* H,person* L){
int por=H->portee;
int x1= H->coord.first;
int y1= H->coord.second;
int x2= L->coord.first;
int y2= L->coord.second;
if(abs(x2-x1)<=portee and abs(y2-y1)<=portee){
return true;
}
return false;
}
bool Hero::surobjet(Objet* B){
int x1= getpos().first;
int y1= getpos().second;
int x2= B->GetPos().first;
int y2= B->GetPos().second;
if(abs(x2-x1)==0 and abs(y2-y1)==0){
return true;
}
return false;
}
void enemy::attaque(Hero* H, vector< enemy* > L){
for(int i=0;i<L.size();i++){
if (assezproche(H,L[i]))
H->hit(L[i]->str);
}
}
void enemy::die(Hero* H){
H->plusexp(expgiven);
}