aboutsummaryrefslogtreecommitdiff
path: root/src/armor.cc
blob: 00e1b05e4d2f329cd6664ef8f3942b9726d6c964 (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
#include "json.hpp"
#include "armor.h"

using namespace std;

namespace item {
    Armor::Armor(const nlohmann::json& data) : Item(data), acBonus(data["ac"]), armorType(data["type"]), strRequirement(data["strength"]), stealthDis(data["disadvantage"]) {}

    int Armor::getACBonus() const {
        return acBonus;
    }

    string Armor::getArmorType() const {
        return armorType;
    }

    int Armor::getStrRequirement() const {
        return strRequirement;
    }

    bool Armor::stealthDisadvantage() const {
        return stealthDis;
    }

    nlohmann::json Armor::toJson() const {
        auto data = Item::toJson();
        data["ac"] = acBonus;
        data["type"] = armorType;
        data["strength"] = strRequirement;
        data["disadvantage"] = stealthDis;
        return data;
    }
}