fix: use computePartyCombatPower in quest panel for consistent CP display
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m5s
CI / Lint, Build & Test (pull_request) Failing after 1m10s

The quest panel was computing party combat power with a simplified
hand-rolled loop (base combatPower × count only) that did not account for
upgrade multipliers, prestige bonus, equipment set bonuses, echo or
crafted multipliers, or the active companion bonus.

This meant the displayed "you have X combat power" value diverged from
the value used by the auto-quest engine (computePartyCombatPower), which
could show the player an incorrect picture of whether a quest was
startable — particularly after upgrades or equipment began boosting
combat power.

Replacing the loop with computePartyCombatPower(state) makes the quest
card display fully consistent with the auto-quest eligibility check.

Closes #157
This commit is contained in:
2026-03-26 10:25:06 -07:00
committed by Naomi Carrigan
parent 689133d05d
commit 0542402b4d
+6 -7
View File
@@ -11,7 +11,10 @@
/* eslint-disable max-statements -- Many local variables needed for quest state */
import { useState, type JSX } from "react";
import { useGame } from "../../context/gameContext.js";
import { zoneFailureChance } from "../../engine/tick.js";
import {
computePartyCombatPower,
zoneFailureChance,
} from "../../engine/tick.js";
import { cdnImage } from "../../utils/cdn.js";
import { LockToggle } from "../ui/lockToggle.js";
import { ZoneSelector } from "./zoneSelector.js";
@@ -208,7 +211,7 @@ const QuestPanel = (): JSX.Element => {
);
}
const { adventurers, autoQuest, bosses, quests, zones } = state;
const { autoQuest, bosses, quests, zones } = state;
const activeZone = zones.find((zone) => {
return zone.id === activeZoneId;
@@ -226,11 +229,7 @@ const QuestPanel = (): JSX.Element => {
: quests.find((quest) => {
return quest.id === activeZone.unlockQuestId;
});
let partyCombatPower = 0;
for (const adventurer of adventurers) {
const contribution = adventurer.combatPower * adventurer.count;
partyCombatPower = partyCombatPower + contribution;
}
const partyCombatPower = computePartyCombatPower(state);
const zoneQuests = quests.filter(({ zoneId }) => {
return zoneId === activeZoneId;
});