summaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
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;
+ }
};