Scatter missed arrows instead of landing on a ring around towers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 15:15:03 +01:00
1 parent 730ad08d7a
commit b4d834823b
2 files changed
+21 -9

No files matched your search

+6 -1
View File
@@ -4886,7 +4886,12 @@ impl Game {
TowerKind::Arrow => {
// the arrow pierces up to two more heroes behind the target
let dir = norm(ex - px, ey - py);
let (endx, endy, wall) = self.arrow_end(px, py, dir.0, dir.1, t.range());
// what the eye sees: past the target the spent arrow comes down at a random
// distance (not all on a circle at the end of the range); the damage below
// still reaches along the whole range
let to_target = ((ex - px).powi(2) + (ey - py).powi(2)).sqrt();
let reach = to_target + 0.8 + self.vrng.f() * (t.range() + 1.5 - to_target - 0.8).max(0.5);
let (endx, endy, wall) = self.arrow_end(px, py, dir.0, dir.1, reach);
self.shot(mx, my, mh, endx, endy, 0.45, 0.3, 0xffd0e0f0);
self.style_last_fx(if wall { crate::particles::ST_ARROW_WALL } else { crate::particles::ST_ARROW_FALL });
self.sfx(Sfx::Shoot, px, py);