diff --git a/src/client/graphics/layers/EventsDisplay.ts b/src/client/graphics/layers/EventsDisplay.ts index 460d1632d..738d39e62 100644 --- a/src/client/graphics/layers/EventsDisplay.ts +++ b/src/client/graphics/layers/EventsDisplay.ts @@ -61,6 +61,7 @@ export class EventsDisplay extends LitElement implements Layer { private events: Event[] = []; @state() private incomingAttacks: AttackUpdate[] = []; @state() private outgoingAttacks: AttackUpdate[] = []; + @state() private outgoingLandAttacks: AttackUpdate[] = []; @state() private outgoingBoats: UnitView[] = []; @state() private _hidden: boolean = false; @state() private newEvents: number = 0; @@ -134,6 +135,10 @@ export class EventsDisplay extends LitElement implements Layer { .outgoingAttacks() .filter((a) => a.targetID != 0); + this.outgoingLandAttacks = myPlayer + .outgoingAttacks() + .filter((a) => a.targetID == 0); + this.outgoingBoats = myPlayer .units() .filter((u) => u.type() === UnitType.TransportShip); @@ -396,14 +401,7 @@ export class EventsDisplay extends LitElement implements Layer { : event.description; } - private renderAttacks() { - if ( - this.incomingAttacks.length === 0 && - this.outgoingAttacks.length === 0 - ) { - return html``; - } - + private renderIncomingAttacks() { return html` ${this.incomingAttacks.length > 0 ? html` @@ -431,6 +429,11 @@ export class EventsDisplay extends LitElement implements Layer { ` : ""} + `; + } + + private renderOutgoingAttacks() { + return html` ${this.outgoingAttacks.length > 0 ? html` @@ -467,6 +470,37 @@ export class EventsDisplay extends LitElement implements Layer { `; } + private renderOutgoingLandAttacks() { + return html` + ${this.outgoingLandAttacks.length > 0 + ? html` + + + ${this.outgoingLandAttacks.map( + (landAttack) => html` + + + ${!landAttack.retreating + ? html`` + : "(retreating...)"} + `, + )} + + + ` + : ""} + `; + } + private renderBoats() { if (this.outgoingBoats.length === 0) { return html``; @@ -497,14 +531,6 @@ export class EventsDisplay extends LitElement implements Layer { } render() { - if ( - this.events.length === 0 && - this.incomingAttacks.length === 0 && - this.outgoingAttacks.length === 0 && - this.outgoingBoats.length === 0 - ) { - return html``; - } this.events.sort((a, b) => { const aPrior = a.priority ?? 100000; const bPrior = b.priority ?? 100000; @@ -602,7 +628,8 @@ export class EventsDisplay extends LitElement implements Layer { `, )} - ${this.renderAttacks()} ${this.renderBoats()} + ${this.renderIncomingAttacks()} ${this.renderOutgoingAttacks()} + ${this.renderOutgoingLandAttacks()} ${this.renderBoats()} diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 5e4e7cc7f..5fbec6111 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -190,7 +190,11 @@ export class AttackExecution implements Execution { tick(ticks: number) { if (this.attack.retreated()) { - this.retreat(malusForRetreat); + if (this.attack.target().isPlayer()) { + this.retreat(malusForRetreat); + } else { + this.retreat(); + } this.active = false; return; } diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 6180d0e19..ddd47dec8 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -92,6 +92,7 @@ export class PlayerImpl implements Player { public _incomingAttacks: Attack[] = []; public _outgoingAttacks: Attack[] = []; + public _outgoingLandAttacks: Attack[] = []; constructor( private mg: GameImpl,