@archivist-gg/dnd5e 0.3.0 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/SRD.md +25 -6
- package/dist/armor/armor.codec.js +4 -3
- package/dist/armor/armor.parser.js +3 -2
- package/dist/armor/armor.schema.d.ts +4 -0
- package/dist/armor/armor.schema.js +2 -1
- package/dist/armor/armor.types.d.ts +8 -0
- package/dist/background/background.codec.js +7 -6
- package/dist/background/background.parser.js +6 -5
- package/dist/background/background.schema.d.ts +34 -0
- package/dist/background/background.schema.js +9 -6
- package/dist/background/background.types.d.ts +22 -0
- package/dist/{chunk-4TIJKN6O.js → chunk-23LZLBJK.js} +1 -1
- package/dist/{chunk-AFKTJXRA.js → chunk-2DFENQIJ.js} +18 -0
- package/dist/chunk-2FRUSVZS.js +489 -0
- package/dist/chunk-4FWNK4FD.js +159 -0
- package/dist/chunk-4U55VNC7.js +22 -0
- package/dist/{chunk-4JHOHWBI.js → chunk-4XTNPNQB.js} +1 -1
- package/dist/{chunk-HCP3GMHS.js → chunk-5N2GW72F.js} +15 -2
- package/dist/{chunk-42Y5IJKT.js → chunk-5U5FFFA3.js} +5 -1
- package/dist/{chunk-4F6AIZ36.js → chunk-5XMQPTHD.js} +1 -1
- package/dist/{chunk-GJOI2GHP.js → chunk-6GNXYAYP.js} +1 -1
- package/dist/chunk-6PKV5V2H.js +178 -0
- package/dist/{chunk-66XXW2Z2.js → chunk-6PXTNCBP.js} +2 -2
- package/dist/chunk-6X2NV665.js +33 -0
- package/dist/{chunk-LV4SNWZQ.js → chunk-6X4KUDMU.js} +8 -1
- package/dist/{chunk-ZMR77DDL.js → chunk-AW3EHF3L.js} +1 -1
- package/dist/chunk-CJYCVNW2.js +7 -0
- package/dist/chunk-COEOOQX2.js +133 -0
- package/dist/{chunk-XTIQWSFM.js → chunk-D5U7GMPX.js} +1 -1
- package/dist/{chunk-RAWJTA45.js → chunk-DEEHHLAP.js} +1 -1
- package/dist/chunk-DPUJDOKV.js +365 -0
- package/dist/{chunk-73HOFQQ5.js → chunk-ESS46GR4.js} +1 -1
- package/dist/chunk-EVMUJYUD.js +195 -0
- package/dist/{chunk-2BWAID3Y.js → chunk-FDBWYMZK.js} +29 -3
- package/dist/{chunk-K6Q5OUGK.js → chunk-GFZ7PITJ.js} +86 -10
- package/dist/chunk-H7KBLR4X.js +81 -0
- package/dist/{chunk-L7E2UT5A.js → chunk-HB7XZXDK.js} +5 -1
- package/dist/{chunk-VTYUBINW.js → chunk-HJ5EEZ47.js} +1 -1
- package/dist/{chunk-6NK2MUD3.js → chunk-HZA7OE7N.js} +9 -2
- package/dist/{chunk-A4WENOUQ.js → chunk-I2NDWFDD.js} +52 -8
- package/dist/{chunk-RSDRMH54.js → chunk-IMZFOOVL.js} +1 -1
- package/dist/{chunk-3DZ74AKK.js → chunk-IN4M4X7P.js} +8 -2
- package/dist/chunk-IUAAXXNO.js +58 -0
- package/dist/{chunk-XJNECUPT.js → chunk-JC5UNIVM.js} +19 -0
- package/dist/chunk-JJ46T5XX.js +297 -0
- package/dist/{chunk-TUIFSVLI.js → chunk-JRDPUDT5.js} +30 -3
- package/dist/{chunk-24GFQU7T.js → chunk-JSZ4H6AQ.js} +1 -1
- package/dist/chunk-KU3YLF6D.js +106 -0
- package/dist/{chunk-5INR4NSL.js → chunk-LDDCNPHD.js} +1 -1
- package/dist/{chunk-DZXSWSBP.js → chunk-LMBAEIP6.js} +1 -1
- package/dist/chunk-LVQLWRCU.js +15 -0
- package/dist/chunk-MI7P3NX3.js +161 -0
- package/dist/chunk-O4SRD3J5.js +165 -0
- package/dist/{chunk-EMOORSQ7.js → chunk-OSQFPGLM.js} +45 -6
- package/dist/chunk-OZP6JFGT.js +162 -0
- package/dist/{chunk-NAEPSZAM.js → chunk-PDJSUH24.js} +24 -2
- package/dist/chunk-PP2UHLBA.js +50 -0
- package/dist/chunk-PVCEA4HZ.js +6 -0
- package/dist/{chunk-XLSVNUTK.js → chunk-R3VAKWKW.js} +1 -1
- package/dist/chunk-RIXI5D3R.js +89 -0
- package/dist/chunk-RLGQ5PZZ.js +16 -0
- package/dist/chunk-S7REMWW4.js +21 -0
- package/dist/{chunk-7VJ6BOA5.js → chunk-SMLXZUBH.js} +9 -1
- package/dist/{chunk-NXSWH3AE.js → chunk-T26ZVCL5.js} +1 -1
- package/dist/chunk-TOM66P2P.js +38 -0
- package/dist/chunk-UA5KS2PL.js +26 -0
- package/dist/{chunk-N6N74K6X.js → chunk-UBBKSYBY.js} +1 -1
- package/dist/{chunk-353WXS6S.js → chunk-UIRMA5KM.js} +1 -1
- package/dist/{chunk-GE4TLPWM.js → chunk-US5IKYCW.js} +1 -1
- package/dist/chunk-UXPGW4TI.js +101 -0
- package/dist/chunk-VQAXTIBW.js +100 -0
- package/dist/{chunk-WP2CX2JO.js → chunk-WELIKLZF.js} +22 -1
- package/dist/chunk-WPWOHGPI.js +172 -0
- package/dist/{chunk-GZ46OVGZ.js → chunk-WSVMLNTO.js} +1 -1
- package/dist/{chunk-4LZJXJJS.js → chunk-WXWPK3LI.js} +6 -2
- package/dist/{chunk-ZZGEVJKX.js → chunk-XBQMCEI2.js} +1 -1
- package/dist/{chunk-PHQRGDRQ.js → chunk-XGOFP7AQ.js} +5 -1
- package/dist/chunk-XJ2F2WO6.js +8 -0
- package/dist/chunk-XQCSGNXE.js +1580 -0
- package/dist/chunk-YBLDE5CG.js +42 -0
- package/dist/{chunk-JEYQU3JT.js → chunk-YHYTW5QA.js} +2 -18
- package/dist/{chunk-TLYDBT5F.js → chunk-YJJTISBN.js} +64 -7
- package/dist/{chunk-PZOWBI3B.js → chunk-YLL2QXY2.js} +7 -2
- package/dist/{chunk-MDEJHMKK.js → chunk-ZONJ66NE.js} +26 -5
- package/dist/class/class.codec.js +12 -9
- package/dist/class/class.parser.js +11 -8
- package/dist/class/class.schema.d.ts +55 -3
- package/dist/class/class.schema.js +9 -7
- package/dist/class/class.types.d.ts +48 -3
- package/dist/condition/condition.codec.d.ts +9 -0
- package/dist/condition/condition.entity-type.d.ts +2 -0
- package/dist/condition/condition.parser.d.ts +13 -0
- package/dist/condition/condition.parser.js +7 -0
- package/dist/condition/condition.schema.d.ts +29 -0
- package/dist/condition/condition.types.d.ts +15 -0
- package/dist/condition/condition.types.js +0 -0
- package/dist/dnd/constants.d.ts +22 -0
- package/dist/dnd/constants.js +9 -3
- package/dist/dnd/formula-tags.js +2 -2
- package/dist/dnd/math.d.ts +26 -0
- package/dist/dnd/math.js +12 -2
- package/dist/dnd/prose-tags.js +1 -1
- package/dist/dnd/resource-formula.d.ts +36 -10
- package/dist/dnd/resource-formula.js +10 -155
- package/dist/dnd/srd-tag-converter.js +3 -3
- package/dist/dnd/tag-grammar.js +1 -1
- package/dist/dnd/warn-once.d.ts +2 -0
- package/dist/dnd/warn-once.js +8 -0
- package/dist/entities/base-item-resolver.js +2 -2
- package/dist/entities/slug.d.ts +13 -0
- package/dist/entities/slug.js +5 -3
- package/dist/entities/wikilink-display.d.ts +3 -0
- package/dist/entities/wikilink-display.js +10 -0
- package/dist/feat/feat.category-codes.d.ts +32 -0
- package/dist/feat/feat.category-codes.js +14 -0
- package/dist/feat/feat.codec.js +7 -5
- package/dist/feat/feat.parser.js +6 -4
- package/dist/feat/feat.schema.d.ts +230 -0
- package/dist/feat/feat.schema.js +5 -3
- package/dist/feat/feat.types.d.ts +37 -1
- package/dist/index.js +2120 -6923
- package/dist/item/item.ai-schema.d.ts +1 -1
- package/dist/item/item.codec.js +4 -3
- package/dist/item/item.enrichment.js +4 -4
- package/dist/item/item.parser.js +3 -2
- package/dist/item/item.schema.d.ts +69 -3
- package/dist/item/item.schema.js +2 -1
- package/dist/item/item.types.d.ts +69 -3
- package/dist/monster/monster.codec.d.ts +7 -6
- package/dist/monster/monster.enrichment.js +4 -4
- package/dist/monster/monster.format.d.ts +135 -0
- package/dist/monster/monster.format.js +78 -0
- package/dist/monster/monster.parser.d.ts +6 -1
- package/dist/monster/monster.parser.js +10 -1
- package/dist/monster/monster.schema.d.ts +369 -0
- package/dist/monster/monster.schema.js +34 -0
- package/dist/monster/monster.types.d.ts +200 -14
- package/dist/optional-feature/optional-feature.codec.js +6 -5
- package/dist/optional-feature/optional-feature.parser.js +5 -4
- package/dist/optional-feature/optional-feature.schema.d.ts +176 -0
- package/dist/optional-feature/optional-feature.schema.js +4 -3
- package/dist/pack.d.ts +1 -1
- package/dist/pc/conditions.constants.d.ts +0 -1
- package/dist/pc/conditions.constants.js +1 -3
- package/dist/pc/decision-recognizer.js +1 -1
- package/dist/pc/pc.additional-spells.d.ts +47 -0
- package/dist/pc/pc.additional-spells.js +23 -0
- package/dist/pc/pc.asi-flatten.d.ts +18 -0
- package/dist/pc/pc.decision-engine.d.ts +106 -5
- package/dist/pc/pc.decision-engine.js +28 -10
- package/dist/pc/pc.defense-normalize.d.ts +11 -0
- package/dist/pc/pc.defense-normalize.js +6 -0
- package/dist/pc/pc.equipment.d.ts +30 -1
- package/dist/pc/pc.equipment.js +12 -7
- package/dist/pc/pc.feature-effects.d.ts +225 -11
- package/dist/pc/pc.feature-effects.js +21 -5
- package/dist/pc/pc.parser.js +2 -2
- package/dist/pc/pc.pools.d.ts +11 -3
- package/dist/pc/pc.pools.js +9 -13
- package/dist/pc/pc.proficiencies.d.ts +60 -4
- package/dist/pc/pc.proficiencies.js +89 -37
- package/dist/pc/pc.proficiency-grants.d.ts +58 -0
- package/dist/pc/pc.proficiency-normalize.d.ts +29 -0
- package/dist/pc/pc.proficiency-normalize.js +12 -0
- package/dist/pc/pc.proficiency-query.d.ts +13 -0
- package/dist/pc/pc.proficiency-query.js +5 -1
- package/dist/pc/pc.recalc.d.ts +69 -14
- package/dist/pc/pc.recalc.js +291 -142
- package/dist/pc/pc.resolver.d.ts +34 -8
- package/dist/pc/pc.resolver.js +27 -12
- package/dist/pc/pc.resource-seed.d.ts +3 -2
- package/dist/pc/pc.resource-seed.js +19 -17
- package/dist/pc/pc.resources.d.ts +87 -0
- package/dist/pc/pc.resources.js +21 -0
- package/dist/pc/pc.rest.d.ts +10 -1
- package/dist/pc/pc.rest.js +66 -12
- package/dist/pc/pc.schema.d.ts +147 -7
- package/dist/pc/pc.schema.js +4 -2
- package/dist/pc/pc.slotting.js +3 -3
- package/dist/pc/pc.spellcasting.d.ts +80 -7
- package/dist/pc/pc.spellcasting.js +18 -6
- package/dist/pc/pc.table-column.d.ts +23 -0
- package/dist/pc/pc.table-column.js +13 -3
- package/dist/pc/pc.types.d.ts +253 -16
- package/dist/pc/pool-layout.d.ts +47 -0
- package/dist/pc/pool-layout.js +16 -0
- package/dist/pc/roll-scope.d.ts +2 -0
- package/dist/pc/roll-scope.js +8 -0
- package/dist/pc/roll-tag-labels.d.ts +40 -0
- package/dist/pc/roll-tag-labels.js +17 -0
- package/dist/pc/spell-source.d.ts +21 -0
- package/dist/pc/spell-source.js +13 -0
- package/dist/race/race.codec.js +9 -7
- package/dist/race/race.parser.js +8 -6
- package/dist/race/race.schema.d.ts +51 -1
- package/dist/race/race.schema.js +8 -5
- package/dist/race/race.structural.d.ts +7 -0
- package/dist/race/race.structural.js +6 -0
- package/dist/race/race.types.d.ts +20 -0
- package/dist/schemas/attack-schema.d.ts +5 -0
- package/dist/schemas/caster-type-schema.d.ts +14 -0
- package/dist/schemas/caster-type-schema.js +6 -0
- package/dist/schemas/choice-schema.js +2 -2
- package/dist/schemas/entity-extras-schema.d.ts +53 -0
- package/dist/schemas/entity-extras-schema.js +10 -0
- package/dist/schemas/equipment-grant-schema.d.ts +2 -0
- package/dist/schemas/equipment-grant-schema.js +1 -1
- package/dist/schemas/feature-alias.d.ts +34 -0
- package/dist/schemas/feature-effect-schema.d.ts +124 -0
- package/dist/schemas/feature-effect-schema.js +1 -1
- package/dist/schemas/feature-schema.d.ts +8 -0
- package/dist/schemas/feature-schema.js +6 -4
- package/dist/schemas/resource-schema.d.ts +43 -0
- package/dist/schemas/resource-schema.js +1 -1
- package/dist/schemas/selection-pool-schema.d.ts +2 -0
- package/dist/schemas/selection-pool-schema.js +1 -1
- package/dist/spell/spell.access.js +23 -3
- package/dist/spell/spell.codec.js +4 -3
- package/dist/spell/spell.enrichment.js +4 -4
- package/dist/spell/spell.parser.d.ts +30 -0
- package/dist/spell/spell.parser.js +9 -2
- package/dist/spell/spell.scaling.d.ts +27 -6
- package/dist/spell/spell.scaling.js +25 -6
- package/dist/spell/spell.schema.d.ts +44 -2
- package/dist/spell/spell.schema.js +2 -1
- package/dist/spell/spell.types.d.ts +14 -0
- package/dist/subclass/subclass.codec.d.ts +1 -1
- package/dist/subclass/subclass.codec.js +11 -8
- package/dist/subclass/subclass.parser.js +10 -7
- package/dist/subclass/subclass.schema.d.ts +54 -7
- package/dist/subclass/subclass.schema.js +8 -6
- package/dist/subclass/subclass.types.d.ts +20 -2
- package/dist/types/choice.d.ts +56 -0
- package/dist/types/choice.js +21 -3
- package/dist/types/equipment-grant.d.ts +8 -1
- package/dist/types/feature-effect.d.ts +78 -23
- package/dist/types/feature.d.ts +70 -1
- package/dist/types/optional-feature.types.d.ts +28 -0
- package/dist/types/resource.d.ts +21 -1
- package/dist/types/selection-pool.d.ts +17 -2
- package/dist/weapon/weapon.classify.js +2 -2
- package/dist/weapon/weapon.codec.js +4 -3
- package/dist/weapon/weapon.parser.js +3 -2
- package/dist/weapon/weapon.schema.d.ts +4 -0
- package/dist/weapon/weapon.schema.js +2 -1
- package/dist/weapon/weapon.types.d.ts +8 -0
- package/package.json +2 -2
- package/dist/chunk-5MZSB6OM.js +0 -1089
- package/dist/chunk-5XUXXAQJ.js +0 -30
- package/dist/chunk-7P65Q426.js +0 -158
- package/dist/chunk-AIRFC5NQ.js +0 -143
- package/dist/chunk-BH6AMZVY.js +0 -25
- package/dist/chunk-CZPMTQOY.js +0 -68
- package/dist/chunk-M2EMFD6S.js +0 -269
- package/dist/chunk-N2JE7BWL.js +0 -81
- package/dist/chunk-NXR3BD2V.js +0 -90
- package/dist/chunk-Q5K6LWBZ.js +0 -45
- package/dist/chunk-TZK36BU7.js +0 -38
- package/dist/chunk-W7HWMMBF.js +0 -46
- package/dist/chunk-Y4I74YEG.js +0 -33
|
@@ -2,16 +2,23 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
3
|
kind: z.ZodLiteral<"initiative-bonus">;
|
|
4
4
|
value: z.ZodNumber;
|
|
5
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
6
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
5
7
|
}, z.core.$strip>, z.ZodObject<{
|
|
6
8
|
kind: z.ZodLiteral<"immune-condition">;
|
|
7
9
|
condition: z.ZodString;
|
|
8
10
|
while: z.ZodOptional<z.ZodString>;
|
|
11
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
9
12
|
}, z.core.$strip>, z.ZodObject<{
|
|
10
13
|
kind: z.ZodLiteral<"resistance">;
|
|
11
14
|
damage_type: z.ZodString;
|
|
15
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
16
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
12
17
|
}, z.core.$strip>, z.ZodObject<{
|
|
13
18
|
kind: z.ZodLiteral<"hp-per-level-bonus">;
|
|
14
19
|
value: z.ZodNumber;
|
|
20
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
21
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
15
22
|
}, z.core.$strip>, z.ZodObject<{
|
|
16
23
|
kind: z.ZodLiteral<"speed-bonus">;
|
|
17
24
|
mode: z.ZodEnum<{
|
|
@@ -23,6 +30,12 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
23
30
|
}>;
|
|
24
31
|
value: z.ZodNumber;
|
|
25
32
|
set: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
scales_at: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
level: z.ZodNumber;
|
|
35
|
+
value: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
38
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
26
39
|
}, z.core.$strip>, z.ZodObject<{
|
|
27
40
|
kind: z.ZodLiteral<"sense">;
|
|
28
41
|
type: z.ZodEnum<{
|
|
@@ -32,6 +45,8 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
32
45
|
truesight: "truesight";
|
|
33
46
|
}>;
|
|
34
47
|
range: z.ZodNumber;
|
|
48
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
49
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
35
50
|
}, z.core.$strip>, z.ZodObject<{
|
|
36
51
|
kind: z.ZodLiteral<"apply-condition">;
|
|
37
52
|
condition: z.ZodString;
|
|
@@ -41,6 +56,7 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
41
56
|
ability: z.ZodString;
|
|
42
57
|
timing: z.ZodString;
|
|
43
58
|
}, z.core.$strip>>;
|
|
59
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
44
60
|
}, z.core.$strip>, z.ZodObject<{
|
|
45
61
|
kind: z.ZodLiteral<"damage-bonus">;
|
|
46
62
|
damage_type: z.ZodString;
|
|
@@ -51,6 +67,7 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
51
67
|
all: "all";
|
|
52
68
|
}>>;
|
|
53
69
|
condition: z.ZodOptional<z.ZodString>;
|
|
70
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
54
71
|
}, z.core.$strip>, z.ZodObject<{
|
|
55
72
|
kind: z.ZodLiteral<"proficiency">;
|
|
56
73
|
proficiency_type: z.ZodEnum<{
|
|
@@ -62,10 +79,15 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
62
79
|
armor: "armor";
|
|
63
80
|
}>;
|
|
64
81
|
value: z.ZodString;
|
|
82
|
+
expertise: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
84
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
65
85
|
}, z.core.$strip>, z.ZodObject<{
|
|
66
86
|
kind: z.ZodLiteral<"ac-bonus">;
|
|
67
87
|
value: z.ZodNumber;
|
|
68
88
|
requires_armor: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
90
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
69
91
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
92
|
kind: z.ZodLiteral<"unarmored-ac">;
|
|
71
93
|
abilities: z.ZodArray<z.ZodEnum<{
|
|
@@ -78,6 +100,23 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
78
100
|
}>>;
|
|
79
101
|
base: z.ZodOptional<z.ZodNumber>;
|
|
80
102
|
allow_shield: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
104
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
kind: z.ZodLiteral<"unarmed-strike">;
|
|
107
|
+
dice: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
108
|
+
column: z.ZodString;
|
|
109
|
+
}, z.core.$strip>]>>;
|
|
110
|
+
abilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
111
|
+
str: "str";
|
|
112
|
+
dex: "dex";
|
|
113
|
+
con: "con";
|
|
114
|
+
int: "int";
|
|
115
|
+
wis: "wis";
|
|
116
|
+
cha: "cha";
|
|
117
|
+
}>>>;
|
|
118
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
119
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
81
120
|
}, z.core.$strip>, z.ZodObject<{
|
|
82
121
|
kind: z.ZodLiteral<"weapon-ability">;
|
|
83
122
|
ability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
@@ -89,22 +128,34 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
89
128
|
cha: "cha";
|
|
90
129
|
}>, z.ZodLiteral<"spellcasting">]>;
|
|
91
130
|
weapons: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"chosen">, z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
131
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
132
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
92
133
|
}, z.core.$strip>, z.ZodObject<{
|
|
93
134
|
kind: z.ZodLiteral<"roll-modifier">;
|
|
94
135
|
mode: z.ZodEnum<{
|
|
95
136
|
advantage: "advantage";
|
|
96
137
|
disadvantage: "disadvantage";
|
|
138
|
+
reroll: "reroll";
|
|
139
|
+
"add-d4": "add-d4";
|
|
97
140
|
}>;
|
|
98
141
|
roll: z.ZodEnum<{
|
|
99
142
|
"saving-throw": "saving-throw";
|
|
100
143
|
"ability-check": "ability-check";
|
|
101
144
|
attack: "attack";
|
|
145
|
+
any: "any";
|
|
102
146
|
}>;
|
|
103
147
|
scope: z.ZodOptional<z.ZodString>;
|
|
104
148
|
condition: z.ZodOptional<z.ZodString>;
|
|
149
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
105
150
|
}, z.core.$strip>, z.ZodObject<{
|
|
106
151
|
kind: z.ZodLiteral<"extra-attack">;
|
|
107
152
|
count: z.ZodNumber;
|
|
153
|
+
scales_at: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
+
level: z.ZodNumber;
|
|
155
|
+
count: z.ZodNumber;
|
|
156
|
+
}, z.core.$strip>>>;
|
|
157
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
158
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
108
159
|
}, z.core.$strip>, z.ZodObject<{
|
|
109
160
|
kind: z.ZodLiteral<"crit-range">;
|
|
110
161
|
min_roll: z.ZodNumber;
|
|
@@ -114,6 +165,7 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
114
165
|
all: "all";
|
|
115
166
|
}>>;
|
|
116
167
|
condition: z.ZodOptional<z.ZodString>;
|
|
168
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
117
169
|
}, z.core.$strip>, z.ZodObject<{
|
|
118
170
|
kind: z.ZodLiteral<"reroll-damage">;
|
|
119
171
|
max_reroll: z.ZodNumber;
|
|
@@ -123,9 +175,81 @@ export declare const featureEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
123
175
|
all: "all";
|
|
124
176
|
}>>;
|
|
125
177
|
once_per_die: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
179
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
126
180
|
}, z.core.$strip>, z.ZodObject<{
|
|
127
181
|
kind: z.ZodLiteral<"attack-rule">;
|
|
128
182
|
flag: z.ZodEnum<{
|
|
129
183
|
"no-ranged-in-melee-disadvantage": "no-ranged-in-melee-disadvantage";
|
|
130
184
|
}>;
|
|
185
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
186
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"immunity">;
|
|
189
|
+
damage_type: z.ZodString;
|
|
190
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
191
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
193
|
+
kind: z.ZodLiteral<"vulnerability">;
|
|
194
|
+
damage_type: z.ZodString;
|
|
195
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
196
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
198
|
+
kind: z.ZodLiteral<"temp-hp">;
|
|
199
|
+
amount: z.ZodString;
|
|
200
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
201
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
203
|
+
kind: z.ZodLiteral<"heal">;
|
|
204
|
+
amount: z.ZodString;
|
|
205
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
206
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
208
|
+
kind: z.ZodLiteral<"ability-score-increase">;
|
|
209
|
+
abilities: z.ZodUnion<readonly [z.ZodLiteral<"chosen">, z.ZodArray<z.ZodEnum<{
|
|
210
|
+
str: "str";
|
|
211
|
+
dex: "dex";
|
|
212
|
+
con: "con";
|
|
213
|
+
int: "int";
|
|
214
|
+
wis: "wis";
|
|
215
|
+
cha: "cha";
|
|
216
|
+
}>>]>;
|
|
217
|
+
amount: z.ZodNumber;
|
|
218
|
+
choose: z.ZodNullable<z.ZodNumber>;
|
|
219
|
+
max: z.ZodNullable<z.ZodNumber>;
|
|
220
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
221
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
222
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
223
|
+
kind: z.ZodLiteral<"extra-action">;
|
|
224
|
+
count: z.ZodNumber;
|
|
225
|
+
action_type: z.ZodEnum<{
|
|
226
|
+
action: "action";
|
|
227
|
+
"bonus-action": "bonus-action";
|
|
228
|
+
reaction: "reaction";
|
|
229
|
+
}>;
|
|
230
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
231
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
kind: z.ZodLiteral<"save-outcome">;
|
|
234
|
+
ability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
235
|
+
str: "str";
|
|
236
|
+
dex: "dex";
|
|
237
|
+
con: "con";
|
|
238
|
+
int: "int";
|
|
239
|
+
wis: "wis";
|
|
240
|
+
cha: "cha";
|
|
241
|
+
}>, z.ZodLiteral<"any">]>;
|
|
242
|
+
on_success: z.ZodEnum<{
|
|
243
|
+
none: "none";
|
|
244
|
+
half: "half";
|
|
245
|
+
full: "full";
|
|
246
|
+
}>;
|
|
247
|
+
on_failure: z.ZodEnum<{
|
|
248
|
+
none: "none";
|
|
249
|
+
half: "half";
|
|
250
|
+
full: "full";
|
|
251
|
+
}>;
|
|
252
|
+
applies_to: z.ZodNullable<z.ZodString>;
|
|
253
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
254
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
131
255
|
}, z.core.$strip>], "kind">;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { Feature } from "../types/feature.js";
|
|
3
|
+
/**
|
|
4
|
+
* The feature OBJECT, declared once (R4-G6 §4.2). Typed against the `Feature` interface so a wrong leaf fails
|
|
5
|
+
* `tsc`; exported UN-REFINED for the monster schema, whose name-only authored traits the hand parser accepted.
|
|
6
|
+
* The recursion runs through the REFINED schema so a nested class sub_feature keeps the description-or-entries
|
|
7
|
+
* rule; the refined `featureSchema` below keeps its exported `z.ZodType<unknown>` for every other root.
|
|
8
|
+
*/
|
|
9
|
+
export declare const featureObjectSchema: z.ZodType<Feature>;
|
|
2
10
|
export declare const featureSchema: z.ZodType<unknown>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
featureObjectSchema,
|
|
2
3
|
featureSchema
|
|
3
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4FWNK4FD.js";
|
|
4
5
|
import "../chunk-WYGD2UGN.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-YLL2QXY2.js";
|
|
7
|
+
import "../chunk-T26ZVCL5.js";
|
|
8
|
+
import "../chunk-WPWOHGPI.js";
|
|
8
9
|
export {
|
|
10
|
+
featureObjectSchema,
|
|
9
11
|
featureSchema
|
|
10
12
|
};
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
declare const resetTriggerEnum: z.ZodEnum<{
|
|
3
3
|
"short-rest": "short-rest";
|
|
4
4
|
"long-rest": "long-rest";
|
|
5
|
+
either: "either";
|
|
5
6
|
dawn: "dawn";
|
|
6
7
|
dusk: "dusk";
|
|
7
8
|
turn: "turn";
|
|
@@ -30,6 +31,7 @@ export declare const resourceSchema: z.ZodObject<{
|
|
|
30
31
|
reset: z.ZodEnum<{
|
|
31
32
|
"short-rest": "short-rest";
|
|
32
33
|
"long-rest": "long-rest";
|
|
34
|
+
either: "either";
|
|
33
35
|
dawn: "dawn";
|
|
34
36
|
dusk: "dusk";
|
|
35
37
|
turn: "turn";
|
|
@@ -55,14 +57,53 @@ export declare const resourceSchema: z.ZodObject<{
|
|
|
55
57
|
reset: z.ZodEnum<{
|
|
56
58
|
"short-rest": "short-rest";
|
|
57
59
|
"long-rest": "long-rest";
|
|
60
|
+
either: "either";
|
|
58
61
|
dawn: "dawn";
|
|
59
62
|
dusk: "dusk";
|
|
60
63
|
turn: "turn";
|
|
61
64
|
round: "round";
|
|
62
65
|
custom: "custom";
|
|
63
66
|
}>;
|
|
67
|
+
restores: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
uses: "uses";
|
|
69
|
+
"spell-slots": "spell-slots";
|
|
70
|
+
}>>;
|
|
64
71
|
}, z.core.$strip>>>;
|
|
65
72
|
}, z.core.$strip>;
|
|
73
|
+
/** A feature's / optional feature's resource spend.
|
|
74
|
+
*
|
|
75
|
+
* `amount` is the MINIMUM spend. When `amount_max` is present the spend is a
|
|
76
|
+
* RANGE (`amount` .. `amount_max`). Readers of `consumes.resource`, re-measured
|
|
77
|
+
* 2026-09-05 across both repos' `src` after plugin task T4 landed: the ENGINE still has
|
|
78
|
+
* exactly one, `pc/pc.pools.ts`'s pool vote (R4-G4 §4.2.3, whose owner-aware form T2 shipped;
|
|
79
|
+
* the `consumes.resource` key itself PREDATES T2, measured on `821f80d`), which reads the
|
|
80
|
+
* id to pick `ResolvedPool.resource` and never spends it; the PLUGIN now has SEVEN FUNCTIONS over
|
|
81
|
+
* EIGHT code lines in four files (the unit matters: `grep -rn "consumes\.resource\|consumes?\.resource"
|
|
82
|
+
* packages/obsidian/src` returns NINE lines, one of them docblock prose, and `consumeCost` reads the
|
|
83
|
+
* field on two of the eight). They are: `renderSpendControl` (`components/actions/spend-control.ts`),
|
|
84
|
+
* which SPENDS it; the four row sites that gate that call, `PoolTab.row`, `PoolTab.grantedRow` and
|
|
85
|
+
* `PoolTab.blockCard` (`components/pool-tab.ts`) and `renderBoonRow`
|
|
86
|
+
* (`components/actions/boon-rows.ts`). Their gates, measured 2026-09-05 with `grep -n` on
|
|
87
|
+
* `pool-tab.ts`, are NOT the same test, because their callers differ: `row` is gated on the entry
|
|
88
|
+
* being SELECTED (`renderSpellLike` sends it every available candidate), `blockCard` on the entry
|
|
89
|
+
* being GRANTED OR SELECTED (`renderBlocks` sends it the available candidates, then the stranded
|
|
90
|
+
* picks, then the grants), and `grantedRow` is UNCONDITIONAL because it is reached only by the loop
|
|
91
|
+
* over `pool.grants`, as is `renderBoonRow`, which the plugin's `section-renderer.ts` reaches only
|
|
92
|
+
* with a `kind` of "selected" or "granted". One rule, KNOWN entries only, expressed four ways;
|
|
93
|
+
* `renderFeatureRow` (`components/actions/feature-rows.ts`), whose owner-and-spender rule
|
|
94
|
+
* decides between the row slot, the expand card and no control at all; and `consumeCost`
|
|
95
|
+
* (`components/pool-tab.ts`), the ONE Cost label the row sub-line and the block card now
|
|
96
|
+
* share, which prints the resource's NAME from the index and keeps the raw id only as the
|
|
97
|
+
* fallback for an id the character does not own (it no longer singularizes or capitalizes
|
|
98
|
+
* it). The field IS spent as of R4-G4 T4: §3's control spends `amount` exactly through
|
|
99
|
+
* `CharacterEditState.spendFeatureUse`, the clamped quantity-taking primitive the plugin
|
|
100
|
+
* already had. What R4-G4 does NOT do (§15): the HOW-MUCH UI for a range spend
|
|
101
|
+
* and its validation rule stay G8, and the converter un-withhold that would emit
|
|
102
|
+
* `amount_max` at all is a G7 handoff. So `amount_max` stays DECLARED here only, with
|
|
103
|
+
* zero emitted carriers, and the refine is undefined-safe by construction so the
|
|
104
|
+
* corpus that ships without the key keeps parsing: 294 `Feature.consumes` carriers
|
|
105
|
+
* over 161 documents, plus 70 `OptionalFeature.consumes` documents (R4-G3a §9; an
|
|
106
|
+
* unguarded refine refuses all 231, measured). */
|
|
66
107
|
export declare const resourceConsumptionSchema: z.ZodObject<{
|
|
67
108
|
source: z.ZodOptional<z.ZodEnum<{
|
|
68
109
|
resource: "resource";
|
|
@@ -72,6 +113,7 @@ export declare const resourceConsumptionSchema: z.ZodObject<{
|
|
|
72
113
|
resource: z.ZodOptional<z.ZodString>;
|
|
73
114
|
column: z.ZodOptional<z.ZodString>;
|
|
74
115
|
amount: z.ZodNumber;
|
|
116
|
+
amount_max: z.ZodOptional<z.ZodNumber>;
|
|
75
117
|
expend_condition: z.ZodOptional<z.ZodEnum<{
|
|
76
118
|
roll_succeeds: "roll_succeeds";
|
|
77
119
|
roll_fails: "roll_fails";
|
|
@@ -83,6 +125,7 @@ export declare const resourceConsumptionSchema: z.ZodObject<{
|
|
|
83
125
|
reset: z.ZodEnum<{
|
|
84
126
|
"short-rest": "short-rest";
|
|
85
127
|
"long-rest": "long-rest";
|
|
128
|
+
either: "either";
|
|
86
129
|
dawn: "dawn";
|
|
87
130
|
dusk: "dusk";
|
|
88
131
|
turn: "turn";
|
|
@@ -3,10 +3,29 @@ import {
|
|
|
3
3
|
} from "../chunk-VTTA2ALZ.js";
|
|
4
4
|
|
|
5
5
|
// src/spell/spell.access.ts
|
|
6
|
+
var LISTED_CLASS_NAMES = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function listedClassNames(registry) {
|
|
8
|
+
const count = registry.count();
|
|
9
|
+
const cached = LISTED_CLASS_NAMES.get(registry);
|
|
10
|
+
if (cached && cached.count === count) return cached.names;
|
|
11
|
+
const names = /* @__PURE__ */ new Set();
|
|
12
|
+
for (const e of registry.search("", "spell", Number.POSITIVE_INFINITY)) {
|
|
13
|
+
const classes = e.data.classes;
|
|
14
|
+
if (!Array.isArray(classes)) continue;
|
|
15
|
+
for (const c of classes) names.add(baseClassName(String(c)));
|
|
16
|
+
}
|
|
17
|
+
LISTED_CLASS_NAMES.set(registry, { count, names });
|
|
18
|
+
return names;
|
|
19
|
+
}
|
|
6
20
|
function classSpellCandidates(registry, classSlugs, maxLevel, knownSlugs, showAll = false, query = "") {
|
|
7
|
-
const all = registry.search(query, "spell",
|
|
21
|
+
const all = registry.search(query, "spell", Number.POSITIVE_INFINITY);
|
|
8
22
|
const q = query.toLowerCase();
|
|
9
23
|
const classSet = new Set(classSlugs.map((s) => baseClassName(s)));
|
|
24
|
+
let unlistable = false;
|
|
25
|
+
if (!showAll && classSet.size > 0) {
|
|
26
|
+
const listed = listedClassNames(registry);
|
|
27
|
+
unlistable = [...classSet].some((n) => !listed.has(n));
|
|
28
|
+
}
|
|
10
29
|
return all.filter((e) => !knownSlugs.has(e.slug)).map((e) => {
|
|
11
30
|
var _a;
|
|
12
31
|
const entity = e.data;
|
|
@@ -15,9 +34,10 @@ function classSpellCandidates(registry, classSlugs, maxLevel, knownSlugs, showAl
|
|
|
15
34
|
var _a;
|
|
16
35
|
if (q && !c.name.toLowerCase().includes(q)) return false;
|
|
17
36
|
if (showAll) return true;
|
|
37
|
+
if (c.level > maxLevel) return false;
|
|
38
|
+
if (unlistable) return true;
|
|
18
39
|
const classes = ((_a = c.entity.classes) != null ? _a : []).map((x) => baseClassName(x));
|
|
19
|
-
|
|
20
|
-
return inClass && c.level <= maxLevel;
|
|
40
|
+
return classes.some((x) => classSet.has(x));
|
|
21
41
|
}).sort((a, b) => a.level - b.level || a.name.localeCompare(b.name));
|
|
22
42
|
}
|
|
23
43
|
export {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
spellCodec
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-JSZ4H6AQ.js";
|
|
4
|
+
import "../chunk-OZP6JFGT.js";
|
|
5
|
+
import "../chunk-VQAXTIBW.js";
|
|
6
|
+
import "../chunk-UA5KS2PL.js";
|
|
6
7
|
export {
|
|
7
8
|
spellCodec
|
|
8
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
enrichSpell
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-WSVMLNTO.js";
|
|
4
|
+
import "../chunk-DEEHHLAP.js";
|
|
5
|
+
import "../chunk-PDJSUH24.js";
|
|
6
|
+
import "../chunk-WELIKLZF.js";
|
|
7
7
|
export {
|
|
8
8
|
enrichSpell
|
|
9
9
|
};
|
|
@@ -1,3 +1,33 @@
|
|
|
1
1
|
import { Spell } from "./spell.types.js";
|
|
2
2
|
import { ParseResult } from "@archivist-gg/core";
|
|
3
|
+
/**
|
|
4
|
+
* §3.3 · collapse the converter's structured `components` object to the corpus's own string form
|
|
5
|
+
* (`V, S, M (a coin), R`), leaving a string input byte-unchanged. Letter order is V, S, M, R;
|
|
6
|
+
* `m` object -> `M (<text>)` (the text already carries the cost prose), `m` string -> `M (<value>)`,
|
|
7
|
+
* `m: true` -> a bare `M`. A boolean flag contributes its letter only when it is exactly `true`.
|
|
8
|
+
* Casing follows the 862 string-form carriers (uppercase letters); `R` has no precedent among them
|
|
9
|
+
* and is an invented-but-decided literal (Gate 0 B-5).
|
|
10
|
+
*
|
|
11
|
+
* The parameter is `unknown` on purpose: `spellComponentsObjectSchema` stays local and unexported,
|
|
12
|
+
* so this function narrows structurally instead of importing the schema's type. `toStringSafe` is
|
|
13
|
+
* the unreachable-shape fallback (the schema has already accepted the value by the time we run).
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeSpellComponents(value: unknown): string;
|
|
16
|
+
/**
|
|
17
|
+
* §3.3 · collapse the converter's structured `duration` array to the corpus's own lowercase string
|
|
18
|
+
* form (`until dispelled`, `up to 1 hour`), leaving a string input byte-unchanged. Concentration is
|
|
19
|
+
* NEVER synthesised here — the separate `concentration` boolean drives the sheet's `Conc · ` prefix.
|
|
20
|
+
* Zero docs carry more than one entry; the `; ` join is the defensive path for the day one does.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeSpellDuration(value: unknown): string;
|
|
23
|
+
/**
|
|
24
|
+
* R4-G7 §7.5 · the RESOLVE-time twin of the two normalisations `parseSpell` performs below. The PC pipeline
|
|
25
|
+
* reads RAW registry entities (`reg.data as unknown as Spell`), so a converter spell reaches the sheet with a
|
|
26
|
+
* structured `components` object and `duration` array unless it passes through here; `componentLetters`
|
|
27
|
+
* (the sheet) and the add drawer's duration cell both read strings. The `!= null` guards MIRROR `parseSpell`'s
|
|
28
|
+
* own, so a spell that authors neither key keeps neither. Lives HERE, beside the normalisers, and not in
|
|
29
|
+
* `pc.resolver.ts`, which already imports `pc.additional-spells` and would make the two a value cycle
|
|
30
|
+
* [G2-I-2]. Returns a fresh object; the shared registry entity is never mutated.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mirrorSpellShapes(entity: Spell): Spell;
|
|
3
33
|
export declare function parseSpell(source: string): ParseResult<Spell>;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
mirrorSpellShapes,
|
|
3
|
+
normalizeSpellComponents,
|
|
4
|
+
normalizeSpellDuration,
|
|
2
5
|
parseSpell
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-OZP6JFGT.js";
|
|
7
|
+
import "../chunk-VQAXTIBW.js";
|
|
8
|
+
import "../chunk-UA5KS2PL.js";
|
|
5
9
|
export {
|
|
10
|
+
mirrorSpellShapes,
|
|
11
|
+
normalizeSpellComponents,
|
|
12
|
+
normalizeSpellDuration,
|
|
6
13
|
parseSpell
|
|
7
14
|
};
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import type { Spell } from "./spell.types.js";
|
|
2
2
|
/** A spell repeats under higher levels only if it has a real upcast benefit. */
|
|
3
3
|
export declare function spellScales(spell: Spell): boolean;
|
|
4
|
+
/** The `casting_options` field a scaled value was read from (R4-G7 T8 RIDER-16). */
|
|
5
|
+
export type SpellEffectField = "damage_roll" | "target_count" | "duration" | "desc";
|
|
6
|
+
/** A scaled value and the FIELD it came from, so a renderer decides where it prints from the field. */
|
|
7
|
+
export interface SpellEffectParts {
|
|
8
|
+
field: SpellEffectField;
|
|
9
|
+
/** As printed: the roll, `"<N> targets"`, the duration, or the authored sentence verbatim. */
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
|
-
* At-a-glance scaled effect for casting `spell` with a slot of `slotLevel`,
|
|
6
|
-
* read from structured `casting_options` (`type: "slot_level_<N>"`)
|
|
7
|
-
* null when absent or untrustworthy.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
13
|
+
* At-a-glance scaled effect for casting a LEVELLED `spell` with a slot of `slotLevel`,
|
|
14
|
+
* read from structured `casting_options` (`type: "slot_level_<N>"`), WITH the field it
|
|
15
|
+
* came from. Returns null when absent or untrustworthy. The FIRST present field wins, in
|
|
16
|
+
* this order: `damage_roll`, `target_count`, `duration`, `desc` (so an option carrying a
|
|
17
|
+
* roll AND a sentence yields the roll). A `target_count` that equals the slot level is
|
|
18
|
+
* the known SRD-2014 bad encoding (e.g. Magic Missile 2nd->2 instead of 4) and is
|
|
19
|
+
* suppressed. This errs toward showing nothing rather than a wrong number.
|
|
11
20
|
*/
|
|
21
|
+
export declare function spellEffectPartsAtSlot(spell: Spell, slotLevel: number): SpellEffectParts | null;
|
|
22
|
+
/** The value of `spellEffectPartsAtSlot`, without its field. */
|
|
12
23
|
export declare function spellEffectAtSlot(spell: Spell, slotLevel: number): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* R4-G7 T8 RIDER-15 (F-NODICE (a)): a CANTRIP's damage roll at the character's total level, read from structured
|
|
26
|
+
* `casting_options` (`type: "player_level_<N>"`). The roll of the HIGHEST `N <= characterLevel` wins: SRD 5e authors
|
|
27
|
+
* one option per level from 5 to 20, SRD 2024 and the converter author only 5 / 11 / 17. An option with no roll or an
|
|
28
|
+
* EMPTY one never qualifies (SRD 5e Acid Splash and Poison Spray open with `player_level_2..4` carrying
|
|
29
|
+
* `damage_roll: ''`; Eldritch Blast 2024 authors `target_count` only). Null for a levelled spell, for a level that is
|
|
30
|
+
* not a finite number (a fixture-built `derived` omits `totalLevel`), and when nothing qualifies: no corpus authors
|
|
31
|
+
* `player_level_1`, so a cantrip's base roll below level 5 is not in the data and nothing is invented here.
|
|
32
|
+
*/
|
|
33
|
+
export declare function spellEffectAtCharacterLevel(spell: Spell, characterLevel: number): string | null;
|
|
13
34
|
/** Owned slot levels strictly above the spell's base level (scaling spells only). */
|
|
14
35
|
export declare function upcastLevelsFor(spell: Spell, ownedSlotLevels: number[]): number[];
|
|
@@ -3,17 +3,34 @@ function spellScales(spell) {
|
|
|
3
3
|
var _a, _b, _c, _d;
|
|
4
4
|
return ((_b = (_a = spell.casting_options) == null ? void 0 : _a.length) != null ? _b : 0) > 0 || ((_d = (_c = spell.at_higher_levels) == null ? void 0 : _c.length) != null ? _d : 0) > 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
var _a
|
|
6
|
+
function spellEffectPartsAtSlot(spell, slotLevel) {
|
|
7
|
+
var _a;
|
|
8
8
|
const opt = ((_a = spell.casting_options) != null ? _a : []).find((o) => o.type === `slot_level_${slotLevel}`);
|
|
9
9
|
if (!opt) return null;
|
|
10
|
-
if (opt.damage_roll) return opt.damage_roll;
|
|
10
|
+
if (opt.damage_roll) return { field: "damage_roll", value: opt.damage_roll };
|
|
11
11
|
if (typeof opt.target_count === "number") {
|
|
12
12
|
if (opt.target_count === slotLevel) return null;
|
|
13
|
-
return `${opt.target_count} targets
|
|
13
|
+
return { field: "target_count", value: `${opt.target_count} targets` };
|
|
14
|
+
}
|
|
15
|
+
if (opt.duration) return { field: "duration", value: opt.duration };
|
|
16
|
+
return opt.desc != null ? { field: "desc", value: opt.desc } : null;
|
|
17
|
+
}
|
|
18
|
+
function spellEffectAtSlot(spell, slotLevel) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (_b = (_a = spellEffectPartsAtSlot(spell, slotLevel)) == null ? void 0 : _a.value) != null ? _b : null;
|
|
21
|
+
}
|
|
22
|
+
var PLAYER_LEVEL_TYPE = /^player_level_(\d+)$/;
|
|
23
|
+
function spellEffectAtCharacterLevel(spell, characterLevel) {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
if (((_a = spell.level) != null ? _a : 0) !== 0 || !Number.isFinite(characterLevel)) return null;
|
|
26
|
+
let best = null;
|
|
27
|
+
for (const opt of (_b = spell.casting_options) != null ? _b : []) {
|
|
28
|
+
const m = PLAYER_LEVEL_TYPE.exec(String((_c = opt.type) != null ? _c : ""));
|
|
29
|
+
if (!m || typeof opt.damage_roll !== "string" || opt.damage_roll.trim() === "") continue;
|
|
30
|
+
const n = Number(m[1]);
|
|
31
|
+
if (n <= characterLevel && (best === null || n > best.n)) best = { n, roll: opt.damage_roll };
|
|
14
32
|
}
|
|
15
|
-
|
|
16
|
-
return (_b = opt.desc) != null ? _b : null;
|
|
33
|
+
return best ? best.roll : null;
|
|
17
34
|
}
|
|
18
35
|
function upcastLevelsFor(spell, ownedSlotLevels) {
|
|
19
36
|
var _a;
|
|
@@ -22,7 +39,9 @@ function upcastLevelsFor(spell, ownedSlotLevels) {
|
|
|
22
39
|
return ownedSlotLevels.filter((l) => l > base).sort((a, b) => a - b);
|
|
23
40
|
}
|
|
24
41
|
export {
|
|
42
|
+
spellEffectAtCharacterLevel,
|
|
25
43
|
spellEffectAtSlot,
|
|
44
|
+
spellEffectPartsAtSlot,
|
|
26
45
|
spellScales,
|
|
27
46
|
upcastLevelsFor
|
|
28
47
|
};
|
|
@@ -5,8 +5,33 @@ export declare const spellEntitySchema: z.ZodObject<{
|
|
|
5
5
|
school: z.ZodOptional<z.ZodString>;
|
|
6
6
|
casting_time: z.ZodOptional<z.ZodString>;
|
|
7
7
|
range: z.ZodOptional<z.ZodString>;
|
|
8
|
-
components: z.ZodOptional<z.ZodString
|
|
9
|
-
|
|
8
|
+
components: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
9
|
+
v: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
s: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
m: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodObject<{
|
|
12
|
+
text: z.ZodString;
|
|
13
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
consume: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
15
|
+
}, z.core.$strict>]>>;
|
|
16
|
+
r: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
}, z.core.$strict>]>>;
|
|
18
|
+
duration: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"permanent">;
|
|
20
|
+
ends: z.ZodArray<z.ZodEnum<{
|
|
21
|
+
trigger: "trigger";
|
|
22
|
+
dispel: "dispel";
|
|
23
|
+
}>>;
|
|
24
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"timed">;
|
|
26
|
+
duration: z.ZodObject<{
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
minute: "minute";
|
|
29
|
+
hour: "hour";
|
|
30
|
+
}>;
|
|
31
|
+
amount: z.ZodNumber;
|
|
32
|
+
up_to: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
}, z.core.$strict>], "type">>]>>;
|
|
10
35
|
concentration: z.ZodOptional<z.ZodBoolean>;
|
|
11
36
|
ritual: z.ZodOptional<z.ZodBoolean>;
|
|
12
37
|
classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -28,4 +53,21 @@ export declare const spellEntitySchema: z.ZodObject<{
|
|
|
28
53
|
shape_size: z.ZodOptional<z.ZodNumber>;
|
|
29
54
|
desc: z.ZodOptional<z.ZodString>;
|
|
30
55
|
}, z.core.$strip>>>;
|
|
56
|
+
rendering_hint: z.ZodOptional<z.ZodString>;
|
|
57
|
+
misc_tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
area_tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
|
+
condition_inflict: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
|
+
affects_creature_type: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
spell_attack: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
melee: "melee";
|
|
63
|
+
ranged: "ranged";
|
|
64
|
+
}>>;
|
|
65
|
+
ability_check: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
damage_resist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
damage_immune: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
condition_immune: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
damage_vulnerable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
has_fluff: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
72
|
+
has_fluff_images: z.ZodOptional<z.ZodBoolean>;
|
|
31
73
|
}, z.core.$strict>;
|