fix: code rabit suggestions

This commit is contained in:
Rj Manhas
2025-11-10 16:27:48 -07:00
parent a3f73f828f
commit 20975185de
2 changed files with 14 additions and 3 deletions
+13 -1
View File
@@ -724,8 +724,20 @@ export class EventsDisplay extends LitElement implements Layer {
const unitView = this.game.unit(event.unitID);
// Format the message for NAVAL_INVASION_INBOUND to display formatted troop count
let description = event.message;
if (event.messageType === MessageType.NAVAL_INVASION_INBOUND && unitView) {
// Replace raw troop count with formatted version
// Message format: "Boat: {troops} {attackerName}"
const formattedTroops = renderTroops(unitView.troops());
description = event.message.replace(
/Boat: \d+/,
`Boat: ${formattedTroops}`,
);
}
this.addEvent({
description: event.message,
description: description,
type: event.messageType,
unsafeDescription: false,
highlight: true,
+1 -2
View File
@@ -1,4 +1,3 @@
import { renderTroops } from "../../client/Utils";
import {
Execution,
Game,
@@ -145,7 +144,7 @@ export class TransportShipExecution implements Execution {
mg.displayIncomingUnit(
this.boat.id(),
// TODO TranslateText
`Boat: ${renderTroops(this.boat.troops())} ${this.attacker.displayName()}`,
`Boat: ${this.boat.troops()} ${this.attacker.displayName()}`,
MessageType.NAVAL_INVASION_INBOUND,
this.targetID,
);