aboutsummaryrefslogtreecommitdiff
path: root/src/weapon.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-15 15:23:23 -0400
committerYour Name <you@example.com>2021-04-15 15:23:23 -0400
commitdfce4d0398a8bafbb7ad7a31345af181c0269c09 (patch)
tree695162ff8cc25e146f52d9e26fe19ffa9934b3d6 /src/weapon.h
parent9034c3d2533177f7cb7a7ce939ec53f7fa63f60e (diff)
downloaddmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.gz
dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.tar.bz2
dmtool-dfce4d0398a8bafbb7ad7a31345af181c0269c09.zip
Added spells
Diffstat (limited to 'src/weapon.h')
-rw-r--r--src/weapon.h33
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);