You now receive damage to multiple body parts and can heal them all too.
This commit is contained in:
parent
1777a6bbf2
commit
360402cb3c
6 changed files with 61 additions and 23 deletions
|
|
@ -107,11 +107,18 @@ namespace components {
|
|||
};
|
||||
|
||||
struct Combat {
|
||||
int ap_delta;
|
||||
int max_ap;
|
||||
int damage;
|
||||
int max_hp=1;
|
||||
int ap_delta=1;
|
||||
int max_ap=1;
|
||||
int damage=1;
|
||||
std::unordered_map<std::string, int> body_parts{
|
||||
{"head", 50},
|
||||
{"head", 10},
|
||||
{"chest", 10},
|
||||
{"stomach", 10},
|
||||
{"right_arm", 10},
|
||||
{"left_arm", 10},
|
||||
{"right_leg", 10},
|
||||
{"left_leg", 10},
|
||||
};
|
||||
|
||||
// everyone starts at 0 but ap_delta is added each round
|
||||
|
|
@ -120,8 +127,9 @@ namespace components {
|
|||
/* NOTE: This is used to _mark_ entities as dead, to detect ones that have just died. Don't make attack automatically set it.*/
|
||||
bool dead = false;
|
||||
|
||||
bool less_than(int level);
|
||||
int attack(Combat &target);
|
||||
void hit_limb(int my_dmg);
|
||||
void take_damage(int my_dmg);
|
||||
bool is_dead();
|
||||
bool almost_dead();
|
||||
bool can_heal();
|
||||
|
|
@ -162,7 +170,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, ap_delta, max_ap, damage, dead);
|
||||
ENROLL_COMPONENT(Combat, max_hp, ap_delta, max_ap, damage, body_parts);
|
||||
ENROLL_COMPONENT(Device, config, events);
|
||||
ENROLL_COMPONENT(Storyboard, image, audio, layout, beats);
|
||||
ENROLL_COMPONENT(Sound, attack, death);
|
||||
|
|
@ -186,7 +194,7 @@ namespace components {
|
|||
|
||||
template <typename COMPONENT> void enroll(ComponentMap &m) {
|
||||
m[NameOf<COMPONENT>::name] = [](DinkyECS::World& world, DinkyECS::Entity ent, nlohmann::json &j) {
|
||||
COMPONENT c;
|
||||
COMPONENT c{};
|
||||
from_json(j, c);
|
||||
world.set<COMPONENT>(ent, c);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue