@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,709 +0,0 @@
1
- import {
2
- qualifiedGrantCovers
3
- } from "./chunk-3LWMFYKS.js";
4
- import {
5
- classifyWeaponRange
6
- } from "./chunk-YDGMBMYI.js";
7
- import {
8
- resolveContainment
9
- } from "./chunk-EJP263OP.js";
10
- import {
11
- normKey
12
- } from "./chunk-RLGQ5PZZ.js";
13
- import {
14
- WEAPON_DEFAULT_ACTION_COST,
15
- resolveEntryEntity
16
- } from "./chunk-3VZZDKRA.js";
17
- import {
18
- readNumericBonus
19
- } from "./chunk-HHBD4SQ6.js";
20
- import {
21
- defaultSlotForType,
22
- effectiveArmor,
23
- effectiveWeapon,
24
- isItemEntity,
25
- isShieldArmor,
26
- isTwoHandedWeapon,
27
- slotAcTerms
28
- } from "./chunk-LHZXYFBU.js";
29
- import {
30
- resolveBaseItem
31
- } from "./chunk-CM5CWO4K.js";
32
- import {
33
- bareEntitySlug
34
- } from "./chunk-ZCTUYGNV.js";
35
-
36
- // src/weapon/weapon-mastery.ts
37
- var MASTERY = {
38
- cleave: { label: "Cleave", description: "If you hit a creature with a melee attack roll using this weapon, you can make an attack roll with the weapon against a second creature within 5 feet of the first that is also within your reach. On a hit, the second creature takes the weapon's damage, but don't add your ability modifier to that damage unless it is negative. You can make this extra attack only once per turn.", gist: "hit a 2nd creature in reach" },
39
- graze: { label: "Graze", description: "If your attack roll with this weapon misses a creature, you can deal damage to that creature equal to the ability modifier you used to make the attack roll. This damage is the same type dealt by the weapon, and the damage can be increased only by increasing the ability modifier.", gist: "on miss: ability-mod damage" },
40
- nick: { label: "Nick", description: "When you make the extra attack of the Light property, you can make it as part of the Attack action instead of as a Bonus Action. You can make this extra attack only once per turn.", gist: "extra Light attack (no Bonus Action)" },
41
- push: { label: "Push", description: "If you hit a creature with this weapon, you can push the creature up to 10 feet straight away from yourself if it is Large or smaller.", gist: "on hit: pushed 10 ft." },
42
- sap: { label: "Sap", description: "If you hit a creature with this weapon, that creature has Disadvantage on its next attack roll before the start of your next turn.", gist: "on hit: target Disadvantage" },
43
- slow: { label: "Slow", description: "If you hit a creature with this weapon and deal damage, you can reduce its Speed by 10 feet until the start of your next turn. If the creature is hit more than once by weapons that have this property, the Speed reduction doesn't exceed 10 feet.", gist: "on hit: -10 ft. Speed" },
44
- topple: { label: "Topple", description: "If you hit a creature with this weapon, you can force the creature to make a Constitution saving throw (DC 8 plus the ability modifier used to make the attack roll and your Proficiency Bonus). On a failed save, the creature has the Prone condition.", gist: "on fail: Prone" },
45
- vex: { label: "Vex", description: "If you hit a creature with this weapon and deal damage, you have Advantage on your next attack roll against that creature before the end of your next turn.", gist: "on hit: you gain Advantage next" }
46
- };
47
- function masteryGist(slug) {
48
- var _a;
49
- return (_a = MASTERY[slug]) == null ? void 0 : _a.gist;
50
- }
51
- function masteryDerived(slug, abilityMod, proficiencyBonus) {
52
- if (slug === "topple") return { label: "Save DC", value: 8 + proficiencyBonus + abilityMod };
53
- if (slug === "graze") return { label: "On miss", value: abilityMod };
54
- return void 0;
55
- }
56
-
57
- // src/pc/pc.equipment.ts
58
- var ABILITY_KEYS = ["str", "dex", "con", "int", "wis", "cha"];
59
- function isAbilityKey(k) {
60
- return ABILITY_KEYS.includes(k);
61
- }
62
- function emptyAppliedBonuses() {
63
- return {
64
- ability_bonuses: {},
65
- ability_statics: {},
66
- save_bonus: 0,
67
- save_terms: [],
68
- speed_bonuses: { walk: 0, fly: null, swim: 0, climb: 0 },
69
- spell_attack: 0,
70
- spell_save_dc: 0,
71
- defenses: { resistances: [], immunities: [], vulnerabilities: [], condition_immunities: [] },
72
- informational: [],
73
- senses: { darkvision: 0, blindsight: 0, tremorsense: 0, truesight: 0 }
74
- };
75
- }
76
- function unwrapSlug(item) {
77
- const m = item.match(/^\[\[(.+)\]\]$/);
78
- return m ? m[1] : null;
79
- }
80
- function isAttunedActive(entry, entity) {
81
- if (!entry.equipped) return false;
82
- const requires = isItemEntity(entity) && entity.attunement && typeof entity.attunement === "object" && "required" in entity.attunement && entity.attunement.required === true;
83
- if (!requires) return true;
84
- return entry.attuned === true;
85
- }
86
- function unwrapClassSlug(maybeWiki) {
87
- if (!maybeWiki) return "";
88
- const m = /^\[\[([^\]]+)\]\]$/.exec(maybeWiki);
89
- return (m ? m[1] : maybeWiki).toLowerCase();
90
- }
91
- function buildConditionContext(resolved, equippedSlots, registry) {
92
- var _a, _b;
93
- return {
94
- derived: { equippedSlots },
95
- classList: (_a = resolved.definition.class) != null ? _a : [],
96
- race: resolved.definition.race,
97
- subclasses: ((_b = resolved.definition.class) != null ? _b : []).map((c) => c.subclass).filter((s) => typeof s === "string" && s.length > 0).map(unwrapClassSlug),
98
- // H234 H2: `wielding_two_handed` reads a magic main-hand weapon's base through it.
99
- registry
100
- };
101
- }
102
- function pushApply(outcome, field, source, pool, onApply) {
103
- if (!outcome) return;
104
- if (outcome.kind === "applied") onApply(outcome.value);
105
- else if (outcome.kind === "informational") {
106
- pool.push({ field, source, value: outcome.value, conditions: outcome.conditions });
107
- }
108
- }
109
- function computeAppliedBonuses(resolved, _profs, registry, warnings) {
110
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
111
- const out = emptyAppliedBonuses();
112
- const equipment = (_a = resolved.definition.equipment) != null ? _a : [];
113
- const ctx = buildConditionContext(resolved, {}, registry);
114
- for (let index = 0; index < equipment.length; index++) {
115
- const entry = equipment[index];
116
- const { entity, entityType } = resolveEntryEntity(entry, index, registry, resolved.infusions);
117
- if (!entity) {
118
- const slug = unwrapSlug(entry.item);
119
- if (slug && entry.equipped && !((_b = resolved.infusions) == null ? void 0 : _b.views.has(index))) warnings.push(`Equipped item [[${slug}]] not found in compendium.`);
120
- continue;
121
- }
122
- if (!isAttunedActive(entry, entity)) continue;
123
- if (entityType !== "item") continue;
124
- const item = entity;
125
- (_c = item.resist) == null ? void 0 : _c.forEach((s) => out.defenses.resistances.push(s));
126
- (_d = item.immune) == null ? void 0 : _d.forEach((s) => out.defenses.immunities.push(s));
127
- (_e = item.vulnerable) == null ? void 0 : _e.forEach((s) => out.defenses.vulnerabilities.push(s));
128
- (_f = item.condition_immune) == null ? void 0 : _f.forEach((s) => out.defenses.condition_immunities.push(s));
129
- (_h = (_g = entry.overrides) == null ? void 0 : _g.resist) == null ? void 0 : _h.forEach((s) => out.defenses.resistances.push(s));
130
- (_j = (_i = entry.overrides) == null ? void 0 : _i.immune) == null ? void 0 : _j.forEach((s) => out.defenses.immunities.push(s));
131
- (_l = (_k = entry.overrides) == null ? void 0 : _k.vulnerable) == null ? void 0 : _l.forEach((s) => out.defenses.vulnerabilities.push(s));
132
- (_n = (_m = entry.overrides) == null ? void 0 : _m.condition_immune) == null ? void 0 : _n.forEach((s) => out.defenses.condition_immunities.push(s));
133
- const gs = (_o = item.grants) == null ? void 0 : _o.senses;
134
- if (gs) {
135
- if (typeof gs.darkvision === "number") out.senses.darkvision = Math.max(out.senses.darkvision, gs.darkvision);
136
- if (typeof gs.blindsight === "number") out.senses.blindsight = Math.max(out.senses.blindsight, gs.blindsight);
137
- if (typeof gs.tremorsense === "number") out.senses.tremorsense = Math.max(out.senses.tremorsense, gs.tremorsense);
138
- if (typeof gs.truesight === "number") out.senses.truesight = Math.max(out.senses.truesight, gs.truesight);
139
- }
140
- const b = item.bonuses;
141
- if (!b) continue;
142
- const saveSource = (_q = (_p = entry.overrides) == null ? void 0 : _p.name) != null ? _q : item.name;
143
- pushApply(
144
- readNumericBonus(b.saving_throws, ctx),
145
- "saving_throws",
146
- saveSource,
147
- out.informational,
148
- (v) => {
149
- out.save_bonus += v;
150
- out.save_terms.push({ source: saveSource, amount: v });
151
- }
152
- );
153
- pushApply(
154
- readNumericBonus(b.spell_attack, ctx),
155
- "spell_attack",
156
- item.name,
157
- out.informational,
158
- (v) => {
159
- out.spell_attack += v;
160
- }
161
- );
162
- pushApply(
163
- readNumericBonus(b.spell_save_dc, ctx),
164
- "spell_save_dc",
165
- item.name,
166
- out.informational,
167
- (v) => {
168
- out.spell_save_dc += v;
169
- }
170
- );
171
- if ((_r = b.ability_scores) == null ? void 0 : _r.bonus) {
172
- for (const [k, v] of Object.entries(b.ability_scores.bonus)) {
173
- if (!isAbilityKey(k)) continue;
174
- pushApply(
175
- readNumericBonus(v, ctx),
176
- `ability_scores.bonus.${k}`,
177
- item.name,
178
- out.informational,
179
- (val) => {
180
- var _a2;
181
- out.ability_bonuses[k] = ((_a2 = out.ability_bonuses[k]) != null ? _a2 : 0) + val;
182
- }
183
- );
184
- }
185
- }
186
- if ((_s = b.ability_scores) == null ? void 0 : _s.static) {
187
- for (const [k, n] of Object.entries(b.ability_scores.static)) {
188
- if (!isAbilityKey(k) || typeof n !== "number") continue;
189
- const prev = out.ability_statics[k];
190
- if (prev === void 0) {
191
- out.ability_statics[k] = n;
192
- } else {
193
- if (n !== prev) {
194
- warnings.push(
195
- `Multiple static ${k.toUpperCase()} bonuses on equipped+attuned items; using highest (${Math.max(prev, n)}).`
196
- );
197
- }
198
- out.ability_statics[k] = Math.max(prev, n);
199
- }
200
- }
201
- }
202
- if (b.speed) {
203
- pushApply(
204
- readNumericBonus(b.speed.walk, ctx),
205
- "speed.walk",
206
- item.name,
207
- out.informational,
208
- (v) => {
209
- out.speed_bonuses.walk += v;
210
- }
211
- );
212
- if (b.speed.fly === "walk") {
213
- out.speed_bonuses.fly = "walk";
214
- } else {
215
- pushApply(
216
- readNumericBonus(b.speed.fly, ctx),
217
- "speed.fly",
218
- item.name,
219
- out.informational,
220
- (v) => {
221
- const cur = out.speed_bonuses.fly;
222
- out.speed_bonuses.fly = (typeof cur === "number" ? cur : 0) + v;
223
- }
224
- );
225
- }
226
- pushApply(
227
- readNumericBonus(b.speed.swim, ctx),
228
- "speed.swim",
229
- item.name,
230
- out.informational,
231
- (v) => {
232
- out.speed_bonuses.swim += v;
233
- }
234
- );
235
- pushApply(
236
- readNumericBonus(b.speed.climb, ctx),
237
- "speed.climb",
238
- item.name,
239
- out.informational,
240
- (v) => {
241
- out.speed_bonuses.climb += v;
242
- }
243
- );
244
- }
245
- }
246
- return out;
247
- }
248
- function assignSlots(resolved, registry, warnings) {
249
- var _a;
250
- const slots = {};
251
- const eq = (_a = resolved.definition.equipment) != null ? _a : [];
252
- for (let i = 0; i < eq.length; i++) {
253
- const entry = eq[i];
254
- if (!entry.equipped || !entry.slot) continue;
255
- const { entity, entityType } = resolveEntryEntity(entry, i, registry, resolved.infusions);
256
- if (slots[entry.slot]) continue;
257
- const placed = { index: i, entity, entityType, entry };
258
- slots[entry.slot] = placed;
259
- }
260
- for (let i = 0; i < eq.length; i++) {
261
- const entry = eq[i];
262
- if (!entry.equipped || entry.slot) continue;
263
- const { entity, entityType } = resolveEntryEntity(entry, i, registry, resolved.infusions);
264
- if (!entity || !entityType) continue;
265
- const defaultSlot = defaultSlotForType(entityType, entity, registry);
266
- if (!defaultSlot) {
267
- if (isItemEntity(entity) && typeof entity.base_item === "string" && entity.base_item.length > 0) {
268
- warnings.push(
269
- `Magic item "${entity.name}" base_item ${entity.base_item} did not resolve to a base weapon or armor; not slotted (AC/attack not applied).`
270
- );
271
- }
272
- continue;
273
- }
274
- const placed = { index: i, entity, entityType, entry };
275
- if (defaultSlot === "mainhand") {
276
- if (!slots.mainhand) slots.mainhand = placed;
277
- else if (!slots.offhand) slots.offhand = placed;
278
- } else if (!slots[defaultSlot]) {
279
- slots[defaultSlot] = placed;
280
- }
281
- }
282
- return slots;
283
- }
284
- function pickShield(equippedSlots, equipment, registry, infusions) {
285
- const slotted = equippedSlots.shield;
286
- const slottedArmor = effectiveArmor(slotted == null ? void 0 : slotted.entity, registry);
287
- if (slotted && slottedArmor && isShieldArmor(slottedArmor)) {
288
- return { index: slotted.index, shield: slottedArmor, entity: slotted.entity, entry: slotted.entry };
289
- }
290
- for (let i = 0; i < equipment.length; i++) {
291
- const entry = equipment[i];
292
- if (!entry.equipped) continue;
293
- const { entity } = resolveEntryEntity(entry, i, registry, infusions);
294
- const armor = effectiveArmor(entity, registry);
295
- if (armor && isShieldArmor(armor)) return { index: i, shield: armor, entity, entry };
296
- }
297
- return null;
298
- }
299
- function twoHandedShieldWarnings(equipment, registry, warnings, infusions) {
300
- const equipped = equipment.flatMap((entry, i) => {
301
- if (!entry.equipped) return [];
302
- const { entity } = resolveEntryEntity(entry, i, registry, infusions);
303
- return [{ entry, entity }];
304
- });
305
- const isShield = (e) => {
306
- const armor = effectiveArmor(e.entity, registry);
307
- return !!armor && isShieldArmor(armor);
308
- };
309
- for (const e of equipped) {
310
- if (!e.entity || !isTwoHandedWeapon(e.entity, registry)) continue;
311
- if (!equipped.some((other) => other !== e && isShield(other))) continue;
312
- warnings.push(`${e.entity.name} is two-handed and a Shield is also equipped.`);
313
- }
314
- }
315
- function computeAC(equippedSlots, resolved, mods, registry, warnings) {
316
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
317
- const breakdown = [];
318
- const armorSlot = equippedSlots.armor;
319
- const armorEntity = (_a = armorSlot == null ? void 0 : armorSlot.entity) != null ? _a : null;
320
- const armor = effectiveArmor(armorEntity, registry);
321
- if (isItemEntity(armorEntity) && typeof armorEntity.base_item === "string" && !armor) {
322
- warnings.push(
323
- `Magic armor "${armorEntity.name}" base_item ${armorEntity.base_item} did not resolve to a base armor; AC not applied.`
324
- );
325
- }
326
- const acCtx = buildConditionContext(resolved, equippedSlots, registry);
327
- const skip = /* @__PURE__ */ new Set();
328
- const slotBonus = (slot) => {
329
- var _a2, _b2;
330
- const view = slot ? (_a2 = resolved.infusions) == null ? void 0 : _a2.views.get(slot.index) : void 0;
331
- if (!slot || !(view == null ? void 0 : view.entity) || !isItemEntity(view.entity) || !isAttunedActive(slot.entry, view.entity)) return 0;
332
- const out = readNumericBonus((_b2 = view.entity.bonuses) == null ? void 0 : _b2.ac, acCtx);
333
- if ((out == null ? void 0 : out.kind) !== "applied") return 0;
334
- skip.add(slot.index);
335
- return out.value;
336
- };
337
- const armorTerms = slotAcTerms(armor, armorSlot == null ? void 0 : armorSlot.entry);
338
- let ac = 10;
339
- if (armor && armorTerms.armor !== null) {
340
- const armorBase = armorTerms.armor + slotBonus(armorSlot);
341
- ac = armorBase;
342
- breakdown.push({ source: (_b = armorEntity == null ? void 0 : armorEntity.name) != null ? _b : armor.name, amount: armorBase, kind: "armor" });
343
- if (armor.ac.add_dex) {
344
- const dexCap = (_c = armor.ac.dex_max) != null ? _c : Number.POSITIVE_INFINITY;
345
- const dexAdd = Math.min(mods.dex, dexCap);
346
- ac += dexAdd;
347
- const capped = mods.dex > dexCap;
348
- breakdown.push({ source: `DEX modifier${capped ? " (capped)" : ""}`, amount: dexAdd, kind: "dex" });
349
- }
350
- } else {
351
- ac = 10 + mods.dex;
352
- breakdown.push({ source: "Base", amount: 10, kind: "unarmored" });
353
- breakdown.push({ source: "DEX modifier", amount: mods.dex, kind: "dex" });
354
- }
355
- const acBonus = armorTerms.override;
356
- if (acBonus !== 0) {
357
- ac += acBonus;
358
- breakdown.push({ source: `${(_d = armorEntity == null ? void 0 : armorEntity.name) != null ? _d : "Armor"} (override)`, amount: acBonus, kind: "override" });
359
- }
360
- const picked = pickShield(equippedSlots, (_e = resolved.definition.equipment) != null ? _e : [], registry, resolved.infusions);
361
- if (picked) {
362
- const { shield, entity: shieldEntity } = picked;
363
- const shieldTerms = slotAcTerms(shield, picked.entry);
364
- const n = shieldTerms.armor + slotBonus(picked);
365
- ac += n;
366
- breakdown.push({ source: (_f = shieldEntity == null ? void 0 : shieldEntity.name) != null ? _f : shield.name, amount: n, kind: "shield" });
367
- const shieldAcBonus = shieldTerms.override;
368
- if (shieldAcBonus !== 0) {
369
- ac += shieldAcBonus;
370
- breakdown.push({ source: `${(_g = shieldEntity == null ? void 0 : shieldEntity.name) != null ? _g : shield.name} (override)`, amount: shieldAcBonus, kind: "shield" });
371
- }
372
- }
373
- const acInformational = [];
374
- const acEquipment = (_h = resolved.definition.equipment) != null ? _h : [];
375
- for (let index = 0; index < acEquipment.length; index++) {
376
- if (skip.has(index)) continue;
377
- const entry = acEquipment[index];
378
- const { entity, entityType } = resolveEntryEntity(entry, index, registry, resolved.infusions);
379
- if (!entity || entityType !== "item") continue;
380
- if (!isAttunedActive(entry, entity)) continue;
381
- const item = entity;
382
- const out = readNumericBonus((_i = item.bonuses) == null ? void 0 : _i.ac, acCtx);
383
- if (!out) continue;
384
- if (out.kind === "applied") {
385
- ac += out.value;
386
- breakdown.push({ source: item.name, amount: out.value, kind: "item" });
387
- } else if (out.kind === "informational") {
388
- acInformational.push({
389
- field: "ac",
390
- source: item.name,
391
- value: out.value,
392
- conditions: out.conditions
393
- });
394
- }
395
- }
396
- return { ac, breakdown, informational: acInformational };
397
- }
398
- function hasProperty(weapon, prop) {
399
- return weapon.properties.some((p) => p === prop);
400
- }
401
- function attackAbility(weapon, mods, weaponAbilities) {
402
- const modes = classifyWeaponRange(weapon);
403
- const finesse = hasProperty(weapon, "finesse");
404
- if (modes.melee) {
405
- const scoped = weaponAbilities.find((o2) => {
406
- var _a;
407
- return (_a = o2.weaponSlugs) == null ? void 0 : _a.includes(bareEntitySlug(weapon.slug));
408
- });
409
- const glob = weaponAbilities.find((o2) => !o2.weaponSlugs);
410
- const o = scoped != null ? scoped : glob;
411
- if (o) return o.ability;
412
- if (finesse) return mods.dex >= mods.str ? "dex" : "str";
413
- return "str";
414
- }
415
- return finesse && mods.str > mods.dex ? "str" : "dex";
416
- }
417
- function isWeaponSlugProficient(weapon, weaponSlug, profs) {
418
- const wp = profs.weapons;
419
- if (wp.specific.some((e) => e === weaponSlug || normKey(e) === normKey(weapon.name))) return true;
420
- if (wp.specific.some((e) => qualifiedGrantCovers(e, weapon))) return true;
421
- const cat = weapon.category;
422
- if (typeof cat === "string") {
423
- if (/^simple\b/.test(cat) && wp.categories.includes("simple")) return true;
424
- if (/^martial\b/.test(cat) && wp.categories.includes("martial")) return true;
425
- if (wp.categories.includes(cat)) return true;
426
- }
427
- return false;
428
- }
429
- function magicBonusesForWeaponEntry(entry, registry, ctx, index, infusions) {
430
- var _a;
431
- const { entity } = resolveEntryEntity(entry, index, registry, infusions);
432
- const ovr = (_a = entry.overrides) != null ? _a : {};
433
- const entryAttack = typeof ovr.bonus === "number" ? ovr.bonus : 0;
434
- const entryDamage = typeof ovr.damage_bonus === "number" ? ovr.damage_bonus : 0;
435
- const extra = typeof ovr.extra_damage === "string" ? ovr.extra_damage : void 0;
436
- let itemAttack = 0;
437
- let itemDamage = 0;
438
- let sourceName;
439
- let itemName;
440
- let damageTypeOverride;
441
- let propertiesOverride;
442
- const informational = [];
443
- let itemRiders = [];
444
- if (entity && isItemEntity(entity)) {
445
- sourceName = entity.name;
446
- itemName = entity.name;
447
- damageTypeOverride = typeof entity.damage_type === "string" && entity.damage_type.length > 0 ? entity.damage_type : void 0;
448
- propertiesOverride = Array.isArray(entity.properties) && entity.properties.length > 0 ? entity.properties : void 0;
449
- const b = entity.bonuses;
450
- const atkOut = readNumericBonus(b == null ? void 0 : b.weapon_attack, ctx);
451
- const dmgOut = readNumericBonus(b == null ? void 0 : b.weapon_damage, ctx);
452
- if ((atkOut == null ? void 0 : atkOut.kind) === "applied") itemAttack = atkOut.value;
453
- else if ((atkOut == null ? void 0 : atkOut.kind) === "informational")
454
- informational.push({ field: "weapon_attack", source: entity.name, value: atkOut.value, conditions: atkOut.conditions });
455
- if ((dmgOut == null ? void 0 : dmgOut.kind) === "applied") itemDamage = dmgOut.value;
456
- else if ((dmgOut == null ? void 0 : dmgOut.kind) === "informational")
457
- informational.push({ field: "weapon_damage", source: entity.name, value: dmgOut.value, conditions: dmgOut.conditions });
458
- itemRiders = Array.isArray(entity.damage_riders) ? entity.damage_riders.filter((r) => {
459
- var _a2;
460
- return ((_a2 = r.applies_to) != null ? _a2 : "weapon") !== "spell";
461
- }).map((r) => ({ amount: r.amount, damage_type: r.damage_type, source: entity.name, ...r.condition ? { condition: r.condition } : {} })) : [];
462
- }
463
- return {
464
- atk: itemAttack + entryAttack,
465
- dmg: itemDamage + entryDamage,
466
- extra,
467
- sourceName,
468
- itemName,
469
- damageTypeOverride,
470
- propertiesOverride,
471
- informational,
472
- riders: itemRiders
473
- };
474
- }
475
- function buildAttackRow(args) {
476
- var _a, _b, _c;
477
- const { id, name, weapon, baseDice, ability, mods, proficient, proficiencyBonus, magic, weaponMasteries } = args;
478
- const abilityMod = mods[ability];
479
- const pb = proficient ? proficiencyBonus : 0;
480
- const toHit = abilityMod + pb + magic.atk;
481
- const dmgFlat = abilityMod + magic.dmg;
482
- const formatDice = (dice) => `${dice}${dmgFlat >= 0 ? "+" : ""}${dmgFlat}`.replace(/\+0$/, "");
483
- const damageDice = formatDice(baseDice);
484
- const magicSource = magic.sourceName ? `${magic.sourceName} bonus` : "Magic weapon";
485
- const toHitBreakdown = [
486
- { source: `${ability.toUpperCase()} modifier`, amount: abilityMod, kind: "ability" },
487
- { source: "Proficiency bonus", amount: proficient ? proficiencyBonus : 0, kind: "ability" },
488
- { source: magicSource, amount: magic.atk, kind: "item" }
489
- ];
490
- const damageBreakdown = [
491
- { source: "Base damage", amount: 0, kind: "ability" },
492
- { source: `${ability.toUpperCase()} modifier`, amount: abilityMod, kind: "ability" },
493
- { source: magicSource, amount: magic.dmg, kind: "item" }
494
- ];
495
- const modes = classifyWeaponRange(weapon);
496
- const fmtRanged = (r) => `${r.normal}/${r.long} ft.`;
497
- const range = modes.melee ? `${modes.melee.reach} ft.` : modes.ranged ? fmtRanged(modes.ranged) : void 0;
498
- const thrownRange = modes.melee && modes.ranged ? fmtRanged(modes.ranged) : void 0;
499
- const stringProps = weapon.properties.filter(
500
- (p) => typeof p === "string"
501
- );
502
- const finalProps = (_a = magic.propertiesOverride) != null ? _a : stringProps;
503
- const row = {
504
- id,
505
- name,
506
- ...range !== void 0 ? { range } : {},
507
- ...thrownRange !== void 0 ? { thrownRange } : {},
508
- toHit,
509
- damageDice,
510
- damageType: (_b = magic.damageTypeOverride) != null ? _b : weapon.damage.type,
511
- // Riders: item damage_riders (Task 2) + the entry's overrides.extra_damage string. The override
512
- // rider carries NO source: the player typed it on this very row, so the weapons table attributes it
513
- // to nothing (no "(manual)" in a caption, no hover title on its chip).
514
- ...(() => {
515
- const riders = [
516
- ...magic.riders,
517
- ...magic.extra ? [{ amount: magic.extra }] : []
518
- ];
519
- return riders.length ? { damageRiders: riders } : {};
520
- })(),
521
- weaponCategory: modes.melee ? "melee" : "ranged",
522
- properties: finalProps,
523
- proficient,
524
- breakdown: { toHit: toHitBreakdown, damage: damageBreakdown },
525
- informational: args.magic.informational.length > 0 ? args.magic.informational : void 0,
526
- slotKey: args.slotKey,
527
- subLabel: formatWeaponSubLabel(weapon, finalProps, modes),
528
- actionCost: args.actionCost,
529
- versatile: args.versatileDice ? { damageDice: formatDice(args.versatileDice) } : void 0
530
- };
531
- const mSlug = (_c = weapon.mastery) == null ? void 0 : _c[0];
532
- if (mSlug && proficient && weaponMasteries.includes(bareEntitySlug(weapon.slug))) {
533
- const g = MASTERY[mSlug];
534
- if (g) {
535
- const derived = masteryDerived(mSlug, mods[ability], proficiencyBonus);
536
- row.mastery = { slug: mSlug, label: g.label, description: g.description, gist: masteryGist(mSlug), ...derived ? { derived } : {} };
537
- }
538
- }
539
- return row;
540
- }
541
- function buildUnarmedRow(mods, proficiencyBonus, spec) {
542
- var _a;
543
- const candidates = ["str", ...(_a = spec == null ? void 0 : spec.abilities) != null ? _a : []];
544
- let ability = "str";
545
- for (const ab of candidates) if (mods[ab] >= mods[ability]) ability = ab;
546
- const abilityMod = mods[ability];
547
- const toHit = abilityMod + proficiencyBonus;
548
- const flat = `${abilityMod >= 0 ? "+" : ""}${abilityMod}`.replace(/^\+0$/, "");
549
- const damageDice = (spec == null ? void 0 : spec.dice) ? `${spec.dice}${flat}` : String(Math.max(0, 1 + abilityMod));
550
- const label = `${ability.toUpperCase()} modifier`;
551
- return {
552
- id: "unarmed-strike",
553
- name: "Unarmed Strike",
554
- unarmed: true,
555
- range: "5 ft.",
556
- toHit,
557
- damageDice,
558
- damageType: "bludgeoning",
559
- properties: [],
560
- proficient: true,
561
- breakdown: {
562
- toHit: [
563
- { source: label, amount: abilityMod, kind: "ability" },
564
- { source: "Proficiency bonus", amount: proficiencyBonus, kind: "ability" }
565
- ],
566
- // T17 T-33: the base term is the one the total sums. With no die the strike deals 1 + mod, so the base is +1
567
- // (it read +0 beside a total of 1 + mod); a die carries its own base, as a weapon's does, so it stays +0.
568
- damage: [
569
- { source: "Base damage", amount: (spec == null ? void 0 : spec.dice) ? 0 : 1, kind: "ability" },
570
- { source: label, amount: abilityMod, kind: "ability" }
571
- ]
572
- },
573
- subLabel: "Unarmed",
574
- actionCost: "action"
575
- };
576
- }
577
- function humanizeWeaponToken(s) {
578
- return s.replace(/[-_]/g, " ").replace(/(^|[\s(])\w/g, (c) => c.toUpperCase());
579
- }
580
- function formatWeaponSubLabel(weapon, properties, modes) {
581
- const parts = [];
582
- if (weapon.category) {
583
- const cat = modes.melee && /ranged/.test(weapon.category) ? weapon.category.replace("ranged", "melee") : weapon.category;
584
- parts.push(humanizeWeaponToken(cat));
585
- }
586
- if (properties.length > 0) parts.push(properties.map(humanizeWeaponToken).join(", "));
587
- return parts.join(" \xB7 ");
588
- }
589
- function computeAttacks(equippedSlots, equipment, mods, profs, registry, warnings, proficiencyBonus, ctx, weaponMasteries, weaponAbilities = [], infusions) {
590
- var _a, _b;
591
- const rows = [];
592
- const rowFor = (index, entry, weapon, slotKey, versatileDice) => {
593
- var _a2, _b2, _c, _d, _e;
594
- const slugFromEntry = (_a2 = unwrapSlug(entry.item)) != null ? _a2 : weapon.slug;
595
- const proficient = isWeaponSlugProficient(weapon, slugFromEntry, profs) || isWeaponSlugProficient(weapon, weapon.slug, profs);
596
- if (!proficient) {
597
- warnings.push(`Character not proficient with ${weapon.name}; proficiency bonus excluded.`);
598
- }
599
- const ability = attackAbility(weapon, mods, weaponAbilities);
600
- const magic = magicBonusesForWeaponEntry(entry, registry, ctx, index, infusions);
601
- const ovr = (_b2 = entry.overrides) != null ? _b2 : {};
602
- return buildAttackRow({
603
- id: `${index}:standard`,
604
- name: (_d = (_c = ovr.name) != null ? _c : magic.itemName) != null ? _d : weapon.name,
605
- weapon,
606
- baseDice: weapon.damage.dice,
607
- ability,
608
- mods,
609
- proficient,
610
- proficiencyBonus,
611
- magic,
612
- slotKey,
613
- actionCost: (_e = ovr.action) != null ? _e : WEAPON_DEFAULT_ACTION_COST,
614
- versatileDice,
615
- weaponMasteries
616
- });
617
- };
618
- const handedSlots = [
619
- { key: "mainhand", placed: equippedSlots.mainhand },
620
- { key: "offhand", placed: equippedSlots.offhand }
621
- ];
622
- for (const { key, placed } of handedSlots) {
623
- if (!placed) continue;
624
- const { entity, entry } = placed;
625
- if (!entity) continue;
626
- const weapon = effectiveWeapon(entity, registry);
627
- if (!weapon) {
628
- if (isItemEntity(entity) && typeof entity.base_item === "string") {
629
- warnings.push(`Magic weapon ${entity.name} references missing base_item ${entity.base_item}.`);
630
- }
631
- continue;
632
- }
633
- const versatileDice = key === "mainhand" && hasProperty(weapon, "versatile") && typeof weapon.damage.versatile_dice === "string" && !equippedSlots.offhand ? weapon.damage.versatile_dice : void 0;
634
- rows.push(rowFor(placed.index, entry, weapon, key, versatileDice));
635
- }
636
- const handIndex = /* @__PURE__ */ new Set([(_a = equippedSlots.mainhand) == null ? void 0 : _a.index, (_b = equippedSlots.offhand) == null ? void 0 : _b.index]);
637
- equipment.forEach((entry, index) => {
638
- if (!entry.equipped || handIndex.has(index)) return;
639
- const { entity } = resolveEntryEntity(entry, index, registry, infusions);
640
- const weapon = effectiveWeapon(entity, registry);
641
- if (!weapon) return;
642
- rows.push(rowFor(index, entry, weapon));
643
- });
644
- return rows;
645
- }
646
- function coerceWeight(raw) {
647
- if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0) return raw;
648
- if (typeof raw === "string") {
649
- const n = Number.parseFloat(raw);
650
- if (Number.isFinite(n) && n >= 0) return n;
651
- }
652
- return 0;
653
- }
654
- function computeCarriedWeight(resolved, registry) {
655
- var _a;
656
- const equipment = (_a = resolved.definition.equipment) != null ? _a : [];
657
- const view = resolveContainment(equipment, registry);
658
- const weightlessContainer = equipment.map((entry) => {
659
- var _a2, _b, _c;
660
- const data = (_a2 = resolveBaseItem(entry.item, registry)) == null ? void 0 : _a2.data;
661
- return ((_c = (_b = data == null ? void 0 : data.container) == null ? void 0 : _b.capacity) == null ? void 0 : _c.weightless) === true;
662
- });
663
- const exempt = (i) => {
664
- for (let p = view.parentOf[i]; p !== null; p = view.parentOf[p]) if (weightlessContainer[p]) return true;
665
- return false;
666
- };
667
- let total = 0;
668
- equipment.forEach((entry, i) => {
669
- if (exempt(i)) return;
670
- const found = resolveBaseItem(entry.item, registry);
671
- if (!found) return;
672
- const entity = found.data;
673
- const w = coerceWeight(entity.weight);
674
- if (w === 0) return;
675
- const qty = typeof entry.qty === "number" && entry.qty >= 0 ? entry.qty : 1;
676
- total += w * qty;
677
- });
678
- return total;
679
- }
680
- function computeSlotsAndAttacks(resolved, mods, profs, registry, warnings, proficiencyBonus, weaponAbilities = [], weaponMasteries = [], attunementFloor = 0) {
681
- var _a, _b, _c, _d, _e;
682
- const equippedSlots = assignSlots(resolved, registry, warnings);
683
- twoHandedShieldWarnings((_a = resolved.definition.equipment) != null ? _a : [], registry, warnings, resolved.infusions);
684
- const overrides = (_b = resolved.definition.overrides) != null ? _b : {};
685
- const acOut = computeAC(equippedSlots, resolved, mods, registry, warnings);
686
- const ctx = buildConditionContext(resolved, equippedSlots, registry);
687
- const attacks = computeAttacks(equippedSlots, (_c = resolved.definition.equipment) != null ? _c : [], mods, profs, registry, warnings, proficiencyBonus, ctx, weaponMasteries, weaponAbilities, resolved.infusions);
688
- return {
689
- ac: acOut.ac,
690
- acBreakdown: acOut.breakdown,
691
- acInformational: acOut.informational,
692
- attacks,
693
- equippedSlots,
694
- carriedWeight: computeCarriedWeight(resolved, registry),
695
- // Attunement is persistent: an attuned item still occupies a slot even when unequipped (SRD).
696
- attunementUsed: ((_d = resolved.definition.equipment) != null ? _d : []).filter((e) => e.attuned).length,
697
- // PRECEDENCE: an explicit character override wins outright (a number the player typed is intent);
698
- // otherwise the baseline 3 is raised — never lowered — by whatever features granted.
699
- attunementLimit: (_e = overrides.attunement_limit) != null ? _e : Math.max(3, attunementFloor)
700
- };
701
- }
702
-
703
- export {
704
- emptyAppliedBonuses,
705
- computeAppliedBonuses,
706
- isWeaponSlugProficient,
707
- buildUnarmedRow,
708
- computeSlotsAndAttacks
709
- };