diff --git a/js/app.js b/js/app.js index 1169cb6..6dece6e 100644 --- a/js/app.js +++ b/js/app.js @@ -8391,6 +8391,18 @@ function orderBattleReportAvatars(avatars) { return avatars; } +function damageBreakdownForAvatar(avatar) { + const damage = avatar.attack_type_damage || {}; + const normal = Number(damage.Normal) || 0; + const skill = Number(damage.BPSkill ?? damage.Skill) || 0; + const ultimate = Number(damage.Ultra ?? damage.Ultimate) || 0; + const breakDamage = Number(avatar.total_break_damage || damage.BreakDamage) || 0; + // Aggregate totals can include damage without an attack-type entry. Keep it + // visible without counting named subcategories a second time. + const other = Math.max(0, (Number(avatar.total_damage) || 0) - normal - skill - ultimate - breakDamage); + return { normal, skill, ultimate, breakDamage, other }; +} + function renderDamageAnalyst() { const report = analystState.currentReport; if (!report) { @@ -8506,10 +8518,7 @@ function renderDamageAnalyst() { } } - const dNormal = a.attack_type_damage?.Normal || 0; - const dSkill = a.attack_type_damage?.BPSkill || a.attack_type_damage?.Skill || 0; - const dUlt = a.attack_type_damage?.Ultra || a.attack_type_damage?.Ultimate || 0; - const dBreak = a.total_break_damage || a.attack_type_damage?.BreakDamage || 0; + const { normal: dNormal, skill: dSkill, ultimate: dUlt, breakDamage: dBreak, other: dOther } = damageBreakdownForAvatar(a); const dFollowup = (a.attack_type_damage?.Insert || 0) + (a.attack_type_damage?.Pursued || 0); const dDot = a.attack_type_damage?.DOT || 0; @@ -8550,6 +8559,7 @@ function renderDamageAnalyst() {