diff options
Diffstat (limited to 'src/creature.h')
-rw-r--r-- | src/creature.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/creature.h b/src/creature.h index 6e0d226..c6697ce 100644 --- a/src/creature.h +++ b/src/creature.h @@ -1,21 +1,19 @@ #pragma once -#include "json.hpp" #include "rules.h" #include "utils.h" #include "entry.h" +#include "feature.h" +#include "item.h" #include <cmath> +#include <nlohmann/json.hpp> namespace entry { - class Feature; - class Item; class Weapon; class Attack; class Spell; class Spellcasting; } -typedef nlohmann::json json; - namespace creature { class Creature; @@ -42,8 +40,9 @@ namespace creature { class Creature : public entry::Entry { public: - Creature(const json& data, const json& base); - virtual ~Creature() {}; + virtual ~Creature() {} + + virtual void init() override; // Getters int getSkillBonus(const rules::Skill& skill) const; @@ -91,10 +90,9 @@ namespace creature { void removeInventoryItem(std::shared_ptr<entry::Item> item); void longRest(void); - virtual json toJson(void) const; + NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Entry, Creature, givenName, hpMax, hp, inventory, stats, skills, prof, size, alignment, hit_die_count, hit_die_sides, speed, saves, senses, langs, cr, observant, natural_armor, d_immunities, d_resistances, d_vulnerabilities, c_immunities, features); private: - std::string givenName; int hpMax; int hp; |