From 0175658a2d06058e9621e34c27e191122bf9821e Mon Sep 17 00:00:00 2001 From: tsiklic1 Date: Tue, 11 Nov 2025 14:47:43 +0100 Subject: [PATCH] make bullet go to the furthest target shot --- apps/api/src/game/Game.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/api/src/game/Game.ts b/apps/api/src/game/Game.ts index 6fdf61e..acfb5a9 100644 --- a/apps/api/src/game/Game.ts +++ b/apps/api/src/game/Game.ts @@ -104,7 +104,15 @@ export class Game { p.isDead = true; p.diedAtMove = this.moves; p.lastSeenPos = new Hex(position.q, position.r); - shooter.lastBulletHex = p.pos; + + if (!shooter.lastBulletHex) shooter.lastBulletHex = p.pos; + else { + shooter.lastBulletHex = + shooter.lastBulletHex.distanceTo(shooter.pos) > + p.pos.distanceTo(shooter.pos) + ? shooter.lastBulletHex + : p.pos; + } } } if (!shooter.lastBulletHex) {