summaryrefslogtreecommitdiff
path: root/src/game/units.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r--src/game/units.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp
index ee6ee9f..a1e233c 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -178,7 +178,7 @@ void unit_t::try_attack(unit_t *target)
ss << name << " " << text::get(text::UNIT_ATTACK) << " " << target->name << ": ";
- hit_roll = game->roll(&cs.hit_roll);
+ hit_roll = game->roll(die_t(20));
ss << hit_roll << " vs " << target->cs.armor_class;
if (hit_roll == 1 || hit_roll < target->cs.armor_class) {
@@ -187,14 +187,14 @@ void unit_t::try_attack(unit_t *target)
return;
}
- dmg_roll = game->roll(&cs.damage_roll);
+ dmg_roll = game->roll(cs.hit_die);
if (hit_roll < 20) {
ss << ", " << text::get(text::UNIT_DAMAGE) << ": ";
- ss << dmg_roll - cs.damage_roll.bonus << " + " << cs.damage_roll.bonus << " = " << dmg_roll;
+ ss << dmg_roll - cs.hit_die.bonus << " + " << cs.hit_die.bonus << " = " << dmg_roll;
} else {
ss << " (" << text::get(text::UNIT_CRITICAL_HIT) << ")" << ", " << text::get(text::UNIT_DAMAGE) << ": ";
- ss << "(" << dmg_roll - cs.damage_roll.bonus << " + " << cs.damage_roll.bonus << ") x 2 = " << dmg_roll * 2;
+ ss << "(" << dmg_roll - cs.hit_die.bonus << " + " << cs.hit_die.bonus << ") x 2 = " << dmg_roll * 2;
dmg_roll *= 2;
}
@@ -239,21 +239,21 @@ static unit_t *find_target(world::world_t *world, v2f_t x, float r,
unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER)
{
- always_awake = true;
- friendly = true;
- controllable = true;
-
- cmodel.cflags = CF_BODY;
- health = max_health = 20;
size[0] = v2f_t(-0.4f, -0.4f);
size[1] = v2f_t(+0.4f, +0.4f);
render_size[0] = v2f_t(-0.5f, -1.0f);
render_size[1] = v2f_t(+0.5f, +0.5f);
+ cmodel.cflags = CF_BODY;
+
name = text::get(text::UNIT_NAME_SOLDIER);
+ always_awake = true;
+ friendly = true;
+ controllable = true;
+
+ health = max_health = 20;
cs.armor_class = 10;
- cs.hit_roll = roll_params_t(20);
- cs.damage_roll = roll_params_t(4);
+ cs.hit_die = die_t(4);
}
void unit_soldier_t::on_think(void)
@@ -339,17 +339,17 @@ void unit_soldier_t::render_to(render::state_t *render)
unit_spider_t::unit_spider_t(game::state_t *game) : unit_t(game, UNIT_SPIDER)
{
- cmodel.cflags = CF_BODY_SMALL;
- health = max_health = 4;
size[0] = v2f_t(-0.2f, -0.3f);
size[1] = v2f_t(+0.2f, +0.3f);
render_size[0] = v2f_t(-0.3f, -0.3f);
render_size[1] = v2f_t(+0.3f, +0.3f);
+ cmodel.cflags = CF_BODY_SMALL;
+
name = text::get(text::UNIT_NAME_SPIDER);
+ health = max_health = 4;
cs.armor_class = 5;
- cs.hit_roll = roll_params_t(20);
- cs.damage_roll = roll_params_t(3, 6, 1);
+ cs.hit_die = die_t(3, 6, 1);
}
void unit_spider_t::on_think(void)