#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; }; }