aboutsummaryrefslogtreecommitdiff
path: root/src/attack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/attack.h')
-rw-r--r--src/attack.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/attack.h b/src/attack.h
index 0a9ad68..2e4125b 100644
--- a/src/attack.h
+++ b/src/attack.h
@@ -1,10 +1,7 @@
#pragma once
#include "feature.h"
-#include "json.hpp"
#include "weapon.h"
-typedef nlohmann::json json;
-
namespace creature {
class Creature;
}
@@ -12,19 +9,14 @@ namespace 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;}
+ virtual std::string getText(const creature::Creature& c) const override {return getWeapon().getText(c) + " " + Entry::getText();}
+ Weapon getWeapon(void) const {return attack;}
- json toJson(void) const {
- auto data = Feature::toJson();
- data["attack"] = weapon.toJson();
- return data;
- }
+ NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Feature, Attack, attack);
private:
- const Weapon weapon;
+ Weapon attack;
};
}