-
Notifications
You must be signed in to change notification settings - Fork 0
/
drow.cc
46 lines (42 loc) · 979 Bytes
/
drow.cc
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
#include"drow.h"
#include "style.h"
#include "object.h"
#include "potion.h"
Drow::Drow(int row, int col):
Player{150, 25, 15, row, col, DROW}{}
bool Drow::visit (Object &object, Type type) {
return object.be_visit (*this, type);
}
Info& Drow::getInfo () {
if(!getPlayerInfo().potion){
if(Character::getInfo().hp < 0){
Character::getInfo().hp = 0;
}
if(Character::getInfo().hp > 150){
Character::getInfo().hp = 150;
}
if(Character::getInfo().atk < 0){
Character::getInfo().atk = 0;
}
if(Character::getInfo().def < 0){
Character::getInfo().def = 0;
}
return Character::getInfo();
} else {
auto &modifyInfo = getPlayerInfo().potion->modify();
Character::getInfo().hp = modifyInfo.hp;
// if(modifyInfo.hp < 0){
// modifyInfo.atk = 0;
// }
if(modifyInfo.hp > 150){
modifyInfo.hp = 150;
}
if(modifyInfo.atk < 0){
modifyInfo.atk = 0;
}
if(modifyInfo.def < 0){
modifyInfo.def = 0;
}
return modifyInfo;
}
}