From 209d550e87a1ba88ff2ab0cf81f9d895537d9cd9 Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 19 Nov 2025 15:37:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(SACastSystem):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E7=9B=AE=E6=A0=87=E9=80=89=E6=8B=A9=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=B9=B6=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当sDamageTargets未找到目标时,回退到使用sDefaultTargets获取默认目标 同时为createSkill方法的isWFuny参数添加默认值false --- assets/script/game/hero/SACastSystem.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; }