From e044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 9 May 2021 19:01:59 -0400 Subject: Code refactoring --- src/armor.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/armor.h') diff --git a/src/armor.h b/src/armor.h index c059093..4351a24 100644 --- a/src/armor.h +++ b/src/armor.h @@ -1,30 +1,30 @@ #pragma once #include "item.h" -#include "json.hpp" +#include namespace entry { class Armor; class Armor : public Item , public Substantial { public: - Armor(const nlohmann::json& data, const nlohmann::json& base) : Item(base), acBonus(data["ac"]), armorType(data["armor_type"]), strRequirement(data["strength"]), stealthDis(data["disadvantage"]), cost(data["cost"]), weight(data["weight"]) {} - - int getACBonus(void) const {return acBonus;} - std::string getArmorType(void) const {return armorType;} - int getStrRequirement(void) const {return strRequirement;} - bool stealthDisadvantage(void) const {return stealthDis;} + int getACBonus(void) const {return ac;} + std::string getArmorType(void) const {return armor_type;} + int getStrRequirement(void) const {return strength;} + bool stealthDisadvantage(void) const {return disadvantage;} int getCost(void) const {return cost;} double getWeight(void) const {return weight;} virtual std::string getText() const override; virtual std::string getText(const creature::Creature& c) const override; + NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Item, Armor, ac, armor_type, strength, disadvantage, cost, weight); + private: - const int acBonus; - const std::string armorType; - const int strRequirement; - const bool stealthDis; - const int cost; - const double weight; + int ac; + std::string armor_type; + int strength; + bool disadvantage; + int cost; + double weight; }; } -- cgit v1.2.3