feat(英雄系统): 优化天赋触发机制和技能施放逻辑

重构HeroAttrsComp组件结构,新增天赋触发相关属性
调整SACastSystem技能施放逻辑,支持风怒和双施天赋效果
删除无用的SCastSystem.ts.meta文件
This commit is contained in:
panw
2025-11-19 11:18:11 +08:00
parent 9f809b1ffa
commit 78ac2e949f
3 changed files with 39 additions and 30 deletions

View File

@@ -132,43 +132,59 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
* 执行施法
*/
private executeCast(casterEntity: ecs.Entity, s_uuid: number, heroView: HeroViewComp,hset:HSSet): boolean {
const heroAttrs=casterEntity.get(HeroAttrsComp)
let isDSill=heroAttrs.isDSill > 0
let isWFuny=heroAttrs.isWFuny > 0
const config = SkillSet[s_uuid];
if (!config) {
console.error("[SACastSystem] 技能配置不存在:", s_uuid);
return false;
}
// 1. 播放施法动画
heroView.playSkillEffect(s_uuid);
let isDSill=false
let isWFuny=false
// 2. 更新攻击类型的天赋触发值
if(casterEntity.has(TalComp)){
const talComp = casterEntity.get(TalComp);
if (hset === HSSet.atk) talComp.updateCur(TriType.ATK);
if (hset != HSSet.atk) talComp.updateCur(TriType.SKILL);
isDSill=talComp.checkIsTrigger().isDSill
isWFuny=talComp.checkIsTrigger().isWFuny
}
// 获取目标位置
let targets = this.sTargets(heroView);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return false;
}
// 2. 延迟创建技能实体(等待动画)
const delay = 0.3
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,isWFuny);
isWFuny=false
//风怒wfuny 只针对 普通攻击起效
if (hset === HSSet.atk&&isWFuny){
this.createSkill(s_uuid, heroView,targets,isWFuny);
heroAttrs.isWFuny --
}else{
this.createSkill(s_uuid, heroView,targets,false);
}
}, delay);
if(isDSill){
targets = this.sTargets(heroView);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return false;
}
heroAttrs.isDSill --
heroView.playSkillEffect(s_uuid);
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,isWFuny);
this.createSkill(s_uuid, heroView,targets,isWFuny);
isWFuny=false
}, delay);
}
const heroAttrs = casterEntity.get(HeroAttrsComp);
// console.log(`[SACastSystem] ${heroAttrs?.hero_name ?? '未知'} 施放技能: ${config.name}`);
return true;
}
@@ -176,7 +192,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
/**
* 创建技能实体
*/
private createSkill(s_uuid: number, caster: HeroViewComp,isWFuny:boolean) {
private createSkill(s_uuid: number, caster: HeroViewComp,targets,isWFuny:boolean) {
// 检查节点有效性
if (!caster.node || !caster.node.isValid) {
console.warn("[SACastSystem] 施法者节点无效");
@@ -190,12 +206,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
return;
}
// 获取目标位置
const targets = this.sTargets(caster);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return;
}
// 创建技能实体
const skill = ecs.getEntity<Skill>(Skill);