34 lines
1.4 KiB
C++
34 lines
1.4 KiB
C++
#ifndef CREATURELIB_ITEMTURNCHOICE_HPP
|
|
#define CREATURELIB_ITEMTURNCHOICE_HPP
|
|
|
|
#include "../../Library/Items/Item.hpp"
|
|
#include "../Models/CreatureIndex.hpp"
|
|
#include "BaseTurnChoice.hpp"
|
|
namespace CreatureLib::Battling {
|
|
class ItemTurnChoice : public BaseTurnChoice {
|
|
ArbUt::BorrowedPtr<const Library::Item> _item;
|
|
std::optional<CreatureIndex> _target;
|
|
|
|
public:
|
|
ItemTurnChoice(ArbUt::BorrowedPtr<Creature> user, const ArbUt::BorrowedPtr<const Library::Item>& item,
|
|
const std::optional<CreatureIndex>& target)
|
|
: BaseTurnChoice(user), _item(item), _target(target) {}
|
|
~ItemTurnChoice() override = default;
|
|
|
|
[[nodiscard]] TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind::Item; }
|
|
|
|
[[nodiscard]] const ArbUt::BorrowedPtr<const Library::Item>& GetItem() const noexcept { return _item; }
|
|
[[nodiscard]] const std::optional<CreatureIndex>& GetTarget() const noexcept { return _target; }
|
|
|
|
protected:
|
|
size_t ScriptCount() const override { return GetUser()->ScriptCount(); }
|
|
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override {
|
|
GetOwnScripts(scripts);
|
|
GetUser()->GetActiveScripts(scripts);
|
|
}
|
|
void GetOwnScripts(ArbUt::List<ScriptWrapper>&) override {}
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_ITEMTURNCHOICE_HPP
|