#include "elf.h"

#include "constants.h"

elf::elf(RNG *rng, const feature enabled_features, const position &pos,
         const int gen_room_num):
        enemy_base{rng, enabled_features, ELF, pos, gen_room_num, "E"} {}

const char *elf::get_race_name() const {
        return "Elf";
}

long_result elf::attack(character *ch) {
        auto res1 = ch->get_hit(this, ATK, base_hit_rate);

        if (res1.res == result::DIED)
                return res1;

        if (ch->get_race() == DROW)
                return res1;

        auto res2 = ch->get_hit(this, ATK, base_hit_rate);

        if (res1.res == MISS && res2.res == MISS)
                return {MISS, res1.msg + res2.msg};
        else if (res2.res == DIED)
                return {DIED, res1.msg + res2.msg};
        else
                return {HIT, res1.msg + res2.msg};
}
