Synced the combat from under the dome.
This commit is contained in:
parent
110612c33a
commit
a22564bb58
8 changed files with 106 additions and 27 deletions
|
|
@ -101,6 +101,7 @@ namespace components {
|
|||
std::vector<std::string> layout;
|
||||
json actors;
|
||||
json fixtures;
|
||||
json buttons;
|
||||
};
|
||||
|
||||
struct Storyboard {
|
||||
|
|
@ -111,19 +112,28 @@ namespace components {
|
|||
};
|
||||
|
||||
struct Combat {
|
||||
int hp;
|
||||
int max_hp;
|
||||
int ap_delta;
|
||||
int max_ap;
|
||||
int damage;
|
||||
int hp=1;
|
||||
int max_hp=1;
|
||||
int ap_delta=1;
|
||||
int max_ap=1;
|
||||
int damage=1;
|
||||
float attack_rating=0.1;
|
||||
float toughness_rating=0.1;
|
||||
|
||||
// everyone starts at 0 but ap_delta is added each round
|
||||
int ap = 0;
|
||||
|
||||
/* 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 has_died = false;
|
||||
|
||||
int attack(Combat &target);
|
||||
bool less_than(int level);
|
||||
void take_damage(int my_dmg);
|
||||
bool is_dead();
|
||||
bool almost_dead();
|
||||
bool can_heal();
|
||||
void apply_healing(Curative& cure);
|
||||
void INVARIANT();
|
||||
};
|
||||
|
||||
struct LightSource {
|
||||
|
|
@ -152,7 +162,7 @@ namespace components {
|
|||
using ComponentMap = std::unordered_map<std::string, ReflFuncSignature>;
|
||||
|
||||
ENROLL_COMPONENT(Tile, display, foreground, background);
|
||||
ENROLL_COMPONENT(AnimatedScene, background, layout, actors, fixtures);
|
||||
ENROLL_COMPONENT(AnimatedScene, background, layout, actors, fixtures, buttons);
|
||||
ENROLL_COMPONENT(Sprite, name, scale);
|
||||
ENROLL_COMPONENT(Curative, hp);
|
||||
ENROLL_COMPONENT(LightSource, strength, radius);
|
||||
|
|
@ -160,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, hp, max_hp, ap_delta, max_ap, damage, dead);
|
||||
ENROLL_COMPONENT(Combat, hp, max_hp, ap_delta, max_ap, damage, attack_rating, toughness_rating);
|
||||
ENROLL_COMPONENT(Device, config, events);
|
||||
ENROLL_COMPONENT(Storyboard, image, audio, layout, beats);
|
||||
ENROLL_COMPONENT(Sound, attack, death);
|
||||
|
|
@ -184,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