From dfce4d0398a8bafbb7ad7a31345af181c0269c09 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 Apr 2021 15:23:23 -0400 Subject: Added spells --- src/weapon.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src/weapon.h') diff --git a/src/weapon.h b/src/weapon.h index f09e8e5..e4755df 100644 --- a/src/weapon.h +++ b/src/weapon.h @@ -10,16 +10,31 @@ namespace creature { namespace item { class Weapon : public Item { public: - Weapon(const nlohmann::json& data); - std::string getDamageType(void) const; - int getDamageDieCount(void) const; + Weapon(const nlohmann::json& data, const nlohmann::json& base) : Item(base), damageType(data["damage"]["dmg_type"]), damageDieCount(data["damage"]["dmg_die_count"]), damageDieSides(data["damage"]["dmg_die_sides"]), properties(data["properties"]), weaponType(data["type"]), range(data["range"][0], data["range"][1]), reach(data["reach"]), cost(data["cost"]), weight(data["weight"]) {} + + std::string getDamageType(void) const {return damageType;} + int getDamageDieCount(void) const {return damageDieCount;} int getDamageDieSides(bool versatile=false) const; - std::set getProperties(void) const; - std::string getWeaponType(void) const; - std::pair getRange(void) const; - int getReach(void) const; + std::set getProperties(void) const {return properties;} + std::string getWeaponType(void) const {return weaponType;} + std::pair getRange(void) const {return range;} + int getReach(void) const {return reach;} + int getCost(void) const {return cost;} + double getWeight(void) const {return weight;} - virtual nlohmann::json toJson(void) const; + /*virtual nlohmann::json toJson(void) const { + auto data = Item::toJson(); + data["damage"]["dmg_type"] = damageType; + data["damage"]["dmg_die_count"] = damageDieCount; + data["damage"]["dmg_die_sides"] = damageDieSides; + data["properties"] = properties; + data["type"] = weaponType; + data["range"] = range; + data["reach"] = reach; + data["cost"] = cost; + data["weight"] = weight; + return data; + }*/ private: const std::string damageType; @@ -29,6 +44,8 @@ namespace item { const std::string weaponType; const std::pair range; const int reach; + const int cost; + const double weight; }; std::string genActionText(const Weapon& w, const creature::Creature& c); -- cgit v1.2.3