Release v0.1.17 2026-07-19
This commit is contained in:
@@ -18,6 +18,14 @@ import { MAX_RUN_GEAR_ENHANCEMENT, MAX_SPELL_RANK } from "./types";
|
||||
|
||||
export const RUN_GEAR_SLOT_ORDER: readonly RunGearSlotId[] = ["weapon", "armor", "trinket"];
|
||||
|
||||
export interface RunGearComparison {
|
||||
readonly currentItem: RunGearItem | undefined;
|
||||
readonly effectLabel: string;
|
||||
readonly currentValue: number;
|
||||
readonly replacementValue: number;
|
||||
readonly delta: number;
|
||||
}
|
||||
|
||||
const GEAR_SLOT_DATA: Record<RunGearSlotId, { label: string; statId: RunGearStatId }> = {
|
||||
weapon: { label: "Weapon", statId: "damage" },
|
||||
armor: { label: "Armor", statId: "maxHealth" },
|
||||
@@ -36,6 +44,29 @@ export function equippedRunGear(
|
||||
return equipment[ownerId]?.[slotId];
|
||||
}
|
||||
|
||||
/** Player weapons convert their damage budget into healing power in combat. */
|
||||
export function runGearEffectLabel(ownerId: RunGearOwnerId, statId: RunGearStatId): string {
|
||||
if (statId === "damage") return ownerId === "player" ? "Healing power" : "Damage";
|
||||
if (statId === "maxHealth") return "Max health";
|
||||
return "Haste";
|
||||
}
|
||||
|
||||
/** Comparison data shared by chest and shop projections on either display. */
|
||||
export function compareRunGear(
|
||||
equipment: RunEquipment,
|
||||
item: RunGearItem,
|
||||
): RunGearComparison {
|
||||
const currentItem = equippedRunGear(equipment, item.ownerId, item.slotId);
|
||||
const currentValue = currentItem?.statId === item.statId ? currentItem.statValue : 0;
|
||||
return {
|
||||
currentItem,
|
||||
effectLabel: runGearEffectLabel(item.ownerId, item.statId),
|
||||
currentValue,
|
||||
replacementValue: item.statValue,
|
||||
delta: item.statValue - currentValue,
|
||||
};
|
||||
}
|
||||
|
||||
export function createRunGearItem(
|
||||
id: string,
|
||||
ownerId: RunGearOwnerId,
|
||||
|
||||
Reference in New Issue
Block a user