Pace scroll reads and the stance restore from the read's UseDone
ACE sends "The scroll is destroyed." before the return-to-ready animation and the UseDone after it (Scroll.ActOnUse, Player.TryUseItem); in a client log they were ~0.7 s apart, and the next read went ~0.8 s after the UseDone. - The first UseDone after a read's send is that read's. The next read goes 250 ms after it; with no UseDone seen, 1.5 s after the read's end as before. - The stance restore goes at the last read's UseDone when no scroll is pending, instead of 3.5 s after the read; a pending scroll keeps the settle wait. - Tests: ReadGapFromUseDone, StanceRestoredAtLastUseDone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
316527227f
commit
bb8ac3e60f
2 changed files with 118 additions and 3 deletions
|
|
@ -67,6 +67,8 @@ internal static class LearnSpellsTests
|
|||
r.Add("learn: a restore that never lands is tried 3 times, then given up", StanceNeverLands);
|
||||
r.Add("learn: Reset and the macro stopping close the series", StanceResetAndMacroStop);
|
||||
r.Add("learn: settings - on by default, old files keep it on, /vt opt and metas reach ReadUnknownScrolls", Settings);
|
||||
r.Add("learn: the gap to the next read counts from the last read's UseDone (no UseDone: 1.5 s from its end)", ReadGapFromUseDone);
|
||||
r.Add("learn: the stance goes back at the last read's UseDone when no scroll is pending; a pending scroll waits", StanceRestoredAtLastUseDone);
|
||||
}
|
||||
|
||||
// ── World ─────────────────────────────────────────────────────────────────
|
||||
|
|
@ -494,6 +496,72 @@ internal static class LearnSpellsTests
|
|||
Done();
|
||||
}
|
||||
|
||||
// ── Read pacing from UseDone (UseDone ~0.7 s after "The scroll is destroyed.") ──
|
||||
|
||||
/// <summary>As FinishARead, with the read taking ~2 s like ACE's (stance, read motion, 1 s read).</summary>
|
||||
private static void FinishARealRead(ScrollLearner l, Clock c)
|
||||
{
|
||||
TickUntilRead(l, c);
|
||||
Check.True(l.IsReading, "a read started");
|
||||
FakeHost.CombatModeValue = CombatMode.NonCombat;
|
||||
c.Now += 1_900;
|
||||
Learned();
|
||||
l.OnChat("The scroll is destroyed.");
|
||||
c.Now += 100;
|
||||
l.Tick(true, 0);
|
||||
Check.False(l.IsReading, "the read is over");
|
||||
}
|
||||
private static void ReadGapFromUseDone()
|
||||
{
|
||||
// UseDone seen: the next read goes 250 ms after it, well inside the old 1.5 s from the chat.
|
||||
var l = StanceRig(CombatMode.NonCombat, false, 2, out var c, out _, () => FakeHost.ServerGates = true);
|
||||
FinishARealRead(l, c); // chat answer at t, ticked at t+100
|
||||
c.Now += 600; FakeHost.UseDone(0); // the server's UseDone ~0.7 s after the chat
|
||||
l.Tick(true, 0);
|
||||
Check.False(l.IsReading, "not at the UseDone itself");
|
||||
c.Now += ScrollLearner.ReadGapAfterUseDoneMs;
|
||||
l.Tick(true, 0);
|
||||
Check.True(l.IsReading, "the next read starts 250 ms after the UseDone (950 ms after the chat)");
|
||||
Check.Eq(FakeHost.Uses.Count, 2, "two reads sent");
|
||||
Done();
|
||||
|
||||
// No UseDone (an older engine or a lost one): 1.5 s from the read's end, as before.
|
||||
var n = StanceRig(CombatMode.NonCombat, false, 2, out var cn, out _, () => FakeHost.ServerGates = true);
|
||||
FinishARealRead(n, cn);
|
||||
cn.Now += 850; n.Tick(true, 0);
|
||||
Check.False(n.IsReading, "no UseDone: not at 950 ms");
|
||||
cn.Now += 700; n.Tick(true, 0);
|
||||
Check.True(n.IsReading, "no UseDone: 1.55 s after the read ended (its chat, seen on the next tick)");
|
||||
|
||||
// A UseDone that came before the read's send does not count for it.
|
||||
var o = StanceRig(CombatMode.NonCombat, false, 2, out var co, out _, () => FakeHost.ServerGates = true);
|
||||
FakeHost.UseDone(0); // an older action's answer
|
||||
FinishARealRead(o, co);
|
||||
co.Now += 850; o.Tick(true, 0);
|
||||
Check.False(o.IsReading, "an earlier UseDone is not this read's");
|
||||
Done();
|
||||
}
|
||||
|
||||
private static void StanceRestoredAtLastUseDone()
|
||||
{
|
||||
// The last scroll: the stance goes back at its UseDone, not 3.5 s after the chat.
|
||||
var l = StanceRig(CombatMode.Magic, false, 1, out var c, out _, () => FakeHost.ServerGates = true);
|
||||
FinishARealRead(l, c);
|
||||
l.Tick(true, 0);
|
||||
Check.Eq(FakeHost.CombatModeRequests.Count, 0, "not before the UseDone");
|
||||
c.Now += 600; FakeHost.UseDone(0);
|
||||
l.Tick(true, 0);
|
||||
Check.Eq(string.Join(",", FakeHost.CombatModeRequests), CombatMode.Magic.ToString(), "Magic requested at the UseDone");
|
||||
Done();
|
||||
|
||||
// Another scroll is pending: no restore at the first read's UseDone; that read comes next.
|
||||
var s = StanceRig(CombatMode.Magic, false, 2, out var cs, out _, () => FakeHost.ServerGates = true);
|
||||
FinishARealRead(s, cs);
|
||||
cs.Now += 600; FakeHost.UseDone(0);
|
||||
s.Tick(true, 0);
|
||||
Check.Eq(FakeHost.CombatModeRequests.Count, 0, "a scroll is pending: no restore at the UseDone");
|
||||
Done();
|
||||
}
|
||||
// ── Tests ─────────────────────────────────────────────────────────────────
|
||||
|
||||
private static void AceRule()
|
||||
|
|
|
|||
Loading…
Reference in a new issue