feat: display current party combat power as a persistent stat
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m8s
CI / Lint, Build & Test (pull_request) Successful in 1m10s

Adds a ⚔️ Combat Power entry to the resource bar, always visible,
showing the sum of each adventurer's combat power multiplied by
their count so players can make informed decisions about boss
fights and quests.

Closes #58
This commit is contained in:
2026-03-19 11:53:35 -07:00
committed by Naomi Carrigan
parent d723656743
commit 0bd7642344
+15 -1
View File
@@ -77,8 +77,15 @@ const ResourceBar = ({
isSyncing, isSyncing,
onForceSync, onForceSync,
}: ResourceBarProperties): JSX.Element => { }: ResourceBarProperties): JSX.Element => {
const { formatNumber, syncError } = useGame(); const { formatNumber, syncError, state } = useGame();
const { gold, essence, crystals } = resources; const { gold, essence, crystals } = resources;
let partyCombatPower = 0;
if (state !== null) {
for (const adventurer of state.adventurers) {
const contribution = adventurer.combatPower * adventurer.count;
partyCombatPower = partyCombatPower + contribution;
}
}
const resourceValues = [ gold, essence, crystals ]; const resourceValues = [ gold, essence, crystals ];
const anyFull = resourceValues.some((v) => { const anyFull = resourceValues.some((v) => {
return v >= RESOURCE_CAP; return v >= RESOURCE_CAP;
@@ -135,6 +142,13 @@ const ResourceBar = ({
<span className="resource-value">{formatNumber(runestones)}</span> <span className="resource-value">{formatNumber(runestones)}</span>
<span className="resource-label">{"Runestones"}</span> <span className="resource-label">{"Runestones"}</span>
</div> </div>
<div className="resource">
<span className="resource-icon">{"⚔️"}</span>
<span className="resource-value">
{formatNumber(partyCombatPower)}
</span>
<span className="resource-label">{"Combat Power"}</span>
</div>
{apotheosisCount > 0 {apotheosisCount > 0
&& <div className="apotheosis-badge"> && <div className="apotheosis-badge">
{"✨ Apotheosis "} {"✨ Apotheosis "}