From 07b5d6e41f787f6c95b05c78a055611edfc52a24 Mon Sep 17 00:00:00 2001 From: FloPinguin <25036848+FloPinguin@users.noreply.github.com> Date: Fri, 20 Feb 2026 18:44:57 +0100 Subject: [PATCH] =?UTF-8?q?Prevent=20self-retaliation=20crash=20when=20own?= =?UTF-8?q?=20nuke=20destroys=20own=20ship=20=F0=9F=94=A7=20(#3260)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: Noticed this in two singleplayer games: When a nation's nuke destroys its own transport/trade ship in the blast radius, `NationWarshipBehavior` incorrectly tries to retaliate against itself, calling `updateRelation(self)` which throws (GameRunner tick error). Added a self-check in `maybeRetaliateWithWarship` to skip retaliation when the destroyer is the player itself. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin --- src/core/execution/nation/NationWarshipBehavior.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/execution/nation/NationWarshipBehavior.ts b/src/core/execution/nation/NationWarshipBehavior.ts index d476e5653..df240f03f 100644 --- a/src/core/execution/nation/NationWarshipBehavior.ts +++ b/src/core/execution/nation/NationWarshipBehavior.ts @@ -136,6 +136,11 @@ export class NationWarshipBehavior { enemy: Player, reason: "trade" | "transport", ): void { + // Don't retaliate against ourselves (e.g. own nuke destroyed own ship) + if (enemy === this.player) { + return; + } + // Don't send too many warships if (this.player.units(UnitType.Warship).length >= 10) { return;