RynthSuite as of 2026-11-19 (internal 48a8cc7e): release 2026.11.19.1

This commit is contained in:
Tom Bohar 2026-11-19 21:35:23 -05:00
commit 660e6b5b1c
31 changed files with 1381 additions and 29 deletions

View file

@ -83,6 +83,7 @@ internal static class Program
MagicArcShortPairs(pairs);
MagicArcLongLines(polys);
MagicArcOutdoors();
OutdoorWallPieces();
var ex = pairs.Where(p => p.Kind == 'W' && cells.TryGetValue(p.Cell, out var ca) && ca.Struct != 0)
.OrderBy(p => (p.B - p.A).Length()).FirstOrDefault();
@ -244,6 +245,42 @@ internal static class Program
Expect(arcOnly * 100 <= Math.Max(1, tested) * 5, "outdoors an arc is clear wherever the line is (at most 5% clip a tree or roof)");
}
/// <summary>
/// R-20261119-114214-b9ed (2026-11-19): in landblock 0xB64A, wall panel 0x02001C33 (24 x 0.4 m) and the
/// drawing-only 0x02001C39 stand every 24 m along the landblock edge. They have no collision spheres or
/// cylinders, so each got its first part's render sphere (28 m and 13 m round), which filled the corner
/// cell: a monster 1.5 m away kept dropping out of sight. Now the parts' physics polygons stand for them
/// (GeometryLoader.PartsPhysicsMesh): the corner is open, and the panels block (with both ends inside
/// the old sphere, a line through a panel crossed no sphere surface and read as clear).
/// </summary>
private static void OutdoorWallPieces()
{
const uint lb = 0xB64A;
uint cell = (lb << 16) | 0x0040;
float bx = (lb >> 8) * 192f, by = (lb & 0xFF) * 192f;
Console.WriteLine($"\n=== Outdoor wall pieces, landblock 0x{lb:X4} cell 0x0040 ===");
var geometry = _geo.GetLandblockGeometry(cell);
int bigSpheres = geometry.Count(v => v.Type == BoundingVolume.VolumeType.Sphere && v.Dimensions.X > 8f
&& v.Max.X >= bx + 166 && v.Min.X <= bx + 194 && v.Max.Y >= by + 166 && v.Min.Y <= by + 194);
Vector3 At(float x, float y) => new Vector3(bx + x, by + y, _geo.GetTerrainZWorld(bx + x, by + y));
var rnd = new Random(1);
int n = 0, blocked = 0;
for (int i = 0; i < 4000; i++)
{
float x = 168 + (float)rnd.NextDouble() * 22, y = 168 + (float)rnd.NextDouble() * 22;
double a = rnd.NextDouble() * Math.PI * 2;
n++;
if (_fsm.IsPathBlocked(cell, At(x, y), At(x + (float)(1.5 * Math.Cos(a)), y + (float)(1.5 * Math.Sin(a))), TargetingFSM.AttackType.Linear, out _))
blocked++;
}
Console.WriteLine($" spheres over 8 m reaching the corner: {bigSpheres}; 1.5 m lines in the corner blocked: {blocked} of {n}");
Expect(bigSpheres == 0, "no render sphere stands in for the wall pieces");
Expect(blocked * 100 <= n * 2, "a monster 1.5 m away in the corner is in sight (at most 2% blocked; it was 4.3%)");
bool wallsBlock = new[] { ((188f, 180f), (196f, 180f)), ((188f, 160f), (196f, 160f)), ((180f, 188f), (180f, 196f)) }
.All(l => _fsm.IsPathBlocked(cell, At(l.Item1.Item1, l.Item1.Item2), At(l.Item2.Item1, l.Item2.Item2), TargetingFSM.AttackType.Linear, out _));
Expect(wallsBlock, "a line through a wall panel on the landblock edge is blocked");
}
private static bool TerrainBetween(Vector3 a, Vector3 b)
{
for (int i = 1; i < 40; i++)

View file

@ -0,0 +1,10 @@
// The raycasting sources linked in from RynthAi log through RynthLog, which needs the plugin's install
// paths and host; this tool has neither, so its trace calls go nowhere.
namespace RynthCore.Plugin.RynthAi
{
internal enum LogCat { Raycast }
internal static class RynthLog
{
public static void Trace(LogCat cat, string message) { }
}
}

View file

@ -129,6 +129,7 @@ internal static class Program
UseRefusalTests.Register(runner);
CorpseKillerTests.Register(runner);
VitalsTests.Register(runner);
HandCastTests.Register(runner);
MultiTargetTests.Register(runner);
CastSafetyTests.Register(runner);
HealLatencyTests.Register(runner);
@ -220,6 +221,7 @@ internal static class Program
BlankLoadTests.Register(runner);
CallStateRepairTests.Register(runner);
ProfileButtonTests.Register(runner);
MonsterProfileTests.Register(runner);
GiveProfileTests.Register(runner);
TinkerTests.Register(runner);
LauncherSwapTests.Register(runner);

View file

@ -1759,7 +1759,8 @@ internal static class BuffTests
var list = rig.B.BuildDynamicBuffList();
Check.Eq(string.Join(", ", list.Take(4)), string.Join(", ", Head), "Creature Enchantment, Focus, Willpower, Life Magic first");
int strength = list.IndexOf("Strength Self"), heavy = list.IndexOf("Heavy Weapon Mastery"), armor = list.IndexOf("Armor Self");
Check.True(strength == 4, $"everything else follows, Strength next (at {strength})");
Check.Eq(list.IndexOf("Mana Conversion Mastery"), 4, "Mana Conversion Mastery right after the head (R-20261119-195743-1993)");
Check.True(strength == 5, $"everything else follows, Strength next (at {strength})");
Check.True(strength < heavy && heavy < armor, "and keeps its old order (attributes, masteries, prots)");
Check.True(list.IndexOf("Blood Drinker Self") > armor, "weapon auras stay after the prots");

View file

@ -54,6 +54,7 @@ internal static class CombatHookTests
r.Add("combat hook: a script heal (a drain) at a fight target whose rule turned to Priority 0 is rejected", HookHealRejectsIgnoredTarget);
r.Add("blacklist: casts answered 'too busy' (UseDone 0x1D) are not no-damage casts (answered 0: the target is dropped)", RefusedCastsNotJudged);
r.Add("ghost (R-20261115-172110-9e6a): two casts answered 'target not acquired' (UseDone 0x42C) mark the target a ghost and stop the casting", NotAcquiredMarksGhost);
r.Add("out of range (R-20261119-155301-121a): a cast answered 'Out of Range!' (UseDone 0x550) drops the target until it comes 3 m nearer", OutOfRangeDropsTarget);
r.Add("blacklist (2026-11-15): melee landing nothing across a building's wall (one inside, one out) keeps the target off 5 min; elsewhere the usual timeout", AcrossWallBlacklistLonger);
r.Add("loot jump: Think sends no cast while in the air after a loot jump; it casts on the landing, or at the cap", LootJumpHoldsAttack);
r.Add("loot jump: a swing refused in the air (WeenieError 0x4EB) is not a no-damage attack (without it: a miss)", MeleeInAirNotJudged);
@ -1087,6 +1088,46 @@ internal static class CombatHookTests
// 2026-11-15, R-20261115-172110-9e6a: every Blade Arc at a target the server didn't have came back
// UseDone 0x42C about 70 ms after the send, and combat cast again at once (13 casts in 0.85 s, the
// hourglass going round), never dropping it.
// 2026.11.15.3: an Olthoi Hive Warrior 88 m off, every Incantation of Force Arc at it answered UseDone
// 0x550 about 60 ms after the send, and combat cast again at once (1,027 casts since the last kill).
private static void OutOfRangeDropsTarget() => Guard(() =>
{
var rig = new AttackRig(setup: () => { FakeHost.ServerGates = true; FakeHost.LastUseDoneCalls = true; });
rig.S.EnableRaycasting = false;
rig.Attack();
Check.Eq(FakeHost.Casts.Count, 1, "the first cast goes out");
FakeHost.UseDone(CombatManager.MissileOutOfRangeErr);
rig.Attack();
Check.Eq(FakeHost.Casts.Count, 1, "the server said 'Out of Range!': no second cast at it");
Check.Eq(rig.C.activeTargetId, 0, "the target is dropped");
Check.True(FakeHost.Logs.Any(l => l.Contains("out of range at 10 m") && l.Contains("UseDone 0x550")),
"logged with the distance and the answer: " + FakeHost.Logs.LastOrDefault(l => l.Contains("out of range")));
Check.Eq(FakeHost.Chat.Count(l => l.Contains("is out of range at 10 yd")), 1, "said once in chat");
SetField(rig.C, "_lastScanTime", DateTime.MinValue); // the scan's own throttle
rig.C.ScanNearbyTargets();
Check.False(rig.C.ScannedTargets.Any(t => t.Id == Target), "the scan leaves it out");
Check.True(rig.C.ScannedTargets.Any(t => t.Id == Other), "the other monster is still a target");
FakeHost.Positions[(uint)Target] = (0x0101001Bu, 0f, 8f, 0f); // 2 m nearer: not enough
SetField(rig.C, "_lastScanTime", DateTime.MinValue);
rig.C.ScanNearbyTargets();
Check.False(rig.C.ScannedTargets.Any(t => t.Id == Target), "2 m nearer: still left out");
FakeHost.Positions[(uint)Target] = (0x0101001Bu, 0f, 6f, 0f); // 4 m nearer
SetField(rig.C, "_lastScanTime", DateTime.MinValue);
rig.C.ScanNearbyTargets();
Check.True(rig.C.ScannedTargets.Any(t => t.Id == Target), "4 m nearer: a target again");
// Control: any other answer leaves the target alone.
var ok = new AttackRig(setup: () => { FakeHost.ServerGates = true; FakeHost.LastUseDoneCalls = true; });
ok.S.EnableRaycasting = false;
ok.Attack();
FakeHost.UseDone(0);
ok.Attack();
Check.Eq(ok.C.activeTargetId, Target, "answered 0: still the target");
});
private static void NotAcquiredMarksGhost() => Guard(() =>
{
var rig = new AttackRig(setup: () => { FakeHost.ServerGates = true; FakeHost.LastUseDoneCalls = true; });

View file

@ -0,0 +1,183 @@
using System;
using System.Linq;
using System.Reflection;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthAi.LegacyUi;
using RynthCore.Plugin.Shared;
using RynthCore.PluginSdk;
using RynthCore.RynthAiHostTests.Fakes;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
// The player casting by hand while the macro runs (2026-11-18, R-20261118-214609-a9a8 and
// R-20261118-205826-9c70, DreamWeave, 2026.11.15.3): "spells are not connecting anymore". A 'too busy'
// UseDone about every 0.4 s with nothing sent by RynthAi; the sender was the player's own spell bar
// (AC prints "Casting <spell>" for each click, type 26; RynthAi's casts never do). RynthAi took each
// refusal as its own: an 8 s backoff, and at the 4th a StopCompletely into the cast that was running.
// Replayed here: the player's clicks, each refused, never stop the character, never back RynthAi off,
// never count as stuck-cast evidence; RynthAi starts nothing while the player casts (an emergency heal
// still may); and with no hand cast the old streak rules still hold.
internal static class HandCastTests
{
private const uint Player = 0x50000B01;
private const uint STypeLife = 33;
private const uint TooBusy = 0x1D;
private const string Spell = "Incantation of Force Streak";
private const BindingFlags Any = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static;
public static void Register(Runner r)
{
r.Add("hand cast: AC's own 'Casting <spell>' (type 26) is the player's cast; RynthAi's and other lines are not", ParsesOnlyAcLine);
r.Add("hand cast (R-20261118-214609-a9a8): the player's refused clicks send no StopCompletely, no backoff, no streak", RefusalsAreNotOurs);
r.Add("hand cast: while the player casts RynthAi starts nothing (an emergency heal may), no move starts; it ends 3 s after the last click, logged", PacerYields);
r.Add("hand cast: with no hand cast, RynthAi's own refusal streak still stops the character once", OwnStreakStillStops);
}
private static long _t;
private static void PaceOn()
{
_t = 20_000_000;
ActionPacer.Reset();
ActionPacer.Enabled = true;
ActionPacer.NowMs = () => _t;
MoveAudit.Reset();
MoveAudit.NowMs = () => _t;
}
private static void PaceOff()
{
ActionPacer.Enabled = false;
ActionPacer.Reset();
ActionPacer.NowMs = () => Environment.TickCount64;
MoveAudit.Reset();
MoveAudit.NowMs = () => Environment.TickCount64;
}
private static void Paced(Action body)
{
PaceOn();
try { body(); }
finally { PaceOff(); }
}
private static (RynthCoreHost host, BuffManager b) Caster()
{
FakeHost.Reset();
FakeHost.WeaponCalls = true;
FakeHost.StopCalls = true;
FakeHost.ServerGates = true;
FakeHost.CombatModeCalls = true;
FakeHost.LastUseDoneCalls = true;
FakeHost.CombatModeValue = CombatMode.Magic;
foreach (var row in SpellTable.Rows) FakeHost.Spellbook.Add((uint)row.Id);
FakeHost.Skills[(Player, STypeLife)] = (400, 2);
var host = FakeHost.Create(Player);
var s = new LegacyUiSettings { IsMacroRunning = true, HealAt = 0, TopOffHP = 0, EmergencyHealAt = 0, StaminaToHealthAt = 0,
GetManaAt = 50, TopOffMana = 50, RestamAt = 0, TopOffStam = 0, UsePotions = false };
var skills = new CharacterSkills(host);
skills.SetPlayerId(Player);
var sm = new SpellManager(host, s);
sm.InitializeNatively();
sm.SetCharacterSkills(skills);
var vitals = new PlayerVitalsCache { MaxHealth = 100, CurrentHealth = 100, MaxStamina = 100, CurrentStamina = 100, MaxMana = 100, CurrentMana = 100 };
var b = new BuffManager(host, s, sm, vitals);
b.SetCharacterSkills(skills);
return (host, b);
}
private static int Streak(BuffManager b) => (int)typeof(BuffManager).GetField("_busyRefusalStreak", Any)!.GetValue(b)!;
private static DateTime BackoffUntil(BuffManager b) => (DateTime)typeof(BuffManager).GetField("_busyBackoffUntil", Any)!.GetValue(b)!;
/// <summary>One click of the player's, as the client sees it: AC's line, the server's 0x1D, AC's refusal line.</summary>
private static void RefusedClick(RynthCoreHost host, BuffManager b)
{
Check.True(RynthAiPlugin.TryParseHandCast("Casting " + Spell, RynthAiPlugin.AcStatusChatType, out string spell), "AC's line parses");
ActionPacer.NoteHandCast(host, spell);
FakeHost.UseDone(TooBusy);
ActionPacer.MayStart(host, "Buff", HealNeed.None, out _); // RynthAi's tick reads the answer
b.OnChatWindowText("You're too busy!", RynthAiPlugin.AcStatusChatType);
}
private static void ParsesOnlyAcLine()
{
Check.True(RynthAiPlugin.TryParseHandCast("Casting Incantation of Force Arc", 26, out string s1), "the report's line");
Check.Eq(s1, "Incantation of Force Arc", "its spell");
Check.True(RynthAiPlugin.TryParseHandCast("Casting Blade Arc VII", 26, out string s2) && s2 == "Blade Arc VII", "a level VII spell");
Check.False(RynthAiPlugin.TryParseHandCast("[RynthAi] Casting: Incantation of Focus Self", 5, out _), "RynthAi's own line");
Check.False(RynthAiPlugin.TryParseHandCast("Casting Incantation of Force Arc", 5, out _), "not AC's status type");
Check.False(RynthAiPlugin.TryParseHandCast("Casting Incantation of Focus Self...", 26, out _), "another plugin's notice");
Check.False(RynthAiPlugin.TryParseHandCast("Bob tells you, \"Casting Blade Arc VII\"", 26, out _), "speech");
Check.False(RynthAiPlugin.TryParseHandCast("Using the Corpse of Olthoi Warrior", 26, out _), "a use line");
Check.False(RynthAiPlugin.TryParseHandCast("Casting ", 26, out _), "nothing after it");
}
// 16:45:16.9-16:45:30.7: 24 refusals of the player's clicks; at the 4th RynthAi sent StopCompletely
// ("the cast gesture looks stuck") into a running cast, and backed its buffs off 8 s.
private static void RefusalsAreNotOurs() => Paced(() =>
{
var (host, b) = Caster();
Check.True(ActionPacer.MayStart(host, "Buff", HealNeed.None, out _), "RynthAi's tick before the clicks (the answers' baseline)");
for (int i = 0; i < 8; i++)
{
RefusedClick(host, b);
_t += 400;
}
Check.Eq(FakeHost.Stops, 0, "eight refused clicks of the player's: no StopCompletely into the running cast");
Check.Eq(Streak(b), 0, "no 'too busy' streak of RynthAi's");
Check.True(BackoffUntil(b) == DateTime.MinValue, "no backoff for RynthAi's own casts");
Check.Eq(ActionPacer.HandCastRefusals, 8L, "the eight refusals counted as the player's");
Check.Eq(FakeHost.Logs.Count(l => l.Contains("answers the player's own cast by hand")), 1, "said once for the run");
Check.False(FakeHost.Logs.Any(l => l.Contains("too-busy streak=")), "no streak lines");
});
private static void PacerYields() => Paced(() =>
{
var (host, _) = Caster();
Check.True(ActionPacer.MayStart(host, "Buff", HealNeed.None, out _), "free before the player casts");
ActionPacer.NoteHandCast(host, Spell);
Check.True(FakeHost.Logs.Any(l => l.Contains("the player is casting by hand: AC's own 'Casting " + Spell + "'")), "the run's start logged");
Check.False(ActionPacer.MayStart(host, "Buff", HealNeed.None, out string why), "a buff waits");
Check.True(why.Contains("casting by hand"), "and says why: " + why);
Check.False(ActionPacer.MayStart(host, "Combat", HealNeed.None, out _), "combat waits");
Check.False(ActionPacer.MayStart(host, "Buff", HealNeed.Heal, out _), "a plain heal waits");
Check.True(ActionPacer.MayStart(host, "Buff", HealNeed.Emergency, out _), "an emergency heal still goes");
Check.True(ActionPacer.GestureHolds(host, "Items", HealNeed.None, out _), "the item managers' moves wait");
FakeHost.CombatModeRequests.Clear();
Check.False(host.ChangeCombatModeFor(CombatMode.NonCombat, "Combat", "idle peace"), "no stance change into the player's cast");
Check.Eq(FakeHost.CombatModeRequests.Count, 0, "and none sent");
Check.True(MoveAudit.HeldForAction(host, "Nav", "SetAutoRun(True)", isStop: false), "a nav start is held");
Check.Eq(FakeHost.Logs.Count(l => l.Contains("[Pace] Buff waits: the player is casting by hand")), 1, "the buff's wait logged once");
// A click every 0.4 s keeps the run going; the 0x1D answers are the player's, not breaker evidence.
for (int i = 0; i < 5; i++)
{
_t += 400;
ActionPacer.NoteHandCast(host, Spell);
FakeHost.UseDone(TooBusy);
ActionPacer.MayStart(host, "Buff", HealNeed.None, out _);
}
Check.Eq(ActionPacer.HandCastRuns, 1L, "one run");
Check.Eq(ActionPacer.HandCasts, 6L, "six casts in it");
Check.Eq(ActionPacer.HandCastRefusals, 5L, "its five refusals counted as the player's");
// 3 s after the last click the player is done; the server's next 'done' clears the latch.
_t += ActionPacer.HandCastHoldMs - 1;
Check.True(ActionPacer.HandCasting(host), "just under 3 s after the last click: still the player's");
_t += 2;
FakeHost.UseDone(0);
Check.True(ActionPacer.MayStart(host, "Buff", HealNeed.None, out string after), "3 s after the last click RynthAi goes on: " + after);
Check.Eq(FakeHost.Logs.Count(l => l.Contains("the player's casting by hand is over (6 cast(s)")), 1, "the run's end logged once");
Check.False(MoveAudit.HeldForAction(host, "Nav", "SetAutoRun(True)", isStop: false), "nav may start again");
});
// TooBusyVitals' rule kept: a refusal streak with no hand cast is RynthAi's, and stops once.
private static void OwnStreakStillStops() => Paced(() =>
{
var (_, b) = Caster();
for (int i = 0; i < 4; i++) { FakeHost.UseDone(TooBusy); b.OnChatWindowText("You're too busy!", RynthAiPlugin.AcStatusChatType); }
Check.Eq(FakeHost.Stops, 1, "4 refusals in a row, no hand cast: one StopCompletely");
Check.Eq(Streak(b), 4, "the streak counts");
});
}

View file

@ -38,6 +38,8 @@ internal static class KillNoticeTests
r.Add("kill notice: the fight is over when the last monster dies - looting gets the tick", FightOverLoots);
r.Add("targeting: a top-priority monster's tier holds while its death is only a guess", GuessedDeathHoldsTier);
r.Add("targeting (melee): after a kill and its echo the same-named top priority is next, not a lesser one", EchoKeepsTopPriorityNext);
r.Add("kill notice (melee, cleave): a same-named neighbour's death keeps the target the server says is alive", CleaveKillKeepsLiveTarget);
r.Add("kill notice (melee): the fight target's own death (the server's 0, or no fresh health) still drops it", MeleeOwnDeathStillDrops);
}
// ── The rig ──────────────────────────────────────────────────────────────
@ -306,4 +308,95 @@ internal static class KillNoticeTests
Check.Eq(rig.C.activeTargetId, Id(twin), "the Priority 5 twin is next (it was 4 s out of the scan before)");
Check.True(rig.Scanned(lesser), "the lesser one was a candidate too");
}
// ── Melee cleave: the neighbour's notice names the target ────────────────
// R-20261118-012228-179f (2026-11-18, DreamWeave, melee with a cleaving weapon in a pack of
// same-named Olthoi): "switching targets when it shouldn't be". A swing hits the target and,
// by cleave, a same-named neighbour; in Melee mode both damage lines are the target's, so when
// the neighbour died its notice was matched to the target, which was dropped while alive (the
// server's health for it had just said 0.6), kept off the scan for 4 s, and the bot turned to
// the next one - twice in 4 s in the report. ACE pushes the fight target's health with every
// hit (combat's QueryHealth made it the server's selection), the lethal one too, before the
// notice: a fresh health above 0 says the target didn't die.
/// <summary>The plugin's OnUpdateHealth for a creature: the cache and combat's fight-health clock.</summary>
private static void ServerHealth(Rig rig, uint id, float ratio)
{
rig.Cache.OnUpdateHealth(id, ratio);
rig.C.NoteServerHealth(Id(id), ratio);
}
/// <summary>A melee strike on the target with its health from the server (as ACE sends it with the
/// hit) and a cleave hit on a same-named neighbour (a line naming the same name).</summary>
private static void StrikeWithCleave(Rig rig, uint target, float healthAfter)
{
ServerHealth(rig, target, healthAfter);
rig.C.OnCombatDamage(40, 1, false, true);
rig.C.HandleChatForDamage("You slash Drumtaken Sentry for 40 points of slashing damage!");
rig.C.HandleChatForDamage("You slash Drumtaken Sentry for 31 points of slashing damage!"); // the cleave
}
private static Rig MeleePair(out uint target, out uint twin)
{
var rig = new Rig(CombatMode.Melee);
FakeHost.TargetCalls = true; // QueryHealth counted
target = rig.Mob(Sentry, SentryWcid, 2);
twin = rig.Mob(Sentry, SentryWcid, 3);
rig.Build(target);
rig.Store.SetManualHp(SentryWcid, 200);
return rig;
}
private static void CleaveKillKeepsLiveTarget()
{
var rig = MeleePair(out uint target, out uint twin);
StrikeWithCleave(rig, target, 0.80f);
rig.Now = rig.Now.AddMilliseconds(1000);
StrikeWithCleave(rig, target, 0.61f);
int queriesBefore = FakeHost.HealthQueries.Count(q => q == target);
// The next strike's cleave kills the neighbour: no damage line for it, its notice only.
rig.Now = rig.Now.AddMilliseconds(900);
ServerHealth(rig, target, 0.55f);
rig.C.HandleChatForDamage("You slash Drumtaken Sentry for 38 points of slashing damage!");
rig.C.OnKillNotification("You killed Drumtaken Sentry!");
Check.Eq(rig.C.activeTargetId, Id(target), "the target the server says is alive is kept");
Check.False(rig.Suppressed(target), "and not kept off the scan");
Check.True(FakeHost.Logs.Any(l => l.Contains("the server says it is alive") && l.Contains("keeping the target")),
"the log says why");
Check.Eq(FakeHost.HealthQueries.Count(q => q == target), queriesBefore + 1,
"its health is asked again (a target dead some other way answers 0)");
rig.Rescan();
rig.C.HandleCombatTrigger();
Check.Eq(rig.C.activeTargetId, Id(target), "no switch to another monster");
Check.False(FakeHost.Logs.Any(l => l.Contains("[CombatTarget] lock") || l.Contains("[CombatTarget] switch")),
"no new lock");
}
private static void MeleeOwnDeathStillDrops()
{
// The lethal hit: the server's 0 comes before the notice.
var rig = MeleePair(out uint target, out uint twin);
StrikeWithCleave(rig, target, 0.30f);
rig.Now = rig.Now.AddMilliseconds(1000);
ServerHealth(rig, target, 0f);
rig.C.OnKillNotification("You killed Drumtaken Sentry!");
Check.Eq(rig.C.activeTargetId, 0, "health 0: the target died, dropped");
Check.True(rig.Suppressed(target), "and kept off the scan while its corpse forms");
Check.True(FakeHost.Logs.Any(l => l.Contains("killed (KillerNotification; server health 0.00")),
"the drop names the server health it went on");
// The health stream stopped (the player selected something else): the last health is older
// than the hits since, so it says nothing about the kill and the notice is the target's.
rig = MeleePair(out target, out twin);
StrikeWithCleave(rig, target, 0.30f);
rig.Now = rig.Now.AddMilliseconds(1500);
rig.C.HandleChatForDamage("You slash Drumtaken Sentry for 40 points of slashing damage!");
rig.Now = rig.Now.AddMilliseconds(1200);
rig.C.OnKillNotification("You killed Drumtaken Sentry!");
Check.Eq(rig.C.activeTargetId, 0, "stale health: the notice is the target's, dropped");
Check.False(rig.Suppressed(twin), "the neighbour isn't taken for it");
}
}

View file

@ -20,6 +20,12 @@ namespace RynthCore.RynthAiHostTests.Tests;
// client (the salvage panel open wins), and the corpse loop then waits for an open that never
// comes. Corpse opens (and every automatic door/corpse use, via UseAudit.WorldUseHold) wait
// while the salvage panel is pending; the corpse claim's timeout is not charged meanwhile.
// I. R-20261117-230613-88c5 (2026-11-18), "after looting a corpse it says you can only move or use
// one item at a time": AutoCram ran on the first tick after a corpse was released, and the
// looter used the next corpse 1-3 ms after the cram's move. The client still held the move in
// its one pending item request, refused the use and sent nothing, and the looter waited 5 s for
// an answer (four times in 100 s). The open now waits for the move's answer (the item out of the
// main pack, or the server refusing it), 3 s at most; so do the other item actions (PacedBusy).
internal static class LootPacingTests
{
private const uint Player = 0x50000E01;
@ -27,6 +33,10 @@ internal static class LootPacingTests
private const uint CorpseB = 0x80073023;
private const uint Ust = 0x80000E11;
private const uint Junk = 0x80000E12;
private const uint Gem = 0x80000E13;
private const uint SidePack = 0x80000E14;
private const uint ItemTypeGem = 0x800;
private const uint ItemsCapacityKey = 6;
private const uint UstWcid = 20646;
private const uint ItemTypeContainer = 0x200, ItemTypeArmor = 0x2;
private const uint LongDescKey = 16;
@ -37,6 +47,8 @@ internal static class LootPacingTests
public static void Register(Runner r)
{
r.Add("salvage/loot: no corpse open (or auto door/corpse use) while the salvage panel is pending; the claim is kept and opened after the execute", CorpseOpenWaitsForSalvagePanel);
r.Add("loot pacing (R-20261117-230613-88c5): no corpse open (or auto door/corpse use, salvage, stone) while AutoCram's move is unanswered; the open goes on the answer", CorpseOpenWaitsForCramMove);
r.Add("loot pacing (R-20261117-230613-88c5): a cram the server refuses frees the open at once; a lost answer holds it 3 s at most", CramMoveHoldBounds);
}
private static void World()
@ -174,4 +186,132 @@ internal static class LootPacingTests
UseAudit.Reset("?", null);
}
}
// A gem loose in the main pack and an empty side pack: AutoCram has one move to make.
private static void CramWorld()
{
World();
FakeHost.WeenieErrorCalls = true;
FakeHost.Names[Gem] = "Black Opal";
FakeHost.ItemTypes[Gem] = ItemTypeGem;
FakeHost.Containers[Gem] = Player;
FakeHost.Names[SidePack] = "Backpack";
FakeHost.ItemTypes[SidePack] = ItemTypeContainer;
FakeHost.Ints[(SidePack, ItemsCapacityKey)] = 24;
FakeHost.Containers[SidePack] = Player;
}
private static InventoryManager CramBot(RynthCoreHost host, Bot bot)
{
_ = bot.Cache[unchecked((int)Gem)];
_ = bot.Cache[unchecked((int)SidePack)];
bot.S.EnableAutocram = true;
var inv = new InventoryManager(host, bot.S, bot.Cache);
bot.Set("_inventoryManager", inv);
// As RynthAiPlugin's init wires it.
UseAudit.WorldUseHold = (Func<string?>)Delegate.CreateDelegate(typeof(Func<string?>), bot.P,
typeof(RynthAiPlugin).GetMethod("WorldUseHoldReason", Any)!);
return inv;
}
private static int PacedBusy(Bot bot) => (int)typeof(RynthAiPlugin).GetProperty("PacedBusy", Any)!.GetValue(bot.P)!;
private static void CorpseOpenWaitsForCramMove()
{
CramWorld();
var host = FakeHost.Create(Player);
var bot = new Bot(host);
long now = 60_000_000;
var start = new DateTime(2026, 11, 17, 23, 0, 0);
var savedClock = RynthAiPlugin.CorpseClock;
RynthAiPlugin.CorpseClock = () => now;
RynthClock.TestNow = () => start.AddMilliseconds(now - 60_000_000);
try
{
UseAudit.Reset("RynthAi", () => true);
var inv = CramBot(host, bot);
// The tick after a corpse is released: no corpse claimed or open, so the cram goes out.
bot.Call("TickCramStack", bot.S);
Check.True(FakeHost.Moves.Any(m => m.Id == Gem && m.Pack == SidePack), "AutoCram moves the gem into the side pack");
Check.True(inv.MoveUnanswered(out string what), "the move has no answer yet");
Check.True(what.Contains("Black Opal"), "the hold names the item: " + what);
Check.True(PacedBusy(bot) > 0, "salvage, mana stones, pets and the next cram see it as busy");
// The same tick and the next ones: the looter claims the next corpse, but its open waits.
for (int i = 0; i < 5; i++) { bot.Tick(); now += 30; }
Check.Eq(CorpseUses(), 0, "no corpse use while the cram's move is unanswered (the client would refuse it)");
Check.Eq(bot.Get<int>("_targetCorpseId"), unchecked((int)CorpseA), "the corpse is claimed and kept");
Check.Eq(FakeHost.Logs.Count(l => l.Contains("waits: the move of 'Black Opal'")), 1, "the wait is logged once");
Check.False(host.UseFor(CorpseB, "Nav", "test: an automatic world use"), "an automatic door/corpse use is held too");
Check.Eq(CorpseUses(), 0, "and not sent");
// The server answers: the gem is in the side pack. The open goes out on the next tick.
FakeHost.Containers[Gem] = SidePack;
bot.Tick();
Check.Eq(CorpseUses(), 1, "the corpse is opened once the move is answered");
Check.True(FakeHost.Uses.Contains(CorpseA), "the claimed corpse");
Check.False(inv.MoveUnanswered(out _), "nothing in flight");
Check.Eq(PacedBusy(bot), 0, "and nothing busy");
}
finally
{
RynthAiPlugin.CorpseClock = savedClock;
RynthClock.TestNow = null;
UseAudit.Reset("?", null);
}
}
private static void CramMoveHoldBounds()
{
CramWorld();
var host = FakeHost.Create(Player);
var bot = new Bot(host);
long now = 60_000_000;
var start = new DateTime(2026, 11, 17, 23, 0, 0);
var savedClock = RynthAiPlugin.CorpseClock;
RynthAiPlugin.CorpseClock = () => now;
RynthClock.TestNow = () => start.AddMilliseconds(now - 60_000_000);
try
{
UseAudit.Reset("RynthAi", () => true);
var inv = CramBot(host, bot);
// Refused: InventoryServerSaveFailed naming the gem (the report's last cram, 18:05:38.869).
bot.Call("TickCramStack", bot.S);
Check.True(inv.MoveUnanswered(out _), "the move is out");
FakeHost.WeenieError(0, evt: 0x00A0, obj: SidePack);
Check.True(inv.MoveUnanswered(out _), "a refusal naming another object is not this move's answer");
FakeHost.WeenieError(0, evt: 0x00A0, obj: Gem);
Check.False(inv.MoveUnanswered(out _), "the server refused the move: that is its answer");
bot.Tick();
Check.Eq(CorpseUses(), 1, "the open goes out at once");
// Lost: no answer at all (a fresh manager, the gem still in the main pack). The hold
// ends after MoveAnswerMaxMs. (The looter lets go of the corpse it opened, so the cram runs.)
bot.Set("_targetCorpseId", 0);
bot.Set("_openedContainerId", 0);
var inv2 = CramBot(host, bot);
bot.Call("TickCramStack", bot.S);
Check.True(inv2.MoveUnanswered(out _), "a second move is out");
Check.False(host.UseFor(CorpseB, "Nav", "test: an automatic world use"), "an automatic world use is held");
long sent = now;
bool freed = false;
while (now - sent < 5000)
{
if (host.UseFor(CorpseB, "Nav", "test: an automatic world use")) { freed = true; break; }
now += 100;
}
long held = now - sent;
Check.True(freed, "the use goes out in the end");
Check.True(held >= (long)InventoryManager.MoveAnswerMaxMs, $"held until the answer limit ({held} ms)");
Check.True(held <= (long)InventoryManager.MoveAnswerMaxMs + 100, $"and no longer ({held} ms)");
}
finally
{
RynthAiPlugin.CorpseClock = savedClock;
RynthClock.TestNow = null;
UseAudit.Reset("?", null);
}
}
}

View file

@ -42,6 +42,39 @@ internal static class ManaStoneChoiceTests
r.Add("mana stones: in a fight, worn gear that runs low is still refilled (armor without mana drops its spells)", RefillInFight);
r.Add("eternal charge: tapping is ignored while it is in the pack, and applies again when it leaves", EternalIgnoresTapping);
r.Add("eternal charge: a use with no answer is tried again in 20 s, not 5 minutes", EternalRetriesSoon);
r.Add("mana tap with macro off (on by default): the macro stopped, stones still refill gear and drain tap loot", TapWithMacroOff);
r.Add("mana tap with macro off, unticked: nothing while the macro is stopped; it starts with the macro", NoTapWithMacroOffUnticked);
}
// 2026-11-19: mana tapping ran only while the macro ran. "Mana tap with macro off" (on by default) lets it
// work while you play by hand too; mana tapping itself is on by default for a new character.
private static void TapWithMacroOff()
{
var fresh = new LegacyUiSettings();
Check.True(fresh.ManaTapMacroOff, "Mana tap with macro off is on by default");
Check.True(fresh.EnableManaTapping, "and so is mana tapping");
using var refill = new Rig(tapping: true, new (uint, int?)[] { (StoneA, 3000) }); // the mace reads 0 of 5000
refill.S.IsMacroRunning = false;
refill.Run(1000);
Check.Eq(refill.OnPlayer.Count, 1, "macro off: the charged stone refills the worn mace");
using var drain = new Rig(tapping: true, new (uint, int?)[] { (StoneA, null) }, ringToDrain: true, maceMana: 5000);
drain.S.IsMacroRunning = false;
drain.Run(1000);
Check.Eq(drain.OnRing.Count, 1, "macro off: the ring looted for tapping is drained into the empty stone");
}
private static void NoTapWithMacroOffUnticked()
{
using var rig = new Rig(tapping: true, new (uint, int?)[] { (StoneA, 3000) });
rig.S.ManaTapMacroOff = false;
rig.S.IsMacroRunning = false;
rig.Run(3000);
Check.Eq(rig.OnPlayer.Count, 0, "unticked, macro off: no stone used");
rig.S.IsMacroRunning = true;
rig.Run(1000);
Check.Eq(rig.OnPlayer.Count, 1, "the macro starts: the stone goes on the player");
}
private const uint ChargeA = 0x80400031, ChargeB = 0x80400032, ChargeC = 0x80400033;

View file

@ -675,7 +675,8 @@ internal static class MetaTests
}
FakeHost.NotAttackable.Add(crier);
var host = FakeHost.Create();
// The lurker never got a health update (untracked); the dead one reads 0.
// The lurker never got a health update (untracked: ACE sends health only once a monster is selected,
// appraised or hit, so most monsters nearby have none); the dead one reads 0.
var cache = FakeHost.MakeCache(host, Player, new[] { drudge, farDrudge, crier, dead, lurker },
new Dictionary<uint, float> { [drudge] = 1f, [farDrudge] = 0.5f, [crier] = 1f, [dead] = 0f });
var rig = new Rig(host, Player);
@ -684,23 +685,30 @@ internal static class MetaTests
rig.S.MonsterRules.Add(new MonsterRule { Name = "^Drudge" });
Check.True(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,1"), "one drudge within 20");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,2"), "dead and untracked ones do not count");
Check.True(rig.Holds(C.MonsterNameCountWithinDistance, "drudge,100,2"), "two within 100 (ignores case, inclusive)");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,99.9,2"), "the far one is at 100");
Check.True(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,2"), "the untracked lurker counts (R-20261119-123029-4bd1)");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,3"), "the dead one does not");
Check.True(rig.Holds(C.MonsterNameCountWithinDistance, "drudge,100,3"), "three within 100 (ignores case, inclusive)");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,99.9,3"), "the far one is at 100");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Crier,20,1"), "not attackable");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,x,1"), "bad distance");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20"), "missing count");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "(,20,1"), "bad regex");
Check.True(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,0"), "at least 0 always holds");
Check.True(rig.Holds(C.NoMonstersWithinDistance, "9"), "none within 9 (crier, dead, untracked skipped)");
Check.True(rig.Holds(C.NoMonstersWithinDistance, "4"), "none within 4 (the crier at 1 is not attackable)");
Check.False(rig.Holds(C.NoMonstersWithinDistance, "5"), "the untracked lurker at 5 is a monster (the dead one there is not)");
Check.False(rig.Holds(C.NoMonstersWithinDistance, "10"), "the drudge at 10");
// A ghost (combat's GhostTracker: the server no longer has it) is left out, like the combat scan leaves it.
rig.M.SetGhostCheck(id => id == unchecked((int)lurker));
Check.True(rig.Holds(C.NoMonstersWithinDistance, "9"), "the lurker is a ghost: none within 9");
Check.False(rig.Holds(C.MonsterNameCountWithinDistance, "Drudge,20,2"), "a ghost is not counted by name either");
rig.M.SetGhostCheck(null);
Check.False(rig.Holds(C.NoMonstersWithinDistance, ""), "empty means 20");
Check.False(rig.Holds(C.NoMonstersWithinDistance, "0"), "0 means 20");
Check.False(rig.Holds(C.NoMonstersWithinDistance, "junk"), "junk means 20");
// Priority counts use the Monsters list (Default excluded) and, unlike the two above,
// do count a monster that never had a health update.
// Priority counts use the Monsters list (Default excluded) and, like the two above,
// count a monster that never had a health update.
Check.True(rig.Holds(C.MonsterPriorityCountWithinDistance, "2,20"), "drudge + untracked lurker");
Check.False(rig.Holds(C.MonsterPriorityCountWithinDistance, "3,20"), "not three within 20");
Check.True(rig.Holds(C.MonsterPriorityCountWithinDistance, "3,100"), "three within 100");

View file

@ -0,0 +1,165 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using RynthCore.Plugin.RynthAi;
using RynthCore.Plugin.RynthAi.LegacyUi;
using RynthCore.Plugin.Shared;
using RynthCore.RynthAiHostTests.Fakes;
using RynthCore.RynthAiTests.Harness;
namespace RynthCore.RynthAiHostTests.Tests;
// 2026-11-18: the Monsters rules belong to the settings profile. Before, the MonsterProfiles
// file (one per character) overrode every profile at login, so after editing the Monsters list
// under one profile, a reload or relog on another profile brought those rules back: a Void
// profile's Default row (off hand Auto) replaced the main profile's (two hand wraps), and the
// character fought with one weapon while the Monsters tab showed the wrong list. Now the file is
// the active profile's copy, tagged "<file>.profile" with that profile's name.
internal static class MonsterProfileTests
{
private const BindingFlags Any = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
private const int HandWraps = unchecked((int)0x801A1F0D);
private const int OffhandAuto = 1;
public static void Register(Runner r)
{
r.Add("monsters per profile: switching profiles switches the Monsters list", SwitchSwitchesList);
r.Add("monsters per profile: a relog keeps the profile's own list, not another profile's file", RelogKeepsOwnList);
r.Add("monsters per profile: an untagged Monsters file (from before) still loads, then is tagged", UntaggedFileLoads);
r.Add("monsters per profile: a Monster Editor save still reloads into the profile in use", EditorSaveReloads);
}
private sealed class Scratch : IDisposable
{
private readonly string? _buffs = BuffProfileStore.FolderOverride;
public readonly string Root, CharDir, MonstersFile;
public Scratch(string name)
{
Root = Path.Combine(Program.TempRoot, "monster-profiles", name);
if (Directory.Exists(Root)) Directory.Delete(Root, recursive: true);
Directory.CreateDirectory(Root);
LegacyDashboardRenderer.ProfilesBase = Path.Combine(Root, "SettingsProfiles");
LegacyDashboardRenderer.MonstersBase = Path.Combine(Root, "MonsterProfiles");
BuffProfileStore.FolderOverride = Path.Combine(Root, "BuffProfiles");
CharDir = Path.Combine(LegacyDashboardRenderer.ProfilesBase, "TestWorld", "Tester");
MonstersFile = Path.Combine(LegacyDashboardRenderer.MonstersBase, "TestWorld", "Tester.json");
}
public string Tag => File.Exists(MonstersFile + ".profile") ? File.ReadAllText(MonstersFile + ".profile").Trim() : "";
public void Dispose() => BuffProfileStore.FolderOverride = _buffs;
}
/// <summary>A fresh dashboard logged in as Tester on TestWorld (a login or a reload).</summary>
private static LegacyDashboardRenderer Login(out LegacyUiSettings s)
{
FakeHost.Reset();
DataWriteGuard.Reset();
FakeHost.WorldName = "TestWorld";
var dash = new LegacyDashboardRenderer(FakeHost.Create());
FakeHost.WorldName = "TestWorld";
dash.LoadSettings("Tester");
s = (LegacyUiSettings)typeof(LegacyDashboardRenderer).GetField("_settings", Any)!.GetValue(dash)!;
return dash;
}
private static MonsterRule DefaultRow(LegacyUiSettings s) =>
s.MonsterRules.Single(r => r.Name.Equals("Default", StringComparison.OrdinalIgnoreCase));
private static void Select(LegacyDashboardRenderer dash, string profile) =>
dash.SelectProfileAtIndex(3, Array.IndexOf(dash.ReadDashboardFiles().Profiles, profile));
/// <summary>Default: Melee, the second hand wraps in the off hand, plus a Drudge rule. Void (Save As): off hand Auto, Void Magic, no Drudge.</summary>
private static LegacyDashboardRenderer TwoProfiles(out LegacyUiSettings s)
{
var dash = Login(out s);
DefaultRow(s).OffhandId = HandWraps;
DefaultRow(s).PreferredDamage = "Melee";
s.MonsterRules.Add(new MonsterRule { Name = "Drudge", Priority = 3 });
dash.SaveMonsterRules();
Check.True(dash.SaveProfileNow(ProfileKind.Settings).Ok, "Default saved");
Check.True(dash.SaveProfileAs(ProfileKind.Settings, "Void", replace: false).Ok, "Save As Void");
Check.Eq(s.SelectedProfile, "Void", "Void in use");
DefaultRow(s).OffhandId = OffhandAuto;
DefaultRow(s).PreferredDamage = "Void Magic";
s.MonsterRules.RemoveAll(r => r.Name == "Drudge");
dash.SaveMonsterRules(); // as the Monsters panel does after an edit
Check.True(dash.SaveProfileNow(ProfileKind.Settings).Ok, "Void saved");
return dash;
}
private static void SwitchSwitchesList()
{
using var t = new Scratch("switch");
var dash = TwoProfiles(out var s);
Check.Eq(t.Tag, "Void", "the Monsters file is Void's while Void is in use");
Select(dash, "Default");
Check.Eq(s.SelectedProfile, "Default", "Default in use");
Check.Eq(DefaultRow(s).OffhandId, HandWraps, "Default's off hand (the hand wraps), not Void's Auto");
Check.Eq(DefaultRow(s).PreferredDamage, "Melee", "Default's damage");
Check.True(s.MonsterRules.Any(r => r.Name == "Drudge"), "Default's own Drudge rule is back");
Check.Eq(t.Tag, "Default", "the Monsters file is tagged Default");
Check.True(File.ReadAllText(t.MonstersFile).Contains("Drudge"), "and holds Default's rules (for the Monster Editor)");
Select(dash, "Void");
Check.Eq(DefaultRow(s).OffhandId, OffhandAuto, "Void's own off hand again");
Check.False(s.MonsterRules.Any(r => r.Name == "Drudge"), "Void has no Drudge rule");
Check.Eq(t.Tag, "Void", "tagged Void");
}
private static void RelogKeepsOwnList()
{
using var t = new Scratch("relog");
var dash = TwoProfiles(out var s);
Select(dash, "Default");
// The report: the file still held Void's rules while Default was the profile in use.
File.WriteAllText(t.MonstersFile, "[{\"Name\":\"Default\",\"Priority\":1,\"PreferredDamage\":\"Void Magic\",\"OffhandId\":1}]");
File.WriteAllText(t.MonstersFile + ".profile", "Void");
Login(out s);
Check.Eq(s.SelectedProfile, "Default", "Default is the active profile");
Check.Eq(DefaultRow(s).OffhandId, HandWraps, "a reload keeps Default's off hand");
Check.True(s.MonsterRules.Any(r => r.Name == "Drudge"), "and Default's other rules");
Check.Eq(t.Tag, "Default", "the file is Default's again");
Check.True(File.ReadAllText(t.MonstersFile).Contains("Drudge"), "rewritten with Default's rules");
Check.True(FakeHost.Logs.Any(l => l.Contains("held profile 'Void''s rules")), "logged why");
}
private static void UntaggedFileLoads()
{
using var t = new Scratch("untagged");
var dash = Login(out var s);
Check.True(dash.SaveProfileNow(ProfileKind.Settings).Ok, "Default saved");
Directory.CreateDirectory(Path.GetDirectoryName(t.MonstersFile)!);
File.Delete(t.MonstersFile + ".profile");
// A file from before the tag (the one list every profile used): its rules are this profile's.
File.WriteAllText(t.MonstersFile, "[{\"Name\":\"Default\",\"Priority\":1},{\"Name\":\"Banderling\",\"Priority\":4}]");
Login(out s);
Check.True(s.MonsterRules.Any(r => r.Name == "Banderling"), "the untagged file's rules load, as before");
Check.Eq(t.Tag, "Default", "and the file is now tagged with the profile in use");
}
private static void EditorSaveReloads()
{
using var t = new Scratch("editor");
var dash = TwoProfiles(out var s);
Select(dash, "Default");
// The Monster Editor writes the rules file only; the tag stays Default's.
File.WriteAllText(t.MonstersFile, "[{\"Name\":\"Default\",\"Priority\":1,\"OffhandId\":" + HandWraps + "},{\"Name\":\"Mosswart\",\"Priority\":2}]");
typeof(LegacyDashboardRenderer).GetField("_monsterFileChanged", Any)!.SetValue(dash, true);
dash.TickMonsterReload();
Check.True(s.MonsterRules.Any(r => r.Name == "Mosswart"), "the editor's rules are in use");
Check.Eq(t.Tag, "Default", "still Default's file");
Select(dash, "Void");
Select(dash, "Default");
Check.True(s.MonsterRules.Any(r => r.Name == "Mosswart"), "the editor's change was saved into Default (it survives a switch)");
}
}

View file

@ -33,6 +33,7 @@ internal static class SpellCatalogTests
r.Add("buff profile: save, list and load round-trip", ProfileRoundTrip);
r.Add("buff profile: an id-only entry is filled in; a newer schema is refused", ProfileNormalizeAndSchema);
r.Add("buff profile: a chosen profile replaces the built-in list (order kept, no disabled or duplicate lines)", ProfileReplacesList);
r.Add("built-in buffs (R-20261119-195743-1993): Mana Conversion Mastery right after the four that raise casting skill, before the rest", ManaConversionEarly);
r.Add("buff profile: a profile spell casts the best level known", ProfileResolvesTier);
r.Add("buff profile: a name with no tier ladder falls back to its spell family", ProfileFamilyFallback);
r.Add("buff profile: Loaded Files lists profiles, picks one by index, and the snapshot reports it", LoadedFilesPicker);
@ -175,6 +176,16 @@ internal static class SpellCatalogTests
// ── Buffing with a profile ──────────────────────────────────────────────
private static void ManaConversionEarly()
{
var list = NewBuffs(500).BuildBuiltInBuffList();
Check.Eq(string.Join(",", list.Take(5)),
"Creature Enchantment Mastery,Focus Self,Willpower Self,Life Magic Mastery,Mana Conversion Mastery",
"the four that raise casting skill, then Mana Conversion Mastery (it cheapens the rest)");
Check.Eq(list.IndexOf("Strength Self"), 5, "then the other creature buffs");
Check.Eq(list.Count(b => b == "Mana Conversion Mastery"), 1, "once");
}
private static void ProfileReplacesList()
{
var buffs = NewBuffs(500);