#include "fine_booze.h"

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

fine_booze::fine_booze(const position &pos):
        potion{potion_type::FINE_BOOZE, DURATION, pos} {}

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

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

                if (HP < MAX_HP[race])
                        HP = std::min(HP + tmp, MAX_HP[race]);

                if (race == BRAWLER)
                        base_hit_rate = HR_TB;
                else
                        base_hit_rate *= HR_MUL;

                --remaining_duration;
        }
}

int fine_booze::get_priority() const {
        return CALC_LAST;
}

const char *fine_booze::get_name() const {
        return "FB";
}
