Vitals: heal grace - a heal never waits more than 2 s on pending state #25

Open
AwfulWaffle wants to merge 1 commit from AwfulWaffle/RynthSuite:heal-grace into main
First-time contributor

Independent: applies to main alone.

What went wrong in play

"Stuck in Healing": a healing kit got no result line, and for 8 s and more no vitals action followed, with the label reading Healing and nothing else healing. The character died. The kit wait's timeout was 8 s (KitResultTimeoutMs = 8000). Several other holds could each park a heal for seconds on top of that: the character's animation, a busy count, the cast gate, and an unanswered item use.

VirindiTank re-sends a kit every 100 ms until the server plays the heal motion (3 s at most), then waits up to 3 s for the result line. It never parks on the client's busy state.

The fix

ActionPacer.HealGraceMs (2000 ms) bounds what a heal under a heal line waits on:

  • The kit wait (BuffManager.KitWaitVerdict):
    • A kit the server shows no sign of taking (no motion, no UseDone, no line) is let go after 2 s, and the next tick sends it again.
    • The kit's own UseDone(0) with no line ends the wait after 700 ms. Only the first UseDone after the send counts, the same way the pacer pairs a cast.
    • A started kit waits 3.5 s at most (was 8 s). Stamina kits share this wait.
    • An engine with neither GetCastBusyState nor the UseDone sequence can't show that the server took a kit. There, only the 3.5 s limit applies.
  • An item use nobody answered (a lost kit) no longer holds a heal past 2 s. Corpse and door uses and our own casts keep their rules.
  • The character's animation holds a plain heal for 2 s (was 4 s). This is logged and counted once per busy spell.
  • The "too busy" probe runs at least every 2 s while a heal is waiting.
  • A cast gate closed for 2 s under a heal line opens for the heal only. No mana, stamina or buff action goes out on that tick.
  • A busy count up for 2 s, timed from its rise, no longer holds a heal.

Files: Combat/BuffManager.cs, Combat/CastGateWatchdog.cs, Shared/ActionPacer.cs, plus tests.

How it was tested

Run from Tools\RynthCore.RynthAiHostTests:

dotnet build -c Release -r win-x86 -nodeReuse:false          (plugin project and host tests: 0 errors)
dotnet run -c Release -- "heal grace"                        10 tests, 60 checks: 10 passed
dotnet run -c Release                                        1505 tests: 1504 passed, 1 failed

The one failure is map bake: 0x6346 from the real dats matches the plan already on disk. Pristine main fails it the same way: 1495 tests, 1494 passed, and that is the only failure.

New tests:

  • HealGraceTests (10), which drive KitPending end to end:
    • with no sign from the server, the kit is retried at 2 s;
    • with neither capability, there is no retry at 2 s and the wait ends at 3.5 s. This test fails with that rule reverted (checked);
    • a started kit waits until 3.5 s;
    • the kit's own UseDone(0) with no line ends the wait at 700 ms, and a later UseDone is not its answer;
    • the heartbeat heals once the gate has been closed for 2 s;
    • a grace-opened gate sends no Stamina to Mana (with an open-gate control);
    • the busy grace is timed from the rise;
    • the gesture grace is logged once.
  • StuckCastTests: its probe test is split into the non-heal doubling and the heal's capped probe.

Scope and risk

  • Vitals only, and only with health under a heal line. Buffing, combat casts, and corpse and door uses are unchanged.
  • A kit the server is slow to start can be sent a second time after 2 s. A refusal is an answer too, and the next heal retries.
  • KitResultTimeoutMs is now 3500 ms for healing and stamina kits.

🤖 Generated with Claude Code

Independent: applies to main alone. ## What went wrong in play "Stuck in Healing": a healing kit got no result line, and for 8 s and more no vitals action followed, with the label reading Healing and nothing else healing. The character died. The kit wait's timeout was 8 s (`KitResultTimeoutMs = 8000`). Several other holds could each park a heal for seconds on top of that: the character's animation, a busy count, the cast gate, and an unanswered item use. VirindiTank re-sends a kit every 100 ms until the server plays the heal motion (3 s at most), then waits up to 3 s for the result line. It never parks on the client's busy state. ## The fix `ActionPacer.HealGraceMs` (2000 ms) bounds what a heal under a heal line waits on: - **The kit wait** (`BuffManager.KitWaitVerdict`): - A kit the server shows no sign of taking (no motion, no UseDone, no line) is let go after 2 s, and the next tick sends it again. - The kit's own UseDone(0) with no line ends the wait after 700 ms. Only the first UseDone after the send counts, the same way the pacer pairs a cast. - A started kit waits 3.5 s at most (was 8 s). Stamina kits share this wait. - An engine with neither GetCastBusyState nor the UseDone sequence can't show that the server took a kit. There, only the 3.5 s limit applies. - **An item use nobody answered** (a lost kit) no longer holds a heal past 2 s. Corpse and door uses and our own casts keep their rules. - **The character's animation** holds a plain heal for 2 s (was 4 s). This is logged and counted once per busy spell. - **The "too busy" probe** runs at least every 2 s while a heal is waiting. - **A cast gate** closed for 2 s under a heal line opens for the heal only. No mana, stamina or buff action goes out on that tick. - **A busy count** up for 2 s, timed from its rise, no longer holds a heal. Files: `Combat/BuffManager.cs`, `Combat/CastGateWatchdog.cs`, `Shared/ActionPacer.cs`, plus tests. ## How it was tested Run from `Tools\RynthCore.RynthAiHostTests`: ``` dotnet build -c Release -r win-x86 -nodeReuse:false (plugin project and host tests: 0 errors) dotnet run -c Release -- "heal grace" 10 tests, 60 checks: 10 passed dotnet run -c Release 1505 tests: 1504 passed, 1 failed ``` The one failure is `map bake: 0x6346 from the real dats matches the plan already on disk`. Pristine main fails it the same way: 1495 tests, 1494 passed, and that is the only failure. New tests: - `HealGraceTests` (10), which drive `KitPending` end to end: - with no sign from the server, the kit is retried at 2 s; - with neither capability, there is no retry at 2 s and the wait ends at 3.5 s. This test fails with that rule reverted (checked); - a started kit waits until 3.5 s; - the kit's own UseDone(0) with no line ends the wait at 700 ms, and a later UseDone is not its answer; - the heartbeat heals once the gate has been closed for 2 s; - a grace-opened gate sends no Stamina to Mana (with an open-gate control); - the busy grace is timed from the rise; - the gesture grace is logged once. - `StuckCastTests`: its probe test is split into the non-heal doubling and the heal's capped probe. ## Scope and risk - Vitals only, and only with health under a heal line. Buffing, combat casts, and corpse and door uses are unchanged. - A kit the server is slow to start can be sent a second time after 2 s. A refusal is an answer too, and the next heal retries. - `KitResultTimeoutMs` is now 3500 ms for healing and stamina kits. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
"Stuck in Healing": a healing kit got no result line, and no vitals
action followed for 8 s and more with the label reading Healing; the
character died. The kit wait's timeout was 8 s.

VirindiTank re-sends a kit every 100 ms until the server plays the heal
motion (3 s at most), then waits up to 3 s for the result line. It never
parks on the client's busy state.

ActionPacer.HealGraceMs (2000) bounds what a heal under a heal line waits on:
- the kit wait (KitWaitVerdict): no motion, no UseDone and no line after
  2 s lets the kit go and the next tick sends it again; the kit's own
  UseDone(0) (the first after the send) with no line ends it after 700 ms;
  a started kit waits 3.5 s at most (KitResultTimeoutMs, was 8 s; stamina
  kits share this wait). An engine with neither GetCastBusyState nor the
  UseDone sequence can't show the server took a kit, so there only the
  3.5 s limit applies;
- an item use nobody answered (a lost kit) no longer holds the heal past
  2 s (corpse/door uses and our own casts keep their rules);
- the character's animation: 2 s for a plain heal (was 4 s), logged and
  counted once per busy spell;
- the 'too busy' probe for a waiting heal: at least every 2 s;
- the cast gate: closed 2 s under a heal line opens for the heal only
  (no mana, stamina or buff goes on that tick);
- a busy count: up 2 s (timed from its rise) no longer holds a heal.

Tests: HealGraceTests (new, 10), StuckCastTests' probe test split into the
non-heal doubling and the heal's capped probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This pull request has changes conflicting with the target branch.
  • Plugins/RynthCore.Plugin.RynthAi/Combat/BuffManager.cs
  • Plugins/Shared/ActionPacer.cs
  • Tools/RynthCore.RynthAiHostTests/Program.cs
  • Tools/RynthCore.RynthAiHostTests/Tests/HealGraceTests.cs
  • Tools/RynthCore.RynthAiHostTests/Tests/StuckCastTests.cs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u heal-grace:AwfulWaffle-heal-grace
git switch AwfulWaffle-heal-grace

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff AwfulWaffle-heal-grace
git switch AwfulWaffle-heal-grace
git rebase main
git switch main
git merge --ff-only AwfulWaffle-heal-grace
git switch AwfulWaffle-heal-grace
git rebase main
git switch main
git merge --no-ff AwfulWaffle-heal-grace
git switch main
git merge --squash AwfulWaffle-heal-grace
git switch main
git merge --ff-only AwfulWaffle-heal-grace
git switch main
git merge AwfulWaffle-heal-grace
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rynth/RynthSuite!25
No description provided.