#include "Player/EnemyHardDifficultLvlStrategy.h"

#include "Ship/Ship.h"

std::random_device EnemyHardDifficultLvlStrategy::_rd{};

EnemyHardDifficultLvlStrategy::EnemyHardDifficultLvlStrategy()
    : _seed(_rd()) {}

int EnemyHardDifficultLvlStrategy::handle(Ship& ship) const {
    std::uniform_int_distribution<int> dice(1, 20);
    int multiplier = 1;
    const int res = dice(_seed);

    if (res < 3) {
        // miss
        return 0;
    } else if (res == 20) {
        // turbo critical
        multiplier = 3;
    } else if (res > 15) {
        // criticall
        multiplier = 2;
    }

    std::uniform_int_distribution<int> damage(30, 60);
    const int total = damage(_seed) * multiplier;
    ship.takeDamage(total);

    return total;
}
