aboutsummaryrefslogtreecommitdiff
path: root/src/spellcasting.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-20 17:00:53 -0400
committerYour Name <you@example.com>2021-05-20 17:00:53 -0400
commitb27700a7e0b281ece3dea23060c17e0cae28715d (patch)
treeef13e98281dd0183c4fb1e32cdf371ea1f6c1794 /src/spellcasting.h
parentbe88609c825e18201f240415fe74a31c1a789484 (diff)
downloaddmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip
Reduced exposure of implementation details
Diffstat (limited to 'src/spellcasting.h')
-rw-r--r--src/spellcasting.h19
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;
};
}