RynthCore as of 2026-11-26 (internal 5e4b1f3): release 2026.11.26.1
This commit is contained in:
parent
d746d568ae
commit
2ff89683f4
75 changed files with 3838 additions and 173 deletions
|
|
@ -35,6 +35,7 @@ namespace CombatSettingsTests
|
|||
("KiteTagFirst", typeof(bool?), "true"),
|
||||
("MeleeThroughWalls", typeof(bool?), "true"), // Combat > Targeting > Melee through walls (2026-11-15)
|
||||
("DebuffAllBeforeAttacking", typeof(bool?), "false"), // Combat > Targeting > Debuff every monster in range before attacking (2026-11-22)
|
||||
("ShowLosLine", typeof(bool?), "false"), // Combat > Line Of Sight > Show Line of Sight (2026-11-26)
|
||||
};
|
||||
|
||||
private static int Main()
|
||||
|
|
@ -103,11 +104,12 @@ namespace CombatSettingsTests
|
|||
("Combat", "Magic Response", "Combo", 0, 0, 3), // beside Missile Response since 2026-11-11
|
||||
("Combat", "Melee through walls", "Bool", 1, 0, 1), // on by default (2026-11-15)
|
||||
("Combat", "Debuff every monster in range before attacking", "Bool", 0, 0, 1), // off by default (2026-11-22)
|
||||
("Combat", "Show Line of Sight", "Bool", 0, 0, 1), // off by default (2026-11-26)
|
||||
};
|
||||
object older = Parse("{\"BoostNavPriority\":true}"); // what an older RynthAi sends
|
||||
object newer = Parse("{\"VariablePowerMin\":50,\"VariablePowerMax\":100,\"MissileEnvironmentResponse\":0,\"MagicEnvironmentResponse\":0," +
|
||||
"\"EnvironmentImpactLimit\":2,\"EnvironmentImpactWindowSec\":20,\"EnvironmentApproachMeters\":6,\"EnvironmentMinDistance\":3," +
|
||||
"\"EnvironmentSkipSec\":30,\"KitePullMeters\":20,\"KiteTagFirst\":true,\"MeleeThroughWalls\":true,\"DebuffAllBeforeAttacking\":false}"); // the plugin's own defaults
|
||||
"\"EnvironmentSkipSec\":30,\"KitePullMeters\":20,\"KiteTagFirst\":true,\"MeleeThroughWalls\":true,\"DebuffAllBeforeAttacking\":false,\"ShowLosLine\":false}"); // the plugin's own defaults
|
||||
foreach (var (tab, label, kind, def, min, max) in rows)
|
||||
{
|
||||
object? row = Row(tab, label, kind);
|
||||
|
|
@ -147,9 +149,12 @@ namespace CombatSettingsTests
|
|||
Set(Row("Combat", "Magic Response", "Combo")!, edit, 1);
|
||||
Set(Row("Combat", "Melee through walls", "Bool")!, edit, 0);
|
||||
Set(Row("Combat", "Debuff every monster in range before attacking", "Bool")!, edit, 1);
|
||||
Set(Row("Combat", "Show Line of Sight", "Bool")!, edit, 1);
|
||||
string after = JsonSerializer.Serialize(edit, info);
|
||||
Check(after.Contains("\"MeleeThroughWalls\":false"), "Melee through walls unticked saves false (RynthAi turns it off)");
|
||||
Check(after.Contains("\"DebuffAllBeforeAttacking\":true"), "Debuff every monster ticked saves true (RynthAi turns it on)");
|
||||
Check(after.Contains("\"ShowLosLine\":true"), "Show Line of Sight ticked saves true (RynthAi turns it on)");
|
||||
Check(JsonSerializer.Serialize(Parse("{\"BoostNavPriority\":true}"), info).Contains("\"ShowLosLine\":null"), "an older RynthAi's Show Line of Sight is sent back absent (unchanged)");
|
||||
Check(after.Contains("\"KitePullMeters\":55") && after.Contains("\"KiteTagFirst\":true") && after.Contains("\"MagicEnvironmentResponse\":1"), "the edits land on their own properties");
|
||||
Check(after.Contains("\"BoostNavPriority\":true") && after.Contains("\"EnvironmentSkipSec\":60") && after.Contains("\"MissileEnvironmentResponse\":2"), "the other settings ride along unchanged");
|
||||
|
||||
|
|
@ -208,9 +213,91 @@ namespace CombatSettingsTests
|
|||
foreach (string f in voidFields)
|
||||
Check(ruleJson.Contains($"\"{f}\":true"), $"the panel sends \"{f}\":true");
|
||||
|
||||
// ── Settings > Spell Combat > Attack Spell Shapes (2026-11-26) ─────────────
|
||||
DefaultShapes(engine, tabs, rule, Lst);
|
||||
|
||||
return Finish();
|
||||
}
|
||||
|
||||
// The DEFAULT monster line's shapes as Settings rows (UI/Data/DefaultSpellShapes.cs): "use streaks
|
||||
// instead of bolts" where the attack-spell settings are, and the monsters that keep their own.
|
||||
private static void DefaultShapes(Assembly engine, Dictionary<string, List<object>> tabs, Type rule, Func<object[], IList> lst)
|
||||
{
|
||||
Type shapes = engine.GetType(Ns + "DefaultSpellShapes", throwOnError: true)!;
|
||||
var defs = ((string Field, string Label, string Tip)[])shapes.GetField("Rows", All)!.GetValue(null)!;
|
||||
static string Label(object r) => (string?)r.GetType().GetProperty("Label")!.GetValue(r) ?? "";
|
||||
static string Kind(object r) => r.GetType().GetProperty("Kind")!.GetValue(r)!.ToString()!;
|
||||
|
||||
// The rows: the streak one first, every shape once, on Spell Combat, before Casting.
|
||||
Check(defs.Length == 6 && defs[0].Field == "UseStreak" && defs[0].Label == "Use streaks instead of bolts", "the first row is Use streaks instead of bolts");
|
||||
Check(defs.Select(d => d.Field).OrderBy(f => f).SequenceEqual(new[] { "UseArc", "UseBlast", "UseBolt", "UseRing", "UseStreak", "UseWall" }),
|
||||
"every shape of a monster rule has a row (arc, blast, bolt, ring, streak, wall)");
|
||||
List<object> spell = tabs["Spell Combat"];
|
||||
int section = spell.FindIndex(r => Label(r) == (string)shapes.GetField("SectionLabel", All)!.GetValue(null)! && Kind(r) == "Section");
|
||||
int casting = spell.FindIndex(r => Label(r) == "Casting" && Kind(r) == "Section");
|
||||
Check(section == 0 && casting > section, "Attack Spell Shapes is the first section of Spell Combat, above Casting");
|
||||
foreach (var d in defs)
|
||||
{
|
||||
object? row = spell.FirstOrDefault(r => Label(r) == d.Label && Kind(r) == "Bool");
|
||||
Check(row != null, $"Spell Combat has the Bool row '{d.Label}'");
|
||||
Check((bool)shapes.GetMethod("IsShapeLabel", All)!.Invoke(null, new object?[] { d.Label })!, $"'{d.Label}' is known as a shape row (the My settings drawer polls the rules for it)");
|
||||
Check(d.Tip.Length > 20, $"'{d.Label}' has a tooltip");
|
||||
}
|
||||
Check(!(bool)shapes.GetMethod("IsShapeLabel", All)!.Invoke(null, new object?[] { "Min Ring Targets" })!, "other rows aren't shape rows");
|
||||
Check(spell.Any(r => Label(r) == (string)shapes.GetField("OpenMonstersLabel", All)!.GetValue(null)! && Kind(r) == "Button"), "a button opens the per-monster place");
|
||||
|
||||
object Rule(string name, bool arc = false, bool bolt = true, bool ring = false, bool streak = false, bool blast = false, bool wall = false)
|
||||
{
|
||||
object r = Activator.CreateInstance(rule, nonPublic: true)!;
|
||||
rule.GetProperty("Name")!.SetValue(r, name);
|
||||
rule.GetProperty("UseArc")!.SetValue(r, arc);
|
||||
rule.GetProperty("UseBolt")!.SetValue(r, bolt);
|
||||
rule.GetProperty("UseRing")!.SetValue(r, ring);
|
||||
rule.GetProperty("UseStreak")!.SetValue(r, streak);
|
||||
rule.GetProperty("UseBlast")!.SetValue(r, blast);
|
||||
rule.GetProperty("UseWall")!.SetValue(r, wall);
|
||||
return r;
|
||||
}
|
||||
bool Flag(object r, string f) => (bool)rule.GetProperty(f)!.GetValue(r)!;
|
||||
void Set(object r, string f, bool on) => shapes.GetMethod("Set", All)!.Invoke(null, new object[] { r, f, on });
|
||||
string Casts(object r) => (string)shapes.GetMethod("Casts", All)!.Invoke(null, new[] { r })!;
|
||||
string Summary(params object[] rules) => (string)shapes.GetMethod("Summary", All)!.Invoke(null, new object?[] { lst(rules) })!;
|
||||
|
||||
// Setting a shape.
|
||||
object def = Rule("Default");
|
||||
Set(def, "UseStreak", true);
|
||||
Check(Flag(def, "UseStreak") && Flag(def, "UseBolt") && Casts(def) == "Streak", "Use streaks on: streaks are cast instead of bolts");
|
||||
Set(def, "UseArc", true);
|
||||
Check(Casts(def) == "Arc", "arcs come first (RynthAi's order: Arc, Streak, Blast, Bolt)");
|
||||
Set(def, "UseArc", false);
|
||||
Set(def, "UseRing", true);
|
||||
Check(Casts(def) == "Streak, Ring when enough are near", "a ring is told as the override it is: " + Casts(def));
|
||||
object only = Rule("Default", bolt: false, streak: true);
|
||||
Set(only, "UseStreak", false);
|
||||
Check(Flag(only, "UseBolt") && !Flag(only, "UseStreak"), "turning the last shape off turns bolts back on (never no shape: RynthAi wouldn't cast)");
|
||||
object blastBolt = Rule("Default", blast: true);
|
||||
Check(Casts(blastBolt) == "Blast", "a blast wins over the bolt");
|
||||
Set(blastBolt, "Fester", true);
|
||||
Check(!Flag(blastBolt, "Fester"), "Set only touches shapes");
|
||||
|
||||
// The line under the rows: what the Default line casts, and the monsters with their own entry.
|
||||
object d1 = Rule("Default", streak: true);
|
||||
string none = Summary(d1);
|
||||
Check(none == "Every monster casts Streak.", "no monster has its own entry: " + none);
|
||||
string three = Summary(d1, Rule("Drudge"), Rule("Mite Squire", arc: true), Rule("Tusker", bolt: false, streak: true, ring: true), Rule("Olthoi", streak: true));
|
||||
Check(three.StartsWith("Monsters without their own entry cast Streak. 3 monsters have their own setting: Drudge, Mite Squire, Tusker.", StringComparison.Ordinal),
|
||||
"three monsters with other shapes are counted and named: " + three);
|
||||
Check(three.Contains(" 1 more has its own entry, set the same for now.", StringComparison.Ordinal), "one set the same is counted apart: " + three);
|
||||
Check(three.EndsWith("Those keep their own shapes: change one in Monsters (click its name).", StringComparison.Ordinal), "and says where to change them: " + three);
|
||||
string many = Summary(d1, Rule("A"), Rule("B"), Rule("C"), Rule("D"), Rule("E"));
|
||||
Check(many.Contains("5 monsters have their own setting: A, B, C (+2 more).", StringComparison.Ordinal), "past three names: +N more: " + many);
|
||||
string same = Summary(d1, Rule("Drudge", streak: true));
|
||||
Check(same.Contains("1 monster has its own entry, set the same for now. It keeps its own shapes", StringComparison.Ordinal), "one the same, singular: " + same);
|
||||
Check(Summary(Rule("Drudge")) == "", "no Default rule: no line (the rows are hidden)");
|
||||
object lower = Rule("default", streak: true);
|
||||
Check(Summary(lower, Rule("Drudge", streak: true)).StartsWith("Monsters without", StringComparison.Ordinal), "Default is found in any case");
|
||||
}
|
||||
|
||||
private static int Finish()
|
||||
{
|
||||
Console.WriteLine(_fails == 0 ? $"All {_asserts} checks passed." : $"{_fails} of {_asserts} checks FAILED.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue