Snapshot for release 2026.10.8.1 (internal f3d67ec)
This commit is contained in:
parent
e5950ddb04
commit
0daf0a44a3
49 changed files with 2802 additions and 121 deletions
|
|
@ -480,7 +480,6 @@ internal static class Program
|
|||
(new SafetyFacts { Appraised = true, Value = 100, CanBeSold = false }, "not sellable"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, IsRare = true }, "rare"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, Attuned = 1 }, "attuned"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, Bonded = 1 }, "bonded"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, Retained = true }, "retained"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, TimesTinkered = 1 }, "tinkered"),
|
||||
(new SafetyFacts { Appraised = true, Value = 100, Imbued = 1 }, "imbued"),
|
||||
|
|
@ -495,6 +494,8 @@ internal static class Program
|
|||
|
||||
var side = new SafetyFacts { Appraised = true, Class = AcObjectClass.Salvage, Value = 100, InMainPack = false };
|
||||
Eq(AutoVendorPlanner.UnsafeReason(side, false), null, "side pack ok by default");
|
||||
// Bonded only decides what a death keeps on ACE: peas, trade notes and salvage are bonded and sell (2026-10-07).
|
||||
Eq(AutoVendorPlanner.UnsafeReason(new SafetyFacts { Appraised = true, Value = 12500, Bonded = 1 }, false), null, "bonded (kept on death) still sells");
|
||||
Eq(AutoVendorPlanner.UnsafeReason(side, true), "not in main pack", "OnlyFromMainPack");
|
||||
}
|
||||
|
||||
|
|
|
|||
117
Tools/RynthCore.LootSdkTests/LootAddT11Tests.cs
Normal file
117
Tools/RynthCore.LootSdkTests/LootAddT11Tests.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RynthCore.Loot;
|
||||
using RynthCore.Loot.Editing;
|
||||
using RynthCore.Loot.T11;
|
||||
using RynthCore.Loot.VTank;
|
||||
|
||||
namespace RynthCore.LootSdkTests;
|
||||
|
||||
// "Add to loot profile" with "Include T11 attributes" (2026-10-07): the T11 conditions a
|
||||
// clicked item adds, on the server-format weapon and armor text LootT11Tests parses.
|
||||
internal static partial class Program
|
||||
{
|
||||
private static void RunLootAddT11Tests()
|
||||
{
|
||||
Console.WriteLine("\n-- LootAdd: include T11 attributes --");
|
||||
TestAddT11Weapon();
|
||||
TestAddT11Armor();
|
||||
TestAddT11EdgeCases();
|
||||
}
|
||||
|
||||
/// <summary>A condition as "type:line,line" for order-sensitive comparisons.</summary>
|
||||
private static string CondText(VTankLootCondition c) => c.NodeType + ":" + string.Join(",", c.DataLines);
|
||||
|
||||
private static string GE(int key, int v) => $"{VTankNodeTypes.LongValKeyGE}:{v},{key}";
|
||||
private static string EQ(int key, int v) => $"{VTankNodeTypes.LongValKeyE}:{v},{key}";
|
||||
|
||||
private static List<string> T11Conds(VTankLootRule r) =>
|
||||
r.Conditions.Where(c => c.DataLines.Count == 2 && int.TryParse(c.DataLines[1], out int k) && T11Keys.IsVirtual(k))
|
||||
.Select(CondText).ToList();
|
||||
|
||||
private static LootItemFacts T11Facts(string name, AcObjectClass cls, string? longDesc, string? use) => new()
|
||||
{
|
||||
Id = 0x7000_0001,
|
||||
Name = name,
|
||||
ObjectClass = (int)cls,
|
||||
T11 = T11ItemInfo.Parse(name, longDesc, use),
|
||||
};
|
||||
|
||||
private static void TestAddT11Weapon()
|
||||
{
|
||||
LootItemFacts f = T11Facts("T11 - Tachi", AcObjectClass.MeleeWeapon, T11WeaponLongDesc, null);
|
||||
|
||||
LootItemRuleDraft? off = LootItemRules.Build(f, new LootItemRuleOptions(), out _);
|
||||
Eq(off == null ? -1 : T11Conds(off.Rule).Count, 0, "add t11: unchecked adds no T11 conditions");
|
||||
|
||||
LootItemRuleDraft? d = LootItemRules.Build(f, new LootItemRuleOptions { IncludeT11 = true }, out string err);
|
||||
Check(d != null, "add t11: weapon builds (" + err + ")");
|
||||
if (d == null) return;
|
||||
Eq(CondText(d.Rule.Conditions[0]), $"{VTankNodeTypes.ObjectClass}:{(int)AcObjectClass.MeleeWeapon}", "add t11: name + class first");
|
||||
Eq(string.Join(" | ", T11Conds(d.Rule)), string.Join(" | ", new[]
|
||||
{
|
||||
EQ(T11Keys.IsT11, 1),
|
||||
GE(T11Keys.EstimatedTier, 13),
|
||||
GE(T11Keys.WeaponGrade, 12),
|
||||
GE(T11Keys.DamagePercent, 86),
|
||||
GE(T11Keys.ForModifier(28), 41), // Damage Rating
|
||||
GE(T11Keys.ForModifier(29), 10), // Crit Damage Rating
|
||||
GE(T11Keys.ForModifier(44), 2), // Pct HP Damage: a slot special with a value
|
||||
GE(T11Keys.CastOnStrikeCount, 1),
|
||||
}), "add t11: weapon conditions, at least this item's");
|
||||
Check(d.Rule.Conditions.All(c => CondText(c) != EQ(T11Keys.HasSlotSpecial, 1)), "add t11: valued special needs no Has Slot Special");
|
||||
Check(d.Rule.Conditions.All(c => CondText(c) != EQ(T11Keys.ZoneLocked, 1)), "add t11: zone lock left out");
|
||||
Eq(d.Notes.Count, 0, "add t11: weapon has no notes");
|
||||
Check(LootItemRules.PreviewLines(d.Rule).Any(l => l.Contains("T11 Mod: Damage Rating")), "add t11: preview names the modifier key");
|
||||
|
||||
var dropped = new List<string>();
|
||||
LootRule? native = LootItemRules.ToNative(d.Rule, dropped);
|
||||
Eq(dropped.Count, 0, "add t11: native format keeps every T11 condition");
|
||||
Eq(native?.Conditions.Count ?? -1, d.Rule.Conditions.Count, "add t11: native condition count");
|
||||
}
|
||||
|
||||
private static void TestAddT11Armor()
|
||||
{
|
||||
LootItemFacts f = T11Facts("T11 - Celdon Breastplate", AcObjectClass.Armor, T11ArmorLongDesc, T11ArmorUse);
|
||||
LootItemRuleDraft? d = LootItemRules.Build(f, new LootItemRuleOptions { IncludeT11 = true }, out _);
|
||||
Check(d != null, "add t11: armor builds");
|
||||
if (d == null) return;
|
||||
List<string> t = T11Conds(d.Rule);
|
||||
Check(t.Contains(GE(T11Keys.EstimatedTier, 16)), "add t11: armor tier from the Triune Weave gate");
|
||||
Check(!t.Any(c => c.EndsWith("," + T11Keys.WeaponGrade)), "add t11: no grade on armor");
|
||||
Check(t.Contains(GE(T11Keys.ForModifier(50), 8)), "add t11: Damage Resist");
|
||||
Check(t.Contains(GE(T11Keys.ForModifier(19), 120)), "add t11: Max Health");
|
||||
Check(t.Contains(GE(T11Keys.ForModifier(47), 2)), "add t11: Max Health Pct");
|
||||
Check(!t.Any(c => c.EndsWith("," + T11Keys.ForModifier(60))), "add t11: unknown modifier has no condition");
|
||||
Check(d.Notes.Any(n => n.Contains("Modifier 60")), "add t11: unknown modifier named in a note");
|
||||
}
|
||||
|
||||
private static void TestAddT11EdgeCases()
|
||||
{
|
||||
// Not T11 gear: a note, no conditions.
|
||||
var plain = new LootItemFacts { Id = 2, Name = "Iron Mace", ObjectClass = (int)AcObjectClass.MeleeWeapon, T11 = T11ItemInfo.None };
|
||||
LootItemRuleDraft? p = LootItemRules.Build(plain, new LootItemRuleOptions { IncludeT11 = true }, out _);
|
||||
Eq(p == null ? -1 : T11Conds(p.Rule).Count, 0, "add t11: non-T11 item adds nothing");
|
||||
Check(p != null && p.Notes.Any(n => n.StartsWith("Not a T11 item")), "add t11: non-T11 note");
|
||||
|
||||
// T11 by name but not identified yet: Is T11 only, and a note to assess it.
|
||||
LootItemFacts unid = T11Facts("T11 - Tachi", AcObjectClass.MeleeWeapon, null, null);
|
||||
LootItemRuleDraft? u = LootItemRules.Build(unid, new LootItemRuleOptions { IncludeT11 = true }, out _);
|
||||
Eq(u == null ? "" : string.Join(" | ", T11Conds(u.Rule)), EQ(T11Keys.IsT11, 1), "add t11: unidentified gives Is T11 only");
|
||||
Check(u != null && u.Notes.Any(n => n.Contains("hasn't been identified")), "add t11: unidentified note");
|
||||
|
||||
// A value-less slot special is required through Has Slot Special.
|
||||
LootItemFacts ring = T11Facts("T11 - Ring", AcObjectClass.Jewelry, null, "Modifiers:\n- Fortify Vitals\n");
|
||||
LootItemRuleDraft? r = LootItemRules.Build(ring, new LootItemRuleOptions { IncludeT11 = true }, out _);
|
||||
Check(r != null && T11Conds(r.Rule).Contains(EQ(T11Keys.HasSlotSpecial, 1)), "add t11: value-less special -> Has Slot Special");
|
||||
|
||||
// "Items like this": T11 conditions count, so the "matches every X" warning goes away.
|
||||
LootItemFacts like = T11Facts("T11 - Tachi", AcObjectClass.MeleeWeapon, T11WeaponLongDesc, null);
|
||||
LootItemRuleDraft? l = LootItemRules.Build(like, new LootItemRuleOptions { Match = LootItemMatch.Like, IncludeT11 = true }, out _);
|
||||
Check(l != null && !l.Notes.Any(n => n.StartsWith("Nothing but the class")), "add t11: like + T11 is not class-only");
|
||||
Check(l != null && l.Rule.Conditions.All(c => c.NodeType != VTankNodeTypes.StringValueMatch), "add t11: like still has no name");
|
||||
LootItemRuleDraft? bare = LootItemRules.Build(plain, new LootItemRuleOptions { Match = LootItemMatch.Like, IncludeT11 = true }, out _);
|
||||
Check(bare != null && bare.Notes.Any(n => n.StartsWith("Nothing but the class")), "add t11: like + non-T11 still warns class-only");
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ internal static partial class Program
|
|||
RunLootEditTests(args);
|
||||
RunLootAddTests(args);
|
||||
RunT11Tests();
|
||||
RunLootAddT11Tests();
|
||||
|
||||
Console.WriteLine($"\nGolden tests: {_asserts} assertions, {_fails} failed.");
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,14 @@
|
|||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Wl" Width="26" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="Wl"
|
||||
IsChecked="{Binding UseWall, Mode=TwoWay}"
|
||||
ToolTip.Tip="Wall — War wall spells (a row of projectiles straight ahead; turns to face the target first). Needs Wall Range in the settings."/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Name -->
|
||||
<DataGridTemplateColumn Header="Name" Width="*" MinWidth="100">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class MonsterRule : INotifyPropertyChanged
|
|||
private string _damageType = "Auto";
|
||||
private int _weaponId;
|
||||
private bool _fester, _broadside, _gravityWell, _imperil, _yield, _vuln;
|
||||
private bool _useArc, _useBolt = true, _useRing, _useStreak, _useBlast;
|
||||
private bool _useArc, _useBolt = true, _useRing, _useStreak, _useBlast, _useWall;
|
||||
private string _exVuln = "None";
|
||||
private int _offhandId;
|
||||
private string _petDamage = "PAuto";
|
||||
|
|
@ -46,6 +46,7 @@ public class MonsterRule : INotifyPropertyChanged
|
|||
public bool UseRing { get => _useRing; set { _useRing = value; OnPropertyChanged(); } }
|
||||
public bool UseStreak { get => _useStreak; set { _useStreak = value; OnPropertyChanged(); } }
|
||||
public bool UseBlast { get => _useBlast; set { _useBlast = value; OnPropertyChanged(); } }
|
||||
public bool UseWall { get => _useWall; set { _useWall = value; OnPropertyChanged(); } }
|
||||
public string ExVuln { get => _exVuln; set { _exVuln = value; OnPropertyChanged(); } }
|
||||
public int OffhandId { get => _offhandId; set { _offhandId = value; OnPropertyChanged(); } }
|
||||
public string PetDamage { get => _petDamage; set { _petDamage = value; OnPropertyChanged(); } }
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ internal static unsafe class FakeHost
|
|||
public static bool GiveCalls;
|
||||
/// <summary>Every GiveObjectTo (item, target, amount; 0 = the whole object), in order.</summary>
|
||||
public static readonly List<(uint Item, uint Target, int Amount)> Gives = new();
|
||||
/// <summary>When true (the default) a give lands at once, as the server does when it isn't busy:
|
||||
/// the item goes to the target. False = the server hasn't taken it (still carried).</summary>
|
||||
public static bool GiveLands = true;
|
||||
/// <summary>Opt-in: wires StopCompletely (off by default so no other test sees it).</summary>
|
||||
public static bool StopCalls;
|
||||
/// <summary>StopCompletely calls (opt-in with <see cref="StopCalls"/>).</summary>
|
||||
|
|
@ -196,7 +199,7 @@ internal static unsafe class FakeHost
|
|||
Vitals = default; BaseVitals = default; WorldName = ""; AccountName = "";
|
||||
HeadingDeg = 0; Wcids.Clear(); Spellbook.Clear(); PlayerIdValue = 0;
|
||||
Logs.Clear(); Chat.Clear(); ChatCommands.Clear();
|
||||
AutoRunCalls.Clear(); AutoRun = false; Jumps = 0; TapJumpCalls = false; TapJumps = 0; Turns = 0; Casts.Clear(); StopCalls = false; Stops = 0; GiveCalls = false; Gives.Clear();
|
||||
AutoRunCalls.Clear(); AutoRun = false; Jumps = 0; TapJumpCalls = false; TapJumps = 0; Turns = 0; Casts.Clear(); StopCalls = false; Stops = 0; GiveCalls = false; Gives.Clear(); GiveLands = true;
|
||||
Uses.Clear(); IdRequests.Clear(); Moves.Clear(); Appraised.Clear(); WeaponCalls = false; CombatModeValue = 1;
|
||||
VTankFlags = -1; VTankSeq = 0; LogCostMicros = 0;
|
||||
ServerGates = false; UseDoneSeq = 0; CastBusy = 0; LastUseDoneError = 0; LastUseDoneCalls = false;
|
||||
|
|
@ -631,7 +634,12 @@ internal static unsafe class FakeHost
|
|||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GetBusyState() => BusyStateValue;
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GiveObjectTo(uint item, uint target, int amount) { Gives.Add((item, target, amount)); return 1; }
|
||||
private static int GiveObjectTo(uint item, uint target, int amount)
|
||||
{
|
||||
Gives.Add((item, target, amount));
|
||||
if (GiveLands && amount == 0) Containers[item] = target;
|
||||
return 1;
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GetCurrentCombatMode() => CombatModeValue;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ internal static class Program
|
|||
HealLatencyTests.Register(runner);
|
||||
BlastTests.Register(runner);
|
||||
ArcWhenClearTests.Register(runner);
|
||||
WallTests.Register(runner);
|
||||
UseAtLoginTests.Register(runner);
|
||||
LearnSpellsTests.Register(runner);
|
||||
AttackLatencyTests.Register(runner);
|
||||
|
|
@ -82,6 +83,9 @@ internal static class Program
|
|||
ItemInfoTests.Register(runner);
|
||||
NavOverlayTests.Register(runner);
|
||||
ActionPacingTests.Register(runner);
|
||||
HazardEscapeTests.Register(runner);
|
||||
ManaStoneChoiceTests.Register(runner);
|
||||
CustomDebuffTests.Register(runner);
|
||||
return runner.Run("RynthAi host tests", args.Length > 0 ? args[0] : null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,9 @@ internal static class AttackLatencyTests
|
|||
Check.Eq(CombatManager.AttackIntervalMs(Missile, 1500, true, true), 1000.0, "missile: 1000 ms");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 1500, true, false), 1500.0, "magic, same target: the setting");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 2500, true, false), 2500.0, "magic, same target: a slower setting is kept");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 0, true, false), 1500.0, "magic, setting 0 (old file): 1500");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 0, true, false), 0.0, "magic, setting 0: no delay of its own (the server gates hold the cast)");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 0, false, false), CombatManager.NoGatesAttackFloorMs, "setting 0 without the server gates: the 250 ms floor");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, -1, true, false), 1500.0, "unset: 1500");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 1500, true, true), CombatManager.NewTargetCastFloorMs,
|
||||
"magic, new target, server gates: the short floor (UseDone + gesture hold the cast)");
|
||||
Check.Eq(CombatManager.AttackIntervalMs(Magic, 1500, false, true), 1500.0,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace RynthCore.RynthAiHostTests.Tests;
|
|||
internal static class BuffTests
|
||||
{
|
||||
private const uint Player = 0x50000B01;
|
||||
private const uint STypeCreature = 31, STypeItem = 32;
|
||||
private const uint STypeCreature = 31, STypeItem = 32, STypeLife = 33;
|
||||
|
||||
/// <summary>Buff/tier pairs the name tables used to miss (fixed by 940cb21); NameGapsResolve checks them by name.</summary>
|
||||
private static readonly HashSet<(string Buff, int Tier)> NameGaps = new()
|
||||
|
|
@ -54,6 +54,9 @@ internal static class BuffTests
|
|||
r.Add("rebuff: our own lower tier under an expiring higher one counts as on", RebuffUnderExpiringHigherTier);
|
||||
r.Add("rebuff: cast over item-granted buffs (CastBuffsOverItemBuffs on)", RebuffOverItemBuffs);
|
||||
r.Add("rebuff: CastBuffsOverItemBuffs defaults on, loads, saves, bridges", OverItemBuffsSetting);
|
||||
r.Add("buff toggles: by default every prot and bane is cast", TogglesDefaultAllOn);
|
||||
r.Add("buff toggles: an unticked prot or bane is never cast and never holds NeedsAnyBuff", UntickedSkipped);
|
||||
r.Add("buff toggles: an old profile loads all on; the list saves, copies and bridges", TogglesSetting);
|
||||
|
||||
r.Add("buff choice: spell names the tables miss (Bludgeon Bane, Nuhmudira's, T'ing, Celdiseth's)", NameGapsResolve); // was a known failure; fixed by 940cb21
|
||||
r.Add("buff choice: a mastery whose name has several spell ids", MultiIdMastery); // was a known failure; fixed by 0aedcee
|
||||
|
|
@ -596,6 +599,129 @@ internal static class BuffTests
|
|||
Check.True(s.CastBuffsOverItemBuffs, "a save with it on turns it on");
|
||||
}
|
||||
|
||||
// ── Prot and bane toggles (Buffing settings, DisabledBuffs) ───────────────
|
||||
|
||||
private static readonly MethodInfo CastSelfBuffs =
|
||||
typeof(BuffManager).GetMethod("CheckAndCastSelfBuffs", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
|
||||
/// <summary>Tier 6 Life and Item Magic, in Magic stance, knowing two prots and two banes.</summary>
|
||||
private static BuffRig ProtBaneRig()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
Know("Fire Protection Self VI", "Cold Protection Self VI", "Flame Bane VI", "Frost Bane VI");
|
||||
FakeHost.Skills[(Player, STypeLife)] = (300, 2);
|
||||
FakeHost.Skills[(Player, STypeItem)] = (300, 2);
|
||||
FakeHost.WeaponCalls = true; // GetCurrentCombatMode answers CombatModeValue
|
||||
FakeHost.CombatModeValue = CombatMode.Magic;
|
||||
return new BuffRig();
|
||||
}
|
||||
|
||||
/// <summary>Runs the buff cast loop until it casts nothing, confirming each cast by chat as the
|
||||
/// server would. Returns the spells cast in order; <paramref name="done"/> = the loop's last
|
||||
/// answer was "nothing to do" (what ends a batch in the heartbeat).</summary>
|
||||
private static List<string> CastAll(BuffRig rig, out bool done)
|
||||
{
|
||||
var cast = new List<string>();
|
||||
done = false;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int before = FakeHost.Casts.Count;
|
||||
bool acted = (bool)CastSelfBuffs.Invoke(rig.B, null)!;
|
||||
if (FakeHost.Casts.Count == before) { done = !acted; break; }
|
||||
string name = NameOf(FakeHost.Casts.Last().SpellId);
|
||||
cast.Add(name);
|
||||
rig.B.OnChatWindowText($"You cast {name} on {(name.Contains("Bane") ? "Rune Robe" : "yourself")}", 7);
|
||||
}
|
||||
return cast;
|
||||
}
|
||||
|
||||
private static void TogglesDefaultAllOn()
|
||||
{
|
||||
var rig = ProtBaneRig();
|
||||
Check.Eq(rig.S.DisabledBuffs.Count, 0, "a new profile unticks nothing");
|
||||
foreach (var (buff, _) in BuffManager.ToggleProtections.Concat(BuffManager.ToggleBanes))
|
||||
Check.True(rig.B.BuildDynamicBuffList().Contains(buff), $"every toggle names a buff in the list: {buff}");
|
||||
rig.Live(("Strength Self I", 3000)); // a registry read, with none of ours on
|
||||
Check.True(rig.B.NeedsAnyBuff(), "nothing on: needs buffs");
|
||||
var cast = CastAll(rig, out bool done);
|
||||
Check.Eq(string.Join(", ", cast), "Fire Protection Self VI, Cold Protection Self VI, Flame Bane VI, Frost Bane VI", $"all four are cast (last skip: {rig.B.LastBuffSkipReason})");
|
||||
Check.True(done, "then the loop has nothing left");
|
||||
}
|
||||
|
||||
private static void UntickedSkipped()
|
||||
{
|
||||
var rig = ProtBaneRig();
|
||||
rig.S.SetBuffEnabled("Fire Protection Self", false);
|
||||
rig.S.SetBuffEnabled("flame bane", false); // names match case-insensitively
|
||||
Check.False(rig.B.BuildDynamicBuffList().Contains("Fire Protection Self"), "an unticked prot leaves the list");
|
||||
Check.False(rig.B.BuildDynamicBuffList().Contains("Flame Bane"), "an unticked bane leaves the list");
|
||||
rig.Live(("Strength Self I", 3000));
|
||||
var cast = CastAll(rig, out bool done);
|
||||
Check.Eq(string.Join(", ", cast), "Cold Protection Self VI, Frost Bane VI", "only the ticked ones are cast");
|
||||
Check.True(done, "the loop ends with the unticked ones still off: the batch can finish");
|
||||
|
||||
// A fresh look, the ticked ones on and the unticked ones never cast: nothing is due.
|
||||
var idle = ProtBaneRig();
|
||||
idle.S.SetBuffEnabled("Fire Protection Self", false);
|
||||
idle.S.SetBuffEnabled("Flame Bane", false);
|
||||
idle.Live(("Cold Protection Self VI", 3000));
|
||||
idle.B.OnChatWindowText("You cast Frost Bane VI on Rune Robe", 7);
|
||||
Check.False(idle.B.NeedsAnyBuff(), "unticked and off doesn't hold Buffing");
|
||||
idle.S.SetBuffEnabled("Fire Protection Self", true);
|
||||
Check.True(idle.B.NeedsAnyBuff(), "ticked again: Fire Protection is due");
|
||||
Check.False(idle.S.IsBuffDisabled("Fire Protection Self"), "and leaves the list");
|
||||
|
||||
// Force Rebuff recasts everything, still not the unticked ones.
|
||||
var fr = ProtBaneRig();
|
||||
fr.S.SetBuffEnabled("Cold Protection Self", false);
|
||||
fr.S.SetBuffEnabled("Frost Bane", false);
|
||||
fr.Live(("Strength Self I", 3000));
|
||||
fr.B.ForceFullRebuff();
|
||||
cast = CastAll(fr, out done);
|
||||
Check.Eq(string.Join(", ", cast), "Fire Protection Self VI, Flame Bane VI", "Force Rebuff skips the unticked ones too");
|
||||
Check.True(done, "and finishes");
|
||||
Check.False(FakeHost.Casts.Any(c => NameOf(c.SpellId) is "Cold Protection Self VI" or "Frost Bane VI"), "never cast");
|
||||
}
|
||||
|
||||
private static void TogglesSetting()
|
||||
{
|
||||
var old = JsonSerializer.Deserialize("{\"EnableBuffing\":true,\"RebuffSecondsRemaining\":300}", RynthAiJsonContext.Default.LegacyUiSettings);
|
||||
Check.True(old != null && old.DisabledBuffs.Count == 0, "a profile saved before the setting: all on");
|
||||
var nul = JsonSerializer.Deserialize("{\"DisabledBuffs\":null}", RynthAiJsonContext.Default.LegacyUiSettings);
|
||||
Check.True(nul != null && nul.DisabledBuffs.Count == 0, "a null list: all on");
|
||||
var some = new LegacyUiSettings();
|
||||
some.SetBuffEnabled("Acid Bane", false);
|
||||
some.SetBuffEnabled("Blade Protection Self", false);
|
||||
var back = JsonSerializer.Deserialize(JsonSerializer.Serialize(some, RynthAiJsonContext.Default.LegacyUiSettings),
|
||||
RynthAiJsonContext.Default.LegacyUiSettings);
|
||||
Check.True(back != null && back.IsBuffDisabled("Acid Bane") && back.IsBuffDisabled("Blade Protection Self") && back.DisabledBuffs.Count == 2,
|
||||
"unticked ones are saved and loaded");
|
||||
|
||||
// Profile switch/load copies it (CopySettings is the hand-written field list).
|
||||
var copy = typeof(LegacyDashboardRenderer).GetMethod("CopySettings", BindingFlags.NonPublic | BindingFlags.Static)!;
|
||||
var dst = new LegacyUiSettings();
|
||||
copy.Invoke(null, new object[] { some, dst });
|
||||
Check.True(dst.IsBuffDisabled("Acid Bane") && dst.DisabledBuffs.Count == 2, "a profile with unticked ones loads them");
|
||||
copy.Invoke(null, new object[] { old!, dst });
|
||||
Check.Eq(dst.DisabledBuffs.Count, 0, "an old profile loads all on");
|
||||
|
||||
// Engine Settings face: the payload carries the list; an engine without the field leaves it alone.
|
||||
var payload = JsonSerializer.Deserialize("{\"PatrolOnLogin\":false}", RynthAiJsonContext.Default.SettingsBridgePayload);
|
||||
Check.True(payload != null && payload.DisabledBuffs == null, "an older engine's payload has no list");
|
||||
var s = new LegacyUiSettings();
|
||||
s.SetBuffEnabled("Frost Bane", false);
|
||||
var dash = (LegacyDashboardRenderer)RuntimeHelpers.GetUninitializedObject(typeof(LegacyDashboardRenderer));
|
||||
typeof(LegacyDashboardRenderer).GetField("_settings", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(dash, s);
|
||||
typeof(LegacyDashboardRenderer).GetField("_advancedSettingsUi", BindingFlags.NonPublic | BindingFlags.Instance)!
|
||||
.SetValue(dash, new LegacyAdvancedSettingsUi(s));
|
||||
var sent = JsonSerializer.Deserialize(dash.BuildSettingsJson(), RynthAiJsonContext.Default.SettingsBridgePayload);
|
||||
Check.True(sent?.DisabledBuffs != null && sent.DisabledBuffs.SequenceEqual(new[] { "Frost Bane" }), "sent to the engine face");
|
||||
dash.ApplySettingsJson("{\"PatrolOnLogin\":false}");
|
||||
Check.True(s.IsBuffDisabled("Frost Bane"), "a save without the list leaves it alone");
|
||||
dash.ApplySettingsJson("{\"DisabledBuffs\":[]}");
|
||||
Check.Eq(s.DisabledBuffs.Count, 0, "a save with an empty list ticks everything");
|
||||
}
|
||||
|
||||
private static BuffRig ArmorRig()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
|
|
|
|||
55
Tools/RynthCore.RynthAiHostTests/Tests/CustomDebuffTests.cs
Normal file
55
Tools/RynthCore.RynthAiHostTests/Tests/CustomDebuffTests.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using System.Reflection;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// 2026-10-08: with Corruption V and VII known, the custom debuff "Corruption" cast V. A typed-in
|
||||
// debuff was capped by Creature and Life alone; Corruption is Void, so the search started at VI.
|
||||
internal static class CustomDebuffTests
|
||||
{
|
||||
private const uint Player = 0x50000180;
|
||||
private const uint STypeCreature = 31, STypeLife = 33, STypeVoid = 43;
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("custom debuff: a base name casts the highest known level, capped by Void too (Corruption VII, not V)", VoidCap);
|
||||
}
|
||||
|
||||
private static void VoidCap()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
foreach (string n in new[] { "Corruption V", "Corruption VII" })
|
||||
foreach (var row in SpellTable.Named(n)) FakeHost.Spellbook.Add((uint)row.Id);
|
||||
FakeHost.Skills[(Player, STypeCreature)] = (250, 2); // tier 5 by the thresholds below
|
||||
FakeHost.Skills[(Player, STypeLife)] = (250, 2);
|
||||
FakeHost.Skills[(Player, STypeVoid)] = (400, 3); // tier 7
|
||||
var s = new LegacyUiSettings
|
||||
{
|
||||
MinSkillLevelTier1 = 0, MinSkillLevelTier2 = 50, MinSkillLevelTier3 = 100, MinSkillLevelTier4 = 150,
|
||||
MinSkillLevelTier5 = 200, MinSkillLevelTier6 = 300, MinSkillLevelTier7 = 350, MinSkillLevelTier8 = 10000,
|
||||
};
|
||||
var host = FakeHost.Create(Player);
|
||||
var cache = FakeHost.MakeCache(host, Player, System.Array.Empty<uint>());
|
||||
var c = new CombatManager(host, s, cache);
|
||||
c.SetPlayerId(Player);
|
||||
var skills = new CharacterSkills(host);
|
||||
skills.SetPlayerId(Player);
|
||||
var sm = new SpellManager(host, s);
|
||||
sm.InitializeNatively();
|
||||
sm.SetCharacterSkills(skills);
|
||||
sm.RefreshKnownSpells();
|
||||
c.SetSpellManager(sm);
|
||||
|
||||
MethodInfo find = typeof(CombatManager).GetMethod("FindBestCustomDebuffWithTier", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
object[] args = { "Corruption", 0 };
|
||||
int id = (int)find.Invoke(c, args)!;
|
||||
Check.Eq(SpellTableStub.GetById(id)?.Name, "Corruption VII", "the highest known level");
|
||||
Check.Eq((int)args[1], 7, "tier 7");
|
||||
|
||||
object[] args5 = { "Corruption V", 0 };
|
||||
Check.Eq(SpellTableStub.GetById((int)find.Invoke(c, args5)!)?.Name, "Corruption V", "a full name still casts as is");
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ internal static class GiveTests
|
|||
r.Add("give: /ub give with a count hands over that many", UbGiveCount);
|
||||
r.Add("give: /mt give hands over only the first match", MtGivesFirst);
|
||||
r.Add("give: /ub givep matches part of the name", UbGivePartial);
|
||||
r.Add("give: the next give waits until the server took the last (it answers extra gives 'too busy')", WaitsForServer);
|
||||
}
|
||||
|
||||
private sealed class World
|
||||
|
|
@ -118,4 +119,20 @@ internal static class GiveTests
|
|||
Check.Eq(FakeHost.Gives.Count, 4, "partial: the three Mana Motes and the Lesser Mana Mote");
|
||||
Check.False(w.GivenItems.Contains(WornMote), "still not the worn one");
|
||||
}
|
||||
|
||||
// 2026-10-08: the queue sent a give every 150 ms; the server takes one at a time and the
|
||||
// rest came back "too busy", so /ub give handed over one item.
|
||||
private static void WaitsForServer()
|
||||
{
|
||||
var w = new World();
|
||||
FakeHost.GiveLands = false; // the server hasn't taken the first yet
|
||||
w.Run("/ub give Mana Mote to Town Crier");
|
||||
Check.Eq(FakeHost.Gives.Count, 1, "one give, then it waits for the server");
|
||||
|
||||
FakeHost.Containers[FakeHost.Gives[0].Item] = Npc; // the server took it
|
||||
FakeHost.GiveLands = true;
|
||||
for (int i = 0; i < 20; i++) w.Call("DrainGiveQueue");
|
||||
Check.Eq(FakeHost.Gives.Count, 3, "then the other two, each after the last landed");
|
||||
Check.Eq(FakeHost.Gives.Select(g => g.Item).Distinct().Count(), 3, "no item sent twice");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
161
Tools/RynthCore.RynthAiHostTests/Tests/HazardEscapeTests.cs
Normal file
161
Tools/RynthCore.RynthAiHostTests/Tests/HazardEscapeTests.cs
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.PluginCore;
|
||||
using RynthCore.PluginSdk;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// 2026-10-07, Drakkon: two deaths in an acid pool in an hour. The patrol left him in a pool the
|
||||
// hazard list didn't know, and topping up with healing kits held him there. Now the first
|
||||
// "You suffer N damage from acid!" stops everything and walks him back out along his footsteps.
|
||||
internal static class HazardEscapeTests
|
||||
{
|
||||
private const uint Player = 0x50000180;
|
||||
private const uint CellA = 0x63470160, CellB = 0x6347016C; // dungeon cells, one landblock
|
||||
private const BindingFlags Any = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("hazard: the hotspot damage line is read (amount, source); other lines are not", Parse);
|
||||
r.Add("hazard: a hit stops everything and walks back along the footsteps, then hands back", EscapeAlongFootsteps);
|
||||
r.Add("hazard: hurt again where it stopped - it goes further back", FurtherBack);
|
||||
r.Add("hazard: macro off - the cell is still learned, nothing moves", MacroOff);
|
||||
r.Add("hazard: Escape Acid and Lava off - no escape and nothing learned (some walk through acid)", SettingOff);
|
||||
}
|
||||
|
||||
private static void Parse()
|
||||
{
|
||||
Check.True(RynthAiPlugin.TryParseHotspotDamage("You suffer 32 damage from acid!", out int a, out string s) && a == 32 && s == "acid", "acid");
|
||||
Check.True(RynthAiPlugin.TryParseHotspotDamage("You suffer 11 damage from the lava.", out a, out s) && a == 11 && s == "lava", "lava, with 'the'");
|
||||
Check.False(RynthAiPlugin.TryParseHotspotDamage("You say, \"Malar Zhapaj\"", out _, out _), "speech");
|
||||
Check.False(RynthAiPlugin.TryParseHotspotDamage("Olthoi Swarm Worker bites you for 20 points of damage!", out _, out _), "a monster's hit");
|
||||
}
|
||||
|
||||
private sealed class Clock { public long Now = 1_000_000; }
|
||||
|
||||
private sealed class Bot
|
||||
{
|
||||
public readonly RynthAiPlugin P = new();
|
||||
public readonly LegacyUiSettings S = new() { IsMacroRunning = true };
|
||||
public readonly WorldObjectCache Cache;
|
||||
public readonly Clock C = new();
|
||||
|
||||
public Bot()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
FakeHost.StopCalls = true;
|
||||
var host = FakeHost.Create(Player);
|
||||
typeof(RynthPluginBase).GetMethod("Attach", Any)!.Invoke(P, new object[] { FakeHost.LastApi });
|
||||
var dash = (LegacyDashboardRenderer)RuntimeHelpers.GetUninitializedObject(typeof(LegacyDashboardRenderer));
|
||||
typeof(LegacyDashboardRenderer).GetField("_settings", Any)!.SetValue(dash, S);
|
||||
typeof(RynthAiPlugin).GetField("_dashboard", Any)!.SetValue(P, dash);
|
||||
Cache = new WorldObjectCache(host);
|
||||
typeof(RynthAiPlugin).GetField("_objectCache", Any)!.SetValue(P, Cache);
|
||||
var clock = C;
|
||||
RynthAiPlugin.HazardClock = () => clock.Now;
|
||||
}
|
||||
|
||||
/// <summary>Stands at (x, y), lets time pass and records the footstep.</summary>
|
||||
public void At(uint cell, float x, float y, long ms = 300)
|
||||
{
|
||||
FakeHost.PlayerPose = (cell, x, y, -24f);
|
||||
C.Now += ms;
|
||||
P.RecordHazardTrail();
|
||||
}
|
||||
|
||||
public bool Hold() => P.HoldForHazardEscape();
|
||||
public void Hit() => P.NoteHotspotChat("You suffer 32 damage from acid!", 0);
|
||||
public T Get<T>(string f) => (T)typeof(RynthAiPlugin).GetField(f, Any)!.GetValue(P)!;
|
||||
}
|
||||
|
||||
private static (float X, float Y) Target(Bot b) => (b.Get<float>("_hazardTargetX"), b.Get<float>("_hazardTargetY"));
|
||||
|
||||
private static void EscapeAlongFootsteps()
|
||||
{
|
||||
var b = new Bot();
|
||||
// An L: north up x=60 from y=-185 to y=-175, then east to x=66 - into the acid.
|
||||
for (int i = 0; i <= 10; i++) b.At(CellA, 60f, -185f + i);
|
||||
for (int i = 1; i <= 6; i++) b.At(CellB, 60f + i, -175f);
|
||||
|
||||
b.Hit();
|
||||
Check.True(b.P.HazardEscaping, "the hit starts the escape");
|
||||
Check.True(b.Cache.IsHazardCell(CellB), "the cell it was hurt in is a hazard now");
|
||||
Check.True(b.Hold(), "the escape owns the tick (nothing else runs)");
|
||||
Check.True(FakeHost.AutoRun, "running");
|
||||
|
||||
var path = b.Get<System.Collections.Generic.List<(uint Cell, float X, float Y)>>("_hazardPath");
|
||||
Check.True(path.Count >= 3, $"a path of footsteps, not one straight line ({path.Count} points)");
|
||||
Check.True(path.Take(path.Count - 1).Any(p => p.Y == -175f && p.X > 60f), "it first walks back east-west along the way it came");
|
||||
var t = Target(b);
|
||||
Check.True(t.X == 60f && t.Y <= -175f, $"and ends back on the north-south leg, outside the hurt cell ({t.X}, {t.Y})");
|
||||
|
||||
// Walk the footsteps: each tick at the next one.
|
||||
foreach (var p in path)
|
||||
{
|
||||
FakeHost.PlayerPose = (p.Cell, p.X, p.Y, -24f);
|
||||
b.C.Now += 300;
|
||||
Check.True(b.Hold(), "still holding while it walks out");
|
||||
}
|
||||
Check.False(FakeHost.AutoRun, "stopped at the target");
|
||||
b.C.Now += RynthAiPlugin.HazardQuietMs;
|
||||
Check.False(b.Hold(), "no hit for a while at the target: the tick is handed back");
|
||||
Check.False(b.P.HazardEscaping, "escape over");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("Hazard: out of it")), "and it says so");
|
||||
}
|
||||
|
||||
private static void FurtherBack()
|
||||
{
|
||||
var b = new Bot();
|
||||
for (int i = 0; i <= 12; i++) b.At(CellA, 60f, -190f + i);
|
||||
b.Hit();
|
||||
var first = Target(b);
|
||||
FakeHost.PlayerPose = (CellA, first.X, first.Y, -24f);
|
||||
b.C.Now += 300;
|
||||
foreach (var _ in Enumerable.Range(0, 20)) { b.Hold(); FakeHost.PlayerPose = (CellA, first.X, first.Y, -24f); }
|
||||
Check.False(FakeHost.AutoRun, "arrived at the first spot");
|
||||
|
||||
b.C.Now += 2500;
|
||||
b.Hit(); // the pool reaches further back
|
||||
var second = Target(b);
|
||||
Check.True(second.Y < first.Y - 1f, $"it goes further back ({first.Y} -> {second.Y})");
|
||||
Check.True(b.Hold(), "and keeps the tick");
|
||||
Check.True(FakeHost.AutoRun, "running again");
|
||||
}
|
||||
|
||||
private static void MacroOff()
|
||||
{
|
||||
var b = new Bot();
|
||||
b.S.IsMacroRunning = false;
|
||||
for (int i = 0; i <= 6; i++) b.At(CellA, 60f, -185f + i);
|
||||
b.Hit();
|
||||
Check.True(b.Cache.IsHazardCell(CellA), "the cell is learned");
|
||||
Check.False(b.P.HazardEscaping, "but nothing moves the character while you play it");
|
||||
Check.False(b.Hold(), "and the tick is not held");
|
||||
}
|
||||
|
||||
private static void SettingOff()
|
||||
{
|
||||
var b = new Bot();
|
||||
b.S.EscapeHazards = false;
|
||||
for (int i = 0; i <= 6; i++) b.At(CellA, 60f, -185f + i);
|
||||
b.Hit();
|
||||
Check.False(b.P.HazardEscaping, "no escape");
|
||||
Check.False(b.Cache.IsHazardCell(CellA), "and the cell is not learned (the patrol keeps its way through)");
|
||||
Check.False(b.Hold(), "the tick is not held");
|
||||
|
||||
// Turned off mid-escape: it lets go at once.
|
||||
b.S.EscapeHazards = true;
|
||||
b.Hit();
|
||||
Check.True(b.P.HazardEscaping, "on again: the next hit escapes");
|
||||
b.S.EscapeHazards = false;
|
||||
Check.False(b.Hold(), "turned off mid-escape: the tick is handed back");
|
||||
Check.False(b.P.HazardEscaping, "escape over");
|
||||
Check.False(new LegacyUiSettings().EscapeHazards == false, "on by default");
|
||||
}
|
||||
}
|
||||
|
|
@ -51,6 +51,7 @@ internal static class LootCorpseTests
|
|||
r.Add("corpse close: an abandoned open corpse is closed once", AbandonedCorpseClosed);
|
||||
r.Add("corpse close: stopping the macro mid-loot closes the open corpse, not marked completed", MacroStopClosesCorpse);
|
||||
r.Add("loot pacing: a pickup waits for the last bend-down, and no retry is timed while it plays", PickupWaitsForAnimation);
|
||||
r.Add("corpse close: not while the last item is between the corpse and the pack - it closes once the item is in the inventory", CloseWaitsForInventory);
|
||||
}
|
||||
|
||||
// ── World set-up ──────────────────────────────────────────────────────────
|
||||
|
|
@ -486,6 +487,26 @@ internal static class LootCorpseTests
|
|||
Check.Eq(FakeHost.ExternalMoves.Count(m => m.Id == Gem), 2, "then one retry");
|
||||
}
|
||||
|
||||
// 2026-10-07: the client takes an item off the corpse list as soon as the move is sent; the
|
||||
// corpse was closed then, and the character picked the item up after the corpse closed.
|
||||
private static void CloseWaitsForInventory()
|
||||
{
|
||||
var bot = OpenCorpseAndSendPickup(closeSupported: true);
|
||||
FakeHost.Containers[Gem] = 0x7FFFFFF0; // off the corpse, not in a pack yet
|
||||
TickFor(bot, 1500);
|
||||
Check.Eq(FakeHost.Closes.Count, 0, "not closed while the item is on its way");
|
||||
Check.False(Completed(bot), "not completed either");
|
||||
|
||||
FakeHost.Containers[Gem] = Player; // in the main pack
|
||||
for (int i = 0; i < 200 && FakeHost.Closes.Count == 0; i++)
|
||||
{
|
||||
bot.Tick(BotActivity.Looting);
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
Check.Eq(FakeHost.Closes.Count, 1, "closed once the item is in the inventory");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("pickup confirmed")), "and the pickup confirmed");
|
||||
}
|
||||
|
||||
private static void TickFor(Bot bot, int ms)
|
||||
{
|
||||
long end = Environment.TickCount64 + ms;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
using RynthCore.Loot;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// 2026-10-08: RynthAi used an Aligned Mana Stone on a wand. Only the ordinary tapping stones
|
||||
// (and mana charges) are stones to RynthAi unless a ManaStone consumable rule names one.
|
||||
internal static class ManaStoneChoiceTests
|
||||
{
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("mana stones: only ordinary stones and charges are used; special stones only when a rule names them", OrdinaryOnly);
|
||||
r.Add("mana stones: with tapping off, charged stones and Mana Charges still refill worn gear", RefillWithoutTapping);
|
||||
}
|
||||
|
||||
private static void OrdinaryOnly()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
var host = FakeHost.Create();
|
||||
var cache = new WorldObjectCache(host);
|
||||
var s = new LegacyUiSettings { EnableManaTapping = true };
|
||||
var m = new ManaStoneManager(host, s, cache);
|
||||
WorldObject W(string name) => new(0x60001000, name, AcObjectClass.ManaStone);
|
||||
|
||||
foreach (string n in new[] { "Minor Mana Stone", "Lesser Mana Stone", "Moderate Mana Stone", "Mana Stone", "Greater Mana Stone", "Major Mana Stone", "Titan Mana Charge" })
|
||||
Check.True(m.IsManaStone(W(n)), $"'{n}' is a stone");
|
||||
foreach (string n in new[] { "Aligned Mana Stone", "Aetheria Mana Stone", "Unstable Mana Stone", "Enchanted Mana Stone", "Adjanite Mana Stone" })
|
||||
Check.False(m.IsManaStone(W(n)), $"'{n}' is left alone");
|
||||
|
||||
s.ConsumableRules.Add(new ConsumableRule { Name = "Aligned Mana Stone", Type = "ManaStone" });
|
||||
Check.True(m.IsManaStone(W("Aligned Mana Stone")), "a rule naming it opts it in");
|
||||
Check.False(m.IsManaStone(W("Mana Stone")), "with rules, only the named stones");
|
||||
}
|
||||
|
||||
private static void RefillWithoutTapping()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
var host = FakeHost.Create();
|
||||
var cache = new WorldObjectCache(host);
|
||||
var s = new LegacyUiSettings { EnableManaTapping = false };
|
||||
var m = new ManaStoneManager(host, s, cache);
|
||||
WorldObject W(string name) => new(0x60001000, name, AcObjectClass.ManaStone);
|
||||
|
||||
Check.False(m.IsManaStone(W("Major Mana Stone")), "tapping off: not a stone to loot or drain into");
|
||||
Check.True(m.IsRefillStone(W("Major Mana Stone")), "but a charged one still refills gear");
|
||||
Check.True(m.IsRefillStone(W("Titan Mana Charge")), "a bought Mana Charge too");
|
||||
Check.False(m.IsRefillStone(W("Aligned Mana Stone")), "never a special stone");
|
||||
|
||||
s.ConsumableRules.Add(new ConsumableRule { Name = "Aligned Mana Stone", Type = "ManaStone" });
|
||||
Check.True(m.IsRefillStone(W("Aligned Mana Stone")), "unless a rule names it");
|
||||
Check.False(m.IsRefillStone(W("Major Mana Stone")), "with rules, only the named stones");
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ internal static class MonsterEditorTests
|
|||
Name = "Olthoi", Category = "Olthoi nest", MatchExpression = "getcharintprop[25]>=200",
|
||||
Priority = 3, DamageType = "Acid", WeaponId = 0x50001234, Fester = true, Broadside = true,
|
||||
GravityWell = true, Imperil = true, Yield = true, Vuln = true, UseArc = true, UseRing = true,
|
||||
UseStreak = true, UseBolt = false, UseBlast = true, ExVuln = "Fire", OffhandId = 2,
|
||||
UseStreak = true, UseBolt = false, UseBlast = true, UseWall = true, ExVuln = "Fire", OffhandId = 2,
|
||||
PetDamage = "Cold", CustomDebuffs = "Corrosion Vulnerability Other, Fire Vulnerability Other VII",
|
||||
},
|
||||
new PluginRule { Name = "", Category = "Expression only", MatchExpression = "wobjectfindnearestbytemplatetype[1]" },
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ internal static class VitalsTests
|
|||
r.Add("vitals: Heal Self known only above the tier Life Magic allows (vitae) is still cast", HealAboveAllowedTier);
|
||||
r.Add("vitals: low health wins the arbiter even on a busy tick; backs off when nothing can heal", HealthWinsArbiter);
|
||||
r.Add("vitals: 'You're too busy!' paces vital casts, and a long streak stops the character once", TooBusyVitals);
|
||||
r.Add("vitals: no components for the top level - the next lower level is cast, not the same one again", NoComponentsFallsBack);
|
||||
// Drakkon's death, 2026-10-05 13:43:20 (ops\overnight\2026-10-05-death-fixes.md).
|
||||
r.Add("vitals: a hot reload's login refresh trusts its first read; a real login waits for two equal reads", HotReloadRefresh);
|
||||
r.Add("vitals: RynthAi tells the engine a reload is unsafe while engaged, under a heal line or casting", ReloadBlockerReport);
|
||||
|
|
@ -69,6 +70,42 @@ internal static class VitalsTests
|
|||
Check.Eq(FakeHost.Stops, 1, "only once per streak");
|
||||
}
|
||||
|
||||
// 2026-10-08: with no components for the highest Stamina to Mana / Revitalize / Heal the
|
||||
// character knew, RynthAi kept retrying that one level; it parked the whole family, then
|
||||
// tried the same level again. Now that level is passed over and the next lower one is cast.
|
||||
private static void NoComponentsFallsBack()
|
||||
{
|
||||
FakeHost.Reset();
|
||||
FakeHost.WeaponCalls = 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();
|
||||
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 = 10 };
|
||||
var b = new BuffManager(host, s, sm, vitals);
|
||||
b.SetCharacterSkills(skills);
|
||||
|
||||
Check.True(b.CheckVitals(), "10% mana: Stamina to Mana is cast");
|
||||
int top = FakeHost.Casts[^1].SpellId;
|
||||
b.OnChatWindowText("You don't have all the components for this spell.", 0);
|
||||
for (int i = 0; i < 50 && FakeHost.Casts.Count < 2; i++)
|
||||
{
|
||||
b.CheckVitals();
|
||||
System.Threading.Thread.Sleep(20);
|
||||
}
|
||||
Check.Eq(FakeHost.Casts.Count, 2, "a second cast goes out");
|
||||
int next = FakeHost.Casts[^1].SpellId;
|
||||
Check.True(next != top, $"a different level ({SpellTableStub.GetById(top)?.Name} -> {SpellTableStub.GetById(next)?.Name})");
|
||||
Check.True(SpellTableStub.GetById(next)?.Family == SpellTableStub.GetById(top)?.Family, "the same spell, one level down");
|
||||
}
|
||||
|
||||
// 2026-10-04, "nav and looting have priority over healing, almost dying in packs": the
|
||||
// arbiter only saw a heal on ticks where CheckVitals ran (never while looting kept the client
|
||||
// busy). Health under a line now says "wants vitals" by itself.
|
||||
|
|
|
|||
327
Tools/RynthCore.RynthAiHostTests/Tests/WallTests.cs
Normal file
327
Tools/RynthCore.RynthAiHostTests/Tests/WallTests.cs
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthAi.LegacyUi;
|
||||
using RynthCore.RynthAiHostTests.Fakes;
|
||||
using RynthCore.RynthAiTests.Harness;
|
||||
|
||||
namespace RynthCore.RynthAiHostTests.Tests;
|
||||
|
||||
// Wall spells (2026-10-08): a monster rule with Wall on casts its element's wall (picked by spell
|
||||
// category, 229-235) when Wall Range is on and enough monsters are in the wall's path toward the
|
||||
// target. Priority: Ring, then Wall, then Blast, then the base shape; a wall-only rule casts Bolt
|
||||
// between walls. A wall is untargeted (ACE flies it along the caster's facing and never turns the
|
||||
// caster for it), so the bot snaps its heading to the target first and holds the cast until the
|
||||
// new heading has reached the server; already facing, it casts at once without turning. Walls are
|
||||
// area casts for the damage bookkeeping. Old profiles and engine payloads load with walls off.
|
||||
internal static class WallTests
|
||||
{
|
||||
private const uint Player = 0x50000D01;
|
||||
private const int Target = 0x7000A001;
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
r.Add("walls: Ring, then Wall, then Blast, then the base shape; wall-only casts Bolt between walls", ShapePriority);
|
||||
r.Add("walls: each element's wall by category, the tier limit, none for Nether", WallPerElement);
|
||||
r.Add("walls: Wall Range off, too few in the path, or no wall known: the rule's other shape", WallOverride);
|
||||
r.Add("walls: the path is a corridor toward the target, ahead of the caster", WallPathGeometry);
|
||||
r.Add("walls: far off the target, it turns first and casts after the settle; facing it, no turn", WallFacing);
|
||||
r.Add("walls: the cast itself waits for the turn, then goes as an area cast", WallCastThroughAttack);
|
||||
r.Add("walls: UseWall, Wall Range and Min Wall Targets load off / 0 / 3 from old files", OldSettings);
|
||||
}
|
||||
|
||||
private static int Id(string name) => SpellTable.Named(name).Select(r => r.Id).First();
|
||||
private static string NameOf(int id) => id == 0 ? "(none)" : SpellTable.ById(id)?.Name ?? $"#{id}";
|
||||
|
||||
private sealed class Rig
|
||||
{
|
||||
public readonly LegacyUiSettings S = new();
|
||||
public readonly CombatManager C;
|
||||
public int InPath = 5;
|
||||
public DateTime Now = new(2026, 10, 8, 12, 0, 0);
|
||||
|
||||
public Rig(int tier, params string[] known)
|
||||
{
|
||||
FakeHost.Reset();
|
||||
foreach (string n in known)
|
||||
foreach (var row in SpellTable.Named(n)) FakeHost.Spellbook.Add((uint)row.Id);
|
||||
int T(int k) => k <= tier ? 0 : 10000; // the no-skills stub reads 250 buffed
|
||||
S.MinSkillLevelTier1 = 0; S.MinSkillLevelTier2 = T(2); S.MinSkillLevelTier3 = T(3); S.MinSkillLevelTier4 = T(4);
|
||||
S.MinSkillLevelTier5 = T(5); S.MinSkillLevelTier6 = T(6); S.MinSkillLevelTier7 = T(7); S.MinSkillLevelTier8 = T(8);
|
||||
S.RingRange = 0;
|
||||
S.WallRange = 20;
|
||||
S.MinWallTargets = 3;
|
||||
// The player at the origin, the target 10 yd north; the player faces north.
|
||||
FakeHost.PlayerPose = (0x0101001Bu, 0f, 0f, 0f);
|
||||
FakeHost.Positions[Player] = FakeHost.PlayerPose;
|
||||
FakeHost.Positions[(uint)Target] = (0x0101001Bu, 0f, 10f, 0f);
|
||||
FakeHost.Names[(uint)Target] = "Drudge Skulker";
|
||||
FakeHost.HeadingDeg = 0;
|
||||
var host = FakeHost.Create(Player);
|
||||
var cache = FakeHost.MakeCache(host, Player, new[] { (uint)Target });
|
||||
C = new CombatManager(host, S, cache);
|
||||
C.SetPlayerId(Player);
|
||||
var sm = new SpellManager(host, S);
|
||||
sm.InitializeNatively();
|
||||
sm.RefreshKnownSpells();
|
||||
C.SetSpellManager(sm);
|
||||
C.WallPathCountOverride = () => InPath;
|
||||
C.WallClock = () => Now;
|
||||
}
|
||||
|
||||
public (string Spell, string Shape) Cast(string element, MonsterRule rule)
|
||||
{
|
||||
int id = C.FindBestShapedSpell(element, rule, out _, out int shape, arcTargetId: Target);
|
||||
return (NameOf(id), CombatManager.ShapeName(shape));
|
||||
}
|
||||
}
|
||||
|
||||
private static MonsterRule Wall(bool bolt = true) => new() { Name = "Drudge", UseBolt = bolt, UseWall = true };
|
||||
|
||||
private static void ShapePriority()
|
||||
{
|
||||
MonsterRule R(bool ring = false, bool bolt = false, bool blast = false, bool wall = false, bool arc = false)
|
||||
=> new() { UseArc = arc, UseRing = ring, UseBolt = bolt, UseBlast = blast, UseWall = wall };
|
||||
string N(int s) => CombatManager.ShapeName(s);
|
||||
int C(MonsterRule r, bool ringDue, bool wallDue, bool blastConditional = false, bool blastFanMet = false)
|
||||
=> CombatManager.ChooseCastShape(r, blastConditional, blastFanMet, ringDue, wallDue, () => true, out _);
|
||||
|
||||
var all = R(ring: true, bolt: true, blast: true, wall: true);
|
||||
Check.Eq(N(C(all, ringDue: true, wallDue: true, true, true)), "Ring", "all due: Ring");
|
||||
Check.Eq(N(C(all, ringDue: false, wallDue: true, true, true)), "Wall", "wall and blast due: Wall");
|
||||
Check.Eq(N(C(all, ringDue: false, wallDue: false, true, true)), "Blast", "only the blast due: Blast");
|
||||
Check.Eq(N(C(all, ringDue: false, wallDue: false, true, false)), "Bolt", "none due: the base shape (Bolt)");
|
||||
Check.Eq(N(C(R(wall: true), false, true)), "Wall", "wall-only, due: Wall");
|
||||
Check.Eq(N(C(R(wall: true), false, false)), "Bolt", "wall-only, not due: Bolt between walls (like ring-only)");
|
||||
Check.Eq(N(CombatManager.PickBaseShape(R(wall: true))), "Bolt", "wall-only base: Bolt");
|
||||
Check.Eq(N(CombatManager.PickBaseShape(R(wall: true, ring: true))), "Bolt", "ring + wall only: Bolt");
|
||||
Check.Eq(CombatManager.PickBaseShape(R()), -1, "nothing on: still no cast");
|
||||
|
||||
int asked = 0;
|
||||
int s = CombatManager.ChooseCastShape(R(arc: true, wall: true), false, false, false, wallDue: true, () => { asked++; return true; }, out bool g);
|
||||
Check.Eq(N(s), "Wall", "Arc + Wall, wall due: Wall");
|
||||
Check.True(asked == 0 && !g, "a due wall skips the arc test");
|
||||
Check.Eq(N(CombatManager.ChooseCastShape(R(arc: true, wall: true), false, false, false, null, out _)), "Arc",
|
||||
"the old overload (no wall) is unchanged");
|
||||
}
|
||||
|
||||
private static void WallPerElement()
|
||||
{
|
||||
var cases = new (string Element, string Wall)[]
|
||||
{
|
||||
("Acid", "Blistering Creeper"), ("Bludgeon", "Hammering Crawler"), ("Cold", "Foon-Ki's Glacial Floe"),
|
||||
("Lightning", "Os' Wall"), ("Fire", "Slithering Flames"), ("Pierce", "Spike Strafe"),
|
||||
("Blade", "Bed of Blades"), ("Slash", "Bed of Blades"),
|
||||
};
|
||||
string[] retail = cases.Select(c => c.Wall).Distinct().ToArray();
|
||||
foreach (var (element, wall) in cases)
|
||||
{
|
||||
var rig = new Rig(7, retail);
|
||||
Check.Eq(NameOf(rig.C.FindBestWallSpell(element)), wall, $"{element}: {wall} (of all seven known)");
|
||||
Check.Eq(rig.Cast(element, Wall()), (wall, "Wall"), $"{element}: cast as the Wall shape");
|
||||
}
|
||||
var any = new Rig(7, retail);
|
||||
Check.Eq(any.C.FindBestWallSpell("Nether"), 0, "Nether: no walls");
|
||||
Check.Eq(any.Cast("Nether", Wall()).Shape, "?", "Nether, nothing else known: no wall cast");
|
||||
|
||||
// Retail walls are power 200: level 5 by ACE's server formula, castable from tier 5.
|
||||
Check.Eq(SpellDatabase.LevelFromPower(SpellTable.ById(Id("Slithering Flames"))!.Power), 5, "Slithering Flames: level 5 (power 200)");
|
||||
Check.Eq(NameOf(new Rig(5, "Slithering Flames").C.FindBestWallSpell("Fire")), "Slithering Flames", "tier 5: the retail wall");
|
||||
Check.Eq(new Rig(4, "Slithering Flames").C.FindBestWallSpell("Fire"), 0, "tier 4: too hard (the same limit as Flame Bolt V)");
|
||||
|
||||
// Several known in the category: the highest level the tier allows, then the power.
|
||||
var fire = new Rig(8, "Slithering Flames", "Burning Earth", "Flame Whip");
|
||||
Check.Eq(NameOf(fire.C.FindBestWallSpell("Fire")), "Burning Earth", "tier 8: Burning Earth (power 400, level 8)");
|
||||
var fire7 = new Rig(7, "Slithering Flames", "Burning Earth");
|
||||
Check.Eq(NameOf(fire7.C.FindBestWallSpell("Fire")), "Slithering Flames", "tier 7: not the level-8 one");
|
||||
Check.Eq(new Rig(7, "Flame Bolt VI").C.FindBestWallSpell("Fire"), 0, "no wall known: none");
|
||||
|
||||
// The cold snapshot: never guess.
|
||||
FakeHost.Reset();
|
||||
var host = FakeHost.Create(Player);
|
||||
var c = new CombatManager(host, new LegacyUiSettings(), FakeHost.MakeCache(host, Player, Array.Empty<uint>()));
|
||||
var sm = new SpellManager(host, new LegacyUiSettings());
|
||||
sm.InitializeNatively();
|
||||
c.SetSpellManager(sm);
|
||||
Check.Eq(c.FindBestWallSpell("Fire"), 0, "spellbook snapshot cold: no wall");
|
||||
}
|
||||
|
||||
private static void WallOverride()
|
||||
{
|
||||
string[] book = { "Foon-Ki's Glacial Floe", "Frost Bolt VI", "Frost Blast VI", "Frost Arc VI" };
|
||||
var rig = new Rig(7, book);
|
||||
Check.Eq(rig.Cast("Cold", Wall()), ("Foon-Ki's Glacial Floe", "Wall"), "5 in the path (3 needed): the wall");
|
||||
rig.InPath = 2;
|
||||
Check.Eq(rig.Cast("Cold", Wall()), ("Frost Bolt VI", "Bolt"), "2 in the path: Bolt");
|
||||
rig.InPath = 5;
|
||||
rig.S.WallRange = 0;
|
||||
Check.Eq(rig.Cast("Cold", Wall()), ("Frost Bolt VI", "Bolt"), "Wall Range 0: no walls");
|
||||
rig.S.WallRange = 20;
|
||||
Check.Eq(rig.Cast("Cold", new MonsterRule { UseArc = true, UseWall = true }).Shape, "Wall", "Arc + Wall, due: Wall");
|
||||
Check.Eq(rig.Cast("Cold", new MonsterRule { UseBlast = true, UseWall = true, UseBolt = false }).Shape, "Wall", "Blast + Wall, both due: Wall");
|
||||
rig.InPath = 1;
|
||||
Check.Eq(rig.Cast("Cold", new MonsterRule { UseBlast = true, UseWall = true, UseBolt = false }), ("Frost Blast VI", "Blast"),
|
||||
"Blast + Wall, wall not due: Blast");
|
||||
rig.InPath = 5;
|
||||
Check.Eq(rig.Cast("Cold", new MonsterRule { UseBolt = true }), ("Frost Bolt VI", "Bolt"), "Wall off in the rule: unchanged");
|
||||
Check.Eq(rig.C.FindBestShapedSpell("Cold", Wall(), out _, out int probeShape), Id("Frost Bolt VI"),
|
||||
"an element probe (no target) never picks a wall");
|
||||
Check.Eq(CombatManager.ShapeName(probeShape), "Bolt", "probe shape Bolt");
|
||||
|
||||
var noWall = new Rig(7, "Frost Bolt VI");
|
||||
Check.Eq(noWall.Cast("Cold", Wall()), ("Frost Bolt VI", "Bolt"), "no cold wall known: Bolt (the wall isn't due)");
|
||||
|
||||
Check.Eq(CombatManager.ChooseCastShape(new MonsterRule { UseRing = true, UseWall = true }, false, false, true, true, null, out _),
|
||||
CombatManager.ShapeRing, "ring and wall due: Ring");
|
||||
}
|
||||
|
||||
private static void WallPathGeometry()
|
||||
{
|
||||
Check.True(CombatManager.InWallPath(10, 0), "the target itself");
|
||||
Check.True(CombatManager.InWallPath(15, 10), "15 yd, 10 deg off: 2.6 yd aside");
|
||||
Check.False(CombatManager.InWallPath(15, 25), "15 yd, 25 deg off: 6.3 yd aside, outside");
|
||||
Check.True(CombatManager.InWallPath(3, 60), "close, 60 deg off: 2.6 yd aside");
|
||||
Check.False(CombatManager.InWallPath(5, 120), "behind the caster: no");
|
||||
Check.True(CombatManager.InWallPath(5, -30), "the other side too");
|
||||
Check.Near(CombatManager.WallHalfWidth, 4.0, 1e-9, "half width 4 yd (5 projectiles across)");
|
||||
}
|
||||
|
||||
private static void WallFacing()
|
||||
{
|
||||
var rig = new Rig(7, "Slithering Flames");
|
||||
// Facing the target (within 1 degree): cast at once, no turn.
|
||||
FakeHost.HeadingDeg = 0.5f;
|
||||
Check.False(rig.C.HoldForWallFacing(Target), "0.5 deg off: cast now");
|
||||
Check.Eq(FakeHost.Turns, 0, "no turn");
|
||||
|
||||
// 90 degrees off: snap to the target, then hold for the settle.
|
||||
FakeHost.HeadingDeg = 90;
|
||||
Check.True(rig.C.HoldForWallFacing(Target), "90 deg off: hold");
|
||||
Check.Eq(FakeHost.Turns, 1, "one heading snap");
|
||||
Check.Near(FakeHost.HeadingDeg, 0, 0.5, "snapped to the target (north)");
|
||||
rig.Now = rig.Now.AddMilliseconds(500);
|
||||
Check.True(rig.C.HoldForWallFacing(Target), "500 ms later: still settling");
|
||||
rig.Now = rig.Now.AddMilliseconds(CombatManager.WallFaceSettleMs);
|
||||
Check.False(rig.C.HoldForWallFacing(Target), "after the settle: cast");
|
||||
Check.Eq(FakeHost.Turns, 1, "no second turn");
|
||||
|
||||
// Turned, but the target walked far off during the settle: turn again.
|
||||
FakeHost.HeadingDeg = 180;
|
||||
Check.True(rig.C.HoldForWallFacing(Target), "180 deg off: hold");
|
||||
FakeHost.Positions[(uint)Target] = (0x0101001Bu, 10f, 0f, 0f); // now due east
|
||||
rig.Now = rig.Now.AddMilliseconds(CombatManager.WallFaceSettleMs + 1);
|
||||
Check.True(rig.C.HoldForWallFacing(Target), "settled but 90 deg off now: turn again");
|
||||
Check.Eq(FakeHost.Turns, 3, "the second snap");
|
||||
Check.Near(FakeHost.HeadingDeg, 90, 0.5, "to the east");
|
||||
Check.True(FakeHost.Logs.Any(l => l.Contains("[CombatCast] wall: facing")), "the turn is logged");
|
||||
|
||||
// The drift allowed after the settle shrinks with distance (1.8 m to the side).
|
||||
Check.Near(CombatManager.WallDriftAllowedDeg(64.0), 1.6, 0.1, "70 yd: about 1.6 degrees");
|
||||
Check.Near(CombatManager.WallDriftAllowedDeg(9.0), 5.0, 0.01, "10 yd: capped at 5 degrees");
|
||||
|
||||
// Always turn: 6 degrees off is a snap too (a wall flies straight).
|
||||
var small = new Rig(7, "Slithering Flames");
|
||||
FakeHost.HeadingDeg = 6;
|
||||
Check.True(small.C.HoldForWallFacing(Target), "6 deg off: turn first");
|
||||
Check.Eq(FakeHost.Turns, 1, "one snap");
|
||||
|
||||
// A target that keeps moving: at most WallFaceMaxSnaps turns, then the wall goes anyway.
|
||||
var chase = new Rig(7, "Slithering Flames");
|
||||
FakeHost.HeadingDeg = 180;
|
||||
Check.True(chase.C.HoldForWallFacing(Target), "first snap");
|
||||
float east = 10f;
|
||||
for (int i = 1; i < CombatManager.WallFaceMaxSnaps; i++)
|
||||
{
|
||||
FakeHost.HeadingDeg = 180; // keeps facing away (the target ran round behind)
|
||||
chase.Now = chase.Now.AddMilliseconds(CombatManager.WallFaceSettleMs + 1);
|
||||
Check.True(chase.C.HoldForWallFacing(Target), $"snap {i + 1}");
|
||||
}
|
||||
FakeHost.HeadingDeg = 180;
|
||||
chase.Now = chase.Now.AddMilliseconds(CombatManager.WallFaceSettleMs + 1);
|
||||
Check.False(chase.C.HoldForWallFacing(Target), "after the last snap: cast anyway");
|
||||
_ = east;
|
||||
}
|
||||
|
||||
private static void WallCastThroughAttack()
|
||||
{
|
||||
var rig = new Rig(7, "Slithering Flames", "Flame Bolt VI");
|
||||
rig.S.MonsterRules.Clear();
|
||||
rig.S.MonsterRules.Add(new MonsterRule { Name = "Drudge", DamageType = "Fire", UseBolt = true, UseWall = true });
|
||||
rig.C.activeTargetId = Target;
|
||||
var target = new WorldObject(Target, "Drudge Skulker");
|
||||
MethodInfo attack = typeof(CombatManager).GetMethod("AttackWithMagic", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
FieldInfo held = typeof(CombatManager).GetField("_wallFaceHeld", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
FieldInfo tier = typeof(CombatManager).GetField("_lastCastTier", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
FieldInfo area = typeof(CombatManager).GetField("_lastCastWasRing", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
FieldInfo resolving = typeof(CombatManager).GetField("_awaitingCastResolution", BindingFlags.NonPublic | BindingFlags.Instance)!;
|
||||
|
||||
FakeHost.HeadingDeg = 270; // facing west, the target is north
|
||||
attack.Invoke(rig.C, new object[] { target });
|
||||
Check.Eq(FakeHost.Casts.Count, 0, "far off: no cast yet");
|
||||
Check.True((bool)held.GetValue(rig.C)!, "the wall is held for its turn");
|
||||
Check.Eq(FakeHost.Turns, 1, "turned first");
|
||||
|
||||
rig.Now = rig.Now.AddMilliseconds(300);
|
||||
attack.Invoke(rig.C, new object[] { target });
|
||||
Check.Eq(FakeHost.Casts.Count, 0, "300 ms later: still no cast (the server catching up)");
|
||||
|
||||
rig.Now = rig.Now.AddMilliseconds(CombatManager.WallFaceSettleMs);
|
||||
attack.Invoke(rig.C, new object[] { target });
|
||||
Check.Eq(FakeHost.Casts.Count, 1, "after the settle: cast");
|
||||
Check.Eq(NameOf(FakeHost.Casts[0].SpellId), "Slithering Flames", "the wall");
|
||||
Check.False((bool)held.GetValue(rig.C)!, "not held");
|
||||
Check.Eq(FakeHost.Turns, 1, "no turn with the cast");
|
||||
Check.True((bool)area.GetValue(rig.C)!, "an area cast for the bookkeeping (like a ring)");
|
||||
Check.Eq((int)tier.GetValue(rig.C)!, -5, "filed with the area tiers: level 5, negative");
|
||||
|
||||
// Already facing: straight to the cast, no turn. (A fresh rig: no cast resolving.)
|
||||
var facing = new Rig(7, "Slithering Flames", "Flame Bolt VI");
|
||||
facing.S.MonsterRules.Add(new MonsterRule { Name = "Drudge", DamageType = "Fire", UseBolt = true, UseWall = true });
|
||||
facing.C.activeTargetId = Target;
|
||||
FakeHost.HeadingDeg = 0;
|
||||
attack.Invoke(facing.C, new object[] { target });
|
||||
Check.Eq(FakeHost.Casts.Count, 1, "facing: cast at once");
|
||||
Check.Eq(NameOf(FakeHost.Casts[0].SpellId), "Slithering Flames", "the wall");
|
||||
Check.Eq(FakeHost.Turns, 0, "no turn");
|
||||
Check.True((bool)resolving.GetValue(facing.C)!, "the cast arms the cadence guard (no turn until it resolves)");
|
||||
|
||||
// A bolt (wall not due) is single-target as before.
|
||||
var bolt = new Rig(7, "Slithering Flames", "Flame Bolt VI");
|
||||
bolt.S.MonsterRules.Add(new MonsterRule { Name = "Drudge", DamageType = "Fire", UseBolt = true, UseWall = true });
|
||||
bolt.C.activeTargetId = Target;
|
||||
bolt.InPath = 1;
|
||||
FakeHost.HeadingDeg = 270;
|
||||
attack.Invoke(bolt.C, new object[] { target });
|
||||
Check.Eq(NameOf(FakeHost.Casts.Single().SpellId), "Flame Bolt VI", "wall not due: the bolt, no turn needed");
|
||||
Check.Eq(FakeHost.Turns, 0, "targeted casts don't turn (the server does)");
|
||||
Check.False((bool)area.GetValue(bolt.C)!, "single-target");
|
||||
Check.Eq((int)tier.GetValue(bolt.C)!, 6, "positive tier");
|
||||
}
|
||||
|
||||
private static void OldSettings()
|
||||
{
|
||||
var old = JsonSerializer.Deserialize("{\"MinRingTargets\":4,\"BlastRange\":10}", RynthAiJsonContext.Default.LegacyUiSettings)!;
|
||||
Check.Eq(old.WallRange, 0, "old profile: Wall Range off");
|
||||
Check.Eq(old.MinWallTargets, 3, "old profile: Min Wall Targets 3");
|
||||
var fresh = new LegacyUiSettings();
|
||||
Check.True(fresh.WallRange == 0 && fresh.MinWallTargets == 3, "new settings: off / 3");
|
||||
|
||||
var bridge = JsonSerializer.Deserialize("{\"MinRingTargets\":4}", RynthAiJsonContext.Default.SettingsBridgePayload)!;
|
||||
Check.True(bridge.WallRange == null && bridge.MinWallTargets == null, "older engine's settings: no wall values (left alone)");
|
||||
var newer = JsonSerializer.Deserialize("{\"WallRange\":15,\"MinWallTargets\":4}", RynthAiJsonContext.Default.SettingsBridgePayload)!;
|
||||
Check.True(newer.WallRange == 15 && newer.MinWallTargets == 4, "an engine with walls: carried");
|
||||
|
||||
const string oldRules = "[{\"Name\":\"Default\",\"Priority\":1,\"UseBolt\":true},{\"Name\":\"Drudge\",\"UseRing\":true,\"UseBlast\":true}]";
|
||||
var rules = JsonSerializer.Deserialize(oldRules, RynthAiJsonContext.Default.MonsterRuleList)!;
|
||||
Check.False(rules[0].UseWall || rules[1].UseWall, "old monster file: Wall off");
|
||||
rules[1].UseWall = true;
|
||||
string json = JsonSerializer.Serialize(rules, RynthAiJsonContext.Default.MonsterRuleList);
|
||||
Check.True(json.Contains("\"UseWall\": true"), "saved with UseWall");
|
||||
var back = JsonSerializer.Deserialize(json, RynthAiJsonContext.Default.MonsterRuleList)!;
|
||||
Check.True(back[1].UseWall && !back[0].UseWall, "round trip keeps it");
|
||||
var payload = JsonSerializer.Deserialize("{\"rules\":[{\"Name\":\"Mite\",\"UseWall\":true}]}", RynthAiJsonContext.Default.MonstersBridgePayload)!;
|
||||
Check.True(payload.Rules[0].UseWall, "the engine's rules JSON carries UseWall");
|
||||
}
|
||||
}
|
||||
|
|
@ -106,6 +106,13 @@ internal static class NavBake
|
|||
/// </summary>
|
||||
public static float AgentMaxClimb = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// How far a wall outline may be simplified. 1.3 m was fine inside the old 2 m agent margin;
|
||||
/// with a body-sized radius (0.6 m: gaps under about 4 m no longer close, Shoushi 2026-10-08)
|
||||
/// a 1.3 m simplification could cut a corner through the margin, so it follows the radius.
|
||||
/// </summary>
|
||||
internal static float EdgeMaxError(float radius) => Math.Min(1.3f, radius + 0.15f);
|
||||
|
||||
private static RcNavMeshBuildSettings Settings(float radius, bool tiled, float cellSize)
|
||||
{
|
||||
float slopeDeg = (float)(Math.Acos(TerrainSampler.FloorZ) * 180.0 / Math.PI);
|
||||
|
|
@ -115,7 +122,7 @@ internal static class NavBake
|
|||
agentHeight = 2.0f, agentRadius = radius, agentMaxClimb = AgentMaxClimb, agentMaxSlope = slopeDeg,
|
||||
minRegionSize = 8, mergedRegionSize = 20, partitioning = (int)RcPartition.WATERSHED,
|
||||
filterLowHangingObstacles = true, filterLedgeSpans = true, filterWalkableLowHeightSpans = true,
|
||||
edgeMaxLen = 12f, edgeMaxError = 1.3f, vertsPerPoly = VertsPerPoly, detailSampleDist = 6f, detailSampleMaxError = 1f,
|
||||
edgeMaxLen = 12f, edgeMaxError = EdgeMaxError(radius), vertsPerPoly = VertsPerPoly, detailSampleDist = 6f, detailSampleMaxError = 1f,
|
||||
// The solo bake reads the intermediate results (the .obj export); the tiled bake only
|
||||
// needs the finished navmesh, and keeping every tile's heightfields cost 1.5-2.7 GB a chunk.
|
||||
tiled = tiled, tileSize = tiled ? TiledTileSize : 0, keepInterResults = !tiled, buildAll = true,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ internal static partial class Program
|
|||
Run(nameof(RecallListColdSpellbook), RecallListColdSpellbook);
|
||||
Run(nameof(RecallMemoryRoundTrip), RecallMemoryRoundTrip);
|
||||
Run(nameof(RecallMessages), RecallMessages);
|
||||
Run(nameof(HandCastOnALifestone), HandCastOnALifestone);
|
||||
Run(nameof(HandCastPortalTie), HandCastPortalTie);
|
||||
Run(nameof(RecallNotLinked), RecallNotLinked);
|
||||
Run(nameof(DungeonLandblocksFromTheAtlas), DungeonLandblocksFromTheAtlas);
|
||||
Run(nameof(AtlasSearchAndBestMatch), AtlasSearchAndBestMatch);
|
||||
Run(nameof(ArrowSingleTarget), ArrowSingleTarget);
|
||||
Run(nameof(ArrowAlongRoute), ArrowAlongRoute);
|
||||
|
|
@ -249,6 +253,128 @@ internal static partial class Program
|
|||
Check(RecallMemory.Classify("", "Tom") == RecallEvent.None, "empty");
|
||||
Check(RecallMemory.SlotFor(RecallEvent.RecallingHome, out var slot) && slot == RecallSlot.House, "house slot");
|
||||
Check(!RecallMemory.SlotFor(RecallEvent.RecallingMarketplace, out _), "marketplace has no slot");
|
||||
// Your spell words (Spellcasting, 17) start a hand cast; the same words typed in local chat don't.
|
||||
Check(RecallMemory.Classify("You say, \"Zojak Ququ\"", "Tom", RecallMemory.ChatTypeSpellcasting) == RecallEvent.OwnSpellWords, "own spell words");
|
||||
Check(RecallMemory.Classify("You say, \"Zojak Ququ\"", "Tom", 2) == RecallEvent.None, "typed in local chat");
|
||||
Check(RecallMemory.Classify("You say, \"Zojak Ququ\"", "Tom") == RecallEvent.None, "chat type unknown");
|
||||
Check(RecallMemory.Classify("Ann says, \"Zojak Ququ\"", "Tom", RecallMemory.ChatTypeSpellcasting) == RecallEvent.None, "someone else casting");
|
||||
}
|
||||
|
||||
// ── A recall cast by hand: which one, from where it landed ───────────────
|
||||
|
||||
private const string Me = "Aelrynth|Tom";
|
||||
|
||||
private static RecallSpot At(double ns, double ew, string label = "") => new() { OnMap = true, Ns = ns, Ew = ew, Label = label };
|
||||
|
||||
private static void HandCastOnALifestone()
|
||||
{
|
||||
var mem = new RecallMemory();
|
||||
var known = new HashSet<int> { RecallPlanner.LifestoneRecall, RecallPlanner.PrimaryPortalTieRecall };
|
||||
var k = RecallPlanner.GuessHandCast(At(42.1, 33.6), atLifestone: true, known, mem, Me, 30, out var slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Learn && slot == RecallSlot.Lifestone, "on a lifestone: Lifestone Recall");
|
||||
|
||||
mem.Set(Me, RecallSlot.Lifestone, At(42.1, 33.6));
|
||||
k = RecallPlanner.GuessHandCast(At(42.11, 33.6), true, known, mem, Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "the same lifestone again: nothing new");
|
||||
k = RecallPlanner.GuessHandCast(At(-30.0, 70.0), true, known, mem, Me, 30, out slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Learn && slot == RecallSlot.Lifestone, "tied somewhere else since: learned again");
|
||||
|
||||
k = RecallPlanner.GuessHandCast(At(42.1, 33.6), true, new HashSet<int> { RecallPlanner.PrimaryPortalTieRecall }, new RecallMemory(), Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "no Lifestone Recall in the spellbook: not it");
|
||||
|
||||
// On the @lifestone lifestone with Recall the Sanctuary known: either spell, can't tell.
|
||||
var mem2 = new RecallMemory();
|
||||
mem2.Set(Me, RecallSlot.Sanctuary, At(42.1, 33.6));
|
||||
var known2 = new HashSet<int> { RecallPlanner.LifestoneRecall, RecallPlanner.RecallTheSanctuary };
|
||||
k = RecallPlanner.GuessHandCast(At(42.1, 33.6), true, known2, mem2, Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "Recall the Sanctuary could land there too");
|
||||
k = RecallPlanner.GuessHandCast(At(10, 10), true, null, mem2, Me, 30, out _, out var why);
|
||||
Check(k == RecallPlanner.HandCast.Nothing && why.Contains("spellbook"), "a cold spellbook teaches nothing");
|
||||
}
|
||||
|
||||
private static void HandCastPortalTie()
|
||||
{
|
||||
var oneTie = new HashSet<int> { RecallPlanner.SecondaryPortalTieRecall };
|
||||
var k = RecallPlanner.GuessHandCast(At(-33.5, 72.8), false, oneTie, new RecallMemory(), Me, 30, out var slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Learn && slot == RecallSlot.Tie2, "the only tie recall known");
|
||||
|
||||
var both = new HashSet<int> { RecallPlanner.PrimaryPortalTieRecall, RecallPlanner.SecondaryPortalTieRecall };
|
||||
k = RecallPlanner.GuessHandCast(At(-33.5, 72.8), false, both, new RecallMemory(), Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.AskTie, "both tie recalls known: ask which");
|
||||
|
||||
var mem = new RecallMemory();
|
||||
mem.Set(Me, RecallSlot.Tie1, At(-33.5, 72.8));
|
||||
k = RecallPlanner.GuessHandCast(At(-33.51, 72.8), false, both, mem, Me, 30, out slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing && slot == RecallSlot.Tie1, "a known tie's landing: nothing new");
|
||||
|
||||
// Portal Recall: lands where the last portal went (known: nothing; unknown: ask).
|
||||
var withPortalRecall = new HashSet<int> { RecallPlanner.PrimaryPortalTieRecall, RecallPlanner.PortalRecall };
|
||||
var mem2 = new RecallMemory();
|
||||
mem2.Set(Me, RecallSlot.LastPortal, At(12, 34));
|
||||
k = RecallPlanner.GuessHandCast(At(12, 34), false, withPortalRecall, mem2, Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "the last portal's landing: Portal Recall");
|
||||
k = RecallPlanner.GuessHandCast(At(-33.5, 72.8), false, withPortalRecall, mem2, Me, 30, out slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Learn && slot == RecallSlot.Tie1, "elsewhere, last portal known: the one tie");
|
||||
k = RecallPlanner.GuessHandCast(At(-33.5, 72.8), false, withPortalRecall, new RecallMemory(), Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.AskTie, "last portal unknown: could be Portal Recall, ask");
|
||||
|
||||
k = RecallPlanner.GuessHandCast(At(1, 1), false, new HashSet<int> { RecallPlanner.LifestoneRecall }, new RecallMemory(), Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "off a lifestone with no tie recall: not one RynthNav knows");
|
||||
|
||||
// A dungeon landing (off the map) is learned too, and matched by its label.
|
||||
var dungeon = new RecallSpot { OnMap = false, Label = "a dungeon (landblock 6145)" };
|
||||
k = RecallPlanner.GuessHandCast(dungeon, false, oneTie, new RecallMemory(), Me, 30, out slot, out _);
|
||||
Check(k == RecallPlanner.HandCast.Learn && slot == RecallSlot.Tie2, "a tie into a dungeon");
|
||||
var mem3 = new RecallMemory();
|
||||
mem3.Set(Me, RecallSlot.Tie2, new RecallSpot { OnMap = false, Label = "a dungeon (landblock 6145)" });
|
||||
k = RecallPlanner.GuessHandCast(dungeon, false, oneTie, mem3, Me, 30, out _, out _);
|
||||
Check(k == RecallPlanner.HandCast.Nothing, "the same dungeon again: nothing new");
|
||||
|
||||
// Once learned, the planner uses it.
|
||||
var plannerMem = new RecallMemory();
|
||||
plannerMem.Set(Me, RecallSlot.Tie2, At(-33.5, 72.8, "Shoushi"));
|
||||
var list = RecallPlanner.Build(Atlas.Empty, oneTie, plannerMem, Me, new List<string>());
|
||||
Check(list.Exists(o => o.SpellId == RecallPlanner.SecondaryPortalTieRecall && Math.Abs(o.Ns + 33.5) < 1e-9), "the learned tie is planned");
|
||||
}
|
||||
|
||||
private static void DungeonLandblocksFromTheAtlas()
|
||||
{
|
||||
// A dungeon landblock's tile is its surface (dungeon cells aren't baked): the walk must
|
||||
// know it's in one. Dungeon places and dungeon portal destinations count; a landblock
|
||||
// with places on the map (a town, its cellars) never does.
|
||||
Atlas atlas = Atlas.Parse(@"{""locations"":[
|
||||
{""name"":""Surface"",""type"":""Portal"",""cell"":""000102C8"",""place"":""dungeon"",""dest"":{""cell"":""26E5001D"",""place"":""outdoor"",""ns"":81.68,""ew"":-71.16}},
|
||||
{""name"":""Holtburg Dungeon Portal"",""type"":""Portal"",""cell"":""A9B40021"",""place"":""outdoor"",""ns"":42.0,""ew"":33.0,""dest"":{""cell"":""01F60230"",""place"":""dungeon""}},
|
||||
{""name"":""Shoushi"",""type"":""Town"",""cell"":""DA55001D"",""place"":""outdoor"",""ns"":-33.5,""ew"":72.8},
|
||||
{""name"":""Cellar Vendor"",""type"":""Vendor"",""cell"":""DA550105"",""place"":""dungeon""},
|
||||
{""name"":""Odd"",""type"":""Landmark"",""cell"":""zz"",""place"":""dungeon""}
|
||||
]}");
|
||||
HashSet<uint> d = atlas.DungeonLandblocks();
|
||||
Check(d.Contains(0x0001), "a dungeon place's landblock");
|
||||
Check(d.Contains(0x01F6), "a portal's dungeon destination");
|
||||
Check(!d.Contains(0x26E5) && !d.Contains(0xA9B4), "outdoor landblocks aren't dungeons");
|
||||
Check(!d.Contains(0xDA55), "a town landblock with a dungeon cell isn't one");
|
||||
Check(d.Count == 2, "nothing else (a bad cell is skipped)");
|
||||
}
|
||||
|
||||
private static void RecallNotLinked()
|
||||
{
|
||||
Check(RecallPlanner.SlotUnlinked(RecallPlanner.ErrorMustLinkLifestone, 0) == RecallSlot.Lifestone, "no lifestone tie: Lifestone Recall");
|
||||
Check(RecallPlanner.SlotUnlinked(RecallPlanner.ErrorMustLinkPortal, RecallPlanner.PrimaryPortalTieRecall) == RecallSlot.Tie1, "no primary tie");
|
||||
Check(RecallPlanner.SlotUnlinked(RecallPlanner.ErrorMustLinkPortal, RecallPlanner.SecondaryPortalTieRecall) == RecallSlot.Tie2, "no secondary tie");
|
||||
Check(RecallPlanner.SlotUnlinked(RecallPlanner.ErrorMustLinkPortal, RecallPlanner.PortalRecall) == RecallSlot.LastPortal, "no last portal");
|
||||
Check(RecallPlanner.SlotUnlinked(RecallPlanner.ErrorMustLinkPortal, 0) == null, "a portal recall cast by hand: can't tell which");
|
||||
Check(RecallPlanner.SlotUnlinked(0x0402, RecallPlanner.LifestoneRecall) == null, "a fizzle isn't a missing tie");
|
||||
Check(RecallPlanner.SpellFor(RecallSlot.Tie2) == RecallPlanner.SecondaryPortalTieRecall && RecallPlanner.SpellFor(RecallSlot.House) == 0, "slot spells");
|
||||
|
||||
var mem = new RecallMemory();
|
||||
mem.Set(Me, RecallSlot.Lifestone, At(42.1, 33.6));
|
||||
int v = mem.Version;
|
||||
mem.Clear(Me, RecallSlot.Lifestone);
|
||||
Check(mem.Get(Me, RecallSlot.Lifestone) == null && mem.Version > v, "forgotten (and saved)");
|
||||
var notes = new List<string>();
|
||||
RecallPlanner.Build(Atlas.Empty, new HashSet<int> { RecallPlanner.LifestoneRecall }, mem, Me, notes);
|
||||
Check(notes.Exists(n => n.Contains("Lifestone Recall") && n.Contains("cast Lifestone Recall once")), "the note says how to teach it");
|
||||
}
|
||||
|
||||
// ── Atlas ────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in a new issue