From 2a9f262e6db5906db445d465e500d7ba8c90fab3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 5 May 2021 09:44:50 -0400 Subject: Implemented additional commands --- src/creature.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/creature.h') 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(data["qualifiers"])) {} std::string type; - std::vector qualifiers; + std::vector 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> getFeatures(void) const {return features;} + std::shared_ptr getSpellcasting(void) const; std::vector> getInventory(void) const {return inventory;} std::vector getDmgImmunities(void) const {return dmgImmunities;} std::vector 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& qualifiers); + void applyDamage(int amount, const std::string& type, const std::vector& 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 item); - void removeInventoryItem(const std::string& itemName); + void addSpell(std::shared_ptr spell); + void removeSpell(std::shared_ptr spell); + void removeInventoryItem(std::shared_ptr item); + void longRest(void); virtual json toJson(void) const; @@ -100,6 +107,7 @@ namespace creature { std::vector> inventory; std::map stats; std::map skills; + int proficiency; //Immutable variables //const std::string creatureName; @@ -113,7 +121,6 @@ namespace creature { const std::vector senses; const std::string langs; const double cr; - const int proficiency; const std::string natArmorName; const int natArmorBonus; const std::vector dmgImmunities; -- cgit v1.2.3