diff --git a/src/client/graphics/layers/PlayerPanel.ts b/src/client/graphics/layers/PlayerPanel.ts index 50d4ffc76..fba06c7a1 100644 --- a/src/client/graphics/layers/PlayerPanel.ts +++ b/src/client/graphics/layers/PlayerPanel.ts @@ -4,7 +4,12 @@ import { EventBus } from "../../../core/EventBus"; import { GameView, PlayerView } from "../../../core/game/GameView"; import { Layer } from "./Layer"; import { MouseUpEvent } from "../../InputHandler"; -import { AllPlayers, Player, PlayerActions } from "../../../core/game/Game"; +import { + AllPlayers, + Player, + PlayerActions, + UnitType, +} from "../../../core/game/Game"; import { TileRef } from "../../../core/game/GameMap"; import { renderNumber, renderTroops } from "../../Utils"; import targetIcon from "../../../../resources/images/TargetIconWhite.svg"; @@ -128,6 +133,24 @@ export class PlayerPanel extends LitElement implements Layer { this.requestUpdate(); } + getTotalNukesSent(): number { + const stats = this.actions.interaction?.stats; + if (!stats) { + return 0; + } + let sum = 0; + const nukes = stats.sentNukes[this.g.myPlayer().id()]; + if (!nukes) { + return 0; + } + for (const nukeType in nukes) { + if (nukeType != UnitType.MIRVWarhead) { + sum += nukes[nukeType]; + } + } + return sum; + } + render() { if (!this.isVisible) { return html``; @@ -165,7 +188,7 @@ export class PlayerPanel extends LitElement implements Layer {