feat(mosstank): buff trained skills and attributes, pick tiers by skill, manage mana
Reworks MossTank against user feedback and the Virindi Tank feature docs
(virindi.net is reachable again over https with a self-signed cert; the
research doc's "unreachable" note is stale).
VTank's stated default is the spec: "automatically buffs every Attribute and
Skill you have trained", and "all buff spells are recast when they go below 5
minutes". The previous pass buffed the whole spellbook and refreshed at 60s;
both are corrected.
The hard problem was working out WHICH stat each buff raises. The client's
spell table has no such link -- it arrives from the server with the
enchantment -- and the naming is too irregular to infer: Invulnerability
raises Melee Defense, Impregnability raises Missile Defense, Fealty raises
Loyalty, Sprint raises Run, Arcane Enlightenment raises Arcane Lore, and the
line called Willpower raises the attribute named Self. Any name-matching
scheme dies on that last one.
Retail states it outright in each spell's own description ("Increases the
caster's Life Magic skill by 10 points"), so BuffProfile derives the whole
mapping from shipped data at runtime. It also carries the one alias the data
needs: the spell text says "Assess Monster" where the skill table says "Assess
Creature", and without that the skill silently never matches.
Two data facts that would each have caused a real bug, found by dumping the
spell table rather than assuming:
* Family is NOT a spell-line identity in general. Retail groups the
instantaneous vital transfers by SOURCE vital, so family 89 holds both
"Stamina to Health" and "Stamina to Mana". Picking the strongest tier in a
family would convert into the wrong vital about half the time. Buff lines
group by family (correct for duration buffs, which is retail's own stacking
bucket); the conversions are found by name stem instead.
* Instantaneous spells have no duration and must be excluded from buff lines
entirely, or they are treated as buffs that never appear to land.
Tier selection now follows the character's skill in the casting school against
the spell's difficulty (VTank's SpellDiffExcessThreshold-Buff), which is why
PluginSpellInfo gained School as a SKILL id -- MagicSchool is retail's 1-5
school enum, not something a character trains.
Mana upkeep is the loop asked for: convert stamina to mana when mana is low,
Revitalize when that leaves stamina too low to convert, and refuse to drain
stamina past a floor. Unknown vitals read as zero and are treated as "no
information" rather than "empty", so it will not cast on a healthy character.
Panel no longer shows at character select. IsAvailable is now the runtime's
own lifecycle state rather than a proxy, and markup gained visible="{Binding}"
plus UiElement.VisibleSource -- evaluated before the visible gate, because
TickSelfAndChildren returns early when hidden and an element could otherwise
never un-hide itself.
Also: a generated SpellId enum of all 6,266 spells (tools/SpellDump --enum),
generated from portal.dat rather than copied, so it cannot drift and carries
no third-party licence; skill and spell names now come from the retail tables
for display; and the Buff click logs unconditionally, so "nothing happened"
can be told apart from "the click never arrived".
Solution builds clean; 14,433 tests pass on the standard hermetic lane filter,
0 failures, including 21 covering the buff profile, tier selection and mana
loop.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9d1117b923
commit
17ebfc434d
18 changed files with 14052 additions and 279 deletions
67
tools/SpellDump/Program.cs
Normal file
67
tools/SpellDump/Program.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// Dump self-targeted beneficial spells from portal.dat's SpellTable so buff
|
||||
// selection can be built on what the data actually says rather than on
|
||||
// remembered spell names.
|
||||
using AcDream.Content;
|
||||
using AcDream.Core.Spells;
|
||||
using DatReaderWriter;
|
||||
using DatReaderWriter.Options;
|
||||
using SysEnv = System.Environment;
|
||||
|
||||
string datDir = SysEnv.GetEnvironmentVariable("ACDREAM_DAT_DIR")
|
||||
?? Path.Combine(SysEnv.GetFolderPath(SysEnv.SpecialFolder.UserProfile),
|
||||
"Documents", "Asheron's Call");
|
||||
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
||||
using var adapter = new DatCollectionAdapter(dats);
|
||||
MagicCatalog catalog = MagicCatalog.Load(adapter);
|
||||
SpellTable table = catalog.SpellTable;
|
||||
Console.WriteLine($"spells loaded: {table.Count}");
|
||||
|
||||
if (args.Length > 0 && args[0] == "--desc")
|
||||
{
|
||||
foreach (uint id in table.SpellIds.OrderBy(i => i))
|
||||
{
|
||||
if (!table.TryGet(id, out var m)) continue;
|
||||
if (!m.IsSelfTargeted || !m.IsBeneficial || m.IsDebuff) continue;
|
||||
if (m.Generation != 1) continue; // one representative per line
|
||||
Console.WriteLine($"fam {m.Family,-5} 0x{m.SpellId:X4} {m.Name,-40} | {m.Description}");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length > 0 && args[0] == "--skills")
|
||||
{
|
||||
var skillTable = dats.Get<DatReaderWriter.DBObjs.SkillTable>(0x0E000004u)
|
||||
?? throw new InvalidOperationException("SkillTable 0x0E000004 missing");
|
||||
Console.WriteLine($"skills: {skillTable.Skills.Count}");
|
||||
foreach (var kv in skillTable.Skills.OrderBy(k => (uint)k.Key))
|
||||
Console.WriteLine($" {(uint)kv.Key,-4} {kv.Value.Name}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length > 0 && args[0] == "--enum")
|
||||
{
|
||||
string outPath = args.Length > 1
|
||||
? args[1]
|
||||
: Path.Combine("src", "AcDream.Plugins.MossTank", "SpellId.g.cs");
|
||||
SpellDump.EmitEnum.Run(table, outPath, "AcDream.Plugins.MossTank", "SpellId");
|
||||
return;
|
||||
}
|
||||
|
||||
string filter = args.Length > 0 ? args[0].ToLowerInvariant() : "";
|
||||
|
||||
var rows = table.SpellIds
|
||||
.Select(id => table.TryGet(id, out var m) ? m : null)
|
||||
.Where(s => s is not null)!
|
||||
.Select(s => s!)
|
||||
.Where(s => s.IsSelfTargeted && s.IsBeneficial && !s.IsDebuff)
|
||||
.Where(s => filter.Length == 0 || s.Name.ToLowerInvariant().Contains(filter))
|
||||
.OrderBy(s => s.Family).ThenBy(s => s.Generation)
|
||||
.ToList();
|
||||
|
||||
Console.WriteLine($"self-targeted beneficial: {rows.Count}\n");
|
||||
Console.WriteLine($"{"family",-8} {"gen",-4} {"id",-8} {"school",-12} {"mana",-5} {"dur",-8} name");
|
||||
foreach (var s in rows)
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"{s.Family,-8} {s.Generation,-4} 0x{s.SpellId:X4} {s.School,-12} {s.ManaCost,-5} {s.Duration,-8:F0} {s.Name}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue