aboutsummaryrefslogtreecommitdiff
path: root/src/spell.h
blob: 31b7d72d6edd3784f5aa6f7eea85d6416da59614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "json.hpp"
#include "entry.h"

namespace entry {
    class Spell : public Entry {
        public:
            Spell(const nlohmann::json& data, const nlohmann::json& base) : Entry(base), level(data["level"]), classes(data["classes"]), castingTime(data["casting_time"]), range(data["range"]), components(data["components"]), duration(data["duration"]) {};
            virtual ~Spell() {};

            //std::string getName(void) const {return name;}
            int getLevel(void) const {return level;}
            std::string getSchool(void) const {return getType();}
            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 override;

            virtual nlohmann::json toJson(void) const {
                auto data = Entry::toJson();
                data["level"] = level;
                data["classes"] = classes;
                data["casting_time"] = castingTime;
                data["range"] = range;
                data["components"] = components;
                data["duration"] = duration;
                return data;
            }

        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;
    };
}