//
//  FleeCommand.hpp
//  eagle0
//
//  Created by Dan Crosby on 12/30/19.
//  Copyright © 2019 none. All rights reserved.
//

#ifndef FleeCommand_hpp
#define FleeCommand_hpp

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

namespace shardok {
class FleeCommand : public ShardokCommand {
protected:
    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:
    FleeCommand(
            const ActionCost& cost,
            PlayerId playerId,
            UnitId fleeingUnitId,
            PercentileRollOdds odds);

    ~FleeCommand() override = default;

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

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

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

#endif /* FleeCommand_hpp */
