aboutsummaryrefslogtreecommitdiff
path: root/src/spellcasting.cc
diff options
context:
space:
mode:
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()) {