refactor(英雄技能): 重构技能系统以支持多技能和独立冷却
- 将 HeroAttrsComp 中的单一攻击/技能ID重构为技能数组,支持多个技能 - 为每个技能添加独立的冷却计时和最大冷却时间 - 修改 SCastSystem 以支持多技能选择和冷却检查 - 更新 HeroViewComp 显示当前展示技能的冷却进度 - 统一英雄和怪物初始化技能的方式,使用 setSkills 方法 - 移除 heroSet 配置中的 as/ss 字段,改为 cds 数组 - 修改 Skill 实体加载,传递 HeroAttrsComp 用于技能伤害计算
This commit is contained in:
@@ -101,9 +101,8 @@ export class Skill extends ecs.Entity {
|
||||
this.addComponents<SMoveDataComp>(SMoveDataComp);
|
||||
}
|
||||
load(startPos: Vec3, parent: Node, s_uuid: number, targetPos: Vec3,
|
||||
caster:HeroViewComp,ext_dmg:number=0) {
|
||||
caster:HeroViewComp,cAttrsComp:HeroAttrsComp, ext_dmg:number=0) {
|
||||
const config = SkillSet[s_uuid];
|
||||
|
||||
if (!config) {
|
||||
mLogger.error(this.debugMode, 'Skill', "[Skill] 技能配置不存在:", s_uuid);
|
||||
return;
|
||||
@@ -196,8 +195,6 @@ export class Skill extends ecs.Entity {
|
||||
const sTimeCom = this.get(StimeDataComp);
|
||||
if (sTimeCom) this.remove(StimeDataComp);
|
||||
}
|
||||
|
||||
let cAttrsComp=caster.ent.get(HeroAttrsComp)
|
||||
// 初始化数据组件
|
||||
let sDataCom = this.get(SDataCom);
|
||||
if (!sDataCom) {
|
||||
@@ -210,7 +207,7 @@ export class Skill extends ecs.Entity {
|
||||
const addCrt = config.crt ?? 0;
|
||||
const addFrz = config.frz ?? 0;
|
||||
const addBck = config.bck ?? 0;
|
||||
sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap;
|
||||
sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap*config.ap;
|
||||
sDataCom.Attrs[Attrs.critical] = cAttrsComp.critical + addCrt;
|
||||
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance + addFrz;
|
||||
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance + addBck;
|
||||
|
||||
Reference in New Issue
Block a user