重构了 技能系统,还需要完善

This commit is contained in:
2025-10-30 15:12:49 +08:00
parent 1281cbd32d
commit 55646c3a11
27 changed files with 1022 additions and 595 deletions

View File

@@ -9,14 +9,14 @@ import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
import { SkillConComp } from "./SkillConComp";
import { BuffConf, SkillSet } from "../common/config/SkillSet";
import { getNeAttrs, getAttrs ,Attrs} from "../common/config/HeroAttrs";
import { TalComp } from "./TalComp";
import { getMonAttr, MonType } from "../map/RogueConfig";
import { EBusComp } from "./EBusComp";
import { HeroViewComp } from "./HeroViewComp";
import { HeroSkillsComp } from "./HeroSkills";
/** 角色实体 */
@ecs.register(`Monster`)
export class Monster extends ecs.Entity {
HeroModel!: HeroAttrsComp;
HeroSkills!: HeroSkillsComp;
HeroView!: HeroViewComp;
BattleMove!: BattleMoveComp;
@@ -24,16 +24,14 @@ export class Monster extends ecs.Entity {
this.addComponents<ecs.Comp>(
BattleMoveComp,
HeroAttrsComp,
TalComp,
EBusComp,
HeroSkillsComp,
);
}
destroy(): void {
this.remove(HeroViewComp);
this.remove(HeroAttrsComp);
this.remove(TalComp);
this.remove(EBusComp);
this.remove(HeroSkillsComp);
super.destroy();
}
@@ -54,6 +52,7 @@ export class Monster extends ecs.Entity {
var view = node.getComponent(HeroViewComp)!;
const model = this.get(HeroAttrsComp);
const skillsComp = this.get(HeroSkillsComp);
let hero = HeroInfo[uuid]; // 共用英雄数据
// 设置 View 层属性(表现相关)
view.scale = scale;
@@ -82,18 +81,9 @@ export class Monster extends ecs.Entity {
model.Attrs[Attrs.MAP] = map;
model.Attrs[Attrs.SPEED] = hero.speed;
model.Attrs[Attrs.DIS] = hero.dis;
// 初始化师兄
// 设置技能
for(let i=0; i<hero.skills.length; i++){
let skill = {
uuid: SkillSet[hero.skills[i]].uuid,
cd_max: SkillSet[hero.skills[i]].cd,
cost: SkillSet[hero.skills[i]].cost,
cd: 0
};
model.skills.push(skill);
}
// ✅ 初始化技能数据(迁移到 HeroSkillsComp
skillsComp.initSkills(hero.skills);
this.add(view);
oops.message.dispatchEvent("monster_load",this)