You can now take damage to your head.

This commit is contained in:
Zed A. Shaw 2026-03-29 23:54:21 -04:00
parent cbd4b858ac
commit d22eaa554d
7 changed files with 64 additions and 49 deletions

View file

@ -8,9 +8,30 @@ namespace components {
if(attack) {
my_dmg = Random::uniform<int>(1, damage);
target.hp -= my_dmg;
target.hit_limb(my_dmg);
}
return my_dmg;
}
void Combat::hit_limb(int my_dmg) {
body_parts["head"] -= my_dmg;
}
bool Combat::is_dead() {
return body_parts["head"] < 0;
}
bool Combat::almost_dead() {
return body_parts["head"] < 20;
}
bool Combat::can_heal() {
return body_parts["head"] < 50;
}
void Combat::apply_healing(Curative& cure) {
int new_hp = body_parts["head"] + cure.hp;
body_parts["head"] = std::min(new_hp, 50);
}
}