#include "Battle/Escape.h"

#include <Player/Player.h>
#include <Ship/Ship.h>

#include <iostream>

std::random_device Escape::_rd{};

Action::Status Escape::operator()(Player* player, Ship*) {
    std::cout << "Player ship: " << player->getShip().name() << " try to escape!\n";
    
    std::uniform_int_distribution<int> dice(0, 20);
    const auto res = dice(_seed);
    if (res > 12) {
        std::cout << "Player escaped!\n";
        return Status::Escaped;
    }

    std::cout << "Escape maneuver failed!\n";
    return Status::Nothing;
}
