RynthAi: no false "never reached your hand" weapon ban #21

Open
AwfulWaffle wants to merge 2 commits from AwfulWaffle/RynthSuite:wield-ban-false-positive into main
First-time contributor

Depends on: nothing (RynthSuite, based on upstream/main 7166d25). Two commits on one branch; the second is separable (see Scope and risk).

What went wrong in play

A weapon that did reach the hand was banned for 30 minutes as "it never reached your hand (the client refused the wield)". Buffing swapped the weapon out for a wand before combat looked again, so combat saw it missing, counted each wield as a failed try, and gave up on it. A readable equipment list was enough to trigger the ban.

The fix

Commit 1, "no false never-reached ban" (the sighting fix):

  • WeaponSwapTracker remembers weapons seen in a main-hand slot while their wields are under way (SeenWielded, WasSeenWielded, HasAttemptsAt). A sighting resets that weapon's try count; a fresh run of wields forgets the old sighting.
  • CombatManager.NoteSwapWieldsSeen() samples the engine's equipment list (read only, no game command, fault-tolerant). It runs from OnHeartbeat and every tick from RynthAiPlugin, ahead of the buffing hold, which skips combat's heartbeat. Only main-hand slots count; a weapon in the shield slot is not the wield combat asked for.
  • NeverReachedHand(id) replaces the old "equipment list readable" test: the weapon must be absent now AND never seen wielded during the run.

Commit 2, "a relog ends never-reached bans" (separable):

  • "Never reached your hand" bans are tracked separately (_neverReachedBans). SetPlayerId (login or relog) lifts them and logs how many; the server's own "skill too low" bans stay, and a real one outranks a never-reached ban on the same weapon. NoteSkillTooLow gains a neverReached flag for this.

How it was tested

Build (from the worktree root), at each commit:

dotnet build Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj -c Release -r win-x86 -nodeReuse:false

Result: Build succeeded, 0 Error(s).

Host tests (from Tools\RynthCore.RynthAiHostTests):

after commit 1:  dotnet run -c Release -- "wield"  ->  49 test(s), 417 check(s): 49 passed, 0 failed
after commit 2:  dotnet run -c Release -- "wield"  ->  50 test(s), 421 check(s): 50 passed, 0 failed
after commit 2:  dotnet run -c Release             ->  1504 test(s), 15402 check(s): 1503 passed, 1 failed

The one failure is map bake: 0x6346 from the real dats ..., which needs the game dats and also fails on pristine upstream/main (baseline 1494/1495). The full suite was run on the final state only. New WieldBanTests are registered with one line in Program.cs (the relog test's registration arrives with commit 2).

Scope and risk

Commit 1: Combat/CombatManager.cs, Combat/WeaponSwapTracker.cs, RynthAiPlugin.cs (one call), Tests/WieldBanTests.cs, Program.cs (one line). Commit 2: Combat/CombatManager.cs and Tests/WieldBanTests.cs only; it can be dropped on its own and commit 1 still builds and passes. Only the never-reached ban path changes. Risk: a weapon that truly never reaches the hand is still banned, but only after a run with no sighting in a main-hand slot; the extra equipment-list read happens only while wields are in flight or recently counted.

🤖 Generated with Claude Code

Depends on: nothing (RynthSuite, based on upstream/main 7166d25). Two commits on one branch; the second is separable (see Scope and risk). ## What went wrong in play A weapon that did reach the hand was banned for 30 minutes as "it never reached your hand (the client refused the wield)". Buffing swapped the weapon out for a wand before combat looked again, so combat saw it missing, counted each wield as a failed try, and gave up on it. A readable equipment list was enough to trigger the ban. ## The fix Commit 1, "no false never-reached ban" (the sighting fix): - `WeaponSwapTracker` remembers weapons seen in a main-hand slot while their wields are under way (`SeenWielded`, `WasSeenWielded`, `HasAttemptsAt`). A sighting resets that weapon's try count; a fresh run of wields forgets the old sighting. - `CombatManager.NoteSwapWieldsSeen()` samples the engine's equipment list (read only, no game command, fault-tolerant). It runs from `OnHeartbeat` and every tick from `RynthAiPlugin`, ahead of the buffing hold, which skips combat's heartbeat. Only main-hand slots count; a weapon in the shield slot is not the wield combat asked for. - `NeverReachedHand(id)` replaces the old "equipment list readable" test: the weapon must be absent now AND never seen wielded during the run. Commit 2, "a relog ends never-reached bans" (separable): - "Never reached your hand" bans are tracked separately (`_neverReachedBans`). `SetPlayerId` (login or relog) lifts them and logs how many; the server's own "skill too low" bans stay, and a real one outranks a never-reached ban on the same weapon. `NoteSkillTooLow` gains a `neverReached` flag for this. ## How it was tested Build (from the worktree root), at each commit: dotnet build Plugins\RynthCore.Plugin.RynthAi\RynthCore.Plugin.RynthAi.csproj -c Release -r win-x86 -nodeReuse:false Result: Build succeeded, 0 Error(s). Host tests (from `Tools\RynthCore.RynthAiHostTests`): after commit 1: dotnet run -c Release -- "wield" -> 49 test(s), 417 check(s): 49 passed, 0 failed after commit 2: dotnet run -c Release -- "wield" -> 50 test(s), 421 check(s): 50 passed, 0 failed after commit 2: dotnet run -c Release -> 1504 test(s), 15402 check(s): 1503 passed, 1 failed The one failure is `map bake: 0x6346 from the real dats ...`, which needs the game dats and also fails on pristine upstream/main (baseline 1494/1495). The full suite was run on the final state only. New `WieldBanTests` are registered with one line in `Program.cs` (the relog test's registration arrives with commit 2). ## Scope and risk Commit 1: `Combat/CombatManager.cs`, `Combat/WeaponSwapTracker.cs`, `RynthAiPlugin.cs` (one call), `Tests/WieldBanTests.cs`, `Program.cs` (one line). Commit 2: `Combat/CombatManager.cs` and `Tests/WieldBanTests.cs` only; it can be dropped on its own and commit 1 still builds and passes. Only the never-reached ban path changes. Risk: a weapon that truly never reaches the hand is still banned, but only after a run with no sighting in a main-hand slot; the extra equipment-list read happens only while wields are in flight or recently counted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A weapon that did reach the hand could be banned for 30 minutes: buffing swapped it out for a wand before combat looked again, and each such wield counted as a failed try. Sample the engine's equipment list while wields are under way; a weapon seen in a main-hand slot during its run of wields has its tries reset and is never banned as 'never reached your hand'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 'never reached your hand' ban is a guess from a missing answer, unlike the server's own 'skill too low' refusal. Track those bans separately and lift them when the character logs in (or relogs); 'skill too low' bans stay.

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/CombatManager.cs
  • Plugins/RynthCore.Plugin.RynthAi/Combat/WeaponSwapTracker.cs
  • Plugins/RynthCore.Plugin.RynthAi/RynthAiPlugin.cs
  • Tools/RynthCore.RynthAiHostTests/Program.cs
  • Tools/RynthCore.RynthAiHostTests/Tests/WieldBanTests.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 wield-ban-false-positive:AwfulWaffle-wield-ban-false-positive
git switch AwfulWaffle-wield-ban-false-positive

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-wield-ban-false-positive
git switch AwfulWaffle-wield-ban-false-positive
git rebase main
git switch main
git merge --ff-only AwfulWaffle-wield-ban-false-positive
git switch AwfulWaffle-wield-ban-false-positive
git rebase main
git switch main
git merge --no-ff AwfulWaffle-wield-ban-false-positive
git switch main
git merge --squash AwfulWaffle-wield-ban-false-positive
git switch main
git merge --ff-only AwfulWaffle-wield-ban-false-positive
git switch main
git merge AwfulWaffle-wield-ban-false-positive
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!21
No description provided.