From 536d7368032f1f94679746b3fec417bd19ad5326 Mon Sep 17 00:00:00 2001 From: troytt <47798984@qq.com> Date: Tue, 22 Sep 2026 03:44:47 +0000 Subject: [PATCH] feat(skill-093): implement 1.13c Bone Spirit module and Vitest suite (#247) --- .../skills/impl/nec/skill-093-bone-spirit.ts | 44 +++++++ .../skills/nec/skill-093-bone-spirit.test.ts | 109 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 src/game/skills/impl/nec/skill-093-bone-spirit.ts create mode 100644 tests/skills/nec/skill-093-bone-spirit.test.ts diff --git a/src/game/skills/impl/nec/skill-093-bone-spirit.ts b/src/game/skills/impl/nec/skill-093-bone-spirit.ts new file mode 100644 index 0000000..f25d72e --- /dev/null +++ b/src/game/skills/impl/nec/skill-093-bone-spirit.ts @@ -0,0 +1,44 @@ +/** + * Diablo II: Lord of Destruction v1.13c — Skill #093: Bone Spirit (NEC) + * + * Authoritative 1.13c Ground Truth (`Patch_D2.mpq` -> `data\\global\\excel\\Skills.txt`): + * - Skill ID: 93 ("Bone Spirit") + * - Class: "nec" + * - Required Level: 30 + * - Server Functions: srvstfunc=0, srvdofunc=10, srvprgfunc1=0, srvprgfunc2=0, srvprgfunc3=0 + * - Associated Missile / State / Summon: missile="bonespirit", state="", summon="" + * - 1.13c Synergy Formulas: EDmgSymPerCalc="(skill('Bone Wall'.blvl)+skill('Bone Prison'.blvl)+skill('Teeth'.blvl)+skill('Bone Spear'.blvl))*par8", DmgSymPerCalc="", ELenSymPerCalc="" + */ +import type { + SkillEvalContext, + SkillEvalResult, + SkillExecContext, + SkillExecOutcome, + SkillModule, +} from '../../types.ts' +import { evaluateSkillCore113c, executeSkillCore113c } from '../../registry.ts' + +export const skillModule: SkillModule = { + skillId: 93, + name: "Bone Spirit", + charClass: "nec", + srvStFunc: 0, + srvDoFunc: 10, + + evaluate(ctx: SkillEvalContext): SkillEvalResult { + return evaluateSkillCore113c(ctx) + }, + + executeDo(ctx: SkillExecContext): SkillExecOutcome { + const outcome = executeSkillCore113c(ctx) + return { + ...outcome, + notes: [ + ...outcome.notes, + 'skill_module:skill-093-bone-spirit', + ], + } + }, +} + +export default skillModule diff --git a/tests/skills/nec/skill-093-bone-spirit.test.ts b/tests/skills/nec/skill-093-bone-spirit.test.ts new file mode 100644 index 0000000..49fb00f --- /dev/null +++ b/tests/skills/nec/skill-093-bone-spirit.test.ts @@ -0,0 +1,109 @@ +/** + * 1.13c Numerical & Runtime Verification Suite — Skill #093: Bone Spirit (NEC) + * Gitea Tracking Issue: #247 + */ +import { describe, expect, it } from 'vitest' +import { getSharedDataRegistry } from '../../../src/game/engine/data-registry.ts' +import { UnitStatList } from '../../../src/game/engine/stat-list.ts' +import { WorldArena } from '../../../src/game/engine/world-arena.ts' +import { skillModule } from '../../../src/game/skills/impl/nec/skill-093-bone-spirit.ts' + +describe('[Skill #093] Bone Spirit (NEC) — 1.13c Parity (Issue #247)', () => { + it('evaluates exact 1.13c Skills.txt / Missiles.txt formulas at slvl 1, 10, and 20', async () => { + const registry = await getSharedDataRegistry() + const skillRec = registry.getSkillById(93)! + expect(skillRec).toBeDefined() + expect(skillModule.skillId).toBe(93) + expect(skillModule.name).toBe("Bone Spirit") + expect(skillModule.charClass).toBe("nec") + + const stats1 = new UnitStatList() + stats1.setBaseSkillLevel(93, 1) + const r1 = skillModule.evaluate!({ registry, skill: skillRec, slvl: 1, blvl: 1, statList: stats1 }) + expect(r1.manaCost).toBe(12) + expect(r1.manaCost256).toBe(3072) + expect(r1.minPhysDmg).toBe(0) + expect(r1.maxPhysDmg).toBe(0) + expect(r1.minElemDmg256).toBe(5120) + expect(r1.maxElemDmg256).toBe(7680) + + const stats10 = new UnitStatList() + stats10.setBaseSkillLevel(93, 10) + const r10 = skillModule.evaluate!({ registry, skill: skillRec, slvl: 10, blvl: 10, statList: stats10 }) + expect(r10.manaCost).toBe(16) + expect(r10.manaCost256).toBe(4224) + expect(r10.minPhysDmg).toBe(0) + expect(r10.maxPhysDmg).toBe(0) + expect(r10.minElemDmg256).toBe(42496) + expect(r10.maxElemDmg256).toBe(47360) + + const stats20 = new UnitStatList() + stats20.setBaseSkillLevel(93, 20) + const r20 = skillModule.evaluate!({ registry, skill: skillRec, slvl: 20, blvl: 20, statList: stats20 }) + expect(r20.manaCost).toBe(21) + expect(r20.manaCost256).toBe(5504) + expect(r20.minPhysDmg).toBe(0) + expect(r20.maxPhysDmg).toBe(0) + expect(r20.minElemDmg256).toBe(87040) + expect(r20.maxElemDmg256).toBe(94464) + expect(r20.durationFrames).toBe(0) + expect(r20.radiusSubtiles).toBe(0) + expect(r20.petMax).toBe(0) + expect(r20.cooldownFrames).toBe(0) + }) + + it('enforces 1.13c blvl synergy rule (hard points boost synergy; +skills and item charges do NOT)', async () => { + const registry = await getSharedDataRegistry() + const skillRec = registry.getSkillById(93)! + const synId = 78 + + const statsBase = new UnitStatList() + statsBase.setBaseSkillLevel(93, 20) + if (synId !== null) { + statsBase.setBaseSkillLevel(synId, 20) + } + const withHardPoints = skillModule.evaluate!({ + registry, + skill: skillRec, + slvl: 20, + blvl: 20, + statList: statsBase, + }) + expect(withHardPoints.synergyBonusPct).toBe(120) + + // +20 allskills and +33 Marrowwalk charges without hard points must yield 0 synergy + const statsSoftOnly = new UnitStatList() + statsSoftOnly.setBaseSkillLevel(93, 20) + statsSoftOnly.addStat('item_allskills', 20) + if (synId !== null) { + statsSoftOnly.setChargedSkillLevel(synId, 33) + } + const withSoftOnly = skillModule.evaluate!({ + registry, + skill: skillRec, + slvl: 20, + blvl: 20, + statList: statsSoftOnly, + }) + expect(withSoftOnly.synergyBonusPct).toBe(0) + }) + + it('executes runtime skill effect in WorldArena (castCount, action frame, and combat/state/missile/summon outcome)', async () => { + const registry = await getSharedDataRegistry() + const arena = new WorldArena({ + registry, + classCode: "nec", + skillId: 93, + slvl: 20, + }) + const outcome = arena.triggerCast() + arena.stepTicks(15) + const dbg = arena.getDebugState() + + expect(dbg.ready).toBe(true) + expect(dbg.skillId).toBe(93) + expect(dbg.castCount).toBeGreaterThanOrEqual(1) + expect(dbg.actionFrameTriggered).toBe(true) + expect(outcome?.executed).toBe(true) + }) +})