refactor(hero): 重构额外属性加成系统,统一为bonus字段
1. 将原ap_bonus/hp_bonus/def_bonus三个字段合并为通用的bonus数组结构 2. 新增多属性同时配置能力,支持hp/ap/def百分比加成与crt/frz/stun/para固定百分点加成 3. 更新所有前端编辑器、服务端渲染与游戏运行时逻辑适配新配置格式 4. 添加数据兼容迁移逻辑,自动处理旧版英雄配置数据
This commit is contained in:
@@ -173,12 +173,8 @@
|
||||
|
||||
<!-- 额外加成 -->
|
||||
<div class="panel">
|
||||
<h3>额外属性加成</h3>
|
||||
<el-tabs>
|
||||
<el-tab-pane label="ap_bonus"><BonusEditor :model="current.ap_bonus" /></el-tab-pane>
|
||||
<el-tab-pane label="hp_bonus"><BonusEditor :model="current.hp_bonus" /></el-tab-pane>
|
||||
<el-tab-pane label="def_bonus"><BonusEditor :model="current.def_bonus" /></el-tab-pane>
|
||||
</el-tabs>
|
||||
<h3>额外属性加成(hp/ap/def 百分比,crt/frz/stun/para 百分点)</h3>
|
||||
<BonusEditor :model="current.bonus" />
|
||||
</div>
|
||||
|
||||
<!-- 描述 -->
|
||||
@@ -363,9 +359,9 @@ function fieldSummary(h) {
|
||||
return `lv${f.lv} · ${auras}`
|
||||
})
|
||||
}
|
||||
// 额外加成条目总数(ap/hp/def_bonus 之和)
|
||||
// 额外加成档位总数(bonus 数组长度)
|
||||
function bonusCount(h) {
|
||||
return (h.ap_bonus?.length || 0) + (h.hp_bonus?.length || 0) + (h.def_bonus?.length || 0)
|
||||
return h.bonus?.length || 0
|
||||
}
|
||||
|
||||
async function loadMeta() {
|
||||
@@ -439,6 +435,11 @@ async function loadHeroes() {
|
||||
try {
|
||||
const r = await api.fetchHeroes()
|
||||
if (Array.isArray(r.heroes) && r.heroes.length) {
|
||||
// 兼容旧数据:ap_bonus/hp_bonus/def_bonus 已废弃,统一迁移为空 bonus
|
||||
for (const h of r.heroes) {
|
||||
if (!Array.isArray(h.bonus)) h.bonus = []
|
||||
delete h.ap_bonus; delete h.hp_bonus; delete h.def_bonus
|
||||
}
|
||||
heroes.value = r.heroes
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user