From 332629de787da7689d4386524ed74f646e86e799 Mon Sep 17 00:00:00 2001 From: Vivacious Box Date: Sun, 18 May 2025 17:03:04 +0200 Subject: [PATCH] Fix mirvhead spamming same location (#801) ## Description: There is a bug in the proximity check in the mirvhead destination This fixes it. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: Vivacious Box --- src/core/execution/MIRVExecution.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/execution/MIRVExecution.ts b/src/core/execution/MIRVExecution.ts index dff072c8e..bdfee3b5b 100644 --- a/src/core/execution/MIRVExecution.ts +++ b/src/core/execution/MIRVExecution.ts @@ -169,10 +169,8 @@ export class MirvExecution implements Execution { if (this.mg.owner(tile) !== this.targetPlayer) { continue; } - for (const t of taken) { - if (this.mg.manhattanDist(tile, t) < 25) { - continue; - } + if (this.proximityCheck(tile, taken)) { + continue; } return tile; } @@ -180,6 +178,15 @@ export class MirvExecution implements Execution { return null; } + private proximityCheck(tile: TileRef, taken: TileRef[]): boolean { + for (const t of taken) { + if (this.mg.manhattanDist(tile, t) < 25) { + return true; + } + } + return false; + } + owner(): Player { return this.player; }