From 8cbba26ab8a8428a8e866634a3286146b21289ea Mon Sep 17 00:00:00 2001 From: DevelopingTom Date: Sat, 26 Jul 2025 01:54:36 +0200 Subject: [PATCH] Change how canceled attacks are recorded (#1480) ## Description: Minor fix: The `retreat()` function is called everytime the troops have to come back home: - alliance between the belligerents - cluster / player conquest - canceled attack Each of those cases are recorded as "canceled" but only the actually canceled attacks should be recorded as such. ## 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 - [x] I have read and accepted the CLA aggreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: IngloriousTom --- src/core/execution/AttackExecution.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 5038c28ad..62d692956 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -185,8 +185,11 @@ export class AttackExecution implements Execution { this.attack.delete(); this.active = false; - // Record stats - this.mg.stats().attackCancel(this._owner, this.target, survivors); + // Not all retreats are canceled attacks + if (this.attack.retreated()) { + // Record stats + this.mg.stats().attackCancel(this._owner, this.target, survivors); + } } tick(ticks: number) {