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
This commit is contained in:
Samuel Safahi
2025-04-29 17:21:18 -07:00
committed by GitHub
parent c2a519ef55
commit e0cbbf0173
+10 -1
View File
@@ -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(),