@archivist-gg/dnd5e 0.3.17 → 0.3.24
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/LICENSE +48 -21
- package/README.md +26 -48
- package/dist/armor/armor.codec.d.ts +0 -7
- package/dist/armor/armor.codec.js +1 -9
- package/dist/armor/armor.parser.js +1 -8
- package/dist/armor/armor.schema.js +1 -7
- package/dist/armor/armor.types.d.ts +0 -3
- package/dist/background/background.codec.d.ts +0 -6
- package/dist/background/background.codec.js +1 -12
- package/dist/background/background.parser.js +1 -11
- package/dist/background/background.schema.js +1 -12
- package/dist/background/background.types.d.ts +0 -5
- package/dist/chunk-2EOGK6R6.js +1 -0
- package/dist/chunk-2HRRH3WL.js +1 -0
- package/dist/chunk-2LCGKNVM.js +1 -0
- package/dist/chunk-2NUDWOFG.js +1 -0
- package/dist/chunk-334WLI7V.js +1 -0
- package/dist/chunk-3LWOVRLA.js +1 -0
- package/dist/chunk-3QQOATV3.js +1 -0
- package/dist/chunk-4E2GIWJE.js +1 -0
- package/dist/chunk-4GN3GYMP.js +1 -0
- package/dist/chunk-4IAMSRHD.js +1 -0
- package/dist/chunk-4JEF3CET.js +1 -0
- package/dist/chunk-4KVVAENP.js +1 -0
- package/dist/chunk-56JK6VCL.js +1 -0
- package/dist/chunk-5FEXHY4U.js +1 -0
- package/dist/chunk-63YJPWTM.js +1 -0
- package/dist/chunk-6ASJ3MVB.js +1 -0
- package/dist/chunk-6IC53O3Q.js +1 -0
- package/dist/chunk-6LCNV26D.js +1 -0
- package/dist/chunk-6W253VHH.js +1 -0
- package/dist/chunk-7AKJBRBD.js +1 -0
- package/dist/chunk-7EL3GWWJ.js +1 -0
- package/dist/chunk-7FPQJDFD.js +1 -0
- package/dist/chunk-7J5BNH2D.js +1 -0
- package/dist/chunk-7LPKI27J.js +1 -0
- package/dist/chunk-7UPYRKMF.js +1 -0
- package/dist/chunk-A7H6LX47.js +1 -0
- package/dist/chunk-AINRPPLH.js +1 -0
- package/dist/chunk-BC52J4LA.js +1 -0
- package/dist/chunk-BCXGB4HP.js +1 -0
- package/dist/chunk-BGX36NPE.js +1 -0
- package/dist/chunk-BPKG6RZ7.js +1 -0
- package/dist/chunk-BREHZNTL.js +1 -0
- package/dist/chunk-BZ6BGGZS.js +1 -0
- package/dist/chunk-CAPYNIGK.js +1 -0
- package/dist/chunk-CCFIINBA.js +1 -0
- package/dist/chunk-CMIEZQL4.js +1 -0
- package/dist/chunk-DVUXUIPV.js +1 -0
- package/dist/chunk-DY6FVAGA.js +1 -0
- package/dist/chunk-DZITM5AG.js +1 -0
- package/dist/chunk-DZKSXSJF.js +1 -0
- package/dist/chunk-EAARMPCW.js +1 -0
- package/dist/chunk-EVT7MGAC.js +1 -0
- package/dist/chunk-FOLHTMSC.js +1 -0
- package/dist/chunk-GCYUCIDN.js +1 -0
- package/dist/chunk-GIOV6JW7.js +1 -0
- package/dist/chunk-HCK6IUB3.js +1 -0
- package/dist/chunk-HR5MKCP2.js +1 -0
- package/dist/chunk-I26FHSI6.js +1 -0
- package/dist/chunk-I4O2FIDT.js +1 -0
- package/dist/chunk-IGVRLGLM.js +1 -0
- package/dist/chunk-IHPLT2ZT.js +1 -0
- package/dist/chunk-IOCJIWCV.js +1 -0
- package/dist/chunk-JXDX2DKF.js +1 -0
- package/dist/chunk-KBFSJ5WE.js +1 -0
- package/dist/chunk-KM75CC6Q.js +1 -0
- package/dist/chunk-KZDDFG4O.js +1 -0
- package/dist/chunk-LJNT3PJP.js +1 -0
- package/dist/chunk-LR6UMA5V.js +1 -0
- package/dist/chunk-M6RPOLKS.js +1 -0
- package/dist/chunk-MC6PLWRZ.js +1 -0
- package/dist/chunk-MGGKZGLG.js +1 -0
- package/dist/chunk-N3RYJ7RE.js +1 -0
- package/dist/chunk-NEMX7QGG.js +1 -0
- package/dist/chunk-NI364WV7.js +1 -0
- package/dist/chunk-O2QZ73GA.js +1 -0
- package/dist/chunk-O776WL7O.js +1 -0
- package/dist/chunk-OTFNINUY.js +1 -0
- package/dist/chunk-PQAVMK3T.js +1 -0
- package/dist/chunk-PZ3ZZ5H5.js +1 -0
- package/dist/chunk-PZ4L2EEG.js +1 -0
- package/dist/chunk-PZUPZBTN.js +1 -0
- package/dist/chunk-QBA757AU.js +1 -0
- package/dist/chunk-QFIGPOFW.js +1 -0
- package/dist/chunk-QMEKQTUT.js +1 -0
- package/dist/chunk-QVWT67WA.js +1 -0
- package/dist/chunk-RDXQAZBA.js +1 -0
- package/dist/chunk-RE5Z5RNK.js +1 -0
- package/dist/chunk-RL4VY2AL.js +1 -0
- package/dist/chunk-RQGTBHJW.js +1 -0
- package/dist/chunk-RQZCGXUZ.js +1 -0
- package/dist/chunk-S5UCI27C.js +1 -0
- package/dist/chunk-SEOASDO4.js +1 -0
- package/dist/chunk-SU4MEZ5P.js +1 -0
- package/dist/chunk-T55DELVL.js +1 -0
- package/dist/chunk-TKIEPC6F.js +1 -0
- package/dist/chunk-TLXFGGWH.js +1 -0
- package/dist/chunk-UBUKCRZ3.js +1 -0
- package/dist/chunk-V6NQ547U.js +1 -0
- package/dist/chunk-VA3ZWV7C.js +1 -0
- package/dist/chunk-VIP3FH2O.js +1 -0
- package/dist/chunk-VTQ4RWEG.js +1 -0
- package/dist/chunk-WUHTSLG4.js +1 -0
- package/dist/chunk-X22SISGM.js +1 -0
- package/dist/chunk-XKJXT2PN.js +1 -0
- package/dist/chunk-XQMKH4R4.js +1 -0
- package/dist/chunk-YGH7S5ZF.js +1 -0
- package/dist/chunk-ZE46ADXS.js +1 -0
- package/dist/chunk-ZI3FEUX3.js +1 -0
- package/dist/class/class.codec.d.ts +0 -7
- package/dist/class/class.codec.js +1 -18
- package/dist/class/class.parser.js +1 -17
- package/dist/class/class.schema.d.ts +2 -1
- package/dist/class/class.schema.js +1 -15
- package/dist/class/class.slug.d.ts +0 -11
- package/dist/class/class.slug.js +1 -8
- package/dist/class/class.standard-array.d.ts +0 -7
- package/dist/class/class.standard-array.js +1 -20
- package/dist/class/class.types.d.ts +0 -20
- package/dist/condition/condition.codec.d.ts +0 -6
- package/dist/condition/condition.parser.d.ts +0 -10
- package/dist/condition/condition.parser.js +1 -7
- package/dist/condition/condition.schema.d.ts +0 -16
- package/dist/condition/condition.types.d.ts +0 -3
- package/dist/data-srd/index.generated.js +1 -146
- package/dist/dnd/amount-text.d.ts +4 -27
- package/dist/dnd/amount-text.js +1 -13
- package/dist/dnd/constants.d.ts +0 -18
- package/dist/dnd/constants.js +1 -42
- package/dist/dnd/formula-tags.d.ts +0 -2
- package/dist/dnd/formula-tags.js +1 -119
- package/dist/dnd/math.d.ts +0 -26
- package/dist/dnd/math.js +1 -45
- package/dist/dnd/prose-tags.d.ts +1 -15
- package/dist/dnd/prose-tags.js +1 -18
- package/dist/dnd/resource-die.d.ts +0 -4
- package/dist/dnd/resource-die.js +1 -17
- package/dist/dnd/resource-formula.d.ts +0 -43
- package/dist/dnd/resource-formula.js +1 -14
- package/dist/dnd/resource-words.d.ts +0 -2
- package/dist/dnd/resource-words.js +1 -30
- package/dist/dnd/srd-tag-converter.d.ts +0 -21
- package/dist/dnd/srd-tag-converter.js +1 -12
- package/dist/dnd/tag-grammar.js +1 -12
- package/dist/dnd/warn-once.js +1 -8
- package/dist/encounter/encounter.ai-schema.js +1 -8
- package/dist/entities/base-item-resolver.d.ts +0 -26
- package/dist/entities/base-item-resolver.js +1 -11
- package/dist/entities/registry-revision.d.ts +10 -0
- package/dist/entities/registry-revision.js +1 -0
- package/dist/entities/slug.d.ts +1 -31
- package/dist/entities/slug.js +1 -12
- package/dist/entities/wikilink-display.d.ts +0 -2
- package/dist/entities/wikilink-display.js +1 -10
- package/dist/feat/feat.category-codes.d.ts +1 -26
- package/dist/feat/feat.category-codes.js +1 -14
- package/dist/feat/feat.codec.d.ts +0 -6
- package/dist/feat/feat.codec.js +1 -12
- package/dist/feat/feat.parser.js +1 -11
- package/dist/feat/feat.schema.d.ts +31 -1
- package/dist/feat/feat.schema.js +1 -10
- package/dist/feat/feat.types.d.ts +0 -6
- package/dist/index.js +45 -138113
- package/dist/inline-tag-parser.js +1 -6
- package/dist/item/item.actions-map.d.ts +4 -63
- package/dist/item/item.actions-map.js +1 -10
- package/dist/item/item.ai-schema.js +1 -6
- package/dist/item/item.attunement.d.ts +0 -14
- package/dist/item/item.attunement.js +1 -6
- package/dist/item/item.bonuses.js +1 -10
- package/dist/item/item.codec.js +1 -9
- package/dist/item/item.conditions.d.ts +0 -7
- package/dist/item/item.conditions.js +1 -11
- package/dist/item/item.conditions.types.d.ts +0 -2
- package/dist/item/item.cost.js +1 -29
- package/dist/item/item.enrichment.js +1 -9
- package/dist/item/item.icon.d.ts +0 -8
- package/dist/item/item.icon.js +1 -211
- package/dist/item/item.parser.js +1 -8
- package/dist/item/item.schema.d.ts +2 -0
- package/dist/item/item.schema.js +1 -11
- package/dist/item/item.types.d.ts +2 -28
- package/dist/monster/monster.ai-schema.js +1 -6
- package/dist/monster/monster.codec.d.ts +0 -10
- package/dist/monster/monster.enrichment.js +1 -19
- package/dist/monster/monster.format.d.ts +0 -69
- package/dist/monster/monster.format.js +1 -78
- package/dist/monster/monster.parser.d.ts +0 -4
- package/dist/monster/monster.parser.js +1 -15
- package/dist/monster/monster.resolve.d.ts +0 -4
- package/dist/monster/monster.schema.d.ts +0 -9
- package/dist/monster/monster.schema.js +1 -34
- package/dist/monster/monster.types.d.ts +0 -3
- package/dist/monster/monster.types.js +1 -1
- package/dist/optional-feature/optional-feature.codec.d.ts +0 -11
- package/dist/optional-feature/optional-feature.codec.js +1 -13
- package/dist/optional-feature/optional-feature.parser.js +1 -12
- package/dist/optional-feature/optional-feature.schema.d.ts +30 -1
- package/dist/optional-feature/optional-feature.schema.js +1 -15
- package/dist/pack.d.ts +0 -9
- package/dist/pc/conditions.constants.js +1 -6
- package/dist/pc/decision-recognizer.js +1 -8
- package/dist/pc/pc.additional-spells.d.ts +4 -14
- package/dist/pc/pc.additional-spells.js +1 -23
- package/dist/pc/pc.amount-bindings.d.ts +4 -20
- package/dist/pc/pc.amount-bindings.js +1 -23
- package/dist/pc/pc.asi-flatten.d.ts +0 -59
- package/dist/pc/pc.asi-flatten.js +1 -16
- package/dist/pc/pc.conditions.d.ts +1 -0
- package/dist/pc/pc.conditions.js +1 -6
- package/dist/pc/pc.containment.d.ts +0 -5
- package/dist/pc/pc.containment.js +1 -24
- package/dist/pc/pc.decision-engine.d.ts +4 -141
- package/dist/pc/pc.decision-engine.js +1 -52
- package/dist/pc/pc.defense-normalize.d.ts +0 -10
- package/dist/pc/pc.defense-normalize.js +1 -6
- package/dist/pc/pc.entry-overrides.d.ts +0 -58
- package/dist/pc/pc.entry-overrides.js +1 -40
- package/dist/pc/pc.equipment.d.ts +2 -22
- package/dist/pc/pc.equipment.js +1 -33
- package/dist/pc/pc.feature-effects.d.ts +23 -275
- package/dist/pc/pc.feature-effects.js +1 -26
- package/dist/pc/pc.formula-context.js +1 -11
- package/dist/pc/pc.infusions.d.ts +0 -65
- package/dist/pc/pc.infusions.js +1 -64
- package/dist/pc/pc.item-effects.d.ts +18 -0
- package/dist/pc/pc.member-choices.d.ts +18 -49
- package/dist/pc/pc.member-choices.js +1 -32
- package/dist/pc/pc.parser.js +1 -58
- package/dist/pc/pc.pools.d.ts +7 -10
- package/dist/pc/pc.pools.js +1 -26
- package/dist/pc/pc.proficiencies.d.ts +7 -33
- package/dist/pc/pc.proficiencies.js +1 -107
- package/dist/pc/pc.proficiency-grants.d.ts +0 -26
- package/dist/pc/pc.proficiency-normalize.d.ts +4 -25
- package/dist/pc/pc.proficiency-normalize.js +1 -12
- package/dist/pc/pc.proficiency-query.d.ts +0 -13
- package/dist/pc/pc.proficiency-query.js +1 -27
- package/dist/pc/pc.recalc.d.ts +7 -131
- package/dist/pc/pc.recalc.js +1 -946
- package/dist/pc/pc.resolver.d.ts +0 -104
- package/dist/pc/pc.resolver.js +1 -59
- package/dist/pc/pc.resource-seed.d.ts +0 -8
- package/dist/pc/pc.resource-seed.js +1 -42
- package/dist/pc/pc.resources.d.ts +1 -59
- package/dist/pc/pc.resources.js +1 -23
- package/dist/pc/pc.rest.d.ts +1 -20
- package/dist/pc/pc.rest.js +1 -230
- package/dist/pc/pc.schema.d.ts +19 -2
- package/dist/pc/pc.schema.js +1 -9
- package/dist/pc/pc.slotting.d.ts +0 -29
- package/dist/pc/pc.slotting.js +1 -28
- package/dist/pc/pc.speeds.d.ts +19 -0
- package/dist/pc/pc.spell-scope.d.ts +6 -0
- package/dist/pc/pc.spellcasting.d.ts +0 -70
- package/dist/pc/pc.spellcasting.js +1 -28
- package/dist/pc/pc.table-column.d.ts +0 -22
- package/dist/pc/pc.table-column.js +1 -18
- package/dist/pc/pc.tool-picks.d.ts +0 -27
- package/dist/pc/pc.tool-picks.js +1 -18
- package/dist/pc/pc.types.d.ts +85 -344
- package/dist/pc/pc.weapon-grant.d.ts +0 -6
- package/dist/pc/pool-layout.d.ts +0 -39
- package/dist/pc/pool-layout.js +1 -18
- package/dist/pc/resource-equivalents.d.ts +2 -40
- package/dist/pc/roll-scope.js +1 -8
- package/dist/pc/roll-tag-labels.d.ts +0 -32
- package/dist/pc/roll-tag-labels.js +1 -17
- package/dist/pc/spell-source.d.ts +0 -11
- package/dist/pc/spell-source.js +1 -8
- package/dist/race/race.codec.d.ts +0 -6
- package/dist/race/race.codec.js +1 -15
- package/dist/race/race.parser.js +1 -14
- package/dist/race/race.schema.d.ts +0 -8
- package/dist/race/race.schema.js +1 -14
- package/dist/race/race.structural.d.ts +0 -6
- package/dist/race/race.structural.js +1 -6
- package/dist/race/race.types.d.ts +0 -8
- package/dist/schemas/attack-schema.d.ts +5 -0
- package/dist/schemas/caster-type-schema.d.ts +1 -6
- package/dist/schemas/caster-type-schema.js +1 -6
- package/dist/schemas/choice-schema.js +1 -7
- package/dist/schemas/duration-schema.d.ts +0 -2
- package/dist/schemas/duration-schema.js +1 -6
- package/dist/schemas/entity-extras-schema.d.ts +0 -30
- package/dist/schemas/entity-extras-schema.js +1 -10
- package/dist/schemas/equipment-grant-schema.d.ts +0 -2
- package/dist/schemas/equipment-grant-schema.js +1 -12
- package/dist/schemas/feature-alias.d.ts +0 -27
- package/dist/schemas/feature-effect-schema.d.ts +30 -1
- package/dist/schemas/feature-effect-schema.js +1 -6
- package/dist/schemas/feature-schema.d.ts +0 -6
- package/dist/schemas/feature-schema.js +1 -12
- package/dist/schemas/resource-schema.d.ts +1 -34
- package/dist/schemas/resource-schema.js +1 -12
- package/dist/schemas/selection-pool-schema.js +1 -10
- package/dist/spell/casting-time.d.ts +0 -15
- package/dist/spell/casting-time.js +1 -6
- package/dist/spell/spell.access.d.ts +0 -6
- package/dist/spell/spell.access.js +1 -45
- package/dist/spell/spell.ai-schema.js +1 -6
- package/dist/spell/spell.codec.js +1 -9
- package/dist/spell/spell.enrichment.js +1 -9
- package/dist/spell/spell.filter.d.ts +0 -5
- package/dist/spell/spell.filter.js +1 -75
- package/dist/spell/spell.parser.d.ts +0 -31
- package/dist/spell/spell.parser.js +1 -16
- package/dist/spell/spell.scaling.d.ts +0 -46
- package/dist/spell/spell.scaling.js +1 -79
- package/dist/spell/spell.schema.js +1 -7
- package/dist/spell/spell.types.d.ts +0 -7
- package/dist/srd/retired-items.d.ts +0 -4
- package/dist/srd/retired-items.js +1 -11
- package/dist/srd-store.d.ts +0 -33
- package/dist/subclass/subclass.codec.d.ts +0 -8
- package/dist/subclass/subclass.codec.js +1 -17
- package/dist/subclass/subclass.parser.js +1 -16
- package/dist/subclass/subclass.schema.d.ts +2 -1
- package/dist/subclass/subclass.schema.js +1 -14
- package/dist/subclass/subclass.types.d.ts +0 -3
- package/dist/types/attack.d.ts +2 -0
- package/dist/types/casting-option.d.ts +0 -4
- package/dist/types/choice.d.ts +1 -72
- package/dist/types/choice.js +1 -24
- package/dist/types/edition.d.ts +0 -3
- package/dist/types/equipment-grant.d.ts +1 -27
- package/dist/types/equipment-grant.js +1 -12
- package/dist/types/feature-effect.d.ts +14 -14
- package/dist/types/feature.d.ts +0 -22
- package/dist/types/optional-feature.types.d.ts +1 -31
- package/dist/types/resource.d.ts +1 -21
- package/dist/types/selection-pool.d.ts +0 -24
- package/dist/weapon/weapon-mastery.d.ts +0 -1
- package/dist/weapon/weapon.classify.d.ts +0 -11
- package/dist/weapon/weapon.classify.js +1 -7
- package/dist/weapon/weapon.codec.d.ts +0 -9
- package/dist/weapon/weapon.codec.js +1 -9
- package/dist/weapon/weapon.parser.js +1 -8
- package/dist/weapon/weapon.schema.js +1 -7
- package/dist/weapon/weapon.types.d.ts +0 -3
- package/package.json +3 -3
- package/src/data-srd/ATTRIBUTION.md +1 -1
- package/dist/chunk-2FRUSVZS.js +0 -489
- package/dist/chunk-2JSQE3DD.js +0 -206
- package/dist/chunk-2LULMQTF.js +0 -14
- package/dist/chunk-2UDSN6VW.js +0 -18
- package/dist/chunk-3LWMFYKS.js +0 -57
- package/dist/chunk-3MGQFFNE.js +0 -110
- package/dist/chunk-3TM34RSJ.js +0 -23
- package/dist/chunk-3VZZDKRA.js +0 -1014
- package/dist/chunk-4U55VNC7.js +0 -22
- package/dist/chunk-5GKJAUMX.js +0 -59
- package/dist/chunk-5MXFW4O3.js +0 -71
- package/dist/chunk-656QCX4U.js +0 -22
- package/dist/chunk-6EI737IO.js +0 -19
- package/dist/chunk-6GNXYAYP.js +0 -25
- package/dist/chunk-6PXTNCBP.js +0 -133
- package/dist/chunk-6X2NV665.js +0 -33
- package/dist/chunk-7ATNGKBS.js +0 -178
- package/dist/chunk-7Q2VPKCD.js +0 -181
- package/dist/chunk-7QN7XSAK.js +0 -19
- package/dist/chunk-A54HHCWW.js +0 -67
- package/dist/chunk-AZRGFUSR.js +0 -18
- package/dist/chunk-B3DP42OM.js +0 -55
- package/dist/chunk-CJYCVNW2.js +0 -7
- package/dist/chunk-CM5CWO4K.js +0 -735
- package/dist/chunk-DEEHHLAP.js +0 -271
- package/dist/chunk-DOXSFYLH.js +0 -158
- package/dist/chunk-DPUJDOKV.js +0 -365
- package/dist/chunk-EJP263OP.js +0 -186
- package/dist/chunk-EVMUJYUD.js +0 -195
- package/dist/chunk-EYX4JMAU.js +0 -101
- package/dist/chunk-FANQVQ3D.js +0 -89
- package/dist/chunk-FC4IGH5Y.js +0 -18
- package/dist/chunk-G6MHJDVT.js +0 -41
- package/dist/chunk-G6PBI2BU.js +0 -18
- package/dist/chunk-H5PTKYXL.js +0 -101
- package/dist/chunk-HHBD4SQ6.js +0 -24
- package/dist/chunk-HS6FIOLP.js +0 -52
- package/dist/chunk-HTYMW5CH.js +0 -228
- package/dist/chunk-IHE6KVC3.js +0 -13
- package/dist/chunk-IN4M4X7P.js +0 -34
- package/dist/chunk-IUAAXXNO.js +0 -58
- package/dist/chunk-JCMUVZIK.js +0 -133
- package/dist/chunk-JSM6JFZR.js +0 -709
- package/dist/chunk-K5NJBTE2.js +0 -18
- package/dist/chunk-KR6JF3BF.js +0 -14
- package/dist/chunk-KSTV7J2U.js +0 -112
- package/dist/chunk-KU3YLF6D.js +0 -106
- package/dist/chunk-LBEXLN6I.js +0 -91
- package/dist/chunk-LF5AGJA4.js +0 -81
- package/dist/chunk-LHZXYFBU.js +0 -94
- package/dist/chunk-LSLSG67V.js +0 -31
- package/dist/chunk-LVQLWRCU.js +0 -15
- package/dist/chunk-MBX25B6D.js +0 -18
- package/dist/chunk-MYY2C5MB.js +0 -233
- package/dist/chunk-OFCSP6MT.js +0 -23
- package/dist/chunk-ONTGZR5T.js +0 -1806
- package/dist/chunk-OOSRUJBI.js +0 -19
- package/dist/chunk-PDJSUH24.js +0 -110
- package/dist/chunk-PKX6TGRE.js +0 -93
- package/dist/chunk-PQZ4LM4Z.js +0 -19
- package/dist/chunk-PTXBIDG7.js +0 -63
- package/dist/chunk-PVCEA4HZ.js +0 -6
- package/dist/chunk-PXVNAY7T.js +0 -84
- package/dist/chunk-QH36K2PU.js +0 -158
- package/dist/chunk-QS5L5YTJ.js +0 -24
- package/dist/chunk-QYZV2MQA.js +0 -97
- package/dist/chunk-QZSWN2KT.js +0 -18
- package/dist/chunk-RLGQ5PZZ.js +0 -16
- package/dist/chunk-RYLXAYIQ.js +0 -18
- package/dist/chunk-S3YUXDSC.js +0 -278
- package/dist/chunk-S7REMWW4.js +0 -21
- package/dist/chunk-T6QIF5XR.js +0 -348
- package/dist/chunk-TOM66P2P.js +0 -38
- package/dist/chunk-TULQ4FFX.js +0 -353
- package/dist/chunk-UA5KS2PL.js +0 -26
- package/dist/chunk-UUBJCNQU.js +0 -187
- package/dist/chunk-UZXG6QSY.js +0 -58
- package/dist/chunk-VPYBK2MG.js +0 -18
- package/dist/chunk-VRV3NNTA.js +0 -161
- package/dist/chunk-VTTA2ALZ.js +0 -16
- package/dist/chunk-W6GC6OKK.js +0 -16
- package/dist/chunk-WELIKLZF.js +0 -256
- package/dist/chunk-WSVMLNTO.js +0 -31
- package/dist/chunk-WYGD2UGN.js +0 -14
- package/dist/chunk-XCFC7LGF.js +0 -122
- package/dist/chunk-XJ2F2WO6.js +0 -8
- package/dist/chunk-Y5VVP73C.js +0 -23
- package/dist/chunk-YBLDE5CG.js +0 -42
- package/dist/chunk-YD2VAHA6.js +0 -159
- package/dist/chunk-YDGMBMYI.js +0 -25
- package/dist/chunk-YHYTW5QA.js +0 -20
- package/dist/chunk-YKL6SHRJ.js +0 -23
- package/dist/chunk-ZCTUYGNV.js +0 -26
- package/dist/chunk-ZDAEGJH4.js +0 -102
- package/dist/chunk-ZJXSXVFP.js +0 -58
- package/dist/chunk-ZUQW5VBZ.js +0 -89
package/dist/chunk-HTYMW5CH.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parsePickKey,
|
|
3
|
-
poolAnchorLevel
|
|
4
|
-
} from "./chunk-3VZZDKRA.js";
|
|
5
|
-
import {
|
|
6
|
-
featProgressionCategory
|
|
7
|
-
} from "./chunk-YBLDE5CG.js";
|
|
8
|
-
import {
|
|
9
|
-
warnOnce
|
|
10
|
-
} from "./chunk-LVQLWRCU.js";
|
|
11
|
-
import {
|
|
12
|
-
bareEntitySlug
|
|
13
|
-
} from "./chunk-ZCTUYGNV.js";
|
|
14
|
-
|
|
15
|
-
// src/pc/pc.member-choices.ts
|
|
16
|
-
var OPTIONAL_FEATURE_TYPE_CODE = {
|
|
17
|
-
"MV:B": "maneuver",
|
|
18
|
-
MV: "maneuver",
|
|
19
|
-
EI: "invocation",
|
|
20
|
-
MM: "metamagic",
|
|
21
|
-
"FS:F": "fighting_style"
|
|
22
|
-
};
|
|
23
|
-
function spellFilter(choose, edition) {
|
|
24
|
-
const where = { edition };
|
|
25
|
-
for (const part of choose.split("|")) {
|
|
26
|
-
const [rawKey, rawValue = ""] = part.split("=");
|
|
27
|
-
const key = rawKey.trim().toLowerCase();
|
|
28
|
-
const value = rawValue.trim();
|
|
29
|
-
if (key === "level") {
|
|
30
|
-
const n = Number(value.split(";")[0]);
|
|
31
|
-
if (!Number.isInteger(n)) return null;
|
|
32
|
-
where.level = n;
|
|
33
|
-
} else if (key === "class") where.list = value.toLowerCase();
|
|
34
|
-
else if (key === "components & miscellaneous" && /ritual/i.test(value)) where.ritual = true;
|
|
35
|
-
}
|
|
36
|
-
return where;
|
|
37
|
-
}
|
|
38
|
-
function isTargetChoice(ch) {
|
|
39
|
-
return ch.kind === "select-entity" && ch.target === true;
|
|
40
|
-
}
|
|
41
|
-
function progressionCount(p) {
|
|
42
|
-
var _a;
|
|
43
|
-
if (Array.isArray(p)) return 0;
|
|
44
|
-
return (_a = p["*"]) != null ? _a : Math.max(0, ...Object.values(p));
|
|
45
|
-
}
|
|
46
|
-
function spellChoices(entity, used) {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
const out = [];
|
|
49
|
-
for (const block of (_a = entity.additional_spells) != null ? _a : []) {
|
|
50
|
-
for (const bucket of ["known", "prepared"]) {
|
|
51
|
-
const byLevel = block[bucket];
|
|
52
|
-
if (!byLevel || typeof byLevel !== "object") continue;
|
|
53
|
-
for (const rows of Object.values(byLevel)) {
|
|
54
|
-
for (const row of Array.isArray(rows) ? rows : []) {
|
|
55
|
-
const r = row;
|
|
56
|
-
if (typeof r.choose !== "string") continue;
|
|
57
|
-
const where = spellFilter(r.choose, entity.edition);
|
|
58
|
-
if (!where) continue;
|
|
59
|
-
const base = where.ritual ? "rituals" : where.level === 0 ? "cantrips" : `spells-${(_b = where.level) != null ? _b : "any"}`;
|
|
60
|
-
const label = where.ritual ? "Rituals" : where.level === 0 ? "Cantrips" : `Level ${where.level} spells`;
|
|
61
|
-
let id = base;
|
|
62
|
-
for (let i = 2; used.has(id); i++) id = `${base}-${i}`;
|
|
63
|
-
used.add(id);
|
|
64
|
-
out.push({ kind: "select-entity", id, label, count: typeof r.count === "number" ? r.count : 1, entity_type: "spell", where });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return out;
|
|
70
|
-
}
|
|
71
|
-
function memberChoices(entity) {
|
|
72
|
-
var _a, _b, _c, _d, _e, _f;
|
|
73
|
-
if (!entity) return [];
|
|
74
|
-
if ((_a = entity.choices) == null ? void 0 : _a.length) return entity.choices;
|
|
75
|
-
const out = [];
|
|
76
|
-
const used = /* @__PURE__ */ new Set();
|
|
77
|
-
for (const fp of (_b = entity.feat_progression) != null ? _b : []) {
|
|
78
|
-
const category = featProgressionCategory(fp.category);
|
|
79
|
-
const count = progressionCount(fp.progression);
|
|
80
|
-
if (!category || count < 1) continue;
|
|
81
|
-
const id = used.has("feat") ? `feat-${used.size}` : "feat";
|
|
82
|
-
used.add(id);
|
|
83
|
-
out.push({ kind: "select-entity", id, label: fp.name, count, entity_type: "feat", where: { category, edition: entity.edition } });
|
|
84
|
-
}
|
|
85
|
-
for (const op of (_c = entity.optionalfeature_progression) != null ? _c : []) {
|
|
86
|
-
const codes = (_e = (_d = op.feature_type) != null ? _d : op.featureType) != null ? _e : [];
|
|
87
|
-
const featureType = codes.map((c) => OPTIONAL_FEATURE_TYPE_CODE[c]).find((t) => !!t);
|
|
88
|
-
const count = progressionCount(op.progression);
|
|
89
|
-
if (!featureType || count < 1) {
|
|
90
|
-
if (!featureType) warnOnce(`member-of-code:${entity.slug}`, `Archivist: "${entity.slug}" asks for optional features of type ${codes.join(", ")}, which this engine does not map; no pick is offered`);
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
const id = op.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "option";
|
|
94
|
-
used.add(id);
|
|
95
|
-
out.push({ kind: "select-entity", id, label: op.name, count, entity_type: "optional-feature", where: { feature_type: featureType, edition: entity.edition } });
|
|
96
|
-
}
|
|
97
|
-
out.push(...spellChoices(entity, used));
|
|
98
|
-
for (const pre of (_f = entity.prerequisites) != null ? _f : []) {
|
|
99
|
-
if (pre.kind !== "spell-choose") continue;
|
|
100
|
-
const where = spellFilter(pre.choose, entity.edition);
|
|
101
|
-
if (!where || used.has("cantrip")) continue;
|
|
102
|
-
used.add("cantrip");
|
|
103
|
-
out.push({ kind: "select-entity", id: "cantrip", label: where.level === 0 ? "Cantrip" : "Spell", count: 1, entity_type: "spell", where, target: true });
|
|
104
|
-
}
|
|
105
|
-
return out;
|
|
106
|
-
}
|
|
107
|
-
function siteOf(classIndex, level, poolId, pickKey, member, memberSlug, block) {
|
|
108
|
-
const choices = memberChoices(member);
|
|
109
|
-
if (!choices.length) return null;
|
|
110
|
-
const prefix = `${poolId}:${pickKey}:`;
|
|
111
|
-
return { classIndex, level, poolId, pickKey, member, memberSlug, choices, prefix, block, read: (id) => block[`${prefix}${id}`] };
|
|
112
|
-
}
|
|
113
|
-
function poolMemberSites(classes, registry) {
|
|
114
|
-
const out = [];
|
|
115
|
-
let byBare = null;
|
|
116
|
-
let all = null;
|
|
117
|
-
const lookup = (s, ownerPrefix) => {
|
|
118
|
-
all != null ? all : all = registry.search("", "optional-feature", Number.POSITIVE_INFINITY);
|
|
119
|
-
const bare = bareEntitySlug(s);
|
|
120
|
-
const owned = all.find((e) => bareEntitySlug(e.slug) === bare && e.slug.split("_")[0] === ownerPrefix);
|
|
121
|
-
if (owned) return owned;
|
|
122
|
-
const direct = registry.getByTypeAndSlug("optional-feature", s);
|
|
123
|
-
if (direct) return direct;
|
|
124
|
-
byBare != null ? byBare : byBare = new Map(all.map((e) => [bareEntitySlug(e.slug), e]));
|
|
125
|
-
return byBare.get(bare);
|
|
126
|
-
};
|
|
127
|
-
classes.forEach((rc, classIndex) => {
|
|
128
|
-
var _a, _b, _c, _d, _e;
|
|
129
|
-
if (!rc.entity) return;
|
|
130
|
-
const seen = /* @__PURE__ */ new Set();
|
|
131
|
-
for (const pool of [...(_a = rc.entity.selection_pools) != null ? _a : [], ...(_c = (_b = rc.subclass) == null ? void 0 : _b.selection_pools) != null ? _c : []]) {
|
|
132
|
-
if (seen.has(pool.id)) continue;
|
|
133
|
-
seen.add(pool.id);
|
|
134
|
-
const { anchorLevel } = poolAnchorLevel(rc.entity, pool);
|
|
135
|
-
const block = (_e = (_d = rc.choices) == null ? void 0 : _d[anchorLevel]) != null ? _e : {};
|
|
136
|
-
const raw = block[pool.id];
|
|
137
|
-
const picks = Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : [];
|
|
138
|
-
for (const s of picks) {
|
|
139
|
-
if (typeof s !== "string") continue;
|
|
140
|
-
const { slugPart, param } = parsePickKey(s);
|
|
141
|
-
const reg = lookup(slugPart, rc.entity.slug.split("_")[0]);
|
|
142
|
-
if (!reg) continue;
|
|
143
|
-
const member = reg.data;
|
|
144
|
-
const key = member.repeatable === true || param !== null ? s : reg.slug;
|
|
145
|
-
const site = siteOf(classIndex, anchorLevel, pool.id, key, member, reg.slug, block);
|
|
146
|
-
if (site) out.push(site);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
return out;
|
|
151
|
-
}
|
|
152
|
-
function poolMemberSitesOf(resolved) {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f;
|
|
154
|
-
const out = [];
|
|
155
|
-
for (const pool of (_a = resolved.pools) != null ? _a : []) {
|
|
156
|
-
const block = (_e = (_d = (_c = (_b = resolved.classes) == null ? void 0 : _b[pool.classIndex]) == null ? void 0 : _c.choices) == null ? void 0 : _d[pool.anchorLevel]) != null ? _e : {};
|
|
157
|
-
for (const e of (_f = pool.selected) != null ? _f : []) {
|
|
158
|
-
const site = siteOf(pool.classIndex, pool.anchorLevel, pool.id, e.key, e.entity, e.slug, block);
|
|
159
|
-
if (site) out.push(site);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return out;
|
|
163
|
-
}
|
|
164
|
-
var stripRef = (ref) => ref.replace(/^\[\[/, "").replace(/\]\]$/, "");
|
|
165
|
-
function featPickSites(classEntries, memberSites, classSlugOf) {
|
|
166
|
-
const out = [];
|
|
167
|
-
(classEntries != null ? classEntries : []).forEach((c, classIndex) => {
|
|
168
|
-
var _a;
|
|
169
|
-
for (const [lvl, choiceBlock] of Object.entries((_a = c.choices) != null ? _a : {})) {
|
|
170
|
-
const block = choiceBlock;
|
|
171
|
-
const feat = block == null ? void 0 : block.feat;
|
|
172
|
-
if (!block || typeof feat !== "string") continue;
|
|
173
|
-
const slug = stripRef(feat);
|
|
174
|
-
if (!slug) continue;
|
|
175
|
-
const level = /^\d+$/.test(lvl) ? Number(lvl) : null;
|
|
176
|
-
const cls = classSlugOf(classIndex);
|
|
177
|
-
out.push({
|
|
178
|
-
slug,
|
|
179
|
-
classIndex,
|
|
180
|
-
level,
|
|
181
|
-
via: cls && level !== null ? { kind: "class", slug: cls, level } : null,
|
|
182
|
-
read: (id) => block[`feat:${id}`]
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
for (const site of memberSites) {
|
|
187
|
-
for (const ch of site.choices) {
|
|
188
|
-
if (ch.kind !== "select-entity" || ch.entity_type !== "feat" || ch.target === true) continue;
|
|
189
|
-
const v = site.read(ch.id);
|
|
190
|
-
for (const ref of Array.isArray(v) ? v : typeof v === "string" ? [v] : []) {
|
|
191
|
-
if (typeof ref !== "string") continue;
|
|
192
|
-
const slug = stripRef(ref);
|
|
193
|
-
if (!slug) continue;
|
|
194
|
-
const cls = classSlugOf(site.classIndex);
|
|
195
|
-
out.push({
|
|
196
|
-
slug,
|
|
197
|
-
classIndex: site.classIndex,
|
|
198
|
-
level: site.level,
|
|
199
|
-
via: cls ? { kind: "pool", slug: site.memberSlug, name: site.member.name, classSlug: cls, level: site.level } : null,
|
|
200
|
-
read: (id) => site.block[`${site.prefix}feat:${id}`]
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return out;
|
|
206
|
-
}
|
|
207
|
-
function featOfSite(site, feats) {
|
|
208
|
-
var _a;
|
|
209
|
-
return (_a = feats.find((f) => f.slug === site.slug)) != null ? _a : feats.find((f) => bareEntitySlug(f.slug) === bareEntitySlug(site.slug));
|
|
210
|
-
}
|
|
211
|
-
function nestedPickKeysToPrune(block, key, next) {
|
|
212
|
-
const prev = block == null ? void 0 : block[key];
|
|
213
|
-
if (!block || !Array.isArray(prev)) return [];
|
|
214
|
-
const keep = new Set(next);
|
|
215
|
-
const gone = prev.filter((k) => typeof k === "string" && !keep.has(k));
|
|
216
|
-
if (!gone.length) return [];
|
|
217
|
-
return Object.keys(block).filter((k) => gone.some((g) => k.startsWith(`${key}:${g}:`)));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export {
|
|
221
|
-
isTargetChoice,
|
|
222
|
-
memberChoices,
|
|
223
|
-
poolMemberSites,
|
|
224
|
-
poolMemberSitesOf,
|
|
225
|
-
featPickSites,
|
|
226
|
-
featOfSite,
|
|
227
|
-
nestedPickKeysToPrune
|
|
228
|
-
};
|
package/dist/chunk-IHE6KVC3.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/item/item.attunement.ts
|
|
2
|
-
function requiresAttunement(entity) {
|
|
3
|
-
if (!entity || !("attunement" in entity)) return false;
|
|
4
|
-
const a = entity.attunement;
|
|
5
|
-
if (a === true) return true;
|
|
6
|
-
if (typeof a === "string") return a.length > 0;
|
|
7
|
-
if (typeof a === "object" && a !== null) return a.required === true;
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
requiresAttunement
|
|
13
|
-
};
|
package/dist/chunk-IN4M4X7P.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// src/schemas/equipment-grant-schema.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var equipmentGrantSchema = z.union([
|
|
4
|
-
z.object({
|
|
5
|
-
item: z.string().min(1),
|
|
6
|
-
qty: z.number().int().positive().optional(),
|
|
7
|
-
contains_value: z.number().int().nonnegative().optional(),
|
|
8
|
-
display_name: z.string().min(1).optional(),
|
|
9
|
-
worth_value: z.number().int().nonnegative().optional()
|
|
10
|
-
}).strict(),
|
|
11
|
-
z.object({ category: z.string().min(1), qty: z.number().int().positive().optional(), display_name: z.string().min(1).optional() }).strict(),
|
|
12
|
-
z.object({ gold: z.number().int().positive() }).strict()
|
|
13
|
-
]);
|
|
14
|
-
var equipmentOptionSchema = z.object({
|
|
15
|
-
label: z.string().min(1),
|
|
16
|
-
grants: z.array(equipmentGrantSchema)
|
|
17
|
-
}).strict();
|
|
18
|
-
var startingEquipmentEntrySchema = z.discriminatedUnion("kind", [
|
|
19
|
-
z.object({ kind: z.literal("choice"), options: z.array(equipmentOptionSchema).nonempty() }).strict(),
|
|
20
|
-
z.object({ kind: z.literal("fixed"), label: z.string().min(1).optional(), grants: z.array(equipmentGrantSchema) }).strict(),
|
|
21
|
-
z.object({ kind: z.literal("gold"), amount: z.number().int().positive() }).strict()
|
|
22
|
-
]);
|
|
23
|
-
var startingGoldSchema = z.object({
|
|
24
|
-
fixed: z.number().int().nonnegative().optional(),
|
|
25
|
-
dice: z.string().min(1).optional(),
|
|
26
|
-
multiplier: z.number().int().positive().optional()
|
|
27
|
-
}).strict();
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
equipmentGrantSchema,
|
|
31
|
-
equipmentOptionSchema,
|
|
32
|
-
startingEquipmentEntrySchema,
|
|
33
|
-
startingGoldSchema
|
|
34
|
-
};
|
package/dist/chunk-IUAAXXNO.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// src/pc/pc.table-column.ts
|
|
2
|
-
function readTableColumn(table, level, keys) {
|
|
3
|
-
var _a;
|
|
4
|
-
const cols = (_a = table == null ? void 0 : table[level]) == null ? void 0 : _a.columns;
|
|
5
|
-
if (!cols) return null;
|
|
6
|
-
for (const k of keys) {
|
|
7
|
-
const raw = cols[k];
|
|
8
|
-
if (raw === void 0 || raw === null) continue;
|
|
9
|
-
const n = typeof raw === "number" ? raw : parseInt(String(raw), 10);
|
|
10
|
-
if (!Number.isNaN(n)) return n;
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
function numericColumnsAt(table, level) {
|
|
15
|
-
var _a;
|
|
16
|
-
const out = {};
|
|
17
|
-
const cols = (_a = table == null ? void 0 : table[level]) == null ? void 0 : _a.columns;
|
|
18
|
-
if (!cols) return out;
|
|
19
|
-
for (const [k, raw] of Object.entries(cols)) {
|
|
20
|
-
if (raw === void 0 || raw === null) continue;
|
|
21
|
-
const n = typeof raw === "number" ? raw : parseInt(String(raw), 10);
|
|
22
|
-
if (!Number.isNaN(n)) out[k] = n;
|
|
23
|
-
}
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
var COUNT_COLUMNS = {
|
|
27
|
-
"weapon-mastery": ["Weapon Mastery"]
|
|
28
|
-
};
|
|
29
|
-
function countColumnsFor(choiceId) {
|
|
30
|
-
if (!Object.prototype.hasOwnProperty.call(COUNT_COLUMNS, choiceId)) return void 0;
|
|
31
|
-
return COUNT_COLUMNS[choiceId];
|
|
32
|
-
}
|
|
33
|
-
function diceColumnAt(table, level, key) {
|
|
34
|
-
var _a;
|
|
35
|
-
const cols = (_a = table == null ? void 0 : table[level]) == null ? void 0 : _a.columns;
|
|
36
|
-
if (!cols || !Object.prototype.hasOwnProperty.call(cols, key)) return null;
|
|
37
|
-
const raw = cols[key];
|
|
38
|
-
if (typeof raw !== "string") return null;
|
|
39
|
-
const cell = raw.trim();
|
|
40
|
-
return /^\d+d\d+$/i.test(cell) ? cell : null;
|
|
41
|
-
}
|
|
42
|
-
var UNARMED_DIE_COLUMNS = {
|
|
43
|
-
"martial-arts": "Martial Arts"
|
|
44
|
-
};
|
|
45
|
-
function unarmedDieColumnFor(featureSlug) {
|
|
46
|
-
if (!Object.prototype.hasOwnProperty.call(UNARMED_DIE_COLUMNS, featureSlug)) return void 0;
|
|
47
|
-
return UNARMED_DIE_COLUMNS[featureSlug];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
readTableColumn,
|
|
52
|
-
numericColumnsAt,
|
|
53
|
-
COUNT_COLUMNS,
|
|
54
|
-
countColumnsFor,
|
|
55
|
-
diceColumnAt,
|
|
56
|
-
UNARMED_DIE_COLUMNS,
|
|
57
|
-
unarmedDieColumnFor
|
|
58
|
-
};
|
package/dist/chunk-JCMUVZIK.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MONSTER_KNOWN_KEYS,
|
|
3
|
-
monsterSchema
|
|
4
|
-
} from "./chunk-7ATNGKBS.js";
|
|
5
|
-
|
|
6
|
-
// src/monster/monster.parser.ts
|
|
7
|
-
import { parseYaml } from "@archivist-gg/core";
|
|
8
|
-
var VALID_RECHARGE_TYPES = /* @__PURE__ */ new Set([
|
|
9
|
-
"recharge_on_roll",
|
|
10
|
-
"per_day",
|
|
11
|
-
"per_short_rest",
|
|
12
|
-
"per_long_rest"
|
|
13
|
-
]);
|
|
14
|
-
var NUMERIC_STRING = /^[+-]?\d+(\.\d+)?$/;
|
|
15
|
-
var FEATURE_ARRAYS = ["traits", "actions", "reactions", "legendary_actions", "bonus_actions", "mythic"];
|
|
16
|
-
var SPEED_MODES = ["walk", "fly", "swim", "climb", "burrow"];
|
|
17
|
-
var ABILITY_KEYS = ["str", "dex", "con", "int", "wis", "cha"];
|
|
18
|
-
var NULL_KEPT = /* @__PURE__ */ new Set(["senses", "languages", "group"]);
|
|
19
|
-
function isRecord(v) {
|
|
20
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
21
|
-
}
|
|
22
|
-
function coerceNumeric(obj, key) {
|
|
23
|
-
const v = obj[key];
|
|
24
|
-
if (typeof v === "string" && NUMERIC_STRING.test(v.trim())) obj[key] = Number(v);
|
|
25
|
-
}
|
|
26
|
-
function scrubNulls(v, top) {
|
|
27
|
-
if (Array.isArray(v)) {
|
|
28
|
-
for (let i = v.length - 1; i >= 0; i--) {
|
|
29
|
-
if (v[i] === null) v.splice(i, 1);
|
|
30
|
-
else scrubNulls(v[i], false);
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (!isRecord(v)) return;
|
|
35
|
-
for (const [k, x] of Object.entries(v)) {
|
|
36
|
-
if (x === null) {
|
|
37
|
-
if (!(top && NULL_KEPT.has(k))) delete v[k];
|
|
38
|
-
} else scrubNulls(x, false);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function scrubNonFinite(v) {
|
|
42
|
-
if (Array.isArray(v)) {
|
|
43
|
-
for (const x of v) scrubNonFinite(x);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!isRecord(v)) return;
|
|
47
|
-
for (const [k, x] of Object.entries(v)) {
|
|
48
|
-
if (typeof x === "number" && !Number.isFinite(x)) delete v[k];
|
|
49
|
-
else scrubNonFinite(x);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function migrateLegacy(raw) {
|
|
53
|
-
scrubNulls(raw, true);
|
|
54
|
-
if (raw.legendary_actions != null && !Array.isArray(raw.legendary_actions) && typeof raw.legendary_actions !== "object") {
|
|
55
|
-
if (raw.legendary_action_uses == null) raw.legendary_action_uses = Number(raw.legendary_actions);
|
|
56
|
-
delete raw.legendary_actions;
|
|
57
|
-
}
|
|
58
|
-
if (!Array.isArray(raw.legendary_actions) && Array.isArray(raw.legendary)) raw.legendary_actions = raw.legendary;
|
|
59
|
-
delete raw.legendary;
|
|
60
|
-
if (typeof raw.ac === "number") raw.ac = [{ ac: raw.ac }];
|
|
61
|
-
if (Array.isArray(raw.ac)) raw.ac = raw.ac.map((e) => typeof e === "number" ? { ac: e } : e);
|
|
62
|
-
if (typeof raw.hp === "number") raw.hp = { average: raw.hp };
|
|
63
|
-
if (typeof raw.cr === "number") raw.cr = String(raw.cr);
|
|
64
|
-
for (const k of ["passive_perception", "legendary_action_uses", "legendary_resistance", "columns", "initiative"]) coerceNumeric(raw, k);
|
|
65
|
-
if (isRecord(raw.initiative)) coerceNumeric(raw.initiative, "proficiency");
|
|
66
|
-
for (const k of ["saves", "skills"]) {
|
|
67
|
-
const o = raw[k];
|
|
68
|
-
if (isRecord(o)) for (const m of Object.keys(o)) coerceNumeric(o, m);
|
|
69
|
-
}
|
|
70
|
-
if (isRecord(raw.hp)) coerceNumeric(raw.hp, "average");
|
|
71
|
-
if (Array.isArray(raw.ac)) {
|
|
72
|
-
for (const e of raw.ac) if (isRecord(e)) coerceNumeric(e, "ac");
|
|
73
|
-
}
|
|
74
|
-
if (isRecord(raw.abilities)) for (const k of ABILITY_KEYS) coerceNumeric(raw.abilities, k);
|
|
75
|
-
if (isRecord(raw.speed)) for (const k of SPEED_MODES) {
|
|
76
|
-
coerceNumeric(raw.speed, k);
|
|
77
|
-
const v = raw.speed[k];
|
|
78
|
-
if (isRecord(v)) coerceNumeric(v, "number");
|
|
79
|
-
}
|
|
80
|
-
scrubNonFinite(raw);
|
|
81
|
-
if (isRecord(raw.abilities)) {
|
|
82
|
-
for (const k of ABILITY_KEYS) if (raw.abilities[k] == null) raw.abilities[k] = 10;
|
|
83
|
-
}
|
|
84
|
-
if (typeof raw.senses === "string") raw.senses = [raw.senses];
|
|
85
|
-
if (typeof raw.languages === "string") raw.languages = [raw.languages];
|
|
86
|
-
for (const k of FEATURE_ARRAYS) {
|
|
87
|
-
const arr = raw[k];
|
|
88
|
-
if (!Array.isArray(arr)) continue;
|
|
89
|
-
for (const f of arr) {
|
|
90
|
-
if (!isRecord(f)) continue;
|
|
91
|
-
if (typeof f.desc === "string" && f.description === void 0 && !Array.isArray(f.entries)) {
|
|
92
|
-
f.description = f.desc;
|
|
93
|
-
delete f.desc;
|
|
94
|
-
}
|
|
95
|
-
const r = f.recharge;
|
|
96
|
-
if (r !== void 0 && !(isRecord(r) && typeof r.param === "number" && VALID_RECHARGE_TYPES.has(r.type))) delete f.recharge;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function parseMonster(source) {
|
|
101
|
-
var _a, _b;
|
|
102
|
-
const result = parseYaml(source, ["name"]);
|
|
103
|
-
if (!result.success) return result;
|
|
104
|
-
const raw = result.data;
|
|
105
|
-
migrateLegacy(raw);
|
|
106
|
-
const parsed = monsterSchema.safeParse(raw);
|
|
107
|
-
if (!parsed.success) {
|
|
108
|
-
return { success: false, error: `monster schema validation failed: ${parsed.error.message}` };
|
|
109
|
-
}
|
|
110
|
-
const monster = parsed.data;
|
|
111
|
-
const extras = {};
|
|
112
|
-
for (const [k, v] of Object.entries(raw)) if (!MONSTER_KNOWN_KEYS.has(k)) extras[k] = v;
|
|
113
|
-
if (Object.keys(extras).length > 0) monster.raw = { ...(_a = monster.raw) != null ? _a : {}, ...extras };
|
|
114
|
-
if (!monster.legendary_resistance && monster.traits) {
|
|
115
|
-
const lrIndex = monster.traits.findIndex((t) => {
|
|
116
|
-
var _a2;
|
|
117
|
-
return /^Legendary Resistance\s*\(/i.test((_a2 = t.name) != null ? _a2 : "");
|
|
118
|
-
});
|
|
119
|
-
if (lrIndex !== -1) {
|
|
120
|
-
const match = (_b = monster.traits[lrIndex].name) == null ? void 0 : _b.match(/\((\d+)\/Day\)/i);
|
|
121
|
-
if (match) {
|
|
122
|
-
monster.legendary_resistance = parseInt(match[1], 10);
|
|
123
|
-
monster.traits.splice(lrIndex, 1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return { success: true, data: monster };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export {
|
|
131
|
-
migrateLegacy,
|
|
132
|
-
parseMonster
|
|
133
|
-
};
|