From dfce4d0398a8bafbb7ad7a31345af181c0269c09 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 Apr 2021 15:23:23 -0400 Subject: Added spells --- src/feature.cc | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'src/feature.cc') diff --git a/src/feature.cc b/src/feature.cc index 2747631..84f23fe 100644 --- a/src/feature.cc +++ b/src/feature.cc @@ -1,5 +1,7 @@ #include "json.hpp" #include "feature.h" +#include "spellcasting.h" +#include "utils.h" #include #include @@ -8,30 +10,9 @@ typedef nlohmann::json json; namespace feature { shared_ptr Feature::create(const json& data) { + if(data["type"] == "spellcasting") { + return utils::loadDFromJson(data); + } return shared_ptr(new Feature(data)); } - - Feature::Feature(const json& data) : name(data["name"]), type(data["type"]), text(data["text"]) {} - - Feature::~Feature() {} - - string Feature::getName() const { - return name; - } - - string Feature::getType() const { - return type; - } - - string Feature::getText() const { - return text; - } - - json Feature::toJson() const { - return json({ - {"name", name}, - {"type", type}, - {"text", text} - }); - } } -- cgit v1.2.3