Snapshot for release 2026.10.12.1 (internal ef4d41d)
This commit is contained in:
parent
08b80eed86
commit
b0f9d74b21
54 changed files with 5062 additions and 935 deletions
24
tools/PreCastStopTests/PreCastStopTests.csproj
Normal file
24
tools/PreCastStopTests/PreCastStopTests.csproj
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--
|
||||
Offline checks for the pre-cast stop (2026-10-12): src\RynthCore.Engine\Compatibility\
|
||||
PreCastStopRules.cs, compiled in. While the player has control, a queued cast first sends
|
||||
its stop and waits for the server's answer (or 750 ms), then casts without the stop that
|
||||
FreeHandsAndCastSpell would otherwise send in the cast's frame. With the server in control
|
||||
(or the state unreadable) the cast goes at once, as before. Pure code, nothing native.
|
||||
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<RootNamespace>PreCastStopTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\PreCastStopRules.cs" Link="Engine\PreCastStopRules.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
43
tools/PreCastStopTests/Program.cs
Normal file
43
tools/PreCastStopTests/Program.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using RynthCore.Engine.Compatibility;
|
||||
|
||||
namespace PreCastStopTests;
|
||||
|
||||
/// <summary>
|
||||
/// The pre-cast stop (PreCastStopRules.cs). Flight 63260: runs of projectile casts that never
|
||||
/// landed each began with a stop burst in a cast's frame; FreeHandsAndCastSpell's own
|
||||
/// MaybeStopCompletely is one of those stops whenever the player has control.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
private static int _checks, _failed;
|
||||
|
||||
private static int Main()
|
||||
{
|
||||
// Server in control (after a cast's server turn): no stop would ride, cast at once.
|
||||
Check(PreCastStopRules.Decide(1, false, 0, 0) == PreCastStep.CastNow, "server in control: cast now");
|
||||
// Unknown state: as before.
|
||||
Check(PreCastStopRules.Decide(-1, false, 0, 0) == PreCastStep.CastNow, "unreadable: cast now (old behavior)");
|
||||
// Player in control: send the stop first, never the cast in the same tick.
|
||||
Check(PreCastStopRules.Decide(0, false, 0, 0) == PreCastStep.SendStop, "player in control: the stop goes first");
|
||||
// Stop sent: wait for the answer.
|
||||
Check(PreCastStopRules.Decide(0, true, 0, 0) == PreCastStep.Wait, "stop sent, no answer: wait");
|
||||
Check(PreCastStopRules.Decide(0, true, 0, PreCastStopRules.EchoMaxMs - 1) == PreCastStep.Wait, "still waiting 1 ms before the limit");
|
||||
// Answered: cast without the cast's own stop.
|
||||
Check(PreCastStopRules.Decide(0, true, 1, 120) == PreCastStep.CastWithoutStop, "answered: cast, no stop in its frame");
|
||||
// Control state is not re-read once the stop is out (the answer may be a server motion).
|
||||
Check(PreCastStopRules.Decide(1, true, 1, 120) == PreCastStep.CastWithoutStop, "answered, server took control meanwhile: still no stop");
|
||||
// No answer in time: cast anyway (never park a cast), still without a second stop.
|
||||
Check(PreCastStopRules.Decide(0, true, 0, PreCastStopRules.EchoMaxMs) == PreCastStep.CastWithoutStop, "no answer in 750 ms: cast anyway");
|
||||
|
||||
Console.WriteLine($"{_checks} check(s), {_failed} failed.");
|
||||
return _failed == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
private static void Check(bool ok, string what)
|
||||
{
|
||||
_checks++;
|
||||
if (ok) return;
|
||||
_failed++;
|
||||
Console.WriteLine($"[FAIL] {what}");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue