diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-21 17:37:40 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-21 17:37:40 +0200 |
commit | ba0af7ef3fcf7a1f85e579d66e823ff25d420c26 (patch) | |
tree | 3354de65d3414181aa115a8121a5ea62d8af632e /src/game/unit_soldier.cpp | |
parent | b2b0f25954126d399f7eac1de7d83ef54e6969ac (diff) |
Rebalance + new firing sound.
Diffstat (limited to 'src/game/unit_soldier.cpp')
-rw-r--r-- | src/game/unit_soldier.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp index 886e09d..db206d1 100644 --- a/src/game/unit_soldier.cpp +++ b/src/game/unit_soldier.cpp @@ -56,7 +56,7 @@ unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER) friendly = true; controllable = true; - health = max_health = 20; + health = max_health = 28; } static v2f_t spread_aim(v2f_t x, v2f_t aim, float cof, procgen::prng_t *prng) @@ -103,6 +103,9 @@ void unit_soldier_t::fire_shotgun(v2f_t aim) world::trace_t trace; fx_flash_t *flash; + if (next_attack && game->time < next_attack) + return; + muzzle_point = x + v2f_t(0, -0.7f); trace = world->ray_v_all_p3d(x, aim, CF_SOLID|CF_BODY|CF_BODY_SMALL, -1, this); @@ -115,21 +118,21 @@ void unit_soldier_t::fire_shotgun(v2f_t aim) return; } - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 7; i++) { v2f_t end; - end = spread_aim(muzzle_point, aim, 0.1f, &game->prng); - shoot(muzzle_point, end, 1); + end = spread_aim(muzzle_point, aim, 0.15f, &game->prng); + shoot(muzzle_point, end, 2); } flash = new fx_flash_t(game, muzzle_point, 5.0f, sf::Color(255, 170, 50, 80)); flash->place(&game->world); - last_attack = game->now; assets::soldier.fire.play_3d(x); - game->hivemind_alert(x, 14.0f, true, x); -} + next_attack = game->time + MSEC(1000); + last_attack = game->time; +} void unit_soldier_t::target_and_attack(void) { @@ -160,9 +163,6 @@ void unit_soldier_t::target_and_attack(void) skip_targetting: aim_marker = std::make_unique<fx_aim_marker_t>(game, aim); - if (last_attack + game->prng.next_float(1.4f, 1.6f) > game->now) - return; - fire_shotgun(aim); } @@ -249,7 +249,7 @@ void unit_soldier_t::render_to(render::state_t *render) legs = &assets::soldier.legs_idle; if (manual_firing || last_target_time + 3 > game->now) { - if (last_attack + 0.1 > game->now) + if (last_attack && last_attack + MSEC(100) > game->time) body = &assets::soldier.body_firing; else body = &assets::soldier.body_aiming; |