From e0cbbf01737a8db3c651acf99c79b042de82ea3d Mon Sep 17 00:00:00 2001 From: Samuel Safahi <60489622+samisbakedham@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:21:18 -0700 Subject: [PATCH] Add Duration to Defense Debuff Messages (#603) ## Description: This PR updates the in-game defense debuff message to include the **duration** of the effect, improving clarity and usability during gameplay. ### Change Summary: - Updated static text to: `You broke your alliance with United States, making you a TRAITOR (50% defense debuff for 30 secs)` - Improves player understanding of how long penalties last. - Aligns with other UI efforts focused on real-time feedback and clearer mechanics. - Sets a standard for future status/debuff messages to include duration info where relevant. This small but high-impact change enhances the player experience, especially in intense or competitive matches where timing matters. --- ## Please complete the following: - [] 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: **@walker9607** Resolves issue https://github.com/openfrontio/OpenFrontIO/issues/602#issue-3018752308 --- src/client/graphics/layers/EventsDisplay.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/graphics/layers/EventsDisplay.ts b/src/client/graphics/layers/EventsDisplay.ts index d68a038a7..48f812c3f 100644 --- a/src/client/graphics/layers/EventsDisplay.ts +++ b/src/client/graphics/layers/EventsDisplay.ts @@ -271,10 +271,19 @@ export class EventsDisplay extends LitElement implements Layer { const malusPercent = Math.round( (1 - this.game.config().traitorDefenseDebuff()) * 100, ); + const traitorDurationRaw = + Number(this.game.config().traitorDuration) / 10; + const traitorDurationSeconds = Math.floor(traitorDurationRaw); + + const durationText = + traitorDurationSeconds === 1 + ? "1 second" + : `${traitorDurationSeconds} seconds`; + this.addEvent({ description: `You broke your alliance with ${betrayed.name()}, making you a TRAITOR ` + - `(${malusPercent}% defense debuff)`, + `(${malusPercent}% defense debuff for ${durationText})`, type: MessageType.ERROR, highlight: true, createdAt: this.game.ticks(),