feat(技能系统): 添加技能类型枚举并重构天赋系统

- 在SkillSet.ts中新增HSSet枚举区分普通攻击、技能和必杀技
- 重构TalSet.ts中的天赋效果枚举,移除N_ATK和N_SKILL类型
- 在HeroSkillsComp中增加hset字段标识技能类型
- 修改SACastSystem以支持根据技能类型触发不同天赋
- 完全重写TalComp组件,实现更完善的天赋触发和效果管理
This commit is contained in:
2025-11-18 23:54:25 +08:00
parent 7b067213c0
commit 9798930879
5 changed files with 262 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Attrs } from "../common/config/HeroAttrs";
import { HeroInfo } from "../common/config/heroSet";
import { SkillSet } from "../common/config/SkillSet";
import { HSSet, SkillSet } from "../common/config/SkillSet";
import { HeroAttrsComp } from "./HeroAttrsComp";
/**
@@ -15,8 +15,10 @@ export interface SkillSlot {
cost: number; // MP消耗
level: number; // 技能等级(预留)
dis: number; // 攻击距离
hset: HSSet; // 技能设定, 0:普通攻击, 1:一般技能, 2:必杀技
}
/**
* ==================== 英雄技能数据组件 ====================
*
@@ -56,6 +58,9 @@ export class HeroSkillsComp extends ecs.Comp {
}
// 第0个技能的 cd_max 取 herosinfo[uuid].as
const cdMax = i === 0 ? HeroInfo[uuid].as : config.cd;
let hset = HSSet.atk;
if(i ===1) hset = HSSet.skill;
if(i ===2) hset = HSSet.max;
this.skills[s_uuid] = {
s_uuid: config.uuid,
cd: 0,
@@ -63,6 +68,7 @@ export class HeroSkillsComp extends ecs.Comp {
cost: config.cost,
level: 1,
dis: Number(config.dis),
hset: hset,
};
}
@@ -80,7 +86,7 @@ export class HeroSkillsComp extends ecs.Comp {
* @param s_uuid 技能配置ID
* @param entity 实体对象(用于更新技能距离缓存)
*/
addSkill(s_uuid: number, entity?: ecs.Entity) {
addSkill(s_uuid: number, entity?: ecs.Entity, hset: HSSet=HSSet.skill) {
const config = SkillSet[s_uuid];
if (!config) {
console.warn(`[HeroSkills] 技能配置不存在: ${s_uuid}`);
@@ -93,6 +99,7 @@ export class HeroSkillsComp extends ecs.Comp {
cost: config.cost,
level: 1,
dis: Number(config.dis),
hset: hset,
};
// 更新技能距离缓存