aboutsummaryrefslogtreecommitdiff
path: root/src/creature.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/creature.h')
-rw-r--r--src/creature.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/creature.h b/src/creature.h
index ee4d5ba..cdbd2b9 100644
--- a/src/creature.h
+++ b/src/creature.h
@@ -10,6 +10,8 @@ namespace entry {
class Item;
class Weapon;
class Attack;
+ class Spell;
+ class Spellcasting;
}
typedef nlohmann::json json;
@@ -19,9 +21,9 @@ namespace creature {
class dmgType : public Jsonable {
public:
- dmgType(const json& data) : type(data["type"]), qualifiers(data["qualifiers"]) {}
+ dmgType(const json& data) : type(data["type"]), qualifiers(json2vec<rules::Qualifier>(data["qualifiers"])) {}
std::string type;
- std::vector<std::string> qualifiers;
+ std::vector<rules::Qualifier> qualifiers;
std::string getText() const {
if(qualifiers.empty()) {
return type;
@@ -74,6 +76,7 @@ namespace creature {
int getBonus(const rules::Ability& ability) const {return std::floor((getScore(ability) - 10) / 2.0);}
int getProficiency(void) const {return proficiency;}
std::vector<std::shared_ptr<entry::Feature>> getFeatures(void) const {return features;}
+ std::shared_ptr<entry::Spellcasting> getSpellcasting(void) const;
std::vector<std::shared_ptr<entry::Item>> getInventory(void) const {return inventory;}
std::vector<dmgType> getDmgImmunities(void) const {return dmgImmunities;}
std::vector<dmgType> getDmgResistances(void) const {return dmgResistances;}
@@ -83,12 +86,16 @@ namespace creature {
// Setters (mutators)
void setGivenName(std::string name) {givenName = name;}
- void applyDamage(int amount, const std::string& type, const std::vector<std::string>& qualifiers);
+ void applyDamage(int amount, const std::string& type, const std::vector<rules::Qualifier>& qualifiers);
void applyHealing(int amount);
void setScore(const rules::Ability& ability, int score);
void setProfLevel(const rules::Skill& skill, int level);
+ void setProficiency(int prof) {proficiency = prof;}
void addInventoryItem(std::shared_ptr<entry::Item> item);
- void removeInventoryItem(const std::string& itemName);
+ void addSpell(std::shared_ptr<entry::Spell> spell);
+ void removeSpell(std::shared_ptr<entry::Spell> spell);
+ void removeInventoryItem(std::shared_ptr<entry::Item> item);
+ void longRest(void);
virtual json toJson(void) const;
@@ -100,6 +107,7 @@ namespace creature {
std::vector<std::shared_ptr<entry::Item>> inventory;
std::map<rules::Ability, int> stats;
std::map<rules::Skill, int> skills;
+ int proficiency;
//Immutable variables
//const std::string creatureName;
@@ -113,7 +121,6 @@ namespace creature {
const std::vector<std::string> senses;
const std::string langs;
const double cr;
- const int proficiency;
const std::string natArmorName;
const int natArmorBonus;
const std::vector<dmgType> dmgImmunities;