From 8de3a5f106d837d8ca5798bcd47d2fa091b782aa Mon Sep 17 00:00:00 2001 From: Quentin Siruguet <54883972+QuentinSiruguet@users.noreply.github.com> Date: Wed, 2 Apr 2025 17:37:58 +0200 Subject: [PATCH] Add notifications for troops attacking wilderness (#363) +Retreat cost no soldiers when coming back from wilderness + Also work with contamined area   ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: quentin.qsi --- src/client/graphics/layers/EventsDisplay.ts | 61 +++++++++++++++------ src/core/execution/AttackExecution.ts | 6 +- src/core/game/PlayerImpl.ts | 1 + 3 files changed, 50 insertions(+), 18 deletions(-) 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`