aboutsummaryrefslogtreecommitdiff
path: root/src/creature.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/creature.h')
-rw-r--r--src/creature.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/creature.h b/src/creature.h
index 7327de9..1c8db21 100644
--- a/src/creature.h
+++ b/src/creature.h
@@ -1,6 +1,7 @@
#pragma once
#include "json.hpp"
#include "jsonable.h"
+#include "rules.h"
namespace entry {
class Feature;
@@ -34,10 +35,10 @@ namespace creature {
virtual ~Creature() {};
// Getters
- int getSkillBonus(const std::string& skill) const;
- int getAbilitySaveBonus(const std::string& ability) const;
- std::map<std::string, int> getSkills(void) const;
- std::map<std::string, int> getSaves(void) const;
+ int getSkillBonus(const rules::Skill& skill) const;
+ int getAbilitySaveBonus(const rules::Ability& ability) const;
+ std::map<rules::Skill, int> getSkills(void) const;
+ std::map<rules::Ability, int> getSaves(void) const;
// Inline getters
std::string getCreatureName(void) const {return creatureName;}
@@ -46,13 +47,14 @@ namespace creature {
std::string getSize(void) const {return size;}
std::string getAlignment(void) const {return alignment;}
double getCR(void) const {return cr;}
+ std::pair<std::string, int> getNaturalArmor(void) const {return {natArmorName, natArmorBonus};}
std::string getLanguages(void) const {return langs;}
int getHP(void) const {return hp;}
int getHPMax(void) const {return hpMax;}
std::vector<std::string> getSenses(void) const {return senses;}
std::string getSpeed(void) const {return speed;}
- int getScore(const std::string& ability) const {return stats.at(ability);}
- int getBonus(const std::string& ability) const {return (int) (getScore(ability) - 10) / 2;}
+ int getScore(const rules::Ability& ability) const {return stats.at(ability);}
+ int getBonus(const rules::Ability& ability) const {return (int) (getScore(ability) - 10) / 2;}
int getProficiency(void) const {return proficiency;}
std::vector<std::shared_ptr<entry::Feature>> getFeatures(void) const {return features;}
std::vector<std::shared_ptr<entry::Item>> getInventory(void) const {return inventory;}
@@ -61,8 +63,8 @@ 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 setScore(const std::string& ability, int score);
- void setProfLevel(const std::string& skill, int level);
+ void setScore(const rules::Ability& ability, int score);
+ void setProfLevel(const rules::Skill& skill, int level);
void addInventoryItem(std::shared_ptr<entry::Item> item);
void removeInventoryItem(const std::string& itemName);
@@ -74,8 +76,8 @@ namespace creature {
int hpMax;
int hp;
std::vector<std::shared_ptr<entry::Item>> inventory;
- std::map<std::string, int> stats;
- std::map<std::string, int> skills;
+ std::map<rules::Ability, int> stats;
+ std::map<rules::Skill, int> skills;
//Immutable variables
const std::string creatureName;
@@ -85,11 +87,13 @@ namespace creature {
const int hdCount;
const int hdSides;
const std::string speed;
- const std::vector<std::string> saves;
+ const std::vector<rules::Ability> saves;
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;
const std::vector<dmgType> dmgResistances;
const std::vector<dmgType> dmgVulnerabilities;