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;