From 7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 1 May 2021 15:10:54 -0400 Subject: Added bash completion, amongst others --- src/attack.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/attack.h (limited to 'src/attack.h') diff --git a/src/attack.h b/src/attack.h new file mode 100644 index 0000000..0a9ad68 --- /dev/null +++ b/src/attack.h @@ -0,0 +1,30 @@ +#pragma once +#include "feature.h" +#include "json.hpp" +#include "weapon.h" + +typedef nlohmann::json json; + +namespace creature { + class Creature; +} + +namespace entry { + class Attack : public Feature { + public: + Attack(const json& data, const json& base): Feature(base), weapon(data["attack"], data["attack"]) {} + virtual ~Attack() {} + + virtual std::string getText(const creature::Creature& c) const override {return weapon.getText(c) + " " + Entry::getText();} + Weapon getWeapon(void) {return weapon;} + + json toJson(void) const { + auto data = Feature::toJson(); + data["attack"] = weapon.toJson(); + return data; + } + + private: + const Weapon weapon; + }; +} -- cgit v1.2.3