feat: derive Obrażenia +1 damageCategory from vault spell category
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E48f1kXhsEbAUxdkNP1yDM
This commit is contained in:
@@ -35,6 +35,7 @@ const SpellNoteSchema = z.object({
|
|||||||
targets: z.coerce.string().default(''),
|
targets: z.coerce.string().default(''),
|
||||||
duration: z.coerce.string().default(''),
|
duration: z.coerce.string().default(''),
|
||||||
damageBase: z.coerce.string().default(''),
|
damageBase: z.coerce.string().default(''),
|
||||||
|
category: z.coerce.string().default(''),
|
||||||
damageCategory: z.boolean().default(false),
|
damageCategory: z.boolean().default(false),
|
||||||
damageType: z.string().default('magical'),
|
damageType: z.string().default('magical'),
|
||||||
ignoresArmor: z.boolean().default(false),
|
ignoresArmor: z.boolean().default(false),
|
||||||
@@ -93,7 +94,8 @@ function toSystem(n: SpellNote): Record<string, unknown> {
|
|||||||
duration: n.duration,
|
duration: n.duration,
|
||||||
areaOfEffect: deriveAreaOfEffect(n.targets),
|
areaOfEffect: deriveAreaOfEffect(n.targets),
|
||||||
damageBase: n.damageBase,
|
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',
|
damageType: n.damageType || 'magical',
|
||||||
ignoresArmor: n.ignoresArmor,
|
ignoresArmor: n.ignoresArmor,
|
||||||
statusEffects: n.statusEffects,
|
statusEffects: n.statusEffects,
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ describe('spell-parser', () => {
|
|||||||
expect(s.difficulty).toEqual({ threshold: 4, successes: 1 });
|
expect(s.difficulty).toEqual({ threshold: 4, successes: 1 });
|
||||||
expect(s.overcastOptions).toEqual([{ description: '+1 punkt Obrażeń', manaPerStep: 1 }]);
|
expect(s.overcastOptions).toEqual([{ description: '+1 punkt Obrażeń', manaPerStep: 1 }]);
|
||||||
expect(s).not.toHaveProperty('circle');
|
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) {
|
for (const d of docs) {
|
||||||
const sys = d.system as any;
|
const sys = d.system as any;
|
||||||
|
|||||||
Reference in New Issue
Block a user