feat(skill-system): 新增计时debuff机制,支持技能命中敌方附加减益效果

本次提交完整实现了技能对敌附加debuff的完整流程:
1.  新增TimedDebuffSnapshot数据结构,用于透传debuff配置
2.  在SkillConfig和SkillOverrides中新增debuff相关配置项
3.  实现HeroAtkSystem中debuff的判定与施加逻辑
4.  完善后台配置、前端编辑器的debuff配置支持
5.  调整了buff目标判定逻辑,修复了原有默认目标的语义混淆问题
6.  优化了BuffSystem的调试日志,新增了debuff分类标识
7.  批量更新了现有英雄技能的debuff配置示例
This commit is contained in:
pan
2026-09-08 16:37:13 +08:00
parent f5908a9adf
commit be17d18ff3
16 changed files with 214 additions and 124 deletions

View File

@@ -280,6 +280,9 @@ const OV_LABELS = {
timed_buff_id: 'buff',
buff_value: 'val',
buff_chance: 'chance',
timed_debuff_id: 'debuff',
debuff_value: 'dval',
debuff_chance: 'dchance',
summon_count: '数',
thorns_dmg: 'thorns',
thorns_rate: 'thorns',

View File

@@ -55,7 +55,7 @@
</div>
</div>
</template>
<!-- buff 型覆写(timed_buff_id):BuffList 下拉,副文本展示 buff info;allow-create 兼容 meta 未加载时手输 id -->
<!-- buff/debuff 型覆写(timed_buff_id/timed_debuff_id):BuffList 下拉,副文本展示 buff info;allow-create 兼容 meta 未加载时手输 id -->
<el-select
v-else-if="isBuffKey(item.key)"
v-model="item.value"
@@ -81,8 +81,8 @@
:closable="false"
show-icon
style="margin-bottom: 6px"
title="对敌技能 debuff 配置提示"
description="对敌技能的命中附带 debuff 以 SkillSet 底座配置为准,此处 overrides 注入建议用于友方/辅助技能(可用 buff_target 分流挂敌);吸血类需 buff_target=1(施法者自身)。proc_skill 用于命中后概率触发主动技能,不是挂 buff 的方式。"
title="buff/debuff 配置提示"
description="buff 为增益语义:缺省挂施法者自身(如吸血/攻击后强化),可用 buff_target 改为全体友方;debuff 为对敌减益语义:缺省挂被命中者(目标不可覆写),对敌技能请用 timed_debuff_id。proc_skill 用于命中后概率触发主动技能,不是挂 buff 的方式。"
/>
<el-button size="small" @click="add">+ 添加覆盖</el-button>
</div>
@@ -197,22 +197,24 @@ function onBuffValueChange(item) {
if (typeof item.value === 'string' && item.value.trim() !== '' && !isNaN(Number(item.value))) {
item.value = Number(item.value)
}
ensureBuffCompanionRows(item.value)
ensureBuffCompanionRows(item.value, item.key === 'timed_debuff_id')
}
// 挂载 timed_buff_id 后自动补齐配套三键(已存在的不重复添加):
// 挂载 timed_buff_id / timed_debuff_id 后自动补齐配套三键(已存在的不重复添加):
// 数值预填 BuffList 默认值(modifiers[0].value / tick.damage_or_heal / duration),避免导出 0 值覆盖 buff 语义
function ensureBuffCompanionRows(buffId) {
// isDebuff=true 时补 debuff_* 键,否则补 buff_* 键
function ensureBuffCompanionRows(buffId, isDebuff = false) {
const buff = typeof buffId === 'number' ? props.buffOptions.find((b) => b.id === buffId) : null
const prefix = isDebuff ? 'debuff' : 'buff'
const has = (key) => rows.value.some((r) => r.key === key)
if (!has('buff_value')) {
rows.value.push({ key: 'buff_value', value: buff?.modifiers?.[0]?.value ?? buff?.tick?.damage_or_heal ?? 0 })
if (!has(`${prefix}_value`)) {
rows.value.push({ key: `${prefix}_value`, value: buff?.modifiers?.[0]?.value ?? buff?.tick?.damage_or_heal ?? 0 })
}
if (!has('buff_chance')) {
rows.value.push({ key: 'buff_chance', value: 100 })
if (!has(`${prefix}_chance`)) {
rows.value.push({ key: `${prefix}_chance`, value: 100 })
}
if (!has('buff_duration')) {
rows.value.push({ key: 'buff_duration', value: buff?.duration ?? 5 })
if (!has(`${prefix}_duration`)) {
rows.value.push({ key: `${prefix}_duration`, value: buff?.duration ?? 5 })
}
}

View File

@@ -109,19 +109,25 @@ export const OVERRIDE_KEYS = [
{ key: 'bck', label: 'bck 击退' },
{ key: 'bck_chance', label: 'bck_chance 击退概率' },
// buff 型覆写:值为 BuffList 配置 id,前端用 meta.BuffList 渲染下拉(支持 allow-create 手输兜底)
// buff 语义为增益,缺省挂施法者自身;debuff 语义为对敌减益,缺省挂被命中者(目标不可覆写)
{ key: 'timed_buff_id', label: 'timed_buff_id 计时buff', type: 'buff' },
{ key: 'buff_value', label: 'buff_value 修饰数值' },
{ key: 'buff_duration', label: 'buff_duration 持续时间' },
{ key: 'buff_chance', label: 'buff_chance 附加概率' },
{ key: 'thorns_dmg', label: 'thorns_dmg 反伤固定值' },
{ key: 'thorns_rate', label: 'thorns_rate 反伤比例(%)' },
// 枚举型覆写:计时 buff 施加目标(缺省跟随技能主效果目标,见 SkillSet.BuffTarget)
// 枚举型覆写:计时 buff 施加目标(缺省按技能主效果推导:伤害→施法者自身,辅助→友方目标)
{ key: 'buff_target', label: 'buff_target buff施加目标', type: 'enum', options: [
{ value: 0, label: '0 被命中者(Hit/默认)' },
{ value: 1, label: '1 施法者自身(Self)' },
{ value: 0, label: '0 被命中者(Hit)' },
{ value: 1, label: '1 施法者自身(Self/默认)' },
{ value: 2, label: '2 全体友方(Ally)' },
{ value: 3, label: '3 全体敌方(Enemy)' },
]},
// debuff 型覆写:值为 BuffList 配置 id,命中被攻击者后施加;目标固定为被命中者,不可覆写
{ key: 'timed_debuff_id', label: 'timed_debuff_id 计时debuff', type: 'buff' },
{ key: 'debuff_value', label: 'debuff_value 修饰数值' },
{ key: 'debuff_duration', label: 'debuff_duration 持续时间' },
{ key: 'debuff_chance', label: 'debuff_chance 附加概率' },
// 枚举型覆写:技能目标群体(JSON 存字符串,导出还原 TGroup.X;proc_skill.overrides 可借此改变被触发技能的释放对象)
// 注:不提供 All —— SCastSystem 未对 TGroup.All 做友/敌分流(会落到敌方分支),避免误配
{ key: 'TGroup', label: 'TGroup 目标群体', type: 'enum', options: [