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
This commit is contained in:
DevelopingTom
2025-07-26 01:54:36 +02:00
committed by GitHub
parent afc5709a1b
commit 8cbba26ab8
+5 -2
View File
@@ -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) {