From cb744b49fc58f80a53e02e2efa115c1104e03843 Mon Sep 17 00:00:00 2001 From: Lavodan <21205085+Lavodan@users.noreply.github.com> Date: Mon, 27 Oct 2025 22:13:05 +0100 Subject: [PATCH] Fix incorrect display of ability to upgrade enemy units (#2308) ## Description: Fixes #2135. Adds an owner check to canUpgradeUnit to prevent enemy units from seemingly being able to be upgraded when Ctrl+clicked on ## 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: Lavodan --- src/core/game/PlayerImpl.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index b6d199fc5..a83c85bfb 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -902,6 +902,9 @@ export class PlayerImpl implements Player { if (this._gold < this.mg.config().unitInfo(unit.type()).cost(this)) { return false; } + if (unit.owner() !== this) { + return false; + } return true; }