#include "poison_health.h"

#include <algorithm>
#include "constants.h"

poison_health::poison_health(const position &pos):
        potion{potion_type::POISON_HEALTH, 1, pos} {}

void poison_health::apply(const enum race &race, int &HP, int &ATK, int &DEF,
                          fraction &base_hit_rate) {
        if (remaining_duration != 0) {
                int tmp = LOSE_HEALTH;

                if (race == DROW)
                        tmp *= DROW_POTION_MUL;

                HP = std::max(HP - tmp, 0);
                --remaining_duration;
        }
}

int poison_health::get_priority() const {
        return CALC_BASE;
}

const char *poison_health::get_name() const {
        return "PH";
}
