@archivist-gg/dnd5e 0.3.19 → 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.
Files changed (440) hide show
  1. package/LICENSE +48 -21
  2. package/README.md +26 -48
  3. package/dist/armor/armor.codec.d.ts +0 -7
  4. package/dist/armor/armor.codec.js +1 -9
  5. package/dist/armor/armor.parser.js +1 -8
  6. package/dist/armor/armor.schema.js +1 -7
  7. package/dist/armor/armor.types.d.ts +0 -3
  8. package/dist/background/background.codec.d.ts +0 -6
  9. package/dist/background/background.codec.js +1 -12
  10. package/dist/background/background.parser.js +1 -11
  11. package/dist/background/background.schema.js +1 -12
  12. package/dist/background/background.types.d.ts +0 -5
  13. package/dist/chunk-2EOGK6R6.js +1 -0
  14. package/dist/chunk-2HRRH3WL.js +1 -0
  15. package/dist/chunk-2LCGKNVM.js +1 -0
  16. package/dist/chunk-2NUDWOFG.js +1 -0
  17. package/dist/chunk-334WLI7V.js +1 -0
  18. package/dist/chunk-3LWOVRLA.js +1 -0
  19. package/dist/chunk-3QQOATV3.js +1 -0
  20. package/dist/chunk-4E2GIWJE.js +1 -0
  21. package/dist/chunk-4GN3GYMP.js +1 -0
  22. package/dist/chunk-4IAMSRHD.js +1 -0
  23. package/dist/chunk-4JEF3CET.js +1 -0
  24. package/dist/chunk-4KVVAENP.js +1 -0
  25. package/dist/chunk-56JK6VCL.js +1 -0
  26. package/dist/chunk-5FEXHY4U.js +1 -0
  27. package/dist/chunk-63YJPWTM.js +1 -0
  28. package/dist/chunk-6ASJ3MVB.js +1 -0
  29. package/dist/chunk-6IC53O3Q.js +1 -0
  30. package/dist/chunk-6LCNV26D.js +1 -0
  31. package/dist/chunk-6W253VHH.js +1 -0
  32. package/dist/chunk-7AKJBRBD.js +1 -0
  33. package/dist/chunk-7EL3GWWJ.js +1 -0
  34. package/dist/chunk-7FPQJDFD.js +1 -0
  35. package/dist/chunk-7J5BNH2D.js +1 -0
  36. package/dist/chunk-7LPKI27J.js +1 -0
  37. package/dist/chunk-7UPYRKMF.js +1 -0
  38. package/dist/chunk-A7H6LX47.js +1 -0
  39. package/dist/chunk-AINRPPLH.js +1 -0
  40. package/dist/chunk-BC52J4LA.js +1 -0
  41. package/dist/chunk-BCXGB4HP.js +1 -0
  42. package/dist/chunk-BGX36NPE.js +1 -0
  43. package/dist/chunk-BPKG6RZ7.js +1 -0
  44. package/dist/chunk-BREHZNTL.js +1 -0
  45. package/dist/chunk-BZ6BGGZS.js +1 -0
  46. package/dist/chunk-CAPYNIGK.js +1 -0
  47. package/dist/chunk-CCFIINBA.js +1 -0
  48. package/dist/chunk-CMIEZQL4.js +1 -0
  49. package/dist/chunk-DVUXUIPV.js +1 -0
  50. package/dist/chunk-DY6FVAGA.js +1 -0
  51. package/dist/chunk-DZITM5AG.js +1 -0
  52. package/dist/chunk-DZKSXSJF.js +1 -0
  53. package/dist/chunk-EAARMPCW.js +1 -0
  54. package/dist/chunk-EVT7MGAC.js +1 -0
  55. package/dist/chunk-FOLHTMSC.js +1 -0
  56. package/dist/chunk-GCYUCIDN.js +1 -0
  57. package/dist/chunk-GIOV6JW7.js +1 -0
  58. package/dist/chunk-HCK6IUB3.js +1 -0
  59. package/dist/chunk-HR5MKCP2.js +1 -0
  60. package/dist/chunk-I26FHSI6.js +1 -0
  61. package/dist/chunk-I4O2FIDT.js +1 -0
  62. package/dist/chunk-IGVRLGLM.js +1 -0
  63. package/dist/chunk-IHPLT2ZT.js +1 -0
  64. package/dist/chunk-IOCJIWCV.js +1 -0
  65. package/dist/chunk-JXDX2DKF.js +1 -0
  66. package/dist/chunk-KBFSJ5WE.js +1 -0
  67. package/dist/chunk-KM75CC6Q.js +1 -0
  68. package/dist/chunk-KZDDFG4O.js +1 -0
  69. package/dist/chunk-LJNT3PJP.js +1 -0
  70. package/dist/chunk-LR6UMA5V.js +1 -0
  71. package/dist/chunk-M6RPOLKS.js +1 -0
  72. package/dist/chunk-MC6PLWRZ.js +1 -0
  73. package/dist/chunk-MGGKZGLG.js +1 -0
  74. package/dist/chunk-N3RYJ7RE.js +1 -0
  75. package/dist/chunk-NEMX7QGG.js +1 -0
  76. package/dist/chunk-NI364WV7.js +1 -0
  77. package/dist/chunk-O2QZ73GA.js +1 -0
  78. package/dist/chunk-O776WL7O.js +1 -0
  79. package/dist/chunk-OTFNINUY.js +1 -0
  80. package/dist/chunk-PQAVMK3T.js +1 -0
  81. package/dist/chunk-PZ3ZZ5H5.js +1 -0
  82. package/dist/chunk-PZ4L2EEG.js +1 -0
  83. package/dist/chunk-PZUPZBTN.js +1 -0
  84. package/dist/chunk-QBA757AU.js +1 -0
  85. package/dist/chunk-QFIGPOFW.js +1 -0
  86. package/dist/chunk-QMEKQTUT.js +1 -0
  87. package/dist/chunk-QVWT67WA.js +1 -0
  88. package/dist/chunk-RDXQAZBA.js +1 -0
  89. package/dist/chunk-RE5Z5RNK.js +1 -0
  90. package/dist/chunk-RL4VY2AL.js +1 -0
  91. package/dist/chunk-RQGTBHJW.js +1 -0
  92. package/dist/chunk-RQZCGXUZ.js +1 -0
  93. package/dist/chunk-S5UCI27C.js +1 -0
  94. package/dist/chunk-SEOASDO4.js +1 -0
  95. package/dist/chunk-SU4MEZ5P.js +1 -0
  96. package/dist/chunk-T55DELVL.js +1 -0
  97. package/dist/chunk-TKIEPC6F.js +1 -0
  98. package/dist/chunk-TLXFGGWH.js +1 -0
  99. package/dist/chunk-UBUKCRZ3.js +1 -0
  100. package/dist/chunk-V6NQ547U.js +1 -0
  101. package/dist/chunk-VA3ZWV7C.js +1 -0
  102. package/dist/chunk-VIP3FH2O.js +1 -0
  103. package/dist/chunk-VTQ4RWEG.js +1 -0
  104. package/dist/chunk-WUHTSLG4.js +1 -0
  105. package/dist/chunk-X22SISGM.js +1 -0
  106. package/dist/chunk-XKJXT2PN.js +1 -0
  107. package/dist/chunk-XQMKH4R4.js +1 -0
  108. package/dist/chunk-YGH7S5ZF.js +1 -0
  109. package/dist/chunk-ZE46ADXS.js +1 -0
  110. package/dist/chunk-ZI3FEUX3.js +1 -0
  111. package/dist/class/class.codec.d.ts +0 -7
  112. package/dist/class/class.codec.js +1 -18
  113. package/dist/class/class.parser.js +1 -17
  114. package/dist/class/class.schema.d.ts +2 -1
  115. package/dist/class/class.schema.js +1 -15
  116. package/dist/class/class.slug.d.ts +0 -11
  117. package/dist/class/class.slug.js +1 -8
  118. package/dist/class/class.standard-array.d.ts +0 -7
  119. package/dist/class/class.standard-array.js +1 -20
  120. package/dist/class/class.types.d.ts +0 -20
  121. package/dist/condition/condition.codec.d.ts +0 -6
  122. package/dist/condition/condition.parser.d.ts +0 -10
  123. package/dist/condition/condition.parser.js +1 -7
  124. package/dist/condition/condition.schema.d.ts +0 -16
  125. package/dist/condition/condition.types.d.ts +0 -3
  126. package/dist/data-srd/index.generated.js +1 -146
  127. package/dist/dnd/amount-text.d.ts +3 -30
  128. package/dist/dnd/amount-text.js +1 -15
  129. package/dist/dnd/constants.d.ts +0 -18
  130. package/dist/dnd/constants.js +1 -42
  131. package/dist/dnd/formula-tags.d.ts +0 -2
  132. package/dist/dnd/formula-tags.js +1 -119
  133. package/dist/dnd/math.d.ts +0 -26
  134. package/dist/dnd/math.js +1 -45
  135. package/dist/dnd/prose-tags.d.ts +1 -15
  136. package/dist/dnd/prose-tags.js +1 -18
  137. package/dist/dnd/resource-die.d.ts +0 -4
  138. package/dist/dnd/resource-die.js +1 -17
  139. package/dist/dnd/resource-formula.d.ts +0 -43
  140. package/dist/dnd/resource-formula.js +1 -14
  141. package/dist/dnd/resource-words.d.ts +0 -2
  142. package/dist/dnd/resource-words.js +1 -30
  143. package/dist/dnd/srd-tag-converter.d.ts +0 -21
  144. package/dist/dnd/srd-tag-converter.js +1 -12
  145. package/dist/dnd/tag-grammar.js +1 -12
  146. package/dist/dnd/warn-once.js +1 -8
  147. package/dist/encounter/encounter.ai-schema.js +1 -8
  148. package/dist/entities/base-item-resolver.d.ts +0 -26
  149. package/dist/entities/base-item-resolver.js +1 -11
  150. package/dist/entities/registry-revision.d.ts +0 -15
  151. package/dist/entities/registry-revision.js +1 -10
  152. package/dist/entities/slug.d.ts +1 -31
  153. package/dist/entities/slug.js +1 -12
  154. package/dist/entities/wikilink-display.d.ts +0 -2
  155. package/dist/entities/wikilink-display.js +1 -10
  156. package/dist/feat/feat.category-codes.d.ts +1 -26
  157. package/dist/feat/feat.category-codes.js +1 -14
  158. package/dist/feat/feat.codec.d.ts +0 -6
  159. package/dist/feat/feat.codec.js +1 -12
  160. package/dist/feat/feat.parser.js +1 -11
  161. package/dist/feat/feat.schema.d.ts +22 -1
  162. package/dist/feat/feat.schema.js +1 -10
  163. package/dist/feat/feat.types.d.ts +0 -6
  164. package/dist/index.js +45 -141495
  165. package/dist/inline-tag-parser.js +1 -6
  166. package/dist/item/item.actions-map.d.ts +4 -63
  167. package/dist/item/item.actions-map.js +1 -10
  168. package/dist/item/item.ai-schema.js +1 -6
  169. package/dist/item/item.attunement.d.ts +0 -14
  170. package/dist/item/item.attunement.js +1 -6
  171. package/dist/item/item.bonuses.js +1 -10
  172. package/dist/item/item.codec.js +1 -9
  173. package/dist/item/item.conditions.d.ts +0 -7
  174. package/dist/item/item.conditions.js +1 -11
  175. package/dist/item/item.conditions.types.d.ts +0 -2
  176. package/dist/item/item.cost.js +1 -29
  177. package/dist/item/item.enrichment.js +1 -9
  178. package/dist/item/item.icon.d.ts +0 -8
  179. package/dist/item/item.icon.js +1 -211
  180. package/dist/item/item.parser.js +1 -8
  181. package/dist/item/item.schema.d.ts +2 -0
  182. package/dist/item/item.schema.js +1 -11
  183. package/dist/item/item.types.d.ts +2 -28
  184. package/dist/monster/monster.ai-schema.js +1 -6
  185. package/dist/monster/monster.codec.d.ts +0 -10
  186. package/dist/monster/monster.enrichment.js +1 -19
  187. package/dist/monster/monster.format.d.ts +0 -69
  188. package/dist/monster/monster.format.js +1 -78
  189. package/dist/monster/monster.parser.d.ts +0 -4
  190. package/dist/monster/monster.parser.js +1 -15
  191. package/dist/monster/monster.resolve.d.ts +0 -4
  192. package/dist/monster/monster.schema.d.ts +0 -9
  193. package/dist/monster/monster.schema.js +1 -34
  194. package/dist/monster/monster.types.d.ts +0 -3
  195. package/dist/monster/monster.types.js +1 -1
  196. package/dist/optional-feature/optional-feature.codec.d.ts +0 -11
  197. package/dist/optional-feature/optional-feature.codec.js +1 -13
  198. package/dist/optional-feature/optional-feature.parser.js +1 -12
  199. package/dist/optional-feature/optional-feature.schema.d.ts +21 -1
  200. package/dist/optional-feature/optional-feature.schema.js +1 -15
  201. package/dist/pack.d.ts +0 -9
  202. package/dist/pc/conditions.constants.js +1 -6
  203. package/dist/pc/decision-recognizer.js +1 -8
  204. package/dist/pc/pc.additional-spells.d.ts +0 -24
  205. package/dist/pc/pc.additional-spells.js +1 -26
  206. package/dist/pc/pc.amount-bindings.d.ts +0 -25
  207. package/dist/pc/pc.amount-bindings.js +1 -28
  208. package/dist/pc/pc.asi-flatten.d.ts +0 -59
  209. package/dist/pc/pc.asi-flatten.js +1 -16
  210. package/dist/pc/pc.conditions.d.ts +1 -0
  211. package/dist/pc/pc.conditions.js +1 -6
  212. package/dist/pc/pc.containment.d.ts +0 -5
  213. package/dist/pc/pc.containment.js +1 -24
  214. package/dist/pc/pc.decision-engine.d.ts +0 -145
  215. package/dist/pc/pc.decision-engine.js +1 -55
  216. package/dist/pc/pc.defense-normalize.d.ts +0 -10
  217. package/dist/pc/pc.defense-normalize.js +1 -6
  218. package/dist/pc/pc.entry-overrides.d.ts +0 -58
  219. package/dist/pc/pc.entry-overrides.js +1 -41
  220. package/dist/pc/pc.equipment.d.ts +2 -22
  221. package/dist/pc/pc.equipment.js +1 -34
  222. package/dist/pc/pc.feature-effects.d.ts +22 -281
  223. package/dist/pc/pc.feature-effects.js +1 -39
  224. package/dist/pc/pc.formula-context.js +1 -11
  225. package/dist/pc/pc.infusions.d.ts +0 -65
  226. package/dist/pc/pc.infusions.js +1 -65
  227. package/dist/pc/pc.item-effects.d.ts +18 -0
  228. package/dist/pc/pc.member-choices.d.ts +3 -66
  229. package/dist/pc/pc.member-choices.js +1 -39
  230. package/dist/pc/pc.parser.js +1 -58
  231. package/dist/pc/pc.pools.d.ts +7 -10
  232. package/dist/pc/pc.pools.js +1 -27
  233. package/dist/pc/pc.proficiencies.d.ts +0 -40
  234. package/dist/pc/pc.proficiencies.js +1 -156
  235. package/dist/pc/pc.proficiency-grants.d.ts +0 -26
  236. package/dist/pc/pc.proficiency-normalize.d.ts +0 -35
  237. package/dist/pc/pc.proficiency-normalize.js +1 -18
  238. package/dist/pc/pc.proficiency-query.d.ts +0 -13
  239. package/dist/pc/pc.proficiency-query.js +1 -27
  240. package/dist/pc/pc.recalc.d.ts +7 -131
  241. package/dist/pc/pc.recalc.js +1 -1042
  242. package/dist/pc/pc.resolver.d.ts +0 -107
  243. package/dist/pc/pc.resolver.js +1 -60
  244. package/dist/pc/pc.resource-seed.d.ts +0 -8
  245. package/dist/pc/pc.resource-seed.js +1 -42
  246. package/dist/pc/pc.resources.d.ts +1 -59
  247. package/dist/pc/pc.resources.js +1 -23
  248. package/dist/pc/pc.rest.d.ts +1 -20
  249. package/dist/pc/pc.rest.js +1 -231
  250. package/dist/pc/pc.schema.d.ts +0 -2
  251. package/dist/pc/pc.schema.js +1 -9
  252. package/dist/pc/pc.slotting.d.ts +0 -29
  253. package/dist/pc/pc.slotting.js +1 -28
  254. package/dist/pc/pc.speeds.d.ts +19 -0
  255. package/dist/pc/pc.spell-scope.d.ts +0 -16
  256. package/dist/pc/pc.spellcasting.d.ts +0 -70
  257. package/dist/pc/pc.spellcasting.js +1 -28
  258. package/dist/pc/pc.table-column.d.ts +0 -22
  259. package/dist/pc/pc.table-column.js +1 -18
  260. package/dist/pc/pc.tool-picks.d.ts +0 -27
  261. package/dist/pc/pc.tool-picks.js +1 -18
  262. package/dist/pc/pc.types.d.ts +54 -374
  263. package/dist/pc/pc.weapon-grant.d.ts +0 -6
  264. package/dist/pc/pool-layout.d.ts +0 -39
  265. package/dist/pc/pool-layout.js +1 -18
  266. package/dist/pc/resource-equivalents.d.ts +2 -40
  267. package/dist/pc/roll-scope.js +1 -8
  268. package/dist/pc/roll-tag-labels.d.ts +0 -32
  269. package/dist/pc/roll-tag-labels.js +1 -17
  270. package/dist/pc/spell-source.d.ts +0 -11
  271. package/dist/pc/spell-source.js +1 -8
  272. package/dist/race/race.codec.d.ts +0 -6
  273. package/dist/race/race.codec.js +1 -15
  274. package/dist/race/race.parser.js +1 -14
  275. package/dist/race/race.schema.d.ts +0 -8
  276. package/dist/race/race.schema.js +1 -14
  277. package/dist/race/race.structural.d.ts +0 -6
  278. package/dist/race/race.structural.js +1 -6
  279. package/dist/race/race.types.d.ts +0 -8
  280. package/dist/schemas/attack-schema.d.ts +5 -0
  281. package/dist/schemas/caster-type-schema.d.ts +1 -6
  282. package/dist/schemas/caster-type-schema.js +1 -6
  283. package/dist/schemas/choice-schema.js +1 -7
  284. package/dist/schemas/duration-schema.d.ts +0 -2
  285. package/dist/schemas/duration-schema.js +1 -6
  286. package/dist/schemas/entity-extras-schema.d.ts +0 -30
  287. package/dist/schemas/entity-extras-schema.js +1 -10
  288. package/dist/schemas/equipment-grant-schema.d.ts +0 -2
  289. package/dist/schemas/equipment-grant-schema.js +1 -12
  290. package/dist/schemas/feature-alias.d.ts +0 -27
  291. package/dist/schemas/feature-effect-schema.d.ts +21 -1
  292. package/dist/schemas/feature-effect-schema.js +1 -6
  293. package/dist/schemas/feature-schema.d.ts +0 -6
  294. package/dist/schemas/feature-schema.js +1 -12
  295. package/dist/schemas/resource-schema.d.ts +1 -34
  296. package/dist/schemas/resource-schema.js +1 -12
  297. package/dist/schemas/selection-pool-schema.js +1 -10
  298. package/dist/spell/casting-time.d.ts +0 -15
  299. package/dist/spell/casting-time.js +1 -6
  300. package/dist/spell/spell.access.d.ts +0 -6
  301. package/dist/spell/spell.access.js +1 -45
  302. package/dist/spell/spell.ai-schema.js +1 -6
  303. package/dist/spell/spell.codec.js +1 -9
  304. package/dist/spell/spell.enrichment.js +1 -9
  305. package/dist/spell/spell.filter.d.ts +0 -5
  306. package/dist/spell/spell.filter.js +1 -75
  307. package/dist/spell/spell.parser.d.ts +0 -31
  308. package/dist/spell/spell.parser.js +1 -16
  309. package/dist/spell/spell.scaling.d.ts +0 -46
  310. package/dist/spell/spell.scaling.js +1 -79
  311. package/dist/spell/spell.schema.js +1 -7
  312. package/dist/spell/spell.types.d.ts +0 -7
  313. package/dist/srd/retired-items.d.ts +0 -4
  314. package/dist/srd/retired-items.js +1 -11
  315. package/dist/srd-store.d.ts +0 -33
  316. package/dist/subclass/subclass.codec.d.ts +0 -8
  317. package/dist/subclass/subclass.codec.js +1 -17
  318. package/dist/subclass/subclass.parser.js +1 -16
  319. package/dist/subclass/subclass.schema.d.ts +2 -1
  320. package/dist/subclass/subclass.schema.js +1 -14
  321. package/dist/subclass/subclass.types.d.ts +0 -3
  322. package/dist/types/attack.d.ts +2 -0
  323. package/dist/types/casting-option.d.ts +0 -4
  324. package/dist/types/choice.d.ts +1 -72
  325. package/dist/types/choice.js +1 -24
  326. package/dist/types/edition.d.ts +0 -3
  327. package/dist/types/equipment-grant.d.ts +1 -27
  328. package/dist/types/equipment-grant.js +1 -12
  329. package/dist/types/feature-effect.d.ts +4 -22
  330. package/dist/types/feature.d.ts +0 -22
  331. package/dist/types/optional-feature.types.d.ts +1 -31
  332. package/dist/types/resource.d.ts +1 -21
  333. package/dist/types/selection-pool.d.ts +0 -24
  334. package/dist/weapon/weapon-mastery.d.ts +0 -1
  335. package/dist/weapon/weapon.classify.d.ts +0 -11
  336. package/dist/weapon/weapon.classify.js +1 -7
  337. package/dist/weapon/weapon.codec.d.ts +0 -9
  338. package/dist/weapon/weapon.codec.js +1 -9
  339. package/dist/weapon/weapon.parser.js +1 -8
  340. package/dist/weapon/weapon.schema.js +1 -7
  341. package/dist/weapon/weapon.types.d.ts +0 -3
  342. package/package.json +3 -3
  343. package/src/data-srd/ATTRIBUTION.md +1 -1
  344. package/dist/chunk-2FRUSVZS.js +0 -489
  345. package/dist/chunk-2LULMQTF.js +0 -14
  346. package/dist/chunk-3LWMFYKS.js +0 -57
  347. package/dist/chunk-3SFGWFVQ.js +0 -19
  348. package/dist/chunk-3SIUAFDQ.js +0 -18
  349. package/dist/chunk-3TM34RSJ.js +0 -23
  350. package/dist/chunk-4J6DS3EJ.js +0 -30
  351. package/dist/chunk-4U55VNC7.js +0 -22
  352. package/dist/chunk-5GKJAUMX.js +0 -59
  353. package/dist/chunk-5JXFJ5AU.js +0 -26
  354. package/dist/chunk-64VNLMSG.js +0 -375
  355. package/dist/chunk-656QCX4U.js +0 -22
  356. package/dist/chunk-6GNXYAYP.js +0 -25
  357. package/dist/chunk-6PXTNCBP.js +0 -133
  358. package/dist/chunk-6X2NV665.js +0 -33
  359. package/dist/chunk-7Q2VPKCD.js +0 -181
  360. package/dist/chunk-7XJHI5H5.js +0 -709
  361. package/dist/chunk-A54HHCWW.js +0 -67
  362. package/dist/chunk-B2QHP6UF.js +0 -159
  363. package/dist/chunk-B3DP42OM.js +0 -55
  364. package/dist/chunk-BJGOSM76.js +0 -18
  365. package/dist/chunk-BJWSOQUC.js +0 -133
  366. package/dist/chunk-CJYCVNW2.js +0 -7
  367. package/dist/chunk-CM5CWO4K.js +0 -735
  368. package/dist/chunk-DEEHHLAP.js +0 -271
  369. package/dist/chunk-DPUJDOKV.js +0 -365
  370. package/dist/chunk-EJD47JHL.js +0 -1838
  371. package/dist/chunk-EJP263OP.js +0 -186
  372. package/dist/chunk-EVMUJYUD.js +0 -195
  373. package/dist/chunk-EYX4JMAU.js +0 -101
  374. package/dist/chunk-FC4IGH5Y.js +0 -18
  375. package/dist/chunk-FJYBLXV7.js +0 -89
  376. package/dist/chunk-FMUD3LDV.js +0 -19
  377. package/dist/chunk-FMYWORTP.js +0 -93
  378. package/dist/chunk-FVXLP7P3.js +0 -18
  379. package/dist/chunk-G6MHJDVT.js +0 -41
  380. package/dist/chunk-GVWEFECG.js +0 -18
  381. package/dist/chunk-HHBD4SQ6.js +0 -24
  382. package/dist/chunk-HS6FIOLP.js +0 -52
  383. package/dist/chunk-HY2SRSVM.js +0 -23
  384. package/dist/chunk-IHE6KVC3.js +0 -13
  385. package/dist/chunk-IN4M4X7P.js +0 -34
  386. package/dist/chunk-IUAAXXNO.js +0 -58
  387. package/dist/chunk-JXWNXIIZ.js +0 -219
  388. package/dist/chunk-K5NJBTE2.js +0 -18
  389. package/dist/chunk-KR6JF3BF.js +0 -14
  390. package/dist/chunk-KSTV7J2U.js +0 -112
  391. package/dist/chunk-KU3YLF6D.js +0 -106
  392. package/dist/chunk-LBEXLN6I.js +0 -91
  393. package/dist/chunk-LHZXYFBU.js +0 -94
  394. package/dist/chunk-LICYHPI3.js +0 -237
  395. package/dist/chunk-LNT64X7C.js +0 -81
  396. package/dist/chunk-LSLSG67V.js +0 -31
  397. package/dist/chunk-LVQLWRCU.js +0 -15
  398. package/dist/chunk-MYY2C5MB.js +0 -233
  399. package/dist/chunk-NKZMQV2C.js +0 -19
  400. package/dist/chunk-NTU2DXNG.js +0 -355
  401. package/dist/chunk-NXUY5XQN.js +0 -1062
  402. package/dist/chunk-NZO7M5GV.js +0 -18
  403. package/dist/chunk-OOL4KMG2.js +0 -71
  404. package/dist/chunk-OOSRUJBI.js +0 -19
  405. package/dist/chunk-PDJSUH24.js +0 -110
  406. package/dist/chunk-PTXBIDG7.js +0 -63
  407. package/dist/chunk-PVCEA4HZ.js +0 -6
  408. package/dist/chunk-QA3YCOML.js +0 -101
  409. package/dist/chunk-QFWQKS3M.js +0 -110
  410. package/dist/chunk-QS5L5YTJ.js +0 -24
  411. package/dist/chunk-QYZV2MQA.js +0 -97
  412. package/dist/chunk-RD2MID3M.js +0 -292
  413. package/dist/chunk-S3YUXDSC.js +0 -278
  414. package/dist/chunk-S7REMWW4.js +0 -21
  415. package/dist/chunk-TOM66P2P.js +0 -38
  416. package/dist/chunk-TRBGC4ZG.js +0 -112
  417. package/dist/chunk-UA5KS2PL.js +0 -26
  418. package/dist/chunk-UJCK5IW4.js +0 -187
  419. package/dist/chunk-UNYR5GLI.js +0 -23
  420. package/dist/chunk-UZXG6QSY.js +0 -58
  421. package/dist/chunk-VN5DLURA.js +0 -158
  422. package/dist/chunk-VP5TIXDK.js +0 -178
  423. package/dist/chunk-VPYBK2MG.js +0 -18
  424. package/dist/chunk-VTTA2ALZ.js +0 -16
  425. package/dist/chunk-W6GC6OKK.js +0 -16
  426. package/dist/chunk-WELIKLZF.js +0 -256
  427. package/dist/chunk-WOHX7YTH.js +0 -165
  428. package/dist/chunk-WSVMLNTO.js +0 -31
  429. package/dist/chunk-WYGD2UGN.js +0 -14
  430. package/dist/chunk-XCFC7LGF.js +0 -122
  431. package/dist/chunk-XJ2F2WO6.js +0 -8
  432. package/dist/chunk-XTEFPUSN.js +0 -23
  433. package/dist/chunk-YBLDE5CG.js +0 -42
  434. package/dist/chunk-YDGMBMYI.js +0 -25
  435. package/dist/chunk-YHYTW5QA.js +0 -20
  436. package/dist/chunk-ZCTUYGNV.js +0 -26
  437. package/dist/chunk-ZDAEGJH4.js +0 -102
  438. package/dist/chunk-ZJXSXVFP.js +0 -58
  439. package/dist/chunk-ZOWKWMD2.js +0 -18
  440. package/dist/chunk-ZUQW5VBZ.js +0 -89
@@ -1,112 +0,0 @@
1
- import {
2
- resolveSpellcasting
3
- } from "./chunk-DPUJDOKV.js";
4
- import {
5
- warnOnce
6
- } from "./chunk-LVQLWRCU.js";
7
- import {
8
- isValidMaxFormula
9
- } from "./chunk-EVMUJYUD.js";
10
-
11
- // src/pc/pc.resources.ts
12
- function resourceLevelFor(source, resolved) {
13
- var _a, _b, _c, _d;
14
- if (source.kind === "class") {
15
- return (_b = (_a = resolved.classes.find((c) => {
16
- var _a2;
17
- return ((_a2 = c.entity) == null ? void 0 : _a2.slug) === source.slug;
18
- })) == null ? void 0 : _a.level) != null ? _b : resolved.totalLevel;
19
- }
20
- if (source.kind === "subclass") {
21
- return (_d = (_c = resolved.classes.find((c) => {
22
- var _a2;
23
- return ((_a2 = c.subclass) == null ? void 0 : _a2.slug) === source.slug;
24
- })) == null ? void 0 : _c.level) != null ? _d : resolved.totalLevel;
25
- }
26
- return resolved.totalLevel;
27
- }
28
- function resolveRecovery(entry) {
29
- var _a;
30
- const kind = (_a = entry.restores) != null ? _a : "uses";
31
- const restTriggered = (entry.reset === "short-rest" || entry.reset === "long-rest") && !entry.action;
32
- const flavour = kind === "spell-slots" ? "manual" : restTriggered ? "rest" : "manual";
33
- return { entry, kind, flavour };
34
- }
35
- function toResolvedResource(r, fallbackName, owner) {
36
- var _a, _b;
37
- return {
38
- id: r.id,
39
- name: (_a = r.name) != null ? _a : fallbackName,
40
- reset: r.reset,
41
- maxFormula: r.max_formula,
42
- ...r.die ? { die: r.die } : {},
43
- ...r.scales_at ? { scalesAt: r.scales_at } : {},
44
- ...((_b = r.recovery) == null ? void 0 : _b.length) ? { recovery: r.recovery.map(resolveRecovery) } : {},
45
- ...r.rendering_hint ? { renderingHint: r.rendering_hint } : {},
46
- ...r.surface ? { surface: r.surface } : {},
47
- owner
48
- };
49
- }
50
- function resolveFeatureResources(features) {
51
- var _a, _b;
52
- const out = /* @__PURE__ */ new Map();
53
- for (const rf of features) {
54
- for (const r of (_a = rf.feature.resources) != null ? _a : []) {
55
- if (out.has(r.id)) continue;
56
- const owner = { kind: "feature", featureId: (_b = rf.feature.id) != null ? _b : rf.feature.name, featureName: rf.feature.name, source: rf.source };
57
- out.set(r.id, toResolvedResource(r, rf.feature.name, owner));
58
- }
59
- }
60
- return out;
61
- }
62
- function pickResourceId(entry) {
63
- return entry.param != null ? entry.key : entry.slug;
64
- }
65
- function resolveResourceIndex(resolved) {
66
- var _a, _b, _c, _d, _e;
67
- const out = new Map(resolveFeatureResources((_a = resolved.features) != null ? _a : []));
68
- for (const pool of (_b = resolved.pools) != null ? _b : []) {
69
- const rc = resolved.classes[pool.classIndex];
70
- const classSlug = (_c = rc == null ? void 0 : rc.entity) == null ? void 0 : _c.slug;
71
- if (!classSlug) continue;
72
- for (const entry of [...(_d = pool.selected) != null ? _d : [], ...(_e = pool.grants) != null ? _e : []]) {
73
- if (entry.itemBound === true) continue;
74
- const uses = entry.entity.uses;
75
- const id = pickResourceId(entry);
76
- if (!uses || out.has(id)) continue;
77
- const maxFormula = String(uses.max);
78
- if (!isValidMaxFormula(maxFormula)) {
79
- warnOnce(`pool-uses:${entry.slug}`, `optional feature "${entry.slug}" has a prose uses.max (${JSON.stringify(uses.max)}); no tracker`);
80
- continue;
81
- }
82
- const pres = entry.entity;
83
- out.set(id, {
84
- id,
85
- name: entry.entity.name,
86
- reset: uses.recharge,
87
- maxFormula,
88
- ...pres.rendering_hint ? { renderingHint: pres.rendering_hint } : {},
89
- ...pres.surface ? { surface: pres.surface } : {},
90
- owner: { kind: "pool", poolId: pool.id, poolLabel: pool.label, source: { kind: "class", slug: classSlug, level: pool.anchorLevel } }
91
- });
92
- }
93
- }
94
- return out;
95
- }
96
- function poolSaveDC(resolved, derived, pool) {
97
- var _a, _b;
98
- const rc = resolved.classes[pool.classIndex];
99
- const ability = (_b = (_a = rc == null ? void 0 : rc.subclass) == null ? void 0 : _a.spellcasting) == null ? void 0 : _b.ability;
100
- if (!rc || !ability) return null;
101
- if (resolveSpellcasting(rc) !== null) return null;
102
- return 8 + derived.proficiencyBonus + derived.mods[ability];
103
- }
104
-
105
- export {
106
- resourceLevelFor,
107
- resolveRecovery,
108
- resolveFeatureResources,
109
- pickResourceId,
110
- resolveResourceIndex,
111
- poolSaveDC
112
- };
@@ -1,106 +0,0 @@
1
- // src/types/choice.ts
2
- var ALL_SKILL_SLUGS = [
3
- "acrobatics",
4
- "animal-handling",
5
- "arcana",
6
- "athletics",
7
- "deception",
8
- "history",
9
- "insight",
10
- "intimidation",
11
- "investigation",
12
- "medicine",
13
- "nature",
14
- "perception",
15
- "performance",
16
- "persuasion",
17
- "religion",
18
- "sleight-of-hand",
19
- "stealth",
20
- "survival"
21
- ];
22
- var STANDARD_LANGUAGES = [
23
- "common",
24
- "dwarvish",
25
- "elvish",
26
- "giant",
27
- "gnomish",
28
- "goblin",
29
- "halfling",
30
- "orc"
31
- ];
32
- var EXOTIC_LANGUAGES = [
33
- "abyssal",
34
- "celestial",
35
- "deep-speech",
36
- "draconic",
37
- "infernal",
38
- "primordial",
39
- "sylvan",
40
- "undercommon"
41
- ];
42
- var SECRET_LANGUAGES = ["druidic", "thieves'-cant"];
43
- var ALL_LANGUAGES = [
44
- ...STANDARD_LANGUAGES,
45
- ...EXOTIC_LANGUAGES,
46
- ...SECRET_LANGUAGES
47
- ];
48
- var ARTISANS_TOOLS = [
49
- "alchemist's-supplies",
50
- "brewer's-supplies",
51
- "calligrapher's-supplies",
52
- "carpenter's-tools",
53
- "cartographer's-tools",
54
- "cobbler's-tools",
55
- "cook's-utensils",
56
- "glassblower's-tools",
57
- "jeweler's-tools",
58
- "leatherworker's-tools",
59
- "mason's-tools",
60
- "painter's-supplies",
61
- "potter's-tools",
62
- "smith's-tools",
63
- "tinker's-tools",
64
- "weaver's-tools",
65
- "woodcarver's-tools"
66
- ];
67
- var MUSICAL_INSTRUMENTS = [
68
- "bagpipes",
69
- "drum",
70
- "dulcimer",
71
- "flute",
72
- "horn",
73
- "lute",
74
- "lyre",
75
- "pan-flute",
76
- "shawm",
77
- "viol"
78
- ];
79
- var GAMING_SETS = ["dice-set", "playing-cards"];
80
- var OTHER_TOOLS = [
81
- "disguise-kit",
82
- "forgery-kit",
83
- "herbalism-kit",
84
- "navigator's-tools",
85
- "poisoner's-kit",
86
- "thieves'-tools"
87
- ];
88
- var ALL_TOOLS = [
89
- ...ARTISANS_TOOLS,
90
- ...MUSICAL_INSTRUMENTS,
91
- ...GAMING_SETS,
92
- ...OTHER_TOOLS
93
- ];
94
-
95
- export {
96
- ALL_SKILL_SLUGS,
97
- STANDARD_LANGUAGES,
98
- EXOTIC_LANGUAGES,
99
- SECRET_LANGUAGES,
100
- ALL_LANGUAGES,
101
- ARTISANS_TOOLS,
102
- MUSICAL_INSTRUMENTS,
103
- GAMING_SETS,
104
- OTHER_TOOLS,
105
- ALL_TOOLS
106
- };
@@ -1,91 +0,0 @@
1
- import {
2
- bareEntitySlug
3
- } from "./chunk-ZCTUYGNV.js";
4
- import {
5
- ABILITY_KEYS
6
- } from "./chunk-WELIKLZF.js";
7
-
8
- // src/pc/pc.asi-flatten.ts
9
- function flattenAsiOrFeat(choice) {
10
- var _a;
11
- if (choice.kind !== "select-inline" || choice.id !== "asi-or-feat") return choice;
12
- const featBranches = choice.options.filter((o) => {
13
- var _a2;
14
- return ((_a2 = o.choices) != null ? _a2 : []).some((c) => c.kind === "select-entity" && c.entity_type === "feat");
15
- });
16
- if (featBranches.length !== 1) return choice;
17
- const inner = (_a = featBranches[0].choices) != null ? _a : [];
18
- if (inner.length !== 1) return choice;
19
- const only = inner[0];
20
- if (only.kind !== "select-entity" || only.entity_type !== "feat") return choice;
21
- return only;
22
- }
23
- var ASI_FEAT_BARE = "ability-score-improvement";
24
- function legacyAsiBranch(block) {
25
- if (!block || typeof block !== "object") return null;
26
- const b = block;
27
- if (typeof b.feat === "string") return null;
28
- const asi = b.asi;
29
- if (!asi || typeof asi !== "object" || Array.isArray(asi)) return null;
30
- const out = {};
31
- let any = false;
32
- for (const ab of ABILITY_KEYS) {
33
- const v = asi[ab];
34
- if (typeof v === "number") {
35
- out[ab] = v;
36
- any = true;
37
- }
38
- }
39
- return any ? out : null;
40
- }
41
- function convertibleLegacyAsi(block) {
42
- const alloc = legacyAsiBranch(block);
43
- if (!alloc) return null;
44
- const branch = block["asi-or-feat"];
45
- return branch === void 0 || branch === "asi" ? alloc : null;
46
- }
47
- function resolveLegacyAsiFeat(registry, classEntity) {
48
- if (!classEntity) return null;
49
- const prefix = classEntity.slug.split("_")[0];
50
- const ranked = [];
51
- for (const e of registry.search("", "feat", Number.POSITIVE_INFINITY)) {
52
- if (bareEntitySlug(e.slug) !== ASI_FEAT_BARE) continue;
53
- const data = e.data;
54
- const choices = Array.isArray(data == null ? void 0 : data.choices) ? data.choices : [];
55
- const points = choices.find((c) => (c == null ? void 0 : c.kind) === "ability-points" && typeof c.id === "string");
56
- if (!points) continue;
57
- ranked.push({
58
- slug: e.slug,
59
- childId: points.id,
60
- prefixHit: e.slug.split("_")[0] === prefix,
61
- editionHit: classEntity.edition !== void 0 && (data == null ? void 0 : data.edition) === classEntity.edition
62
- });
63
- }
64
- ranked.sort((a, b) => Number(b.prefixHit) - Number(a.prefixHit) || Number(b.editionHit) - Number(a.editionHit) || (a.slug < b.slug ? -1 : a.slug > b.slug ? 1 : 0));
65
- return ranked.length ? { slug: ranked[0].slug, childId: ranked[0].childId } : null;
66
- }
67
- function migrateLegacyAsiLevel(block, key, value, registry, classEntity) {
68
- if (key !== "feat" && !key.startsWith("feat:")) return null;
69
- const alloc = convertibleLegacyAsi(block);
70
- if (!alloc) return null;
71
- const asi = resolveLegacyAsiFeat(registry, classEntity);
72
- if (!asi) return null;
73
- const childKey = `feat:${asi.childId}`;
74
- const isSwitch = key === "feat" && value !== asi.slug;
75
- const out = {};
76
- for (const [k, v] of Object.entries(block)) {
77
- if (k === "asi-or-feat" || k === "asi" || k === childKey) continue;
78
- out[k] = v;
79
- }
80
- out.feat = asi.slug;
81
- if (!isSwitch) out[childKey] = alloc;
82
- return out;
83
- }
84
-
85
- export {
86
- flattenAsiOrFeat,
87
- legacyAsiBranch,
88
- convertibleLegacyAsi,
89
- resolveLegacyAsiFeat,
90
- migrateLegacyAsiLevel
91
- };
@@ -1,94 +0,0 @@
1
- import {
2
- resolveBaseItem
3
- } from "./chunk-CM5CWO4K.js";
4
-
5
- // src/pc/pc.slotting.ts
6
- function isItemEntity(e) {
7
- return !!e && typeof e === "object" && "rarity" in e;
8
- }
9
- function isWeaponEntity(e) {
10
- if (!e || typeof e !== "object") return false;
11
- if (!("damage" in e) || !("category" in e)) return false;
12
- const cat = e.category;
13
- return typeof cat === "string" && /melee|ranged/.test(cat);
14
- }
15
- function isArmorEntity(e) {
16
- return !!e && typeof e === "object" && "ac" in e && "category" in e && !("damage" in e);
17
- }
18
- function resolveEntityForEntry(item, registry) {
19
- const found = resolveBaseItem(item, registry);
20
- if (!found) return { entity: null, entityType: null };
21
- return {
22
- entity: found.data,
23
- entityType: found.entityType
24
- };
25
- }
26
- function isShieldArmor(armor) {
27
- var _a, _b;
28
- if (armor.category === "shield") return true;
29
- const slug = ((_a = armor.slug) != null ? _a : "").toLowerCase();
30
- if (slug === "shield" || slug.endsWith("_shield") || slug.endsWith("-shield")) return true;
31
- return ((_b = armor.name) != null ? _b : "").trim().toLowerCase() === "shield";
32
- }
33
- function effectiveArmor(entity, registry) {
34
- if (isArmorEntity(entity)) return entity;
35
- if (isItemEntity(entity) && typeof entity.base_item === "string") {
36
- const base = resolveBaseItem(entity.base_item, registry);
37
- if ((base == null ? void 0 : base.entityType) === "armor") return base.data;
38
- }
39
- return null;
40
- }
41
- function effectiveWeapon(entity, registry) {
42
- if (isWeaponEntity(entity)) return entity;
43
- if (isItemEntity(entity) && typeof entity.base_item === "string") {
44
- const base = resolveBaseItem(entity.base_item, registry);
45
- if ((base == null ? void 0 : base.entityType) === "weapon" && isWeaponEntity(base.data)) return base.data;
46
- }
47
- return null;
48
- }
49
- function isTwoHandedWeapon(entity, registry) {
50
- if (!entity || typeof entity !== "object") return false;
51
- const own = entity.properties;
52
- if (Array.isArray(own) && own.length > 0) return own.some((p) => p === "two_handed");
53
- if (!registry) return false;
54
- const weapon = effectiveWeapon(entity, registry);
55
- return !!weapon && Array.isArray(weapon.properties) && weapon.properties.some((p) => p === "two_handed");
56
- }
57
- function armorAcTerm(armor) {
58
- var _a;
59
- return armor.ac.base + ((_a = armor.ac.flat) != null ? _a : 0);
60
- }
61
- function slotAcTerms(armor, entry) {
62
- var _a;
63
- const bonus = (_a = entry == null ? void 0 : entry.overrides) == null ? void 0 : _a.ac_bonus;
64
- return { armor: armor ? armorAcTerm(armor) : null, override: typeof bonus === "number" ? bonus : 0 };
65
- }
66
- function defaultSlotForType(entityType, entity, registry) {
67
- if (entityType === "weapon") return "mainhand";
68
- if (entityType === "armor") {
69
- return isArmorEntity(entity) && isShieldArmor(entity) ? "shield" : "armor";
70
- }
71
- if (entityType === "item" && isItemEntity(entity) && typeof entity.base_item === "string") {
72
- const base = resolveBaseItem(entity.base_item, registry);
73
- if ((base == null ? void 0 : base.entityType) === "weapon") return "mainhand";
74
- if ((base == null ? void 0 : base.entityType) === "armor") {
75
- const armorData = base.data;
76
- return isShieldArmor(armorData) ? "shield" : "armor";
77
- }
78
- }
79
- return null;
80
- }
81
-
82
- export {
83
- isItemEntity,
84
- isWeaponEntity,
85
- isArmorEntity,
86
- resolveEntityForEntry,
87
- isShieldArmor,
88
- effectiveArmor,
89
- effectiveWeapon,
90
- isTwoHandedWeapon,
91
- armorAcTerm,
92
- slotAcTerms,
93
- defaultSlotForType
94
- };
@@ -1,237 +0,0 @@
1
- import {
2
- RACE_STRUCTURAL_PSEUDO
3
- } from "./chunk-PVCEA4HZ.js";
4
- import {
5
- warnOnce
6
- } from "./chunk-LVQLWRCU.js";
7
- import {
8
- memoByRevision
9
- } from "./chunk-4J6DS3EJ.js";
10
- import {
11
- slugify
12
- } from "./chunk-ZCTUYGNV.js";
13
- import {
14
- mirrorSpellShapes
15
- } from "./chunk-7Q2VPKCD.js";
16
- import {
17
- ABILITY_KEYS
18
- } from "./chunk-WELIKLZF.js";
19
-
20
- // src/pc/pc.additional-spells.ts
21
- var entriesOf = (a) => Array.isArray(a) ? a : a && typeof a === "object" ? [a] : [];
22
- var editionOf = (x) => {
23
- const e = x == null ? void 0 : x.edition;
24
- return typeof e === "string" ? e : void 0;
25
- };
26
- var prefixOf = (slug) => {
27
- var _a;
28
- return (_a = slug.split("_")[0]) != null ? _a : slug;
29
- };
30
- function normalizeSpellRef(ref) {
31
- var _a, _b, _c;
32
- if (typeof ref !== "string") return null;
33
- let s = ref.trim();
34
- const wl = /^\[\[(.+)\]\]$/.exec(s);
35
- if (wl) {
36
- const target = (_a = wl[1].split("|")[0]) != null ? _a : "";
37
- const tail = (_b = target.split("/").pop()) != null ? _b : target;
38
- const w = slugify(tail.replace(/#.*$/, "").trim());
39
- return w.length > 0 ? w : null;
40
- }
41
- s = s.replace(/#.*$/, "");
42
- s = (_c = s.split("|")[0]) != null ? _c : "";
43
- const out = slugify(s.trim());
44
- return out.length > 0 ? out : null;
45
- }
46
- function buildSpellNameIndex(entities) {
47
- return memoByRevision(SPELL_NAME_INDEX, entities, () => spellNameIndexOf(entities));
48
- }
49
- var SPELL_NAME_INDEX = /* @__PURE__ */ new WeakMap();
50
- function spellNameIndexOf(entities) {
51
- var _a;
52
- const byName = /* @__PURE__ */ new Map();
53
- for (const e of entities.search("", "spell", Number.POSITIVE_INFINITY)) {
54
- const raw = e.data.name;
55
- const key = slugify(typeof raw === "string" ? raw : e.name);
56
- const list = (_a = byName.get(key)) != null ? _a : [];
57
- list.push(e);
58
- byName.set(key, list);
59
- }
60
- return { byName };
61
- }
62
- function resolveSpellByName(opts) {
63
- var _a;
64
- const { entities, index, nameSlug, carrierSlug, carrierEdition, alreadyCollected } = opts;
65
- const own = alreadyCollected.find((s) => {
66
- var _a2;
67
- return slugify(String((_a2 = s.entity.name) != null ? _a2 : "")) === nameSlug;
68
- });
69
- if (own) return { entity: own.entity, slug: own.slug };
70
- const exact = entities.getByTypeAndSlug("spell", `${prefixOf(carrierSlug)}_spell_${nameSlug}`);
71
- if (exact) return { entity: mirrorSpellShapes(exact.data), slug: exact.slug };
72
- const cands = (_a = index.byName.get(nameSlug)) != null ? _a : [];
73
- if (cands.length === 0) {
74
- warnOnce(`addspells:miss:${nameSlug}`, `archivist: additional_spells ref "${nameSlug}" matches no spell in the compendium`);
75
- return null;
76
- }
77
- const prefix = prefixOf(carrierSlug);
78
- let pool = cands.filter((e) => prefixOf(e.slug) === prefix);
79
- if (pool.length === 0) pool = cands;
80
- if (carrierEdition !== void 0) {
81
- const same = pool.filter((e) => editionOf(e.data) === carrierEdition);
82
- if (same.length > 0) pool = same;
83
- }
84
- pool = [...pool].sort((a, b) => a.slug < b.slug ? -1 : a.slug > b.slug ? 1 : 0);
85
- if (pool.length > 1) warnOnce(`addspells:multi:${nameSlug}`, `archivist: additional_spells ref "${nameSlug}" matches ${cands.length} spells; using "${pool[0].slug}"`);
86
- return { entity: mirrorSpellShapes(pool[0].data), slug: pool[0].slug };
87
- }
88
- var hasContentSelectInline = (choices) => Array.isArray(choices) && choices.some((c) => (c == null ? void 0 : c.kind) === "select-inline" && typeof c.id === "string" && !RACE_STRUCTURAL_PSEUDO.has(c.id) || Array.isArray(c == null ? void 0 : c.options) && c.options.some((o) => hasContentSelectInline(o == null ? void 0 : o.choices)));
89
- function raceIsUngated(race) {
90
- var _a;
91
- const r = race;
92
- if (hasContentSelectInline(r.choices)) return false;
93
- return !((_a = r.traits) != null ? _a : []).some((t) => hasContentSelectInline(t == null ? void 0 : t.choices));
94
- }
95
- var readAbility = (v, own) => {
96
- if (v && typeof v === "object" && "choose" in v) return "choose";
97
- if (typeof v !== "string") return void 0;
98
- if (v === "inherit") return own != null ? own : void 0;
99
- return ABILITY_KEYS.includes(v) ? v : void 0;
100
- };
101
- var entryHasInSliceLeaf = (e, comparand, own) => readAbility(e.ability, own) !== "choose" && ["known", "prepared"].some((b) => {
102
- const lv = e[b];
103
- return !!lv && typeof lv === "object" && !Array.isArray(lv) && Object.entries(lv).some(([k, v]) => (k === "_" || Number(k) <= comparand) && Array.isArray(v) && v.some((x) => typeof x === "string"));
104
- });
105
- function chosenRaceOptionKeys(race, read) {
106
- var _a;
107
- const out = /* @__PURE__ */ new Set();
108
- const r = race;
109
- const lists = [r.choices, ...((_a = r.traits) != null ? _a : []).map((t) => t == null ? void 0 : t.choices)];
110
- for (const list of lists) {
111
- for (const c of Array.isArray(list) ? list : []) {
112
- if ((c == null ? void 0 : c.kind) !== "select-inline" || typeof c.id !== "string" || RACE_STRUCTURAL_PSEUDO.has(c.id)) continue;
113
- const v = read(c.id);
114
- for (const value of Array.isArray(v) ? v : typeof v === "string" ? [v] : []) {
115
- if (typeof value !== "string") continue;
116
- out.add(slugify(value));
117
- const opt = (Array.isArray(c.options) ? c.options : []).find((o) => (o == null ? void 0 : o.value) === value);
118
- if (typeof (opt == null ? void 0 : opt.label) === "string") out.add(slugify(opt.label));
119
- }
120
- }
121
- }
122
- return out;
123
- }
124
- function innateLeaves(innate, comparand) {
125
- if (!innate || typeof innate !== "object" || Array.isArray(innate)) return [];
126
- const strings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : v && typeof v === "object" ? Object.values(v).flatMap(strings) : [];
127
- return Object.entries(innate).filter(([k]) => k === "_" || Number(k) <= comparand).flatMap(([, v]) => strings(v));
128
- }
129
- function memberAtWillLeaves(innate, comparand, slug) {
130
- if (!innate || typeof innate !== "object" || Array.isArray(innate)) return [];
131
- const out = [];
132
- for (const [k, v] of Object.entries(innate)) {
133
- if (!(k === "_" || Number(k) <= comparand)) continue;
134
- if (Array.isArray(v)) {
135
- out.push(...v);
136
- continue;
137
- }
138
- for (const [usage, list] of v && typeof v === "object" ? Object.entries(v) : []) {
139
- if (usage === "will" && Array.isArray(list)) out.push(...list);
140
- else warnOnce(`addspells:usage:${slug}:innate:${k}:${usage}`, `archivist: additional_spells on "${slug}" innate.${k}.${usage} is a usage economy (skipped; G8)`);
141
- }
142
- }
143
- return out;
144
- }
145
- function collectAdditionalSpells(args) {
146
- var _a, _b;
147
- const { race, feats, classes, totalLevel, ownAbility, alreadyCollected, entities, warnings } = args;
148
- const raceChoice = (_a = args.raceChoice) != null ? _a : (() => void 0);
149
- let index = null;
150
- const indexOf = () => index != null ? index : index = buildSpellNameIndex(entities);
151
- const out = [];
152
- const carriers = [];
153
- const asRaw = (x) => x == null ? void 0 : x.additional_spells;
154
- if (race && raceIsUngated(race)) carriers.push({ root: "race", slug: race.slug, edition: editionOf(race), entries: entriesOf(asRaw(race)), comparand: totalLevel, classSlug: null });
155
- else if (race) {
156
- const chosen = chosenRaceOptionKeys(race, raceChoice);
157
- for (const e of entriesOf(asRaw(race))) {
158
- if (typeof e.name === "string" && chosen.has(slugify(e.name))) {
159
- carriers.push({ root: "race", slug: race.slug, edition: editionOf(race), entries: [e], comparand: totalLevel, classSlug: null });
160
- }
161
- }
162
- }
163
- for (const f of feats) carriers.push({ root: "feat", slug: f.slug, edition: editionOf(f), entries: entriesOf(asRaw(f)), comparand: totalLevel, classSlug: null });
164
- for (const c of classes) {
165
- if (!c.entity) continue;
166
- carriers.push({ root: "class", slug: c.entity.slug, edition: editionOf(c.entity), entries: entriesOf(asRaw(c.entity)), comparand: c.level, classSlug: c.entity.slug });
167
- if (c.subclass) carriers.push({ root: "subclass", slug: c.subclass.slug, edition: editionOf(c.subclass), entries: entriesOf(asRaw(c.subclass)), comparand: c.level, classSlug: c.entity.slug });
168
- }
169
- for (const pool of (_b = args.pools) != null ? _b : []) {
170
- const c = classes[pool.classIndex];
171
- if (!(c == null ? void 0 : c.entity)) continue;
172
- for (const m of [...pool.selected, ...pool.grants]) {
173
- if (m.itemBound === true) continue;
174
- carriers.push({ root: "member", slug: m.slug, edition: editionOf(m.entity), entries: entriesOf(asRaw(m.entity)), comparand: c.level, classSlug: c.entity.slug });
175
- }
176
- }
177
- for (const car of carriers) {
178
- if (car.entries.length === 0) continue;
179
- if (car.entries.length > 1) {
180
- if (car.entries.some((e) => entryHasInSliceLeaf(e, car.comparand, ownAbility))) warnOnce(`addspells:siblings:${car.slug}`, `archivist: additional_spells on "${car.slug}" has ${car.entries.length} sibling entries (a choose-one grant); skipped`);
181
- continue;
182
- }
183
- const entry = car.entries[0];
184
- let ability = readAbility(entry.ability, ownAbility);
185
- if (ability === "choose" && car.root === "race") {
186
- const pick = raceChoice("spellcasting-ability");
187
- const allowed = entry.ability.choose;
188
- ability = typeof pick === "string" && Array.isArray(allowed) && allowed.includes(pick) ? pick : "choose";
189
- }
190
- if (ability === "choose") continue;
191
- const buckets = ["known", "prepared"].map((bucket) => {
192
- const levels = entry[bucket];
193
- return [bucket, !levels || typeof levels !== "object" || Array.isArray(levels) ? [] : Object.entries(levels)];
194
- });
195
- if (car.root === "race") buckets.push(["innate", [["_", innateLeaves(entry.innate, car.comparand)]]]);
196
- if (car.root === "member") buckets.push(["at-will", [["_", memberAtWillLeaves(entry.innate, car.comparand, car.slug)]]]);
197
- for (const [bucket, levelEntries] of buckets) {
198
- for (const [k, v] of levelEntries) {
199
- if (!(k === "_" || Number(k) <= car.comparand)) continue;
200
- if (!Array.isArray(v)) {
201
- warnOnce(`addspells:usage:${car.slug}:${bucket}:${k}`, `archivist: additional_spells on "${car.slug}" ${bucket}.${k} is a usage economy (skipped; G8)`);
202
- continue;
203
- }
204
- for (const leaf of v) {
205
- const nameSlug = normalizeSpellRef(leaf);
206
- if (!nameSlug) continue;
207
- const hit = resolveSpellByName({ entities, index: indexOf(), nameSlug, carrierSlug: car.slug, carrierEdition: car.edition, alreadyCollected: [...alreadyCollected, ...out] });
208
- if (!hit) {
209
- warnings.push(`additional_spells ref "${String(leaf)}" on ${car.slug} not found in compendium.`);
210
- continue;
211
- }
212
- out.push({
213
- entity: hit.entity,
214
- slug: hit.slug,
215
- classSlug: car.classSlug,
216
- source: car.root === "race" ? "race" : car.root === "feat" ? "feat" : "class",
217
- prepared: true,
218
- alwaysPrepared: true,
219
- ...ability ? { ability } : {},
220
- ...bucket === "at-will" ? { atWill: true } : {}
221
- });
222
- }
223
- }
224
- }
225
- }
226
- return out;
227
- }
228
-
229
- export {
230
- prefixOf,
231
- normalizeSpellRef,
232
- buildSpellNameIndex,
233
- resolveSpellByName,
234
- raceIsUngated,
235
- chosenRaceOptionKeys,
236
- collectAdditionalSpells
237
- };