RynthSuite as of 2026-10-04 (internal c94715f): RynthOracle (based on Oracle of Dereth by Advis Eveldan) and RynthInventory, RynthAi patrol doorways and rooms, healing priority, strict monster priority, finish the wounded target, slayer weapons, arcs when clear, blasts like rings, learn unknown spells, looting fixes, release 2026.10.4.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c33e24a610
commit
12ca25f911
426 changed files with 108239 additions and 7521 deletions
|
|
@ -77,6 +77,26 @@ internal static class ComponentDatabase
|
|||
private static readonly Dictionary<int, uint[]> _spellComps = new();
|
||||
private static bool _spellCompsLoaded;
|
||||
|
||||
// spellId → (MagicSchool, Power) from the same SpellTable pass. The server's own
|
||||
// values (ACE's Spell.School / Spell.Power read the dat's SpellBase), so learning a
|
||||
// scroll is judged with the numbers the server uses. Tests set entries directly.
|
||||
private static readonly Dictionary<int, (int School, int Power)> _spellMeta = new();
|
||||
internal static readonly Dictionary<int, (int School, int Power)> SpellMetaOverride = new();
|
||||
|
||||
/// <summary>
|
||||
/// A spell's magic school (ACE MagicSchool: War 1, Life 2, Item 3, Creature 4, Void 5)
|
||||
/// and power (difficulty) from the portal.dat SpellTable. False when the dat couldn't be
|
||||
/// read or the spell isn't in it.
|
||||
/// </summary>
|
||||
public static bool TryGetSpellSchoolAndPower(int spellId, out int school, out int power)
|
||||
{
|
||||
if (SpellMetaOverride.TryGetValue(spellId, out var o)) { school = o.School; power = o.Power; return true; }
|
||||
if (SpellMetaOverride.Count == 0) EnsureLoaded();
|
||||
if (_spellMeta.TryGetValue(spellId, out var m)) { school = m.School; power = m.Power; return true; }
|
||||
school = 0; power = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool _loaded;
|
||||
private static readonly object _lock = new();
|
||||
private static Action<string>? _log;
|
||||
|
|
@ -319,26 +339,27 @@ internal static class ComponentDatabase
|
|||
{
|
||||
if (r.BaseStream.Position + 4 > raw.Length) break;
|
||||
uint spellId = r.ReadUInt32();
|
||||
uint[] comps = ReadSpellBaseFormula(r);
|
||||
uint[] comps = ReadSpellBaseFormula(r, out uint school, out uint power);
|
||||
_spellComps[(int)spellId] = comps;
|
||||
_spellMeta[(int)spellId] = ((int)school, (int)power);
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private static uint[] ReadSpellBaseFormula(BinaryReader r)
|
||||
private static uint[] ReadSpellBaseFormula(BinaryReader r, out uint school, out uint power)
|
||||
{
|
||||
byte[] nameB = ReadObf(r); Align(r);
|
||||
byte[] descB = ReadObf(r); Align(r);
|
||||
|
||||
r.ReadUInt32(); // School
|
||||
school = r.ReadUInt32(); // School (MagicSchool: War 1, Life 2, Item 3, Creature 4, Void 5)
|
||||
r.ReadUInt32(); // Icon
|
||||
r.ReadUInt32(); // Category
|
||||
r.ReadUInt32(); // Bitfield
|
||||
r.ReadUInt32(); // BaseMana
|
||||
r.ReadSingle(); // BaseRangeConstant
|
||||
r.ReadSingle(); // BaseRangeMod
|
||||
r.ReadUInt32(); // Power
|
||||
power = r.ReadUInt32(); // Power (the spell's difficulty; ACE's scroll rule reads it)
|
||||
r.ReadSingle(); // SpellEconomyMod
|
||||
r.ReadUInt32(); // FormulaVersion
|
||||
r.ReadSingle(); // ComponentLoss
|
||||
|
|
|
|||
Loading…
Reference in a new issue