aboutsummaryrefslogtreecommitdiff
path: root/src/weapon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/weapon.h')
-rw-r--r--src/weapon.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/weapon.h b/src/weapon.h
index 9ee2e8a..7a8c0ba 100644
--- a/src/weapon.h
+++ b/src/weapon.h
@@ -8,9 +8,13 @@ namespace creature {
}
namespace entry {
+ class Weapon;
+
+ std::string genText(const Weapon& w, const creature::Creature& c);
+
class Weapon : public Item, public Substantial {
public:
- 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"]) {}
+ 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["weapon_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;}
@@ -21,8 +25,9 @@ namespace entry {
int getReach(void) const {return reach;}
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();
@@ -49,6 +54,4 @@ namespace entry {
const int cost;
const double weight;
};
-
- std::string genText(const Weapon& w, const creature::Creature& c);
}