diff options
author | Your Name <you@example.com> | 2021-05-01 15:10:54 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-01 15:10:54 -0400 |
commit | 7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d (patch) | |
tree | d9b808542216f71dbab053ad23145903e96c6401 /src/attack.h | |
parent | 5a813a75412ac9b8fadb90c9abd46dd95aee8e9b (diff) | |
download | dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.gz dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.bz2 dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.zip |
Added bash completion, amongst others
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; + }; +} |