From 6c1b18231435b7cb467656182644d01698c5dd21 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 22 Mar 2026 22:07:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=95=B0=E6=8D=AE=E7=A9=BA=E5=80=BC=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将空值合并运算符(??)替换为三元条件运算符,确保当SkillUpList[s_uuid]为0或false时也能正确使用默认值SkillUpList[1001]。同时移除未使用的sNum变量计算。 --- assets/script/game/hero/SCastSystem.ts | 3 +-- assets/script/game/skill/Skill.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 9e6c5208..a619cfde 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -110,7 +110,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const s_uuid = castPlan.skillId; const skillLv = castPlan.skillLv; const config = SkillSet[s_uuid]; - const sUp = SkillUpList[s_uuid] ?? SkillUpList[1001]; + const sUp = SkillUpList[s_uuid] ? SkillUpList[s_uuid]:SkillUpList[1001]; const cNum = Math.min(2, Math.max(0, Math.floor(sUp.num ?? 0))); if (!config) return; //播放前摇技能动画 @@ -164,7 +164,6 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const parent = caster.node.parent; if (!parent) return; const skill = ecs.getEntity(Skill); - const sNum= Math.floor(SkillUpList[s_uuid].num*skillLv) const startPos = this.resolveRepeatCastStartPos(caster.node.position, castIndex); skill.load(startPos, parent, s_uuid, targetPos.clone(), caster, cAttrsComp, skillLv, 0); } diff --git a/assets/script/game/skill/Skill.ts b/assets/script/game/skill/Skill.ts index 14a0c0ce..84991405 100644 --- a/assets/script/game/skill/Skill.ts +++ b/assets/script/game/skill/Skill.ts @@ -204,7 +204,7 @@ export class Skill extends ecs.Entity { sDataCom.group=caster.box_group sDataCom.casterEid=caster.ent.eid sDataCom.Attrs = {}; - const SUp=SkillUpList[s_uuid]??SkillUpList[1001] + const SUp=SkillUpList[s_uuid] ? SkillUpList[s_uuid]:SkillUpList[1001]; const sCrt = (config.crt ?? 0)+SUp.crt*skill_lv; const sFrz = (config.frz ?? 0)+SUp.frz*skill_lv; const sBck = (config.bck ?? 0)+SUp.bck*skill_lv;