@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.
Files changed (439) 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 +4 -27
  128. package/dist/dnd/amount-text.js +1 -13
  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 +10 -0
  151. package/dist/entities/registry-revision.js +1 -0
  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 +31 -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 -138113
  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 +30 -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 +4 -14
  205. package/dist/pc/pc.additional-spells.js +1 -23
  206. package/dist/pc/pc.amount-bindings.d.ts +4 -20
  207. package/dist/pc/pc.amount-bindings.js +1 -23
  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 +4 -141
  215. package/dist/pc/pc.decision-engine.js +1 -52
  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 -40
  220. package/dist/pc/pc.equipment.d.ts +2 -22
  221. package/dist/pc/pc.equipment.js +1 -33
  222. package/dist/pc/pc.feature-effects.d.ts +23 -275
  223. package/dist/pc/pc.feature-effects.js +1 -26
  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 -64
  227. package/dist/pc/pc.item-effects.d.ts +18 -0
  228. package/dist/pc/pc.member-choices.d.ts +18 -49
  229. package/dist/pc/pc.member-choices.js +1 -32
  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 -26
  233. package/dist/pc/pc.proficiencies.d.ts +7 -33
  234. package/dist/pc/pc.proficiencies.js +1 -107
  235. package/dist/pc/pc.proficiency-grants.d.ts +0 -26
  236. package/dist/pc/pc.proficiency-normalize.d.ts +4 -25
  237. package/dist/pc/pc.proficiency-normalize.js +1 -12
  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 -946
  242. package/dist/pc/pc.resolver.d.ts +0 -104
  243. package/dist/pc/pc.resolver.js +1 -59
  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 -230
  250. package/dist/pc/pc.schema.d.ts +19 -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 +6 -0
  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 +85 -344
  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 +30 -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 +14 -14
  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-2JSQE3DD.js +0 -206
  346. package/dist/chunk-2LULMQTF.js +0 -14
  347. package/dist/chunk-2UDSN6VW.js +0 -18
  348. package/dist/chunk-3LWMFYKS.js +0 -57
  349. package/dist/chunk-3MGQFFNE.js +0 -110
  350. package/dist/chunk-3TM34RSJ.js +0 -23
  351. package/dist/chunk-3VZZDKRA.js +0 -1014
  352. package/dist/chunk-4U55VNC7.js +0 -22
  353. package/dist/chunk-5GKJAUMX.js +0 -59
  354. package/dist/chunk-5MXFW4O3.js +0 -71
  355. package/dist/chunk-656QCX4U.js +0 -22
  356. package/dist/chunk-6EI737IO.js +0 -19
  357. package/dist/chunk-6GNXYAYP.js +0 -25
  358. package/dist/chunk-6PXTNCBP.js +0 -133
  359. package/dist/chunk-6X2NV665.js +0 -33
  360. package/dist/chunk-7ATNGKBS.js +0 -178
  361. package/dist/chunk-7Q2VPKCD.js +0 -181
  362. package/dist/chunk-7QN7XSAK.js +0 -19
  363. package/dist/chunk-A54HHCWW.js +0 -67
  364. package/dist/chunk-AZRGFUSR.js +0 -18
  365. package/dist/chunk-B3DP42OM.js +0 -55
  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-DOXSFYLH.js +0 -158
  370. package/dist/chunk-DPUJDOKV.js +0 -365
  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-FANQVQ3D.js +0 -89
  375. package/dist/chunk-FC4IGH5Y.js +0 -18
  376. package/dist/chunk-G6MHJDVT.js +0 -41
  377. package/dist/chunk-G6PBI2BU.js +0 -18
  378. package/dist/chunk-H5PTKYXL.js +0 -101
  379. package/dist/chunk-HHBD4SQ6.js +0 -24
  380. package/dist/chunk-HS6FIOLP.js +0 -52
  381. package/dist/chunk-HTYMW5CH.js +0 -228
  382. package/dist/chunk-IHE6KVC3.js +0 -13
  383. package/dist/chunk-IN4M4X7P.js +0 -34
  384. package/dist/chunk-IUAAXXNO.js +0 -58
  385. package/dist/chunk-JCMUVZIK.js +0 -133
  386. package/dist/chunk-JSM6JFZR.js +0 -709
  387. package/dist/chunk-K5NJBTE2.js +0 -18
  388. package/dist/chunk-KR6JF3BF.js +0 -14
  389. package/dist/chunk-KSTV7J2U.js +0 -112
  390. package/dist/chunk-KU3YLF6D.js +0 -106
  391. package/dist/chunk-LBEXLN6I.js +0 -91
  392. package/dist/chunk-LF5AGJA4.js +0 -81
  393. package/dist/chunk-LHZXYFBU.js +0 -94
  394. package/dist/chunk-LSLSG67V.js +0 -31
  395. package/dist/chunk-LVQLWRCU.js +0 -15
  396. package/dist/chunk-MBX25B6D.js +0 -18
  397. package/dist/chunk-MYY2C5MB.js +0 -233
  398. package/dist/chunk-OFCSP6MT.js +0 -23
  399. package/dist/chunk-ONTGZR5T.js +0 -1806
  400. package/dist/chunk-OOSRUJBI.js +0 -19
  401. package/dist/chunk-PDJSUH24.js +0 -110
  402. package/dist/chunk-PKX6TGRE.js +0 -93
  403. package/dist/chunk-PQZ4LM4Z.js +0 -19
  404. package/dist/chunk-PTXBIDG7.js +0 -63
  405. package/dist/chunk-PVCEA4HZ.js +0 -6
  406. package/dist/chunk-PXVNAY7T.js +0 -84
  407. package/dist/chunk-QH36K2PU.js +0 -158
  408. package/dist/chunk-QS5L5YTJ.js +0 -24
  409. package/dist/chunk-QYZV2MQA.js +0 -97
  410. package/dist/chunk-QZSWN2KT.js +0 -18
  411. package/dist/chunk-RLGQ5PZZ.js +0 -16
  412. package/dist/chunk-RYLXAYIQ.js +0 -18
  413. package/dist/chunk-S3YUXDSC.js +0 -278
  414. package/dist/chunk-S7REMWW4.js +0 -21
  415. package/dist/chunk-T6QIF5XR.js +0 -348
  416. package/dist/chunk-TOM66P2P.js +0 -38
  417. package/dist/chunk-TULQ4FFX.js +0 -353
  418. package/dist/chunk-UA5KS2PL.js +0 -26
  419. package/dist/chunk-UUBJCNQU.js +0 -187
  420. package/dist/chunk-UZXG6QSY.js +0 -58
  421. package/dist/chunk-VPYBK2MG.js +0 -18
  422. package/dist/chunk-VRV3NNTA.js +0 -161
  423. package/dist/chunk-VTTA2ALZ.js +0 -16
  424. package/dist/chunk-W6GC6OKK.js +0 -16
  425. package/dist/chunk-WELIKLZF.js +0 -256
  426. package/dist/chunk-WSVMLNTO.js +0 -31
  427. package/dist/chunk-WYGD2UGN.js +0 -14
  428. package/dist/chunk-XCFC7LGF.js +0 -122
  429. package/dist/chunk-XJ2F2WO6.js +0 -8
  430. package/dist/chunk-Y5VVP73C.js +0 -23
  431. package/dist/chunk-YBLDE5CG.js +0 -42
  432. package/dist/chunk-YD2VAHA6.js +0 -159
  433. package/dist/chunk-YDGMBMYI.js +0 -25
  434. package/dist/chunk-YHYTW5QA.js +0 -20
  435. package/dist/chunk-YKL6SHRJ.js +0 -23
  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-ZUQW5VBZ.js +0 -89
@@ -1,365 +0,0 @@
1
- import {
2
- readTableColumn
3
- } from "./chunk-IUAAXXNO.js";
4
- import {
5
- bareSlug,
6
- baseClassName
7
- } from "./chunk-VTTA2ALZ.js";
8
- import {
9
- abilityModifier
10
- } from "./chunk-PDJSUH24.js";
11
-
12
- // src/pc/pc.spellcasting.ts
13
- function hasPreparedColumn(table) {
14
- return Object.values(table).some((row) => PREPARED_COLUMNS.some((k) => {
15
- var _a;
16
- return ((_a = row == null ? void 0 : row.columns) == null ? void 0 : _a[k]) !== void 0;
17
- }));
18
- }
19
- function resolveSpellcasting(rc) {
20
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
21
- const sub = (_b = (_a = rc.subclass) == null ? void 0 : _a.spellcasting) != null ? _b : null;
22
- const cls = (_d = (_c = rc.entity) == null ? void 0 : _c.spellcasting) != null ? _d : null;
23
- const casterType = (_f = (_e = sub == null ? void 0 : sub.caster_type) != null ? _e : cls == null ? void 0 : cls.caster_type) != null ? _f : null;
24
- const ability = (_h = (_g = sub == null ? void 0 : sub.ability) != null ? _g : cls == null ? void 0 : cls.ability) != null ? _h : null;
25
- if (!casterType || !ability) return null;
26
- const table = (_l = (_k = (sub == null ? void 0 : sub.caster_type) ? (_i = rc.subclass) == null ? void 0 : _i.table : void 0) != null ? _k : (_j = rc.entity) == null ? void 0 : _j.table) != null ? _l : {};
27
- const preparation = (_n = (_m = sub == null ? void 0 : sub.preparation) != null ? _m : cls == null ? void 0 : cls.preparation) != null ? _n : hasPreparedColumn(table) ? "prepared" : "known";
28
- const spellList = (_p = (_o = sub == null ? void 0 : sub.spell_list) != null ? _o : cls == null ? void 0 : cls.spell_list) != null ? _p : null;
29
- return { ability, casterType, preparation, spellList, table };
30
- }
31
- function effectiveSpellcastingAbility(classSlug, dataAbility, overrides) {
32
- var _a, _b;
33
- return (_b = (_a = overrides.spellcasting_ability_by_class) == null ? void 0 : _a[classSlug]) != null ? _b : dataAbility;
34
- }
35
- function normalizeKnownSpell(entry) {
36
- var _a, _b;
37
- if (typeof entry === "string") {
38
- return { slug: bareSlug(entry), classSlug: null, source: "class", preparedFlag: void 0, alwaysPrepared: false };
39
- }
40
- return {
41
- slug: bareSlug(entry.spell),
42
- classSlug: entry.class ? bareSlug(entry.class) : null,
43
- source: (_a = entry.source) != null ? _a : "class",
44
- preparedFlag: entry.prepared,
45
- alwaysPrepared: (_b = entry.always_prepared) != null ? _b : false
46
- };
47
- }
48
- function firstListedCasterClass(spellClasses, casterClassSlugs) {
49
- var _a;
50
- if (!Array.isArray(spellClasses) || spellClasses.length === 0) return null;
51
- const listed = new Set(spellClasses.map((c) => baseClassName(String(c))));
52
- return (_a = casterClassSlugs.find((slug) => listed.has(baseClassName(slug)))) != null ? _a : null;
53
- }
54
- var LISTED_CLASS_NAMES = /* @__PURE__ */ new WeakMap();
55
- var NO_NAMES = /* @__PURE__ */ new Set();
56
- function listedSpellClassNames(registry, compendium) {
57
- var _a;
58
- const count = registry.count();
59
- let cached = LISTED_CLASS_NAMES.get(registry);
60
- if (!cached || cached.count !== count) {
61
- const byCompendium = /* @__PURE__ */ new Map();
62
- for (const e of registry.search("", "spell", Number.POSITIVE_INFINITY)) {
63
- const classes = e.data.classes;
64
- if (!Array.isArray(classes)) continue;
65
- let names = byCompendium.get(e.compendium);
66
- if (!names) byCompendium.set(e.compendium, names = /* @__PURE__ */ new Set());
67
- for (const c of classes) names.add(baseClassName(String(c)));
68
- }
69
- cached = { count, byCompendium };
70
- LISTED_CLASS_NAMES.set(registry, cached);
71
- }
72
- return (_a = cached.byCompendium.get(compendium)) != null ? _a : NO_NAMES;
73
- }
74
- function attributeUnclassedSpell(spellClasses, casters, registry) {
75
- var _a;
76
- const first = casters[0];
77
- if (!first) return null;
78
- const listed = firstListedCasterClass(spellClasses, casters.map((c) => c.classSlug));
79
- if (listed == null || listed === first.classSlug) return first.classSlug;
80
- if (first.spellList == null) return first.classSlug;
81
- const compendium = (_a = registry.getByTypeAndSlug("class", first.classSlug)) == null ? void 0 : _a.compendium;
82
- if (compendium == null || !listedSpellClassNames(registry, compendium).has(baseClassName(first.classSlug))) return first.classSlug;
83
- return listed;
84
- }
85
- var FULL_CASTER_SLOTS = [
86
- /* 1 */
87
- [2, 0, 0, 0, 0, 0, 0, 0, 0],
88
- /* 2 */
89
- [3, 0, 0, 0, 0, 0, 0, 0, 0],
90
- /* 3 */
91
- [4, 2, 0, 0, 0, 0, 0, 0, 0],
92
- /* 4 */
93
- [4, 3, 0, 0, 0, 0, 0, 0, 0],
94
- /* 5 */
95
- [4, 3, 2, 0, 0, 0, 0, 0, 0],
96
- /* 6 */
97
- [4, 3, 3, 0, 0, 0, 0, 0, 0],
98
- /* 7 */
99
- [4, 3, 3, 1, 0, 0, 0, 0, 0],
100
- /* 8 */
101
- [4, 3, 3, 2, 0, 0, 0, 0, 0],
102
- /* 9 */
103
- [4, 3, 3, 3, 1, 0, 0, 0, 0],
104
- /* 10 */
105
- [4, 3, 3, 3, 2, 0, 0, 0, 0],
106
- /* 11 */
107
- [4, 3, 3, 3, 2, 1, 0, 0, 0],
108
- /* 12 */
109
- [4, 3, 3, 3, 2, 1, 0, 0, 0],
110
- /* 13 */
111
- [4, 3, 3, 3, 2, 1, 1, 0, 0],
112
- /* 14 */
113
- [4, 3, 3, 3, 2, 1, 1, 0, 0],
114
- /* 15 */
115
- [4, 3, 3, 3, 2, 1, 1, 1, 0],
116
- /* 16 */
117
- [4, 3, 3, 3, 2, 1, 1, 1, 0],
118
- /* 17 */
119
- [4, 3, 3, 3, 2, 1, 1, 1, 1],
120
- /* 18 */
121
- [4, 3, 3, 3, 3, 1, 1, 1, 1],
122
- /* 19 */
123
- [4, 3, 3, 3, 3, 2, 1, 1, 1],
124
- /* 20 */
125
- [4, 3, 3, 3, 3, 2, 2, 1, 1]
126
- ];
127
- var HALF_CASTER_SLOTS = [
128
- /* 1 */
129
- [0, 0, 0, 0, 0],
130
- /* 2 */
131
- [2, 0, 0, 0, 0],
132
- /* 3 */
133
- [3, 0, 0, 0, 0],
134
- /* 4 */
135
- [3, 0, 0, 0, 0],
136
- /* 5 */
137
- [4, 2, 0, 0, 0],
138
- /* 6 */
139
- [4, 2, 0, 0, 0],
140
- /* 7 */
141
- [4, 3, 0, 0, 0],
142
- /* 8 */
143
- [4, 3, 0, 0, 0],
144
- /* 9 */
145
- [4, 3, 2, 0, 0],
146
- /* 10 */
147
- [4, 3, 2, 0, 0],
148
- /* 11 */
149
- [4, 3, 3, 0, 0],
150
- /* 12 */
151
- [4, 3, 3, 0, 0],
152
- /* 13 */
153
- [4, 3, 3, 1, 0],
154
- /* 14 */
155
- [4, 3, 3, 1, 0],
156
- /* 15 */
157
- [4, 3, 3, 2, 0],
158
- /* 16 */
159
- [4, 3, 3, 2, 0],
160
- /* 17 */
161
- [4, 3, 3, 3, 1],
162
- /* 18 */
163
- [4, 3, 3, 3, 1],
164
- /* 19 */
165
- [4, 3, 3, 3, 2],
166
- /* 20 */
167
- [4, 3, 3, 3, 2]
168
- ];
169
- var THIRD_CASTER_SLOTS = [
170
- /* 1 */
171
- [0, 0, 0, 0],
172
- /* 2 */
173
- [0, 0, 0, 0],
174
- /* 3 */
175
- [2, 0, 0, 0],
176
- /* 4 */
177
- [3, 0, 0, 0],
178
- /* 5 */
179
- [3, 0, 0, 0],
180
- /* 6 */
181
- [3, 0, 0, 0],
182
- /* 7 */
183
- [4, 2, 0, 0],
184
- /* 8 */
185
- [4, 2, 0, 0],
186
- /* 9 */
187
- [4, 2, 0, 0],
188
- /* 10 */
189
- [4, 3, 0, 0],
190
- /* 11 */
191
- [4, 3, 0, 0],
192
- /* 12 */
193
- [4, 3, 0, 0],
194
- /* 13 */
195
- [4, 3, 2, 0],
196
- /* 14 */
197
- [4, 3, 2, 0],
198
- /* 15 */
199
- [4, 3, 2, 0],
200
- /* 16 */
201
- [4, 3, 3, 0],
202
- /* 17 */
203
- [4, 3, 3, 0],
204
- /* 18 */
205
- [4, 3, 3, 0],
206
- /* 19 */
207
- [4, 3, 3, 1],
208
- /* 20 */
209
- [4, 3, 3, 1]
210
- ];
211
- var PACT_MAGIC = [
212
- /* 1 */
213
- { level: 1, total: 1 },
214
- /* 2 */
215
- { level: 1, total: 2 },
216
- /* 3 */
217
- { level: 2, total: 2 },
218
- /* 4 */
219
- { level: 2, total: 2 },
220
- /* 5 */
221
- { level: 3, total: 2 },
222
- /* 6 */
223
- { level: 3, total: 2 },
224
- /* 7 */
225
- { level: 4, total: 2 },
226
- /* 8 */
227
- { level: 4, total: 2 },
228
- /* 9 */
229
- { level: 5, total: 2 },
230
- /* 10 */
231
- { level: 5, total: 2 },
232
- /* 11 */
233
- { level: 5, total: 3 },
234
- /* 12 */
235
- { level: 5, total: 3 },
236
- /* 13 */
237
- { level: 5, total: 3 },
238
- /* 14 */
239
- { level: 5, total: 3 },
240
- /* 15 */
241
- { level: 5, total: 3 },
242
- /* 16 */
243
- { level: 5, total: 3 },
244
- /* 17 */
245
- { level: 5, total: 4 },
246
- /* 18 */
247
- { level: 5, total: 4 },
248
- /* 19 */
249
- { level: 5, total: 4 },
250
- /* 20 */
251
- { level: 5, total: 4 }
252
- ];
253
- var ARTIFICER_CASTER_SLOTS = HALF_CASTER_SLOTS.map((row) => [...row]);
254
- ARTIFICER_CASTER_SLOTS[0] = [2, 0, 0, 0, 0];
255
- function slotTableFor(caster) {
256
- switch (caster) {
257
- case "full":
258
- return FULL_CASTER_SLOTS;
259
- case "half":
260
- return HALF_CASTER_SLOTS;
261
- case "third":
262
- return THIRD_CASTER_SLOTS;
263
- case "artificer":
264
- return ARTIFICER_CASTER_SLOTS;
265
- default: {
266
- const _n = caster;
267
- throw new Error(`unknown caster type ${String(_n)}`);
268
- }
269
- }
270
- }
271
- function rowToRecord(row) {
272
- const out = {};
273
- row.forEach((n, i) => {
274
- if (n > 0) out[i + 1] = n;
275
- });
276
- return out;
277
- }
278
- function deriveSpellSlots(classes) {
279
- let fullLevels = 0, halfLevels = 0, thirdLevels = 0, artificerLevels = 0, warlockLevel = 0;
280
- const regular = [];
281
- for (const c of classes) {
282
- if (c.casterType === "pact") {
283
- warlockLevel += c.level;
284
- continue;
285
- }
286
- regular.push({ caster: c.casterType, level: c.level });
287
- switch (c.casterType) {
288
- case "full":
289
- fullLevels += c.level;
290
- break;
291
- case "half":
292
- halfLevels += c.level;
293
- break;
294
- case "third":
295
- thirdLevels += c.level;
296
- break;
297
- case "artificer":
298
- artificerLevels += c.level;
299
- break;
300
- default: {
301
- const _n = c.casterType;
302
- throw new Error(`unknown caster type ${String(_n)}`);
303
- }
304
- }
305
- }
306
- let standard = {};
307
- if (regular.length === 1) {
308
- const only = regular[0];
309
- const table = slotTableFor(only.caster);
310
- const idx = only.level - 1;
311
- if (idx >= 0 && idx < table.length) standard = rowToRecord(table[idx]);
312
- } else if (regular.length >= 2) {
313
- const cl = fullLevels + Math.floor(halfLevels / 2) + Math.floor(thirdLevels / 3) + Math.ceil(artificerLevels / 2);
314
- if (cl >= 1 && cl <= FULL_CASTER_SLOTS.length) standard = rowToRecord(FULL_CASTER_SLOTS[cl - 1]);
315
- }
316
- const pact = warlockLevel >= 1 && warlockLevel <= PACT_MAGIC.length ? PACT_MAGIC[warlockLevel - 1] : null;
317
- return { standard, pact };
318
- }
319
- var PREPARED_COLUMNS = ["Prepared Spells", "Spells Prepared"];
320
- function preparedLevelTerm(caster, level) {
321
- switch (caster) {
322
- case "full":
323
- case "pact":
324
- return level;
325
- case "half":
326
- case "artificer":
327
- return Math.floor(level / 2);
328
- case "third":
329
- return Math.floor(level / 3);
330
- default: {
331
- const _n = caster;
332
- throw new Error(`unknown caster type ${String(_n)}`);
333
- }
334
- }
335
- }
336
- function computeSpellLimits(inputs) {
337
- const out = [];
338
- for (const i of inputs) {
339
- const p = i.profile;
340
- const cantripsKnown = readTableColumn(p.table, i.level, ["Cantrips Known", "Cantrips"]);
341
- const mod = abilityModifier(i.abilityScore);
342
- let preparedOrKnown;
343
- if (p.preparation === "prepared") {
344
- const fromTable = readTableColumn(p.table, i.level, PREPARED_COLUMNS);
345
- preparedOrKnown = fromTable !== null ? fromTable : Math.max(1, mod + preparedLevelTerm(p.casterType, i.level));
346
- } else {
347
- preparedOrKnown = readTableColumn(p.table, i.level, ["Spells Known", "Prepared Spells"]);
348
- }
349
- out.push({ classSlug: i.classSlug, kind: p.preparation, cantripsKnown, preparedOrKnown });
350
- }
351
- return out;
352
- }
353
-
354
- export {
355
- resolveSpellcasting,
356
- effectiveSpellcastingAbility,
357
- normalizeKnownSpell,
358
- listedSpellClassNames,
359
- attributeUnclassedSpell,
360
- slotTableFor,
361
- deriveSpellSlots,
362
- PREPARED_COLUMNS,
363
- preparedLevelTerm,
364
- computeSpellLimits
365
- };
@@ -1,186 +0,0 @@
1
- import {
2
- resolveBaseItem
3
- } from "./chunk-CM5CWO4K.js";
4
- import {
5
- bareEntitySlug,
6
- slugify,
7
- wikilinkTailSlug
8
- } from "./chunk-ZCTUYGNV.js";
9
-
10
- // src/pc/pc.containment.ts
11
- function nonEmptyRef(v) {
12
- return typeof v === "string" && v.length > 0 ? v : null;
13
- }
14
- function isContainerItem(entity) {
15
- if (!entity || typeof entity !== "object") return false;
16
- const c = entity.container;
17
- if (!c || typeof c !== "object") return false;
18
- const container = c;
19
- if (typeof container.holds_items === "boolean") return container.holds_items;
20
- if (typeof container.capacity_weight === "number" && container.capacity_weight > 0) return true;
21
- const cap = container.capacity;
22
- if (!cap || typeof cap !== "object") return false;
23
- const k = cap;
24
- if (Array.isArray(k.weight) && k.weight.length > 0) return true;
25
- if (Array.isArray(k.item) && k.item.length > 0) return true;
26
- return k.weightless === true;
27
- }
28
- function idOwners(equipment) {
29
- const ownerOfId = /* @__PURE__ */ new Map();
30
- const duplicateIds = [];
31
- equipment.forEach((entry, i) => {
32
- const id = nonEmptyRef(entry.id);
33
- if (id === null) return;
34
- if (ownerOfId.has(id)) duplicateIds.push(i);
35
- else ownerOfId.set(id, i);
36
- });
37
- return { ownerOfId, duplicateIds };
38
- }
39
- function entityOfEntry(entry, registry) {
40
- var _a, _b;
41
- if (!registry) return null;
42
- return (_b = (_a = resolveBaseItem(entry.item, registry)) == null ? void 0 : _a.data) != null ? _b : null;
43
- }
44
- function resolveContainment(equipment, registry) {
45
- const n = equipment.length;
46
- const { ownerOfId, duplicateIds } = idOwners(equipment);
47
- const entities = equipment.map((entry) => entityOfEntry(entry, registry));
48
- const isContainer = entities.map((entity) => isContainerItem(entity));
49
- const parentOf = new Array(n).fill(null);
50
- const broken = [];
51
- const closesCycle = (child, owner) => {
52
- for (let cur = owner; cur !== null; cur = parentOf[cur]) if (cur === child) return true;
53
- return false;
54
- };
55
- for (let i = 0; i < n; i++) {
56
- const target = nonEmptyRef(equipment[i].in);
57
- if (target === null) continue;
58
- const owner = ownerOfId.get(target);
59
- let reason = null;
60
- if (equipment[i].equipped === true) reason = "equipped";
61
- else if (owner === void 0) reason = "missing";
62
- else if (owner === i) reason = "self";
63
- else if (entities[owner] === null) reason = "unresolved";
64
- else if (!isContainer[owner]) reason = "not-container";
65
- else if (closesCycle(i, owner)) reason = "cycle";
66
- if (reason !== null) {
67
- broken.push({ index: i, reason });
68
- continue;
69
- }
70
- parentOf[i] = owner;
71
- }
72
- const childrenOf = Array.from({ length: n }, () => []);
73
- parentOf.forEach((p, i) => {
74
- if (p !== null) childrenOf[p].push(i);
75
- });
76
- return { parentOf, childrenOf, isContainer, ownerOfId, duplicateIds, broken };
77
- }
78
- function mintBase(entry, registry) {
79
- var _a, _b, _c;
80
- const found = registry ? resolveBaseItem(entry.item, registry) : null;
81
- const byName = found ? slugify((_a = found.name) != null ? _a : "") : "";
82
- if (byName) return byName;
83
- const inner = (_c = (_b = /^\[\[(.+?)\]\]$/.exec(entry.item.trim())) == null ? void 0 : _b[1]) != null ? _c : entry.item.trim();
84
- const ref = inner.split("|")[0].trim();
85
- const byRef = ref.includes("/") ? wikilinkTailSlug(ref) : slugify(bareEntitySlug(ref));
86
- return byRef || "item";
87
- }
88
- function ensureEntryId(equipment, index, registry) {
89
- const { ownerOfId } = idOwners(equipment);
90
- const own = nonEmptyRef(equipment[index].id);
91
- if (own !== null && ownerOfId.get(own) === index) return own;
92
- const taken = /* @__PURE__ */ new Set();
93
- for (const entry of equipment) {
94
- const a = nonEmptyRef(entry.id);
95
- if (a !== null) taken.add(a);
96
- const b = nonEmptyRef(entry.in);
97
- if (b !== null) taken.add(b);
98
- }
99
- const base = mintBase(equipment[index], registry);
100
- let id = base;
101
- for (let k = 2; taken.has(id); k++) id = `${base}-${k}`;
102
- equipment[index].id = id;
103
- return id;
104
- }
105
- function canMoveInto(equipment, index, target, registry) {
106
- var _a;
107
- const inRange = (i) => Number.isInteger(i) && i >= 0 && i < equipment.length;
108
- if (!inRange(index) || target !== null && !inRange(target)) return { ok: false, reason: "out-of-range" };
109
- if (target === null) return { ok: true };
110
- if (equipment[index].equipped === true) return { ok: false, reason: "equipped" };
111
- if (target === index) return { ok: false, reason: "self" };
112
- const view = resolveContainment(equipment, registry);
113
- const unresolvedLink = new Set(view.broken.filter((b) => b.reason === "unresolved").map((b) => b.index));
114
- const seen = /* @__PURE__ */ new Set();
115
- for (let cur = target; cur !== null && !seen.has(cur); ) {
116
- if (cur === index) return { ok: false, reason: "descendant" };
117
- seen.add(cur);
118
- const up = view.parentOf[cur];
119
- if (up !== null) {
120
- cur = up;
121
- continue;
122
- }
123
- if (unresolvedLink.has(cur)) {
124
- const raw = nonEmptyRef(equipment[cur].in);
125
- cur = raw === null ? null : (_a = view.ownerOfId.get(raw)) != null ? _a : null;
126
- continue;
127
- }
128
- cur = null;
129
- }
130
- const entity = entityOfEntry(equipment[target], registry);
131
- if (entity === null) return { ok: false, reason: "unresolved" };
132
- if (!isContainerItem(entity)) return { ok: false, reason: "not-container" };
133
- return { ok: true };
134
- }
135
- function moveInto(equipment, index, target, registry) {
136
- const check = canMoveInto(equipment, index, target, registry);
137
- if (!check.ok) return check;
138
- const entry = equipment[index];
139
- if (target === null) {
140
- const had = entry.in !== void 0;
141
- delete entry.in;
142
- return { ok: true, changed: had };
143
- }
144
- const wasHonoured = resolveContainment(equipment, registry).parentOf[index] === target;
145
- const idBefore = equipment[target].id;
146
- const id = ensureEntryId(equipment, target, registry);
147
- entry.in = id;
148
- return { ok: true, changed: idBefore !== id || !wasHonoured };
149
- }
150
- function repairContainment(equipment, registry) {
151
- if (!registry) return 0;
152
- let removed = 0;
153
- for (const entry of equipment) {
154
- if (entry.id === "") {
155
- delete entry.id;
156
- removed++;
157
- }
158
- if (entry.in === "") {
159
- delete entry.in;
160
- removed++;
161
- }
162
- }
163
- const view = resolveContainment(equipment, registry);
164
- for (const b of view.broken) {
165
- if (b.reason === "unresolved") continue;
166
- delete equipment[b.index].in;
167
- removed++;
168
- }
169
- for (const i of view.duplicateIds) {
170
- delete equipment[i].id;
171
- removed++;
172
- }
173
- return removed;
174
- }
175
-
176
- export {
177
- nonEmptyRef,
178
- isContainerItem,
179
- idOwners,
180
- entityOfEntry,
181
- resolveContainment,
182
- ensureEntryId,
183
- canMoveInto,
184
- moveInto,
185
- repairContainment
186
- };