aboutsummaryrefslogtreecommitdiff
path: root/src/armor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/armor.h')
-rw-r--r--src/armor.h26
1 files changed, 13 insertions, 13 deletions
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 <nlohmann/json.hpp>
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;
};
}