aboutsummaryrefslogtreecommitdiff
path: root/src/spellcasting.cc
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.cc
parentbe88609c825e18201f240415fe74a31c1a789484 (diff)
downloaddmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2
dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip
Reduced exposure of implementation details
Diffstat (limited to 'src/spellcasting.cc')
-rw-r--r--src/spellcasting.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/spellcasting.cc b/src/spellcasting.cc
index 6315446..d969c5e 100644
--- a/src/spellcasting.cc
+++ b/src/spellcasting.cc
@@ -26,6 +26,27 @@ namespace entry {
return shared_ptr<SlotLevel>(new SlotLevel(data));
}
+ struct spellcastingImpl {
+ bool innate;
+ rules::Ability spellcasting_ability;
+ std::vector<std::shared_ptr<SlotLevel>> levels;
+ };
+
+ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(spellcastingImpl, innate, spellcasting_ability, levels);
+
+ NLOHMANN_FRIEND_DEFS(Feature, Spellcasting, data);
+
+ Spellcasting::Spellcasting() : Feature("spellcasting", "spells", ""), data(new spellcastingImpl()) {
+ data->innate = false;
+ data->spellcasting_ability = rules::Ability::Int();
+ }
+
+ bool Spellcasting::isInnate(void) const {return data->innate;}
+ rules::Ability Spellcasting::getAbility(void) const {return data->spellcasting_ability;}
+ void Spellcasting::setAbility(const rules::Ability& ability) {data->spellcasting_ability = ability;}
+ const std::vector<std::shared_ptr<SlotLevel>>& Spellcasting::getSlotLevels(void) const {return data->levels;}
+ void Spellcasting::addSlotLevel(void) {data->levels.push_back(std::shared_ptr<SlotLevel>(new SlotLevel()));}
+
vector<shared_ptr<Spell>> Spellcasting::getSpells() const {
vector<shared_ptr<Spell>> ret;
for(auto sl : getSlotLevels()) {