RynthAi: a refused combat mode change is not a sent request
ChangeCombatModeFor called host.ChangeCombatMode, began a paced action only on success, and then returned true either way. BuffManager and the Combat stance paths read that true as a sent request: they advanced their attempt clocks, counted a failed try and logged a retry. With the engine turning non-teardown actions away around a teleport or a death, chained refusals could reach NoWandFlipMaxFails and set _magicModeBlocked / _wandSwapExhausted. - ChangeCombatModeFor returns false on a refusal, without Begin. The other *For helpers already return the host result. The no-ChangeCombatMode host case still returns true (nothing to send or pace). - Callers stamp their bookkeeping only on true: BuffManager peace-for-kit paths (_lastCastAttempt, _healWaitKind); CorpseOpenController's peace before an open and MissileCraftingManager's peace before the first combine are asked again until accepted, inside their 2.5 s ceiling counted from the first ask; the stuck-stance clocks (BuffManager, CombatManager) start only once a stance request has gone out; ExpressionEngine's cast-stance flip throttle; the CombatManager stall-watchdog toggle, whose ladder step is taken back (CombatStallWatchdog.Unfire) when the toggle is refused. - ActionPacer tracks a streak of consecutive engine refusals (one log line when it starts, one when an accepted call ends it). After EngineRefusalFailOpenMs (30 s) ChangeCombatModeFor returns true again, so a permanent refusal (missing hook, full ring) is counted by the callers' own failure paths instead of retrying forever. A gap of more than RefuseGapMs (10 s) starts a new streak; Reset() and Forget() end it. - ActionPacer.LastEngineRefusalMs: a refusal newer than a stuck-stance clock's start restarts that clock, so a request accepted and then dropped by a teleport does not end in a re-equip UseObject on the wielded weapon. Tests: FakeHost.CombatModeRefuse; ActionPacingTests (refusals burn no try or backoff, streak, fail-open, expiry and Forget, stuck clock restart, 20 s no-wand loop never reaches _magicModeBlocked, peace-before-open retry, MissileCraftingManager), WeaponTests (equip pass keeps its backoff), CombatHookTests, CombatStallWatchdogTests (Unfire). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2d8bebb0f4
commit
2e8258b079
12 changed files with 570 additions and 34 deletions
|
|
@ -2831,8 +2831,9 @@ internal sealed class ExpressionEngine
|
|||
if (_host.HasChangeCombatMode
|
||||
&& (now - _castStanceLastFlipAt).TotalMilliseconds > CastStanceFlipGateMs)
|
||||
{
|
||||
_host.ChangeCombatModeFor(CombatMode.Magic, "Meta", "meta cast: Magic mode", force: true);
|
||||
_castStanceLastFlipAt = now;
|
||||
// Only a request that went out arms the flip throttle: a refusal is asked again next pulse.
|
||||
if (_host.ChangeCombatModeFor(CombatMode.Magic, "Meta", "meta cast: Magic mode", force: true))
|
||||
_castStanceLastFlipAt = now;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue