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

@ -83,10 +83,6 @@ namespace components {
std::string ai_goal_name;
};
struct Curative {
int hp = 10;
};
struct Sprite {
string name;
float scale;
@ -106,12 +102,17 @@ namespace components {
std::vector<std::array<std::string, 4>> beats;
};
struct Curative {
int hp = 10;
};
struct Combat {
int hp;
int max_hp;
int ap_delta;
int max_ap;
int damage;
std::unordered_map<std::string, int> body_parts{
{"head", 50},
};
// everyone starts at 0 but ap_delta is added each round
int ap = 0;
@ -120,6 +121,11 @@ namespace components {
bool dead = false;
int attack(Combat &target);
void hit_limb(int my_dmg);
bool is_dead();
bool almost_dead();
bool can_heal();
void apply_healing(Curative& cure);
};
struct LightSource {
@ -156,7 +162,7 @@ namespace components {
ENROLL_COMPONENT(EnemyConfig, ai_script, ai_start_name, ai_goal_name);
ENROLL_COMPONENT(Personality, hearing_distance, tough);
ENROLL_COMPONENT(Motion, dx, dy, random);
ENROLL_COMPONENT(Combat, hp, max_hp, ap_delta, max_ap, damage, dead);
ENROLL_COMPONENT(Combat, ap_delta, max_ap, damage, dead);
ENROLL_COMPONENT(Device, config, events);
ENROLL_COMPONENT(Storyboard, image, audio, layout, beats);
ENROLL_COMPONENT(Sound, attack, death);