diff --git a/assets/script/game/hero/SACastSystem.ts b/assets/script/game/hero/SACastSystem.ts index 4735a05b..0f9454b5 100644 --- a/assets/script/game/hero/SACastSystem.ts +++ b/assets/script/game/hero/SACastSystem.ts @@ -193,7 +193,7 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat /** * 创建技能实体 */ - private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean) { + private createSkill(s_uuid: number, caster: HeroViewComp,targets:Vec3[]=[],isWFuny:boolean=false) { // 检查节点有效性 if (!caster.node || !caster.node.isValid) { console.warn("[SACastSystem] 施法者节点无效"); @@ -229,7 +229,10 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat // 简化版:选择最前方的敌人 let heroAttrs = caster.ent.get(HeroAttrsComp); if (!heroAttrs) return []; - let targets=this.sDefaultTargets(caster,heroAttrs.fac) + let targets=this.sDamageTargets(caster, config, maxTargets); + if (targets.length === 0) { + targets.push(...this.sDefaultTargets(caster, heroAttrs.fac)); + } return targets; }