From 9f824a2b17717f2c6512ad7e823d35f1755e76c1 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 22 Mar 2026 21:56:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8A=80=E8=83=BD=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E4=B8=BA=E9=87=8D=E5=A4=8D=E6=96=BD=E6=94=BE=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=81=8F=E7=A7=BB=E7=9B=AE=E6=A0=87=E4=B8=8E?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当技能重复施放时,根据施放序号调整目标位置和起始位置,使多次施放的效果在垂直方向上产生偏移,避免完全重叠。 --- assets/script/game/hero/SCastSystem.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 788f3854..9e6c5208 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -134,12 +134,20 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate this.applyFriendlySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, friendlyTargets, null); continue; } - this.applyEnemySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, castPlan.targetPos); + const enemyTargetPos = this.resolveRepeatCastTargetPos(castPlan.targetPos, i); + this.applyEnemySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, enemyTargetPos, i); } }, delay); heroAttrs.triggerSkillCD(s_uuid); } + private resolveRepeatCastTargetPos(targetPos: Vec3 | null, castIndex: number): Vec3 | null { + if (!targetPos) return null; + if (castIndex === 1) return new Vec3(targetPos.x, targetPos.y + 15, targetPos.z); + if (castIndex === 2) return new Vec3(targetPos.x, targetPos.y - 15, targetPos.z); + return targetPos; + } + /** 构建技能尝试顺序:优先主动技能,其次普攻 */ private buildSkillCandidates(skillIds: number[]): number[] { if (!skillIds || skillIds.length === 0) return []; @@ -151,24 +159,31 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate * 创建技能实体(投射物/范围体等)。 * 仅用于对敌伤害技能的实体化表现与碰撞伤害分发。 */ - private createSkillEntity(s_uuid: number, skillLv: number, caster: HeroViewComp,cAttrsComp: HeroAttrsComp, targetPos: Vec3) { + private createSkillEntity(s_uuid: number, skillLv: number, caster: HeroViewComp,cAttrsComp: HeroAttrsComp, targetPos: Vec3, castIndex: number = 0) { if (!caster.node || !caster.node.isValid) return; const parent = caster.node.parent; if (!parent) return; const skill = ecs.getEntity(Skill); const sNum= Math.floor(SkillUpList[s_uuid].num*skillLv) - skill.load(caster.node.position.clone(), parent, s_uuid, targetPos.clone(), caster, cAttrsComp, skillLv, 0); + const startPos = this.resolveRepeatCastStartPos(caster.node.position, castIndex); + skill.load(startPos, parent, s_uuid, targetPos.clone(), caster, cAttrsComp, skillLv, 0); } /** * 对敌技能效果处理。 * 当前职责:仅处理伤害技能并创建技能实体。 */ - private applyEnemySkillEffects(s_uuid: number, skillLv: number, config: SkillConfig, heroView: HeroViewComp, cAttrsComp: HeroAttrsComp, targetPos: Vec3 | null) { + private applyEnemySkillEffects(s_uuid: number, skillLv: number, config: SkillConfig, heroView: HeroViewComp, cAttrsComp: HeroAttrsComp, targetPos: Vec3 | null, castIndex: number = 0) { const kind = config.kind ?? SkillKind.Damage; if (kind !== SkillKind.Damage) return; if (config.ap <= 0 || !targetPos) return; - this.createSkillEntity(s_uuid, skillLv, heroView, cAttrsComp, targetPos); + this.createSkillEntity(s_uuid, skillLv, heroView, cAttrsComp, targetPos, castIndex); + } + + private resolveRepeatCastStartPos(startPos: Readonly, castIndex: number): Vec3 { + if (castIndex === 1) return new Vec3(startPos.x, startPos.y + 15, startPos.z); + if (castIndex === 2) return new Vec3(startPos.x, startPos.y - 15, startPos.z); + return startPos.clone(); } /**