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,