#pragma once #include "features/feature.h" #include "spell.h" #include "rules.h" #include "utils.h" #include #include typedef nlohmann::json json; namespace entry { struct SlotLevel; struct spellcastingImpl; void to_json(nlohmann::json& j, const SlotLevel& sl); void from_json(const nlohmann::json& j, SlotLevel& sl); struct SlotLevel { SlotLevel() : numSlots(0) {} int numSlots; std::vector> spells; static std::shared_ptr create(const nlohmann::json& data); nlohmann::json serialize() { nlohmann::json ret; to_json(ret, *this); return ret; } }; class Spellcasting : public Feature { public: Spellcasting(); bool isInnate(void) const; rules::Ability getAbility(void) const; void setAbility(const rules::Ability& ability); const std::vector>& getSlotLevels(void) const; void addSlotLevel(void); std::vector> getSpells(void) const; virtual std::string getText(const creature::Creature& c) const; NLOHMANN_FRIEND_DECLARES(Spellcasting); private: std::shared_ptr data; }; }