refactor(skill): 将buff/debuff应用逻辑从SkillView移到SCastSystem

重构技能效果应用逻辑,将buff/debuff处理从SkillView的碰撞检测中移除,统一在SCastSystem中根据技能配置决定是否创建技能实体或直接应用支持效果。这样可以更清晰地分离伤害技能和支持技能的处理逻辑,避免在碰撞时重复应用效果。
This commit is contained in:
panw
2026-03-12 22:02:42 +08:00
parent fac8d571c3
commit 5d83bd1516
3 changed files with 41 additions and 33 deletions

View File

@@ -140,36 +140,6 @@ export class SkillView extends CCComp {
this.sData.dmg_ratio,
);
// 1. 应用 Buff 效果 (对目标,虽然通常 Buff 是给自己,但这里 target 是碰撞对象)
// 注意:如果是增益 Buff (如治疗),通常目标应该是自己或队友。
// 但 SkillView 的碰撞逻辑通常是针对"命中目标"。
// 如果是治疗技能target 应该是队友。如果是攻击技能target 是敌人。
// 这里的逻辑假设 SkillView 命中的就是正确的目标。
if (this.SConf.buffs && this.SConf.buffs.length > 0) {
const targetModel = target.ent.get(HeroAttrsComp);
if (targetModel) {
for (const buffId of this.SConf.buffs) {
const buffConf = BuffsList[buffId];
if (buffConf) {
targetModel.addBuff(buffConf);
}
}
}
}
// 2. 应用 Debuff 效果
if (this.SConf.debuffs && this.SConf.debuffs.length > 0) {
const targetModel = target.ent.get(HeroAttrsComp);
if (targetModel) {
for (const buffId of this.SConf.debuffs) {
const buffConf = BuffsList[buffId];
if (buffConf) {
targetModel.addBuff(buffConf);
}
}
}
}
// 更新技能命中次数
this.sData.hit_count++
if (