From 5b1d57165e0457ea1bda7816d03cb5bd570abde3 Mon Sep 17 00:00:00 2001 From: Octoturge Date: Fri, 30 Oct 2026 08:11:35 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20derive=20Obra=C5=BCenia=20+1=20damageCa?= =?UTF-8?q?tegory=20from=20vault=20spell=20category?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01E48f1kXhsEbAUxdkNP1yDM --- scripts/parsers/spell-parser.ts | 4 +++- tests/parsers/spell-parser.test.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/parsers/spell-parser.ts b/scripts/parsers/spell-parser.ts index d3b2651..6814e1c 100644 --- a/scripts/parsers/spell-parser.ts +++ b/scripts/parsers/spell-parser.ts @@ -35,6 +35,7 @@ const SpellNoteSchema = z.object({ targets: z.coerce.string().default(''), duration: z.coerce.string().default(''), damageBase: z.coerce.string().default(''), + category: z.coerce.string().default(''), damageCategory: z.boolean().default(false), damageType: z.string().default('magical'), ignoresArmor: z.boolean().default(false), @@ -93,7 +94,8 @@ function toSystem(n: SpellNote): Record { duration: n.duration, areaOfEffect: deriveAreaOfEffect(n.targets), damageBase: n.damageBase, - damageCategory: n.damageCategory, + // Spells of the "Obrażenia" effect category (vault `category:`) deal +1 damage. + damageCategory: n.damageCategory || n.category.trim().toLowerCase() === 'obrażenia', damageType: n.damageType || 'magical', ignoresArmor: n.ignoresArmor, statusEffects: n.statusEffects, diff --git a/tests/parsers/spell-parser.test.ts b/tests/parsers/spell-parser.test.ts index df916c9..230eab3 100644 --- a/tests/parsers/spell-parser.test.ts +++ b/tests/parsers/spell-parser.test.ts @@ -21,6 +21,8 @@ describe('spell-parser', () => { expect(s.difficulty).toEqual({ threshold: 4, successes: 1 }); expect(s.overcastOptions).toEqual([{ description: '+1 punkt Obrażeń', manaPerStep: 1 }]); expect(s).not.toHaveProperty('circle'); + expect(s.damageCategory).toBe(true); + expect((docs.find((d) => d.id === 'crimson-bolt')!.system as any).damageCategory).toBe(true); for (const d of docs) { const sys = d.system as any;