moved files out of subdirectories, added required documentation
This commit is contained in:
33
src/restore_health.cc
Normal file
33
src/restore_health.cc
Normal file
@ -0,0 +1,33 @@
|
||||
#include "restore_health.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "constants.h"
|
||||
|
||||
restore_health::restore_health(const position &pos):
|
||||
potion{potion_type::RESTORE_HEALTH, 1, pos} {}
|
||||
|
||||
void restore_health::apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) {
|
||||
if (remaining_duration != 0) {
|
||||
if (HP >= MAX_HP[race]) {
|
||||
--remaining_duration;
|
||||
return;
|
||||
}
|
||||
|
||||
int tmp = GAIN_HEALTH;
|
||||
|
||||
if (race == DROW)
|
||||
tmp *= DROW_POTION_MUL;
|
||||
|
||||
HP = std::min(HP + tmp, MAX_HP[race]);
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int restore_health::get_priority() const {
|
||||
return CALC_BASE;
|
||||
}
|
||||
|
||||
const char *restore_health::get_name() const {
|
||||
return "RH";
|
||||
}
|
Reference in New Issue
Block a user