diff options
author | Your Name <you@example.com> | 2021-04-15 15:23:23 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-04-15 15:23:23 -0400 |
commit | dfce4d0398a8bafbb7ad7a31345af181c0269c09 (patch) | |
tree | 695162ff8cc25e146f52d9e26fe19ffa9934b3d6 /src/spell.h | |
parent | 9034c3d2533177f7cb7a7ce939ec53f7fa63f60e (diff) | |
download | dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.gz dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.bz2 dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.zip |
Added spells
Diffstat (limited to 'src/spell.h')
-rw-r--r-- | src/spell.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/spell.h b/src/spell.h new file mode 100644 index 0000000..d493d5d --- /dev/null +++ b/src/spell.h @@ -0,0 +1,47 @@ +#pragma once +#include "json.hpp" +#include "jsonable.h" + +namespace spell { + class Spell : public Jsonable { + public: + Spell(const nlohmann::json& data) : name(data["name"]), level(data["level"]), school(data["school"]), classes(data["classes"]), castingTime(data["casting_time"]), range(data["range"]), components(data["components"]), duration(data["duration"]), text(data["text"]) {}; + virtual ~Spell() {}; + + std::string getName(void) const {return name;} + int getLevel(void) const {return level;} + std::string getSchool(void) const {return school;} + std::vector<std::string> getClasses(void) const {return classes;} + std::string getCastingTime(void) const {return castingTime;} + std::string getRange(void) const {return range;} + std::string getComponents(void) const {return components;} + std::string getDuration(void) const {return duration;} + std::string getText(void) const {return text;} + + virtual nlohmann::json toJson(void) const { + /*return nlohmann::json({ + {"name", name}, + {"level", level}, + {"school", school}, + {"classes", classes}, + {"casting_time", castingTime}, + {"range", range}, + {"components", components}, + {"duration", duration}, + {"text", text} + });*/ + return nlohmann::json(name); + } + + private: + const std::string name; + const int level; + const std::string school; + const std::vector<std::string> classes; + const std::string castingTime; + const std::string range; + const std::string components; + const std::string duration; + const std::string text; + }; +} |