RynthAi: stuck-cast breaker, no re-send into a busy server, recovery retry, HP failsafe
Two casts were held open 40.8 s and 37 s by ACE's fast-tick turn-to-cast wait; every later send was answered UseDone 0x1D and a heal was re-sent every 2.5 s. - ActionPacer: after a 0x1D UseDone nothing starts until the server answers; with no cast of ours open, one probe after 1.5 s, then doubling (max 6 s). Attack repeats are not held (ACE sends no UseDone for a swing), and a latch with no cast of ours open ends after LatchMaxMs (15 s). A cast still unanswered 1 s past its normal cycle (learned per spell, at least 3 s) is turned to face its target; 2 s past it (capped by Stuck Cast Break, default 8000 ms) or on a 0x1D while it has been open 3 s, it is broken with a jump (TapJump; ACE fails a cast on a fast-tick jump). Starts wait until landed; no UseDone 3 s after landing -> Peace mode; 3 s more -> going on. Every hold is bounded: a cast StaleCastMs old, or sent before a frame gap of 5 s (keyed on the gap's end), is dropped with the latch, never broken. No breaker step in portal space; Forget on portal-enter and the death hold. A burst of 5 'too busy' answers in a second holds every start except a heal. A refused forced jump with no cast open leaves no breaker stage. A cast a script chose (the combat hook) is not jumped before 6 s from its send (ScriptCastMinBreakMs, the held-cast nudge's HeldAfterIncantMs). Stuck Cast Break is read from the settings once per tick. - MoveAudit: no start in the tick of a movement change; 150 ms and a clear motion queue (or 600 ms) let it go. A held stop sent later by FlushPendingStops counts as a movement change too; the forced flush in CastSpellFor still goes out in the same tick as the cast that follows it. - Blacklist: casts answered 0x1D (or unanswered while the server is busy) are not no-damage casts. - Combat hook: ctx.pending is the cast in flight; ctx.last is the most recent RESOLVED cast, its err final (the first UseDone after its send; nil only when none could be read: 7 s timeout, or another answer came first). The casts in flight of both kinds resolve in send order through one queue. The send-time UseDone count comes from the pacer (LastCastSeqAtSend). CombatRequestV1 appends Resolved*/Pending* fields (StructSize-gated, no Version bump); an older RynthAi keeps the old ctx.last. - HP failsafe (BuffManager.HpFailsafe.cs): at or under Emergency Heal At with no heal landing for 3 rounds of 2.5 s, a forced jump; 3 more rounds, the macro stops and /lifestone goes out (HP Failsafe Recall, default on). Nothing counts in portal space; a pending recall is dropped on death; a recall that never starts turns the macro back on (only one the failsafe stopped, never past the VTank yield) and re-arms after a 30 s cooldown. Recovery retry: recovery vitals (Heal Self, Stamina to Health, Revitalize, Stamina to Mana) refused for "not enough mana" retry after Recovery Retry (200 ms, a setting) instead of resting the family: ACE rolls Mana Conversion on every attempt before the windup and a refusal costs nothing. At most 5 recovery casts a second, 20 refusals in a row, stamina and Mana Conversion checks, an episode with no refusal for 7 s ends; an episode summary line. Stamina to Mana and Revitalize are still held under their cost by the mana reserve (AttemptVitalCast), so for them the retry applies when the mana reading is stale or costs are unknown; Heal Self and Stamina to Health, which are tried below cost, gain the most. When the retry stops, the vital rests as the existing mana reserve has it (LowManaHealRestSec, 2 s). Script heals and other casts are unchanged. Tests: StuckCastTests (incl. the script cast's break floor), PacerEdgeTests, RecoveryRetryTests (incl. costs known: Stamina to Mana held), HpFailsafeTests, CombatHookTests (ctx.last/ctx.pending, send order, an answer during the send, 0x1D blacklist, script heal keeps its rest, script attack and heal not jumped before 6 s with or without a 'too busy' answer); HealLatencyTests' and ManaReserveTests' low-mana rest cases pin untrained Mana Conversion; RynthLua compat combathook.lua. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7cbc6fdca9
commit
2d8bebb0f4
30 changed files with 3156 additions and 53 deletions
|
|
@ -55,6 +55,7 @@ internal static class MoveAudit
|
|||
if (on) FlushPendingStops(host, "before a start");
|
||||
Note(host, who, "SetAutoRun", on ? "True" : "False", collapseByKindOnly: false);
|
||||
lock (Gate) { _autoRunOn = on; if (on) _lastStartMs = NowMs(); else _pendingAutoRunOff = null; }
|
||||
Changed(on ? "SetAutoRun(True)" : "SetAutoRun(False)");
|
||||
return host.SetAutoRun(on);
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +64,7 @@ internal static class MoveAudit
|
|||
if (HeldForAction(host, who, "StopCompletely()", isStop: true, deferAs: PendingStop.Complete())) return false;
|
||||
Note(host, who, "StopCompletely", "", collapseByKindOnly: false);
|
||||
lock (Gate) { _autoRunOn = false; _motionsOn.Clear(); ClearPendingLocked(); } // clears everything AC has on
|
||||
Changed("StopCompletely()");
|
||||
return host.StopCompletely();
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +75,7 @@ internal static class MoveAudit
|
|||
if (on) FlushPendingStops(host, "before a start");
|
||||
Note(host, who, "SetMotion", $"0x{motion:X8}, {(on ? "True" : "False")}", collapseByKindOnly: false);
|
||||
lock (Gate) { if (on) { _motionsOn.Add(motion); _lastStartMs = NowMs(); } else { _motionsOn.Remove(motion); _pendingMotionOff.Remove(motion); } }
|
||||
Changed($"SetMotion(0x{motion:X8}, {(on ? "True" : "False")})");
|
||||
return host.SetMotion(motion, on);
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +86,7 @@ internal static class MoveAudit
|
|||
FlushPendingStops(host, "before a start");
|
||||
Note(host, who, "DoMovement", $"0x{motion:X8}, {speed:0.##}, {holdKey}", collapseByKindOnly: false);
|
||||
lock (Gate) { _motionsOn.Add(motion); _lastStartMs = NowMs(); }
|
||||
Changed($"DoMovement(0x{motion:X8})");
|
||||
return host.DoMovement(motion, speed, holdKey);
|
||||
}
|
||||
|
||||
|
|
@ -290,6 +294,9 @@ internal static class MoveAudit
|
|||
}
|
||||
catch { }
|
||||
|
||||
// A held stop sent now is a movement change like any other: the settle wait applies to it.
|
||||
if (sent.Count > 0) Changed(sent[sent.Count - 1]);
|
||||
|
||||
if (sent.Count > 0 && Enabled)
|
||||
{
|
||||
try { host.Log($"[Move] {PluginName} held stop(s) sent {why} after {waited} ms: {string.Join(", ", sent)}"); }
|
||||
|
|
@ -332,6 +339,7 @@ internal static class MoveAudit
|
|||
if (HeldForAction(host, who, $"StopMovement(0x{motion:X8})", isStop: true, motion, PendingStop.StopMovement(motion, holdKey))) return false;
|
||||
Note(host, who, "StopMovement", $"0x{motion:X8}, {holdKey}", collapseByKindOnly: false);
|
||||
lock (Gate) { _motionsOn.Remove(motion); _pendingStopMovement.Remove(motion); }
|
||||
Changed($"StopMovement(0x{motion:X8})");
|
||||
return host.StopMovement(motion, holdKey);
|
||||
}
|
||||
|
||||
|
|
@ -341,6 +349,7 @@ internal static class MoveAudit
|
|||
if (HeldForUse(host, who, "TurnToHeading")) return false;
|
||||
if (HeldForAction(host, who, "TurnToHeading", isStop: false)) return false;
|
||||
Note(host, who, "TurnToHeading", headingDegrees.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture), collapseByKindOnly: true);
|
||||
Changed("TurnToHeading");
|
||||
return host.TurnToHeading(headingDegrees);
|
||||
}
|
||||
|
||||
|
|
@ -400,6 +409,38 @@ internal static class MoveAudit
|
|||
ClearPendingLocked();
|
||||
_pendingSinceMs = 0;
|
||||
_deferredStopsSent = 0;
|
||||
_lastChangeMs = long.MinValue / 2;
|
||||
_lastChangeWhat = "";
|
||||
}
|
||||
}
|
||||
|
||||
// -- Settle after a movement change -------------------------------------------------
|
||||
// A Bolt VII went out in the same tick as nav's SetAutoRun(False), after nav's turns; on ACE's
|
||||
// fast tick the movement packet cancelled the cast's turn and the server held the cast 40.8 s
|
||||
// (ActionPacer's stuck-cast notes). After any movement call RynthAi sends (a start, a stop, a
|
||||
// turn), nothing starts until MoveSettleMinMs has passed and the client's motion queue reads
|
||||
// clear (GetCastBusyState), or MoveSettleMaxMs. ActionPacer.MayStart asks (not for attack repeats).
|
||||
internal const long MoveSettleMinMs = 150;
|
||||
internal const long MoveSettleMaxMs = 600;
|
||||
private static long _lastChangeMs = long.MinValue / 2;
|
||||
private static string _lastChangeWhat = "";
|
||||
|
||||
private static void Changed(string what)
|
||||
{
|
||||
lock (Gate) { _lastChangeMs = NowMs(); _lastChangeWhat = what; }
|
||||
}
|
||||
|
||||
/// <summary>True (with why) while the last movement change has not settled.</summary>
|
||||
internal static bool SettleHolds(RynthCoreHost host, out string why)
|
||||
{
|
||||
why = "";
|
||||
long age; string what;
|
||||
lock (Gate) { age = NowMs() - _lastChangeMs; what = _lastChangeWhat; }
|
||||
if (age >= MoveSettleMaxMs) return false;
|
||||
bool queueBusy;
|
||||
try { queueBusy = host.HasGetCastBusyState && host.GetCastBusyState() != 0; } catch { queueBusy = false; }
|
||||
if (age >= MoveSettleMinMs && !queueBusy) return false;
|
||||
why = $"the movement change {what} sent {age} ms ago has not settled";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue