aboutsummaryrefslogtreecommitdiff
path: root/src/creature.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-09 19:01:59 -0400
committerYour Name <you@example.com>2021-05-09 19:01:59 -0400
commite044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd (patch)
tree344c09421c5839a764a132fe9166f0e6e3f90e45 /src/creature.h
parentd13358b71ec15085f2638fd9c3fc634df62dfc94 (diff)
downloaddmtool-e044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd.tar.gz
dmtool-e044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd.tar.bz2
dmtool-e044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd.zip
Code refactoring
Diffstat (limited to 'src/creature.h')
-rw-r--r--src/creature.h16
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;