summaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:09:07 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:09:07 +0100
commit154004ae6ac3747769648511cdc77e7171c684d8 (patch)
treea85cd8be5ee9c83e31f028ee9ffdf0ea1269e4ce /src/game/game.hpp
parent12143c33141a9c35e8eb01609062655f560b4bc1 (diff)
The gamelog, being reworking combat.
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r--src/game/game.hpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 107bfbf..55e3c45 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -59,6 +59,7 @@ namespace game {
} type_t;
type_t type;
+ std::string name;
unit_t(game::state_t *game_, type_t type_);
@@ -88,12 +89,13 @@ namespace game {
bool dead = false;
double death_time = -INFINITY;
int health = 1, max_health = 1;
- void damage(int points);
+ void damage(int points, unit_t *attacker);
+ void try_attack(unit_t *target);
virtual void die() = 0;
- const wchar_t *say_text;
+ std::string say_text;
double say_time = -INFINITY;
- void say(const wchar_t *wstr);
+ void say(std::string str);
void render_to(render::state_t *render);
@@ -124,4 +126,14 @@ 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;
+ }
};