#pragma once #include "item.h" #include "rules.h" #include #include namespace creature { class Creature; } namespace entry { class Weapon; class Damage; std::vector getAbilityOptions(const Weapon& w); std::vector rollDmg(const Weapon& w, bool versatile=false); std::string formatDmg(const Weapon& w, const creature::Creature& c); struct Damage { int dmg_die_count; int dmg_die_sides; std::string dmg_type; bool is_or; int rolled = 0; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Damage, dmg_die_count, dmg_die_sides, dmg_type, is_or); class Weapon : public Item, public Substantial { public: std::vector getDamage(void) const {return damage;} std::set getProperties(void) const {return properties;} std::string getWeaponType(void) const {return weapon_type;} 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 std::string getText() const override; virtual std::string getText(const creature::Creature& c) const override; NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Item, Weapon, damage, properties, weapon_type, range, reach, cost, weight); private: std::vector damage; std::set properties; std::string weapon_type; std::pair range; int reach; int cost; double weight; }; }