Task 2: Fix Combat UI Casting Bar progress animation
This commit is contained in:
@@ -221,13 +221,19 @@ export function deductSpellCost(
|
||||
|
||||
// ─── Equipment Spell Helpers ──────────────────────────────────────────────────
|
||||
|
||||
// Return type for active equipment spells with source equipment
|
||||
export interface ActiveEquipmentSpell {
|
||||
spellId: string;
|
||||
equipmentId: string;
|
||||
}
|
||||
|
||||
// Get active spells from equipped equipment
|
||||
export function getActiveEquipmentSpells(
|
||||
equippedInstances: Record<string, string | null>,
|
||||
equipmentInstances: Record<string, EquipmentInstance>
|
||||
): string[] {
|
||||
): ActiveEquipmentSpell[] {
|
||||
const equippedIds = Object.values(equippedInstances).filter((id): id is string => id !== null);
|
||||
const spells: string[] = [];
|
||||
const spells: ActiveEquipmentSpell[] = [];
|
||||
|
||||
for (const id of equippedIds) {
|
||||
const instance = equipmentInstances[id];
|
||||
@@ -236,12 +242,16 @@ export function getActiveEquipmentSpells(
|
||||
for (const ench of instance.enchantments) {
|
||||
const effectDef = ENCHANTMENT_EFFECTS[ench.effectId];
|
||||
if (effectDef?.effect.type === 'spell' && effectDef.effect.spellId) {
|
||||
spells.push(effectDef.effect.spellId);
|
||||
// Check if we already have this spell from this equipment
|
||||
const exists = spells.some(s => s.spellId === effectDef.effect.spellId && s.equipmentId === id);
|
||||
if (!exists) {
|
||||
spells.push({ spellId: effectDef.effect.spellId, equipmentId: id });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [...new Set(spells)];
|
||||
return spells;
|
||||
}
|
||||
|
||||
// ─── DPS Calculation ──────────────────────────────────────────────────────────
|
||||
@@ -258,7 +268,7 @@ export function getTotalDPS(
|
||||
const activeSpells = getActiveEquipmentSpells(state.equippedInstances, state.equipmentInstances);
|
||||
|
||||
// Calculate DPS for each active spell
|
||||
for (const spellId of activeSpells) {
|
||||
for (const { spellId } of activeSpells) {
|
||||
const spellDef = SPELLS_DEF[spellId];
|
||||
if (!spellDef) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user