diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-14 22:16:48 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-14 22:16:48 +0100 |
commit | 47ac1b7868b8bfb3e5fe71395a34124bf9f7209a (patch) | |
tree | 4bb1361ac664a3267344f6cf8230621be9c6feed /src/game/game.hpp | |
parent | b914d67b4e683c2d3e43c1854d6ef48b1878e4b6 (diff) |
Improve combat.
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r-- | src/game/game.hpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/game/game.hpp b/src/game/game.hpp index d4aed5d..57dbb07 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -49,6 +49,9 @@ namespace game { world::cmodel_t make_cmodel(v2f_t at); void compute_bounds(); + double next_targetting = -INFINITY; + double last_attack = -INFINITY; + public: v2f_t x; rectf_t size, render_size; @@ -88,6 +91,12 @@ namespace game { virtual void wake(unit_t *by_whom) = 0; virtual void sleep(void) = 0; + struct { + size_t armor_class; + roll_params_t hit_roll; + roll_params_t damage_roll; + } cs; + bool dead = false; double death_time = -INFINITY; int health = 1, max_health = 1; @@ -99,15 +108,14 @@ namespace game { double say_time = -INFINITY; void say(std::string str); + void render_to(render::state_t *render); }; class human_t : public unit_t { - double next_targetting = -INFINITY; double last_target_time = -INFINITY; v2f_t last_target_x; - double last_attack = -INFINITY; public: human_t(game::state_t *game); @@ -121,9 +129,7 @@ namespace game { class alien_t : public unit_t { double next_targetting = -INFINITY; - double next_attack = -INFINITY; - void attack(unit_t *target, float range); public: alien_t(game::state_t *game); void render_to(render::state_t *render); @@ -133,14 +139,4 @@ namespace game { void think(void); void die(void); }; - - static inline size_t roll(size_t count, size_t sides) - { - size_t total = 0; - - for (size_t i = 0; i < count; i++) - total += rand() % sides + 1; - - return total; - } }; |