diff options
Diffstat (limited to 'src/weapon.h')
-rw-r--r-- | src/weapon.h | 33 |
1 files changed, 25 insertions, 8 deletions
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<std::string> getProperties(void) const; - std::string getWeaponType(void) const; - std::pair<int, int> getRange(void) const; - int getReach(void) const; + std::set<std::string> getProperties(void) const {return properties;} + std::string getWeaponType(void) const {return weaponType;} + std::pair<int, int> 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<const int, const int> range; const int reach; + const int cost; + const double weight; }; std::string genActionText(const Weapon& w, const creature::Creature& c); |