From 53b1cf27342f48ad0c0ac0e438d7e267c939fdd1 Mon Sep 17 00:00:00 2001 From: walkpan Date: Wed, 18 Mar 2026 20:42:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=88=98=E6=96=97):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=BF=91=E6=88=98=E8=8B=B1=E9=9B=84=E8=BF=BD=E5=87=BB=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E6=94=BB=E5=87=BB=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 禁用 atk_s1.prefab 中的某个节点以避免干扰 - 增加近战攻击范围的高度从 100 到 150 - 添加 meleeOvertakeSpeedGap 常量用于控制追击速度差阈值 - 实现 shouldAllowMeleeOvertake 方法,允许高速近战英雄在特定条件下超越同优先级盟友 - 条件包括:双方均为近战、优先级相同、速度足够快、盟友未进入攻击准备状态且仍在前进中 --- assets/resources/game/skill/atk/atk_s1.prefab | 4 +-- assets/script/game/hero/MoveComp.ts | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/assets/resources/game/skill/atk/atk_s1.prefab b/assets/resources/game/skill/atk/atk_s1.prefab index 3787230b..a0e0199c 100644 --- a/assets/resources/game/skill/atk/atk_s1.prefab +++ b/assets/resources/game/skill/atk/atk_s1.prefab @@ -297,7 +297,7 @@ "node": { "__id__": 8 }, - "_enabled": true, + "_enabled": false, "__prefab": { "__id__": 12 }, @@ -492,7 +492,7 @@ "_size": { "__type__": "cc.Size", "width": 30, - "height": 100 + "height": 150 }, "_id": "" }, diff --git a/assets/script/game/hero/MoveComp.ts b/assets/script/game/hero/MoveComp.ts index 4670da78..e8fc4899 100644 --- a/assets/script/game/hero/MoveComp.ts +++ b/assets/script/game/hero/MoveComp.ts @@ -38,6 +38,7 @@ interface MoveFacConfig { export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate { private readonly meleeAttackRange = HeroDisVal[HType.Melee]; private readonly meleeMinEnemyDistanceX = 80; + private readonly meleeOvertakeSpeedGap = 20; private readonly allySpacingX = 40; private readonly allyOverlapSpacingX = 14; private readonly displacementReleaseX = 10; @@ -309,6 +310,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate const allyPriority = this.getCombatPriority(attrs); if (allyPriority < selfPriority) return; const x = view.node.position.x; + if (this.shouldAllowMeleeOvertake(selfAttrs, selfMove, attrs, allyMove, currentX, x, direction, allyPriority, selfPriority)) return; const spacing = this.resolveAllySpacing(selfAttrs, selfMove, currentX, direction, allyMove, x, allyPriority, selfPriority); if (direction > 0 && x > currentX) { clampedX = Math.min(clampedX, x - spacing); @@ -320,6 +322,35 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate return clampedX; } + private shouldAllowMeleeOvertake( + selfAttrs: HeroAttrsComp | null, + selfMove: MoveComp | null, + allyAttrs: HeroAttrsComp, + allyMove: MoveComp | null, + currentX: number, + allyX: number, + direction: number, + allyPriority: number, + selfPriority: number + ): boolean { + if (!selfAttrs || !selfMove || !allyMove) return false; + if ((selfAttrs.type as HType) !== HType.Melee || (allyAttrs.type as HType) !== HType.Melee) return false; + if (allyPriority !== selfPriority) return false; + if (selfAttrs.speed <= allyAttrs.speed + this.meleeOvertakeSpeedGap) return false; + if (direction > 0 && allyX <= currentX) return false; + if (direction < 0 && allyX >= currentX) return false; + const selfTargetX = selfMove.targetX; + const allyTargetX = allyMove.targetX; + if (Math.abs(selfTargetX) <= 0.01 || Math.abs(allyTargetX) <= 0.01) return false; + const selfNeedAdvance = direction > 0 ? selfTargetX > currentX + 2 : selfTargetX < currentX - 2; + if (!selfNeedAdvance) return false; + const allyCanAttackNow = allyAttrs.enemy_in_cast_range || Math.abs(allyTargetX - allyX) <= this.attackReadyLockX; + if (allyCanAttackNow) return false; + const allyStillAdvancing = direction > 0 ? allyTargetX > allyX + 2 : allyTargetX < allyX - 2; + if (!allyStillAdvancing) return false; + return true; + } + private resolveAllySpacing( selfAttrs: HeroAttrsComp | null, selfMove: MoveComp | null,