From b27700a7e0b281ece3dea23060c17e0cae28715d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 20 May 2021 17:00:53 -0400 Subject: Reduced exposure of implementation details --- src/spellcasting.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/spellcasting.cc') 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(new SlotLevel(data)); } + struct spellcastingImpl { + bool innate; + rules::Ability spellcasting_ability; + std::vector> 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>& Spellcasting::getSlotLevels(void) const {return data->levels;} + void Spellcasting::addSlotLevel(void) {data->levels.push_back(std::shared_ptr(new SlotLevel()));} + vector> Spellcasting::getSpells() const { vector> ret; for(auto sl : getSlotLevels()) { -- cgit v1.2.3