/** * @file Goddess Boss panel β challenge divine realm bosses. * @copyright nhcarrigan * @license Naomi's Public License * @author Naomi Carrigan */ /* eslint-disable max-lines -- Panel with sub-component, modal, and zone filter */ /* eslint-disable max-lines-per-function -- Complex component with many render paths */ /* eslint-disable complexity -- Boss card requires many conditional render paths */ /* eslint-disable max-statements -- Panel requires many variable declarations */ /* eslint-disable react/no-multi-comp -- Sub-components are tightly coupled to this panel */ import { type JSX, useState } from "react"; import { useGame } from "../../context/gameContext.js"; import type { GoddessBoss, GoddessBossChallengeResponse, GoddessZone, } from "@elysium/types"; interface GoddessBossCardProperties { readonly boss: GoddessBoss; readonly onChallenge: (bossId: string)=> void; readonly isChallenging: boolean; readonly unlockHint: string | undefined; readonly formatNumber: (n: number)=> string; readonly formatInteger: (n: number)=> string; } /** * Renders a single goddess boss card. * @param props - The boss card properties. * @param props.boss - The boss data. * @param props.onChallenge - Callback to challenge this boss. * @param props.isChallenging - Whether this boss is currently being challenged. * @param props.unlockHint - Optional hint for how to unlock this boss. * @param props.formatNumber - The number formatting utility function. * @param props.formatInteger - The integer formatting utility function. * @returns The JSX element. */ const GoddessBossCard = ({ boss, onChallenge, isChallenging, unlockHint, formatNumber, formatInteger, }: GoddessBossCardProperties): JSX.Element => { const canChallenge = (boss.status === "available" || boss.status === "in_progress") && !isChallenging; const hpRatio = boss.currentHp / boss.maxHp; const hpPercent = hpRatio * 100; function handleChallenge(): void { onChallenge(boss.id); } return (
{boss.description}
{boss.status === "locked" && unlockHint !== undefined ?{unlockHint}
: null} {boss.consecrationRequirement > 0 ?{"ποΈ Requires Consecration "} {boss.consecrationRequirement}
: null}{"π "} {formatNumber(result.rewards.prayers)} {" Prayers"}
: null} {result.rewards.divinity > 0 ?{"β¨ "} {formatInteger(result.rewards.divinity)} {" Divinity"}
: null} {result.rewards.stardust > 0 ?{"β "} {formatInteger(result.rewards.stardust)} {" Stardust"}
: null} {result.rewards.bountyDivinity > 0 ?{"β¨ "} {formatInteger(result.rewards.bountyDivinity)} {" Divinity (first kill bonus!)"}
: null} {result.rewards.upgradeIds.length > 0 ?{"π "} {result.rewards.upgradeIds.length} {" Upgrade(s) unlocked"}
: null} {result.rewards.equipmentIds.length > 0 ?{"π‘οΈ "} {result.rewards.equipmentIds.length} {" Equipment item(s) gained"}
: null}{casualty.killed} {" "} {casualty.discipleId} {" lost"}
); })}{"Loading..."}
{"The Goddess expansion is not yet unlocked."}
{"π This zone is locked."}
{activeZoneData.unlockBossId === null ? null :{"βοΈ Defeat: "} {bosses.find((boss) => { return boss.id === activeZoneData.unlockBossId; })?.name ?? activeZoneData.unlockBossId}
} {activeZoneData.unlockQuestId === null ? null :{"π Complete: "} {quests.find((quest) => { return quest.id === activeZoneData.unlockQuestId; })?.name ?? activeZoneData.unlockQuestId}
}{"No bosses to show in this zone."}
: null}