aboutsummaryrefslogtreecommitdiff
path: root/src/feature.cc
blob: c42aba21e7fd8c93c1f817fe053b5f3aae20037f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "json.hpp"
#include "feature.h"
#include "spellcasting.h"
#include "attack.h"
#include "utils.h"
#include <sstream>
#include <map>

using namespace std;
typedef nlohmann::json json;

namespace entry {
    shared_ptr<Feature> Feature::create(const 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));
    }
}