diff options
Diffstat (limited to 'src/features/feature.cc')
-rw-r--r-- | src/features/feature.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/features/feature.cc b/src/features/feature.cc new file mode 100644 index 0000000..0fd2d6c --- /dev/null +++ b/src/features/feature.cc @@ -0,0 +1,19 @@ +#include "feature.h" +#include "../spellcasting.h" +#include "../attack.h" +#include "../utils.h" +#include <nlohmann/json.hpp> +#include <memory> + +using namespace std; + +namespace entry { + shared_ptr<Feature> Feature::create(const nlohmann::json& data) { + if(data["type"] == "spells") { + return utils::loadDFromJson<Feature, Spellcasting>(data); + } else if(data["type"] == "attack") { + return utils::loadDFromJson<Feature, Attack>(data); + } + return shared_ptr<Feature>(new Feature(data)); + } +} |