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
|
|
@ -348,11 +348,35 @@ public sealed partial class RynthLuaPlugin
|
|||
}
|
||||
t["monsters"] = monsters;
|
||||
|
||||
// ctx.last: the most recent RESOLVED cast, its err final (nil only when no answer could be
|
||||
// read); ctx.pending: the cast still in flight, or nil. From a RynthAi that writes the
|
||||
// appended fields; an older one: ctx.last is its last decision, no err, no pending.
|
||||
var last = new Table(s);
|
||||
last["seq"] = (double)r.LastSeq;
|
||||
last["spell"] = (double)r.LastSpell;
|
||||
last["target"] = (double)r.LastTarget;
|
||||
last["at"] = (double)r.LastAtMs;
|
||||
uint newEnd = (uint)System.Runtime.InteropServices.Marshal.OffsetOf<CombatRequestV1>(nameof(CombatRequestV1.PendingAtMs)) + sizeof(long);
|
||||
if (r.StructSize >= newEnd)
|
||||
{
|
||||
last["seq"] = (double)r.ResolvedSeq;
|
||||
last["spell"] = (double)r.ResolvedSpell;
|
||||
last["target"] = (double)r.ResolvedTarget;
|
||||
last["at"] = (double)r.ResolvedAtMs;
|
||||
if (r.ResolvedSpell != 0 && r.ResolvedErr >= 0) last["err"] = (double)r.ResolvedErr;
|
||||
if (r.PendingSpell != 0)
|
||||
{
|
||||
var pending = new Table(s);
|
||||
pending["seq"] = (double)r.PendingSeq;
|
||||
pending["spell"] = (double)r.PendingSpell;
|
||||
pending["target"] = (double)r.PendingTarget;
|
||||
pending["at"] = (double)r.PendingAtMs;
|
||||
t["pending"] = pending;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
last["seq"] = (double)r.LastSeq;
|
||||
last["spell"] = (double)r.LastSpell;
|
||||
last["target"] = (double)r.LastTarget;
|
||||
last["at"] = (double)r.LastAtMs;
|
||||
}
|
||||
t["last"] = last;
|
||||
return DynValue.NewTable(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1470,7 +1470,7 @@ function RynthAiModule.SubmitCommand(text) end
|
|||
---another target while the projectile flies, and the next request names the new target. An
|
||||
---unknown spell, a target that isn't the fight target, a scanned monster or the player, or a spell
|
||||
---the server refused outright right after the script cast it (no components) is rejected and
|
||||
---RynthAi casts its own; a rejected request reads as last.spell = 0. A refused spell stays parked
|
||||
---RynthAi casts its own; a rejected request is not a cast and appears in neither ctx.last nor ctx.pending. A refused spell stays parked
|
||||
---for 600 s (as RynthAi parks a vital level); restocking components does not unpark it sooner.
|
||||
---One script per kind: the first to register owns it; the same script registering again replaces
|
||||
---its handler; nil clears it. An error declines that request; a handler still running 1 s past
|
||||
|
|
@ -1515,17 +1515,34 @@ function RynthAiModule.ClearCombatHandlers() end
|
|||
---@field issuedAt number clock() when RynthAi asked.
|
||||
---@field deadline number clock() after which RynthAi casts its own choice.
|
||||
---@field monsters RynthLua.CombatMonster[] RynthAi's targets in range (attackable, in sight), nearest first.
|
||||
---@field last RynthLua.CombatLast The last answer of this kind RynthAi used.
|
||||
---@field last RynthLua.CombatLast The most recent RESOLVED cast of this kind (its answer is in).
|
||||
---@field pending RynthLua.CombatPending? The cast of this kind still in flight (sent, no answer yet); nil = none.
|
||||
|
||||
---@class RynthLua.CombatMonster
|
||||
---@field id integer
|
||||
---@field distance number Metres.
|
||||
|
||||
---A cast of this kind is in flight from its send until its answer: the UseDones answer the casts in flight of both kinds in send order (an attack sent first takes the first one, a heal sent after it the next),
|
||||
---then resolved. ctx.last never changes after the fact: a cast moves from ctx.pending to ctx.last once,
|
||||
---with its final err. Declines and rejects are not casts and appear in neither.
|
||||
---With an older RynthAi (one that does not write these fields): ctx.last is the last decision RynthAi used (spell 0 =
|
||||
---declined or rejected), with no err, and ctx.pending is always nil.
|
||||
---@class RynthLua.CombatLast
|
||||
---@field seq integer 0 before the first.
|
||||
---@field spell integer The spell cast; 0 = declined or rejected.
|
||||
---@field seq integer The request seq of that cast; 0 before the first resolved cast.
|
||||
---@field spell integer The spell cast; 0 before the first resolved cast.
|
||||
---@field target integer
|
||||
---@field at number clock() when it was used.
|
||||
---@field at number clock() when it was sent.
|
||||
---@field err integer? Its answer, final: the UseDone error. 0 = done (it went off), 29 (0x1D) =
|
||||
--- refused 'too busy' (it never went off: not a miss), 1025 (0x401) = not enough
|
||||
--- mana, 1026 (0x402) = fizzled. nil only when no answer could be read: no UseDone
|
||||
--- within 7 s of the send, or another answer came first; also nil before the
|
||||
--- first resolved cast.
|
||||
|
||||
---@class RynthLua.CombatPending
|
||||
---@field seq integer The request seq of the cast in flight.
|
||||
---@field spell integer
|
||||
---@field target integer
|
||||
---@field at number clock() when it was sent.
|
||||
|
||||
---ai.CombatHook
|
||||
---@class RynthLua.CombatHookInfo
|
||||
|
|
|
|||
Loading…
Reference in a new issue