refactor(skill): 统一技能效果处理逻辑至 SkillView

移除 SCastSystem 中的 applySupportSkill 方法,将治疗、护盾、Buff/Debuff 效果统一在 SkillView 的碰撞逻辑中处理。同时删除 SkillConfig 中的 SType 枚举,改为通过 buffs 和 debuffs 列表配置效果。
This commit is contained in:
panw
2026-03-12 16:51:14 +08:00
parent 3ba33c5240
commit fac8d571c3
3 changed files with 65 additions and 71 deletions

View File

@@ -2,7 +2,7 @@ import { _decorator, Animation, CCInteger, Collider2D, Contact2DType, UITransfor
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroViewComp } from "../hero/HeroViewComp";
import { DTType, EType, RType, SkillConfig, SkillSet } from "../common/config/SkillSet";
import { BuffsList, DTType, EType, RType, SkillConfig, SkillSet } from "../common/config/SkillSet";
import { SDataCom } from "./SDataCom";
import { Attrs } from "../common/config/HeroAttrs";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
@@ -139,6 +139,37 @@ export class SkillView extends CCComp {
this.sData.ext_dmg,
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 (