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