summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-21 17:37:40 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-21 17:37:40 +0200
commitba0af7ef3fcf7a1f85e579d66e823ff25d420c26 (patch)
tree3354de65d3414181aa115a8121a5ea62d8af632e
parentb2b0f25954126d399f7eac1de7d83ef54e6969ac (diff)
Rebalance + new firing sound.
-rw-r--r--LICENSE3
-rw-r--r--assets/units/soldier/fire.oggbin11474 -> 34393 bytes
-rw-r--r--src/game/game.hpp3
-rw-r--r--src/game/unit_soldier.cpp22
-rw-r--r--src/game/unit_spider.cpp4
5 files changed, 17 insertions, 15 deletions
diff --git a/LICENSE b/LICENSE
index e4732c8..17a5aff 100644
--- a/LICENSE
+++ b/LICENSE
@@ -14,7 +14,6 @@ assets/ambience/nexus.ogg
assets/ambience/water.ogg
assets/src/
assets/units/repl/sound.ogg
-assets/units/soldier/fire.ogg
assets/units/soldier/fire_far.ogg
assets/units/soldier/step_stone_*.ogg
@@ -36,6 +35,8 @@ assets/units/spider/*.ogg
The following assets were made by various other authors:
FILE AUTHOR LICENSE
+assets/units/soldier/fire.ogg IchBinJager @ freesound.org CC-BY
+ enneract
assets/Roboto-Medium.ttf Google Apache License 2.0
assets/fx/explosion.ogg cydon at freesound.org CC0
assets/fx/water_splash.ogg Rocktopus at freesound.org CC-BY \ No newline at end of file
diff --git a/assets/units/soldier/fire.ogg b/assets/units/soldier/fire.ogg
index 23d7a8f..cdeae45 100644
--- a/assets/units/soldier/fire.ogg
+++ b/assets/units/soldier/fire.ogg
Binary files differ
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 908d73b..e35f156 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -183,7 +183,7 @@ namespace game {
class unit_t : public entity_t {
protected:
double next_targetting = -INFINITY;
- double last_attack = -INFINITY;
+ ntime_t next_attack = 0;
public:
size_t selected = 0;
@@ -248,6 +248,7 @@ namespace game {
public:
double last_target_time = -INFINITY;
v2f_t last_target_x;
+ ntime_t last_attack = 0;
std::unique_ptr<fx_move_marker_t> move_marker;
std::unique_ptr<fx_aim_marker_t> aim_marker;
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;
diff --git a/src/game/unit_spider.cpp b/src/game/unit_spider.cpp
index c6f5755..6bd7509 100644
--- a/src/game/unit_spider.cpp
+++ b/src/game/unit_spider.cpp
@@ -60,7 +60,7 @@ void unit_spider_t::target_and_attack(void)
start_moving(target->x);
next_targetting = game->now + game->prng.next_float(0.2f, 0.4f);
- if (last_attack + 0.5 > game->now)
+ if (next_attack && game->time < next_attack)
return;
if ((x - target->x).len() >= 1.0f)
@@ -70,9 +70,9 @@ void unit_spider_t::target_and_attack(void)
if (trace.hit)
return;
- last_attack = game->now;
target->damage(15, this);
assets::spider.bite.play_3d(x);
+ next_attack = game->time + MSEC(500);
}
void unit_spider_t::on_wake(void)