diff options
Diffstat (limited to 'src/spellcasting.h')
-rw-r--r-- | src/spellcasting.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/spellcasting.h b/src/spellcasting.h index aa3b3e8..902f860 100644 --- a/src/spellcasting.h +++ b/src/spellcasting.h @@ -10,6 +10,7 @@ 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); @@ -28,20 +29,18 @@ namespace entry { class Spellcasting : public Feature { public: - Spellcasting() : Feature("spellcasting", "spells", ""), innate(false), spellcasting_ability("int") {} - bool isInnate(void) const {return innate;} - rules::Ability getAbility(void) const {return spellcasting_ability;} - void setAbility(const rules::Ability& ability) {spellcasting_ability = ability;} - const std::vector<std::shared_ptr<SlotLevel>>& getSlotLevels(void) const {return levels;} - void addSlotLevel(void) {levels.push_back(std::shared_ptr<SlotLevel>(new SlotLevel()));} + Spellcasting(); + bool isInnate(void) const; + rules::Ability getAbility(void) const; + void setAbility(const rules::Ability& ability); + const std::vector<std::shared_ptr<SlotLevel>>& getSlotLevels(void) const; + void addSlotLevel(void); std::vector<std::shared_ptr<Spell>> getSpells(void) const; virtual std::string getText(const creature::Creature& c) const; - NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Feature, Spellcasting, innate, spellcasting_ability, levels); + NLOHMANN_FRIEND_DECLARES(Spellcasting); private: - bool innate; - rules::Ability spellcasting_ability; - std::vector<std::shared_ptr<SlotLevel>> levels; + std::shared_ptr<spellcastingImpl> data; }; } |