fix(inventory-go): add Prodigal Spirit Drinker effect; document dmgMod key substitution; test wand mastery fallback

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-15 08:00:22 +02:00
parent 99f394d1ef
commit 9b2f28d942
2 changed files with 44 additions and 5 deletions

View file

@ -23,6 +23,38 @@ func TestOD_Wand(t *testing.T) {
}
}
// Wand with an ACTIVE Prodigal Spirit Drinker (3735, change .15, bonus 0):
// shown ElemVsMonsters 1.55 un-buffs to 1.55 .15 = 1.40 → OD +22, same
// underlying weapon as TestOD_Wand.
func TestOD_WandActiveProdigalSpiritDrinker(t *testing.T) {
raw := map[string]any{
"ObjectClass": 31.0,
"IntValues": map[string]any{"159": 34.0, "160": 385.0},
"DoubleValues": map[string]any{"152": 1.55, "167772169": 8.0},
"Spells": []any{}, "ActiveSpells": []any{3735.0},
}
od, ok := computeOD(raw)
if !ok || !approx(od, 22.0) {
t.Fatalf("wand w/ active Prodigal SD OD = %v ok=%v, want +22", od, ok)
}
}
// Wand carrying a mastery value (353) with no matching wand table row: the
// exact-match lookup on (34,5,0,385) misses, and the mastery-0 retry must hit
// the (34,0,0,385) row → OD +22 as in TestOD_Wand.
func TestOD_WandMasteryFallback(t *testing.T) {
raw := map[string]any{
"ObjectClass": 31.0,
"IntValues": map[string]any{"159": 34.0, "353": 5.0, "160": 385.0},
"DoubleValues": map[string]any{"152": 1.40, "167772169": 8.0},
"Spells": []any{}, "ActiveSpells": []any{},
}
od, ok := computeOD(raw)
if !ok || !approx(od, 22.0) {
t.Fatalf("wand mastery-fallback OD = %v ok=%v, want +22", od, ok)
}
}
// Non-loot (no workmanship) → no OD.
func TestOD_NonLootNull(t *testing.T) {
raw := map[string]any{