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, 20 insertions, 6 deletions
diff --git a/src/armor.h b/src/armor.h
index 0ea7199..2df1fff 100644
--- a/src/armor.h
+++ b/src/armor.h
@@ -5,18 +5,32 @@
namespace item {
class Armor : public Item {
public:
- Armor(const nlohmann::json& data);
- int getACBonus(void) const;
- std::string getArmorType(void) const;
- int getStrRequirement(void) const;
- bool stealthDisadvantage(void) const;
+ Armor(const nlohmann::json& data, const nlohmann::json& base) : Item(base), acBonus(data["ac"]), armorType(data["type"]), strRequirement(data["strength"]), stealthDis(data["disadvantage"]), cost(data["cost"]), weight(data["weight"]) {}
- virtual nlohmann::json toJson(void) const;
+ 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 getCost(void) const {return cost;}
+ double getWeight(void) const {return weight;}
+
+ /*virtual nlohmann::json toJson(void) const {
+ auto data = Item::toJson();
+ data["ac"] = acBonus;
+ data["type"] = armorType;
+ data["strength"] = strRequirement;
+ data["disadvantage"] = stealthDis;
+ data["cost"] = cost;
+ data["weight"] = weight;
+ return data;
+ }*/
private:
const int acBonus;
const std::string armorType;
const int strRequirement;
const bool stealthDis;
+ const int cost;
+ const double weight;
};
}