diff options
Diffstat (limited to 'src/attack.h')
-rw-r--r-- | src/attack.h | 30 |
1 files changed, 30 insertions, 0 deletions
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; + }; +} |