fix(combat): [Item 1] fix skill spam and enforce animation completion with proper cooldown
This commit is contained in:
1 parent
b37334b08f
commit
47843f78d5
2 files changed
+11
-2
No files matched your search
@@ -38,6 +38,15 @@ internal sealed partial class GameRouter
|
|||||||
return;
|
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.CombatUseCount++;
|
||||||
state.RestoreResourcesAfterActiveSkill |=
|
state.RestoreResourcesAfterActiveSkill |=
|
||||||
req.SkillId == weapon.ActiveSkill(style) ||
|
req.SkillId == weapon.ActiveSkill(style) ||
|
||||||
@@ -98,7 +107,7 @@ internal sealed partial class GameRouter
|
|||||||
await ctx.NotifyAsync(MethodId.SyncFightResource,
|
await ctx.NotifyAsync(MethodId.SyncFightResource,
|
||||||
CombatCodec.FightResource(state.ActiveSpiritUnitId, CombatCodec.UltimateResourceId, CombatCodec.UltimateResourceMax));
|
CombatCodec.FightResource(state.ActiveSpiritUnitId, CombatCodec.UltimateResourceId, CombatCodec.UltimateResourceMax));
|
||||||
await ctx.NotifyAsync(MethodId.SyncFightResourceFreeState,
|
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)
|
Task OnSkillHit(RpcContext ctx, SceneMethods.SkillHitData hit)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ internal sealed partial class GameRouter
|
|||||||
await ctx.NotifyAsync(MethodId.SyncFightResource,
|
await ctx.NotifyAsync(MethodId.SyncFightResource,
|
||||||
CombatCodec.FightResource(unitId, resourceId, maximum));
|
CombatCodec.FightResource(unitId, resourceId, maximum));
|
||||||
await ctx.NotifyAsync(MethodId.SyncFightResourceFreeState,
|
await ctx.NotifyAsync(MethodId.SyncFightResourceFreeState,
|
||||||
CombatCodec.FightResourceFreeState(unitId, resourceId, true));
|
CombatCodec.FightResourceFreeState(unitId, resourceId, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user