feat: regen buffs, wand aura, spellbook assess, indicator press flash
Four reports from one gate round. Three were mine; the fourth I first
mis-explained, and the correction is the useful part.
**The vital regeneration rates were never cast.** Regeneration (health),
Rejuvenation (stamina) and Mana Renewal (mana) all landed in the catch-all
Other bucket, which is off by default. Retail words each of the three
differently and two of the six phrasings do not begin with "Increases the
caster's" at all:
Increase caster's natural healing rate by 10%. <- and note "Increase"
Increases your Health Regeneration Rate by 50%. (Empyrean)
Increases the rate at which the caster regains Stamina by 10%.
Increases the caster's natural mana rate by 10%.
They are matched per vital, on by default, and ranked at the very tail of the
Life group so they finish the pass. The mana line had to be checked BEFORE the
generic "Increases the caster's X by N" match, which would otherwise read it as
a buff to a stat named "natural mana rate".
**Aura of Hermetic Link was the sixth aura line and the only one missed.**
"a magic casting implement's" is reached by none of the other alternatives, so
the wand's mana-conversion buff was silently in Other too.
**Right-clicking a spell in the spellbook did nothing.** I claimed this had
never worked; the user said it used to, and they were right -- I had checked
one file's history and concluded from it. The regression is 3e31b0ac, which
gave UiCatalogSlot its own RightClick case returning true unconditionally. On
any list that had not wired the examine seam -- the spellbook among them -- the
event was reported handled and UiRoot stopped bubbling. Two fixes: the row now
reports an unwired right-click UNHANDLED so bubbling continues, and the
spellbook wires the seam to the same appraisal window the spell bar uses.
Retail does this generically in the list rather than per window
(UIElement_ItemList::ListenToElementMessage @ 0x004E4F1F -> ExamineSpell
@ 0x00564A70), which is exactly why a per-controller seam could be forgotten
for one window and not another.
**No green flash when pressing an indicator.** Every indicator button authors
a full-size 0x100000F2 child whose DirectState is a draw-nothing File=0 image
and whose only other state, Normal_pressed, carries the green selector sprite
0x06004CE8 -- and the buttons author Normal_pressed with PassToChildren. But
UiButton.ConsumesDatChildren drops dat children at import, so the cascade had
nothing left to reach. The child is re-attached through the same repair the map
hotspot's rollover highlight already uses.
**tools/LayoutDump** is new, and is why the last two are diagnoses rather than
guesses: it prints an authored LayoutDesc tree -- geometry, edge modes, state
sets, PassToChildren, per-state media -- straight from the installed DATs.
"Does this button even have a pressed state?" was being answered by reading our
own importer and inferring; now it is read from the data.
Solution builds clean; 14,464 tests pass on the standard hermetic lane filter,
0 failures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
fe1f124cd8
commit
46ce6f238c
14 changed files with 1003 additions and 18 deletions
|
|
@ -109,6 +109,48 @@ public sealed class SpellbookWindowControllerTests
|
|||
(delete.Left, delete.Top, delete.FaceWidth, delete.FaceHeight));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RightClickingASpellRow_AssessesIt()
|
||||
{
|
||||
// Retail examines from the list itself:
|
||||
// UIElement_ItemList::ListenToElementMessage @ 0x004E4F1F takes the
|
||||
// right-click branch and calls ClientUISystem::ExamineSpell for a row
|
||||
// carrying a spellID, the same examination window an item or creature
|
||||
// opens. The spellbook never wired that seam.
|
||||
ImportedLayout layout = FixtureLoader.LoadSpellbook();
|
||||
Spellbook book = CreateSpellbook();
|
||||
book.OnSpellLearned(101u);
|
||||
var examined = new List<uint>();
|
||||
using SpellbookWindowController controller = Bind(
|
||||
layout, book, examineSpell: examined.Add)!;
|
||||
|
||||
UiItemList list = Assert.IsType<UiItemList>(
|
||||
layout.FindElement(SpellbookWindowController.SpellListId));
|
||||
UiCatalogSlot row = Assert.IsType<UiCatalogSlot>(list.GetItem(0));
|
||||
|
||||
Assert.True(row.OnEvent(new UiEvent(0, row, UiEventType.RightClick)));
|
||||
Assert.Equal([101u], examined);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RightClickWithNoExamineSeam_BubblesInsteadOfBeingSwallowed()
|
||||
{
|
||||
// The regression that lost the spellbook's assess: the catalog row
|
||||
// reported EVERY right-click handled, so on any list that had not wired
|
||||
// the seam UiRoot stopped bubbling and nothing ran. Reporting it
|
||||
// unhandled is what lets an ancestor still act on it.
|
||||
ImportedLayout layout = FixtureLoader.LoadSpellbook();
|
||||
Spellbook book = CreateSpellbook();
|
||||
book.OnSpellLearned(101u);
|
||||
using SpellbookWindowController controller = Bind(layout, book)!;
|
||||
|
||||
UiItemList list = Assert.IsType<UiItemList>(
|
||||
layout.FindElement(SpellbookWindowController.SpellListId));
|
||||
UiCatalogSlot row = Assert.IsType<UiCatalogSlot>(list.GetItem(0));
|
||||
|
||||
Assert.False(row.OnEvent(new UiEvent(0, row, UiEventType.RightClick)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LearnedSpells_AreAuthoredRows_InDisplayOrder_WithSelectionAndDragPayload()
|
||||
{
|
||||
|
|
@ -394,6 +436,7 @@ public sealed class SpellbookWindowControllerTests
|
|||
Action<uint>? addFavorite = null,
|
||||
Action<uint>? sendFilter = null,
|
||||
Action<uint>? removeSpell = null,
|
||||
Action<uint>? examineSpell = null,
|
||||
Action<string, Action<bool>>? showConfirmation = null,
|
||||
Action? close = null,
|
||||
ClientObjectTable? objects = null,
|
||||
|
|
@ -420,6 +463,7 @@ public sealed class SpellbookWindowControllerTests
|
|||
sendFilter?.Invoke(filters);
|
||||
},
|
||||
removeSpell ?? (_ => { }),
|
||||
examineSpell,
|
||||
showConfirmation ?? ((_, _) => { }),
|
||||
(componentId, amount) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -433,4 +433,94 @@ public class BuffPlanTests
|
|||
Assert.True(item[0].ManaCost <= item[1].ManaCost);
|
||||
Assert.Equal(8u, item[0].SpellId); // the 20-mana aura before the 30-mana bane
|
||||
}
|
||||
|
||||
// ── The vital regeneration rates ─────────────────────────────────────
|
||||
|
||||
[Theory]
|
||||
// Retail writes "Increase", not "Increases", and omits "the" -- a typo in
|
||||
// shipped data, and the reason the strict sentence shape lost this line.
|
||||
[InlineData("Increase caster's natural healing rate by 10%.", "Health")]
|
||||
[InlineData("Increases your Health Regeneration Rate by 50%. "
|
||||
+ "This effect can be layered with normal spell effects.", "Health")]
|
||||
// This one does not begin with "Increases the caster's" at all.
|
||||
[InlineData("Increases the rate at which the caster regains Stamina by 10%.", "Stamina")]
|
||||
[InlineData("Increases your Stamina Regeneration Rate by 50%.", "Stamina")]
|
||||
// This one DOES match the generic shape, and would have been read as a buff
|
||||
// to a stat called "natural mana rate" had it been checked in that order.
|
||||
[InlineData("Increases the caster's natural mana rate by 10%.", "Mana")]
|
||||
[InlineData("Increases your Mana Regeneration Rate by 50%.", "Mana")]
|
||||
public void RegenerationRatesAreClassifiedPerVital(string description, string vital)
|
||||
{
|
||||
BuffProfile.Classify(description, out var kind, out string target);
|
||||
Assert.Equal(BuffTargetKind.Regeneration, kind);
|
||||
Assert.Equal(vital, target);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HermeticLinkIsAWandAura()
|
||||
{
|
||||
// The only one of retail's six aura lines that none of the other
|
||||
// alternatives reach; it was landing in Other and never being cast.
|
||||
BuffProfile.Classify(
|
||||
"Increases a magic casting implement's mana conversion bonus by 10%.",
|
||||
out var kind, out _);
|
||||
Assert.Equal(BuffTargetKind.Aura, kind);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RegenerationRatesFinishThePass()
|
||||
{
|
||||
List<BuffLine> book = Lines(
|
||||
Spell(1, 201, 1, "Increases the caster's Focus by 10 points.",
|
||||
mana: 10, school: CreatureEnchantmentSkill),
|
||||
Spell(2, 202, 1, "Reduces damage the caster takes from Fire by 9%.",
|
||||
mana: 10, school: LifeMagicSkill),
|
||||
Spell(3, 203, 1, "Increases the caster's natural armor by 20 points.",
|
||||
mana: 10, school: LifeMagicSkill),
|
||||
// The three regen lines, deliberately the CHEAPEST in the book.
|
||||
Spell(4, 204, 1, "Increase caster's natural healing rate by 10%.",
|
||||
mana: 1, school: LifeMagicSkill),
|
||||
Spell(5, 205, 1, "Increases the rate at which the caster regains Stamina by 10%.",
|
||||
mana: 1, school: LifeMagicSkill),
|
||||
Spell(6, 206, 1, "Increases the caster's natural mana rate by 10%.",
|
||||
mana: 1, school: LifeMagicSkill));
|
||||
|
||||
List<PluginSpellInfo> plan = BuffPlan.Build(
|
||||
book,
|
||||
new[]
|
||||
{
|
||||
Skill(CreatureEnchantmentSkill, "Creature Enchantment",
|
||||
PluginSkillTraining.Specialized),
|
||||
Skill(LifeMagicSkill, "Life Magic", PluginSkillTraining.Trained),
|
||||
},
|
||||
new[] { Attribute(4, "Focus") },
|
||||
Array.Empty<PluginActiveEnchantment>(),
|
||||
Default,
|
||||
force: true);
|
||||
|
||||
// All six are cast -- regen is on by default...
|
||||
Assert.Equal(6, plan.Count);
|
||||
// ...the protections precede them...
|
||||
Assert.Equal(new uint[] { 2, 3 }, plan.Skip(1).Take(2).Select(s => s.SpellId));
|
||||
// ...and the three regen lines are the tail, despite being cheapest.
|
||||
Assert.Equal(
|
||||
new uint[] { 4, 5, 6 },
|
||||
plan.TakeLast(3).Select(s => s.SpellId).OrderBy(id => id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RegenerationRatesCanBeSwitchedOff()
|
||||
{
|
||||
List<BuffLine> book = Lines(
|
||||
Spell(1, 301, 1, "Increase caster's natural healing rate by 10%.",
|
||||
school: LifeMagicSkill));
|
||||
var off = new BuffSettings { BuffRegeneration = false };
|
||||
|
||||
Assert.Single(BuffPlan.Build(book, Array.Empty<PluginSkillInfo>(),
|
||||
Array.Empty<PluginAttributeInfo>(),
|
||||
Array.Empty<PluginActiveEnchantment>(), Default, force: true));
|
||||
Assert.Empty(BuffPlan.Build(book, Array.Empty<PluginSkillInfo>(),
|
||||
Array.Empty<PluginAttributeInfo>(),
|
||||
Array.Empty<PluginActiveEnchantment>(), off, force: true));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue