From 47843f78d59e0051f51aaa2a3fb0d04cb30ddd35 Mon Sep 17 00:00:00 2001 From: CAtlas0784 Date: Wed, 16 Sep 2026 02:19:01 +0700 Subject: [PATCH] fix(combat): [Item 1] fix skill spam and enforce animation completion with proper cooldown --- .../Ananta.Handlers/Game/GameRouter.Combat.cs | 11 ++++++++++- .../Ananta.Handlers/Game/GameRouter.Profiles.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Ananta.Server/Ananta.Handlers/Game/GameRouter.Combat.cs b/Ananta.Server/Ananta.Handlers/Game/GameRouter.Combat.cs index d110ea1..fe5d13b 100644 --- a/Ananta.Server/Ananta.Handlers/Game/GameRouter.Combat.cs +++ b/Ananta.Server/Ananta.Handlers/Game/GameRouter.Combat.cs @@ -38,6 +38,15 @@ internal sealed partial class GameRouter return; } + // Prevent rapid re-triggering of the same active or unique skill while the animation is executing + if (state.ActiveSkillId == req.SkillId && + (req.SkillId == weapon.ActiveSkill(style) || req.SkillId == weapon.UniqueSkill(style)) && + (Environment.TickCount64 - state.ActiveSkillStartedTicks) < 1200) + { + ctx.Session.Log.Warn($"[COMBAT] ignore rapid spam of active/unique skill={req.SkillId} elapsed={Environment.TickCount64 - state.ActiveSkillStartedTicks}ms"); + return; + } + state.CombatUseCount++; state.RestoreResourcesAfterActiveSkill |= req.SkillId == weapon.ActiveSkill(style) || @@ -98,7 +107,7 @@ internal sealed partial class GameRouter await ctx.NotifyAsync(MethodId.SyncFightResource, CombatCodec.FightResource(state.ActiveSpiritUnitId, CombatCodec.UltimateResourceId, CombatCodec.UltimateResourceMax)); await ctx.NotifyAsync(MethodId.SyncFightResourceFreeState, - CombatCodec.FightResourceFreeState(state.ActiveSpiritUnitId, CombatCodec.UltimateResourceId, true)); + CombatCodec.FightResourceFreeState(state.ActiveSpiritUnitId, CombatCodec.UltimateResourceId, false)); } Task OnSkillHit(RpcContext ctx, SceneMethods.SkillHitData hit) diff --git a/Ananta.Server/Ananta.Handlers/Game/GameRouter.Profiles.cs b/Ananta.Server/Ananta.Handlers/Game/GameRouter.Profiles.cs index cb4ccaa..6f35d9d 100644 --- a/Ananta.Server/Ananta.Handlers/Game/GameRouter.Profiles.cs +++ b/Ananta.Server/Ananta.Handlers/Game/GameRouter.Profiles.cs @@ -51,7 +51,7 @@ internal sealed partial class GameRouter await ctx.NotifyAsync(MethodId.SyncFightResource, CombatCodec.FightResource(unitId, resourceId, maximum)); await ctx.NotifyAsync(MethodId.SyncFightResourceFreeState, - CombatCodec.FightResourceFreeState(unitId, resourceId, true)); + CombatCodec.FightResourceFreeState(unitId, resourceId, false)); } }