2661 PR 1/3 Warship Retreat Core, Blue UI Signal, and Transport-First Target Priority (#3498)

Part of #2661 (split into 3 PRs so they are not too large..)

## Description:

Part 1/3 of #2661.

This PR adds warship retreat basics, a blue retreating UI state, and
updates target priority.

Added:
- Retreat state handling
- Blue visual for retreating warships
- Target priority: transport > warship > trade 
- Tests for retreat and target priority

Example video:
https://youtu.be/2hE2qeOeY48
Ship retreating:
<img width="630" height="488" alt="image"
src="https://github.com/user-attachments/assets/56d3e6d5-08af-453d-afe5-ee21dd6f3414"
/>
Ship healing:
<img width="483" height="311" alt="image"
src="https://github.com/user-attachments/assets/aeaf2239-bb81-444f-84ef-62dbcb48fddf"
/>
Back to being deployed:
<img width="585" height="358" alt="image"
src="https://github.com/user-attachments/assets/875828a2-8a24-4593-ac76-26426bb81057"
/>

## 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:

zixer._
This commit is contained in:
Zixer1
2026-04-24 08:26:14 -06:00
committed by GitHub
parent 66bbbc664b
commit 37079e6a05
8 changed files with 250 additions and 16 deletions
+11 -6
View File
@@ -226,6 +226,7 @@ export class UnitImpl implements Unit {
0n,
toInt(this.info().maxHealth ?? 1),
);
this.mg.addUpdate(this.toUpdate());
if (this._health === 0n) {
this.delete(true, attacker);
}
@@ -331,16 +332,20 @@ export class UnitImpl implements Unit {
return this._retreating;
}
orderBoatRetreat() {
if (this.type() !== UnitType.TransportShip) {
throw new Error(`Cannot retreat ${this.type()}`);
}
if (!this._retreating) {
this._retreating = true;
setRetreating(retreating: boolean): void {
if (this._retreating !== retreating) {
this._retreating = retreating;
this.mg.addUpdate(this.toUpdate());
}
}
orderBoatRetreat() {
if (this.type() !== UnitType.TransportShip) {
throw new Error("Cannot retreat " + this.type());
}
this.setRetreating(true);
}
isUnderConstruction(): boolean {
return this._underConstruction;
}