feat(trigger): add 回合结束触发组支持

1. 新增fend触发组常量与默认英雄模板配置
2. 后端校验、渲染逻辑兼容新触发组
3. 更新文档说明fend触发组规范
4. 前端UI添加回合结束触发组编辑器
5. 兼容旧英雄数据补全fend空对象
This commit is contained in:
panFD
2026-09-14 17:09:31 +08:00
parent 923d81c2a0
commit b63572c383
4 changed files with 14 additions and 8 deletions

View File

@@ -168,6 +168,7 @@
<el-tab-pane label="atking 攻击后"><TriggerGroupEditor :model="current.atking" :skill-options="allSkills" :skill-map="skillMap" :buff-options="buffOptions" /></el-tab-pane>
<el-tab-pane label="atked 受击后"><TriggerGroupEditor :model="current.atked" :skill-options="allSkills" :skill-map="skillMap" :buff-options="buffOptions" /></el-tab-pane>
<el-tab-pane label="fstart 战斗开始"><TriggerGroupEditor :model="current.fstart" :skill-options="allSkills" :skill-map="skillMap" :buff-options="buffOptions" /></el-tab-pane>
<el-tab-pane label="fend 回合结束"><TriggerGroupEditor :model="current.fend" :skill-options="allSkills" :skill-map="skillMap" :buff-options="buffOptions" /></el-tab-pane>
<el-tab-pane label="dead 死亡后"><TriggerGroupEditor :model="current.dead" :skill-options="allSkills" :skill-map="skillMap" :buff-options="buffOptions" /></el-tab-pane>
</el-tabs>
</div>
@@ -369,7 +370,7 @@ function heroStats(h) {
// 触发明细行:atking: 6004 奋力一击 lv4 ap300 格式,仅输出已启用的组
function triggerSummary(h) {
const lines = []
for (const tk of ['atking', 'atked', 'fstart', 'dead']) {
for (const tk of ['atking', 'atked', 'fstart', 'fend', 'dead']) {
const grp = h[tk]
if (!grp) continue
for (const [sid, entries] of Object.entries(grp)) {
@@ -384,7 +385,7 @@ function triggerSummary(h) {
return lines
}
function hasTriggers(h) {
return ['atking', 'atked', 'fstart', 'dead'].some((k) => h[k] && Object.keys(h[k]).length)
return ['atking', 'atked', 'fstart', 'fend', 'dead'].some((k) => h[k] && Object.keys(h[k]).length)
}
// 光环明细行:lv4 · 大圣神威 0.25
function fieldSummary(h) {
@@ -471,9 +472,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
// 兼容旧数据:ap_bonus/hp_bonus/def_bonus 已废弃,统一迁移为空 bonus;
// 旧英雄无 fend 触发组(后期新增),补空对象避免 TriggerGroupEditor 拿到 undefined
for (const h of r.heroes) {
if (!Array.isArray(h.bonus)) h.bonus = []
if (!h.fend) h.fend = {}
delete h.ap_bonus; delete h.hp_bonus; delete h.def_bonus
}
heroes.value = r.heroes