#include "brawler.h"

#include "constants.h"

brawler::brawler(RNG *rng, const feature enabled_features):
        player_base{rng, enabled_features, race::BRAWLER} {};

const char *brawler::get_race_name() const {
        return "Tavern Brawler";
}

long_result brawler::attack(character *ch) {
        if (ch == nullptr)
                return {result::NOTHING,
                        "PC tried to attack thin air. "};

        // hits twice
        if (rng->coin_flip()) {
                auto res1 = ch->get_hit(this, ATK, base_hit_rate);
                auto res2 = ch->get_hit(this, ATK, base_hit_rate);
                return {res2.res, res1.msg + res2.msg};
        } else {
                auto res1 = ch->get_hit(this, ATK, base_hit_rate);
                auto res2 = ch->get_hit(this, ATK, base_hit_rate);
                auto res3 = ch->get_hit(this, ATK, base_hit_rate);
                return {res3.res, res1.msg + res2.msg + res3.msg};
        }

        return {NOTHING, ""};
}
