//
// Created by Dan Crosby on 5/25/20.
//

#ifndef EAGLE0_METEORTARGETCOMMAND_HPP
#define EAGLE0_METEORTARGETCOMMAND_HPP

#include "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/ShardokCommand.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/map/Coordinates.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/settings/GameSettings.hpp"

namespace shardok {

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

    const ActionCost cost;
    const SettingsGetter settings;
    const UnitId casterId;
    const Coords target;
    const int minimumKnowledge;

public:
    MeteorTargetCommand(
            const ActionCost &cost,
            const SettingsGetter &settingsGetter,
            PlayerId playerId,
            UnitId casterId,
            Coords target,
            int minimumKnowledge);

    ~MeteorTargetCommand() override = default;

    auto GetCommandType() const -> CommandType override {
        return net::eagle0::shardok::common::METEOR_TARGET_COMMAND;
    }

    auto GetCommandProto() const -> CommandProto override;
    [[nodiscard]] auto IsRequiredToEndTurn() const -> bool override { return true; }
    [[nodiscard]] auto CanDoWithLowMorale() const -> bool override { return true; }
    [[nodiscard]] auto CanDoWithLowVigor() const -> bool override { return true; }

    [[nodiscard]] int GetActorUnitId() const override { return casterId; }
    [[nodiscard]] MapIndex GetTargetRow() const override { return target.row(); }
    [[nodiscard]] MapIndex GetTargetColumn() const override { return target.column(); }
};
}  // namespace shardok

#endif  // EAGLE0_METEORTARGETCOMMAND_HPP
