aboutsummaryrefslogtreecommitdiff
path: root/src/armor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/armor.h')
-rw-r--r--src/armor.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/armor.h b/src/armor.h
index 57402cb..0d148b7 100644
--- a/src/armor.h
+++ b/src/armor.h
@@ -3,9 +3,13 @@
#include "json.hpp"
namespace entry {
+ class Armor;
+
+ std::string genText(const Armor& a, const creature::Creature& c);
+
class Armor : public Item , public Substantial {
public:
- 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"]) {}
+ 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;}
@@ -14,7 +18,8 @@ namespace entry {
int getCost(void) const {return cost;}
double getWeight(void) const {return weight;}
- virtual std::string getText(const creature::Creature& c) const;
+ virtual std::string getText() const override;
+ virtual std::string getText(const creature::Creature& c) const override {return genText(*this, c);}
/*virtual nlohmann::json toJson(void) const {
auto data = Item::toJson();
@@ -35,6 +40,4 @@ namespace entry {
const int cost;
const double weight;
};
-
- std::string genText(const Armor& a, const creature::Creature& c);
}