aboutsummaryrefslogtreecommitdiff
path: root/src/weapon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/weapon.cc')
-rw-r--r--src/weapon.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/weapon.cc b/src/weapon.cc
index 0c4dc29..053dbc1 100644
--- a/src/weapon.cc
+++ b/src/weapon.cc
@@ -9,6 +9,30 @@
using namespace std;
namespace entry {
+ struct weaponImpl {
+ std::vector<Damage> damage;
+ std::set<std::string> properties;
+ std::string weapon_type;
+ std::pair<int, int> range;
+ int reach;
+ int cost;
+ double weight;
+ };
+
+ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(weaponImpl, damage, properties, weapon_type, range, reach, cost, weight);
+
+ NLOHMANN_FRIEND_DEFS(Item, Weapon, data);
+
+ Weapon::Weapon() : data(new weaponImpl()) {}
+
+ std::vector<Damage> Weapon::getDamage(void) const {return data->damage;}
+ std::set<std::string> Weapon::getProperties(void) const {return data->properties;}
+ std::string Weapon::getWeaponType(void) const {return data->weapon_type;}
+ std::pair<int, int> Weapon::getRange(void) const {return data->range;}
+ int Weapon::getReach(void) const {return data->reach;}
+ int Weapon::getCost(void) const {return data->cost;}
+ double Weapon::getWeight(void) const {return data->weight;}
+
string getTextHelper(const Weapon& w, string toHitBonus, string damageBonus) {
stringstream text;
text << "+" << toHitBonus << " to hit, ";