//
//  BecomeOutlawCommand.hpp
//  eagle0
//
//  Created by Dan Crosby on 2021/06/13.
//  Copyright © 2021 none. All rights reserved.
//

#ifndef EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP
#define EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP

#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"

namespace shardok {
class BecomeOutlawCommand : public ShardokCommand {
protected:
    [[nodiscard]] auto InternalExecute(
            const GameStateW& currentState,
            const std::shared_ptr<RandomGenerator>& generator) const
            -> vector<ActionResult> override;

    const ActionCost cost;
    const UnitId fleeingUnitId;
    const PercentileRollOdds successOdds;

public:
    BecomeOutlawCommand(
            const ActionCost& cost,
            PlayerId playerId,
            UnitId fleeingUnitId,
            PercentileRollOdds odds);

    ~BecomeOutlawCommand() override = default;

    [[nodiscard]] auto ExecuteWithRoll(const GameStateW& currentState, double roll) const
            -> vector<ActionResult>;

    [[nodiscard]] auto GetCommandType() const -> CommandType override {
        return net::eagle0::shardok::common::BECOME_OUTLAW_COMMAND;
    }

    [[nodiscard]] auto GetCommandProto() const -> CommandProto override;
    [[nodiscard]] auto HasOdds() const -> bool override { return true; }
    [[nodiscard]] auto GetOddsPercentile() const -> int32_t override;
    [[nodiscard]] auto CanBeFollowUp() const -> bool override { return false; }
    [[nodiscard]] auto CanDoWithLowMorale() const -> bool override { return true; }

    [[nodiscard]] int GetActorUnitId() const override { return fleeingUnitId; }
};
}  // namespace shardok

#endif  // EAGLE0_SHARDOK_LIBRARY_COMMANDS_BECOME_OUTLAW_COMMAND_HPP
