feat(editor): 新增枚举型覆写编辑器与优化技能描述

1. 新增TGroup枚举覆写类型到常量配置,添加对应下拉编辑组件
2. 重构覆写解析逻辑,统一处理枚举与对象类型覆写
3. 批量更新全英雄技能的描述文本与覆写参数,修正技能效果描述
4. 优化技能详情展示逻辑,复用覆写解析函数减少重复代码
This commit is contained in:
pan
2026-09-07 09:32:25 +08:00
parent 232446789f
commit 55c7909241
5 changed files with 81 additions and 64 deletions

View File

@@ -235,39 +235,36 @@ function skillLabel(sk) {
if (!sk) return '-'
return `${sk.uuid} ${sk.name || skillMap.value[sk.uuid]?.name || ''}`.trim()
}
// 技能数值摘要:关键 overrides 与成长档位上限(如 ap150 →lv16)
function skillDetail(sk) {
if (!sk) return ''
const parts = []
if (sk.overrides?.ap != null) parts.push(`ap${sk.overrides.ap}`)
if (sk.overrides?.timed_buff_id != null) parts.push(`buff${sk.overrides.timed_buff_id}`)
if (sk.overrides?.frz != null) parts.push(`frz${sk.overrides.frz}`)
if (sk.overrides?.stun != null) parts.push(`stun${sk.overrides.stun}`)
if (sk.overrides?.thorns_dmg != null) parts.push(`thorns${sk.overrides.thorns_dmg}`)
if (sk.overrides?.thorns_rate != null) parts.push(`thorns${sk.overrides.thorns_rate}%`)
if (sk.overrides?.summon_count != null) parts.push(`数${sk.overrides.summon_count}`)
if (sk.lv_entries?.length) parts.push(`→lv${Math.max(...sk.lv_entries.map((e) => e.lv))}`)
return parts.join(' ')
// 覆写键 → 短标签映射,未列出的键直接用原始键名兜底,保证任何参数都能显示
const OV_LABELS = {
hit_count: 'hit',
timed_buff_id: 'buff',
buff_value: 'val',
buff_chance: 'chance',
summon_count: '数',
thorns_dmg: 'thorns',
thorns_rate: 'thorns',
}
// 覆写对象转简写(如 ap100、crt10、stun20、summon2)
// 覆写对象转简写(如 ap100、crt10、proc:6001×100%、bck_chance20)
function overrideParts(ov) {
if (!ov) return []
const parts = []
if (ov.ap != null) parts.push(`ap${ov.ap}`)
if (ov.hit_count != null) parts.push(`hit${ov.hit_count}`)
if (ov.crt != null) parts.push(`crt${ov.crt}`)
if (ov.frz != null) parts.push(`frz${ov.frz}`)
if (ov.stun != null) parts.push(`stun${ov.stun}`)
if (ov.para != null) parts.push(`para${ov.para}`)
if (ov.bck != null) parts.push(`bck${ov.bck}`)
if (ov.thorns_dmg != null) parts.push(`thorns${ov.thorns_dmg}`)
if (ov.thorns_rate != null) parts.push(`thorns${ov.thorns_rate}%`)
if (ov.summon_count != null) parts.push(`数${ov.summon_count}`)
if (ov.num != null) parts.push(`num${ov.num}`)
if (ov.timed_buff_id != null) parts.push(`buff${ov.timed_buff_id}`)
if (ov.buff_value != null) parts.push(`val${ov.buff_value}`)
if (ov.buff_chance != null) parts.push(`chance${ov.buff_chance}`)
for (const [k, v] of Object.entries(ov)) {
// 跳过空值与编辑器内部标记键
if (v == null || k === 'TGroup' || k === 'desc') continue
if (k === 'proc_skill') {
const sub = overrideParts(v.overrides).join(',')
parts.push(`proc:${v.s_uuid}×${v.chance}%${sub ? `(${sub})` : ''}`)
continue
}
if (typeof v === 'object') {
parts.push(`${k}${JSON.stringify(v)}`)
continue
}
const label = OV_LABELS[k] ?? k
parts.push(k === 'thorns_rate' ? `${label}${v}%` : `${label}${v}`)
}
return parts
}
@@ -305,17 +302,7 @@ function triggerSummary(h) {
const name = entries[0]?.name || skillMap.value[sid]?.name || ''
const e = entries[0]
const ov = e?.overrides || {}
const parts = [`t_num${e?.t_num}`]
if (ov.ap != null) parts.push(`ap${ov.ap}`)
if (ov.crt != null) parts.push(`crt${ov.crt}`)
if (ov.stun != null) parts.push(`stun${ov.stun}`)
if (ov.frz != null) parts.push(`frz${ov.frz}`)
if (ov.para != null) parts.push(`para${ov.para}`)
if (ov.bck != null) parts.push(`bck${ov.bck}`)
if (ov.thorns_dmg != null) parts.push(`thorns${ov.thorns_dmg}`)
if (ov.thorns_rate != null) parts.push(`thorns${ov.thorns_rate}%`)
if (ov.timed_buff_id != null) parts.push(`buff${ov.timed_buff_id}`)
if (ov.summon_count != null) parts.push(`数${ov.summon_count}`)
const parts = [`t_num${e?.t_num}`, ...overrideParts(ov)]
lines.push(`${tk}: ${sid} ${name} lv${minLv} ${parts.join(' ')}`)
}
}