fix: 修正技能升级数据空值检查逻辑
将空值合并运算符(??)替换为三元条件运算符,确保当SkillUpList[s_uuid]为0或false时也能正确使用默认值SkillUpList[1001]。同时移除未使用的sNum变量计算。
This commit is contained in:
@@ -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>(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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user