diff options
Diffstat (limited to 'src/creature.cc')
-rw-r--r-- | src/creature.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/creature.cc b/src/creature.cc index 88b26e7..e1f2b61 100644 --- a/src/creature.cc +++ b/src/creature.cc @@ -104,6 +104,13 @@ namespace creature { } } + void Creature::applyHealing(int amount) { + hp += amount; + if(hp > hpMax) { + hp = hpMax; + } + } + int Creature::getSkillBonus(const rules::Skill& skill) const { int bonus = this->getBonus(skill.getAbility()); if(skills.contains(skill)) { @@ -150,7 +157,13 @@ namespace creature { } void Creature::setScore(const rules::Ability& ability, int score) { + int initBonus = getBonus(ability); stats.insert({ability, score}); + if(ability == rules::Ability::Con()) { + int delta = getBonus(ability) - initBonus; + hpMax += delta * hdCount; + hp += delta * hdCount; + } } void Creature::setProfLevel(const rules::Skill& skill, int level) { |