@archivist-gg/dnd5e 0.1.0

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 (322) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/SRD.md +37 -0
  3. package/README.md +65 -0
  4. package/dist/armor/armor.codec.d.ts +10 -0
  5. package/dist/armor/armor.codec.js +8 -0
  6. package/dist/armor/armor.entity-type.d.ts +2 -0
  7. package/dist/armor/armor.parser.d.ts +3 -0
  8. package/dist/armor/armor.parser.js +7 -0
  9. package/dist/armor/armor.schema.d.ts +25 -0
  10. package/dist/armor/armor.schema.js +6 -0
  11. package/dist/armor/armor.types.d.ts +26 -0
  12. package/dist/armor/armor.types.js +0 -0
  13. package/dist/background/background.codec.d.ts +9 -0
  14. package/dist/background/background.codec.js +11 -0
  15. package/dist/background/background.entity-type.d.ts +2 -0
  16. package/dist/background/background.parser.d.ts +3 -0
  17. package/dist/background/background.parser.js +10 -0
  18. package/dist/background/background.schema.d.ts +74 -0
  19. package/dist/background/background.schema.js +9 -0
  20. package/dist/background/background.types.d.ts +52 -0
  21. package/dist/background/background.types.js +0 -0
  22. package/dist/chunk-24GFQU7T.js +18 -0
  23. package/dist/chunk-3DZ74AKK.js +28 -0
  24. package/dist/chunk-3TM34RSJ.js +23 -0
  25. package/dist/chunk-3TRGRSCH.js +8 -0
  26. package/dist/chunk-4C2KOKLF.js +185 -0
  27. package/dist/chunk-4F6AIZ36.js +19 -0
  28. package/dist/chunk-4SSDYJS2.js +86 -0
  29. package/dist/chunk-4TIJKN6O.js +37 -0
  30. package/dist/chunk-537BHVSH.js +18 -0
  31. package/dist/chunk-5INR4NSL.js +18 -0
  32. package/dist/chunk-5XUXXAQJ.js +30 -0
  33. package/dist/chunk-656QCX4U.js +22 -0
  34. package/dist/chunk-66XXW2Z2.js +133 -0
  35. package/dist/chunk-6NK2MUD3.js +114 -0
  36. package/dist/chunk-6PXE7T7C.js +79 -0
  37. package/dist/chunk-7P65Q426.js +158 -0
  38. package/dist/chunk-A7T5L7SS.js +83 -0
  39. package/dist/chunk-AFKTJXRA.js +39 -0
  40. package/dist/chunk-B7UXKNLD.js +46 -0
  41. package/dist/chunk-BAXWWGFJ.js +45 -0
  42. package/dist/chunk-BH6AMZVY.js +25 -0
  43. package/dist/chunk-CDW7R2QT.js +62 -0
  44. package/dist/chunk-DABBCYTT.js +68 -0
  45. package/dist/chunk-DC74TZNA.js +46 -0
  46. package/dist/chunk-DNAJRMNN.js +68 -0
  47. package/dist/chunk-DRNZJNJP.js +19 -0
  48. package/dist/chunk-FEOB24KP.js +18 -0
  49. package/dist/chunk-FFULAF2P.js +63 -0
  50. package/dist/chunk-FUK7QSN5.js +19 -0
  51. package/dist/chunk-GIOH5JB5.js +19 -0
  52. package/dist/chunk-GJOI2GHP.js +25 -0
  53. package/dist/chunk-GZ46OVGZ.js +31 -0
  54. package/dist/chunk-HCP3GMHS.js +44 -0
  55. package/dist/chunk-IDTDACM6.js +19 -0
  56. package/dist/chunk-IKSMX4TN.js +0 -0
  57. package/dist/chunk-IXZXFFFW.js +269 -0
  58. package/dist/chunk-J2RYSZMQ.js +16 -0
  59. package/dist/chunk-JEYQU3JT.js +36 -0
  60. package/dist/chunk-LSLSG67V.js +31 -0
  61. package/dist/chunk-LWFTHJIE.js +24 -0
  62. package/dist/chunk-MDEJHMKK.js +52 -0
  63. package/dist/chunk-N2JE7BWL.js +81 -0
  64. package/dist/chunk-NAEPSZAM.js +88 -0
  65. package/dist/chunk-NXR3BD2V.js +90 -0
  66. package/dist/chunk-PKC77VZP.js +18 -0
  67. package/dist/chunk-PMADYMUI.js +19 -0
  68. package/dist/chunk-PTXBIDG7.js +63 -0
  69. package/dist/chunk-PZOWBI3B.js +49 -0
  70. package/dist/chunk-QQ5W2AZP.js +515 -0
  71. package/dist/chunk-QS5L5YTJ.js +24 -0
  72. package/dist/chunk-QYZV2MQA.js +97 -0
  73. package/dist/chunk-R2ZV233X.js +233 -0
  74. package/dist/chunk-RAWJTA45.js +271 -0
  75. package/dist/chunk-RSDRMH54.js +18 -0
  76. package/dist/chunk-RVYYKYFL.js +18 -0
  77. package/dist/chunk-SSXBYF3P.js +18 -0
  78. package/dist/chunk-TJCNX6UZ.js +521 -0
  79. package/dist/chunk-TZK36BU7.js +38 -0
  80. package/dist/chunk-UC4FE5X3.js +65 -0
  81. package/dist/chunk-WP2CX2JO.js +235 -0
  82. package/dist/chunk-WYGD2UGN.js +14 -0
  83. package/dist/chunk-XJNECUPT.js +31 -0
  84. package/dist/chunk-XURS6Q6Q.js +127 -0
  85. package/dist/chunk-Y4I74YEG.js +33 -0
  86. package/dist/chunk-Z4TL2V7S.js +18 -0
  87. package/dist/chunk-Z6GXV2GO.js +121 -0
  88. package/dist/chunk-ZLG6FQFB.js +237 -0
  89. package/dist/chunk-ZMR77DDL.js +18 -0
  90. package/dist/class/class.codec.d.ts +10 -0
  91. package/dist/class/class.codec.js +15 -0
  92. package/dist/class/class.entity-type.d.ts +2 -0
  93. package/dist/class/class.parser.d.ts +3 -0
  94. package/dist/class/class.parser.js +14 -0
  95. package/dist/class/class.schema.d.ts +202 -0
  96. package/dist/class/class.schema.js +13 -0
  97. package/dist/class/class.slug.d.ts +11 -0
  98. package/dist/class/class.slug.js +8 -0
  99. package/dist/class/class.types.d.ts +74 -0
  100. package/dist/class/class.types.js +0 -0
  101. package/dist/data-srd/index.generated.d.ts +7 -0
  102. package/dist/data-srd/index.generated.js +146 -0
  103. package/dist/dnd/constants.d.ts +16 -0
  104. package/dist/dnd/constants.js +36 -0
  105. package/dist/dnd/formula-tags.d.ts +16 -0
  106. package/dist/dnd/formula-tags.js +119 -0
  107. package/dist/dnd/math.d.ts +24 -0
  108. package/dist/dnd/math.js +35 -0
  109. package/dist/dnd/prose-tags.d.ts +16 -0
  110. package/dist/dnd/prose-tags.js +18 -0
  111. package/dist/dnd/resource-die.d.ts +6 -0
  112. package/dist/dnd/resource-die.js +17 -0
  113. package/dist/dnd/resource-formula.d.ts +41 -0
  114. package/dist/dnd/resource-formula.js +159 -0
  115. package/dist/dnd/srd-tag-converter.d.ts +44 -0
  116. package/dist/dnd/srd-tag-converter.js +12 -0
  117. package/dist/dnd/tag-grammar.d.ts +19 -0
  118. package/dist/dnd/tag-grammar.js +12 -0
  119. package/dist/encounter/encounter.ai-schema.d.ts +29 -0
  120. package/dist/encounter/encounter.ai-schema.js +8 -0
  121. package/dist/encounter/encounter.entity-type.d.ts +2 -0
  122. package/dist/encounter/encounter.generatable.d.ts +2 -0
  123. package/dist/entities/base-item-resolver.d.ts +21 -0
  124. package/dist/entities/base-item-resolver.js +9 -0
  125. package/dist/entities/slug.d.ts +5 -0
  126. package/dist/entities/slug.js +6 -0
  127. package/dist/feat/feat.codec.d.ts +9 -0
  128. package/dist/feat/feat.codec.js +10 -0
  129. package/dist/feat/feat.entity-type.d.ts +2 -0
  130. package/dist/feat/feat.parser.d.ts +3 -0
  131. package/dist/feat/feat.parser.js +9 -0
  132. package/dist/feat/feat.schema.d.ts +194 -0
  133. package/dist/feat/feat.schema.js +8 -0
  134. package/dist/feat/feat.types.d.ts +42 -0
  135. package/dist/feat/feat.types.js +0 -0
  136. package/dist/index.d.ts +12 -0
  137. package/dist/index.js +139149 -0
  138. package/dist/inline-tag-parser.d.ts +11 -0
  139. package/dist/inline-tag-parser.js +6 -0
  140. package/dist/item/item.actions-map.d.ts +41 -0
  141. package/dist/item/item.actions-map.js +85 -0
  142. package/dist/item/item.ai-schema.d.ts +35 -0
  143. package/dist/item/item.ai-schema.js +6 -0
  144. package/dist/item/item.attunement.d.ts +18 -0
  145. package/dist/item/item.attunement.js +12 -0
  146. package/dist/item/item.bonuses.d.ts +2 -0
  147. package/dist/item/item.bonuses.js +7 -0
  148. package/dist/item/item.codec.d.ts +3 -0
  149. package/dist/item/item.codec.js +8 -0
  150. package/dist/item/item.conditions.d.ts +10 -0
  151. package/dist/item/item.conditions.js +8 -0
  152. package/dist/item/item.conditions.types.d.ts +28 -0
  153. package/dist/item/item.conditions.types.js +0 -0
  154. package/dist/item/item.enrichment.d.ts +4 -0
  155. package/dist/item/item.enrichment.js +9 -0
  156. package/dist/item/item.entity-type.d.ts +2 -0
  157. package/dist/item/item.generatable.d.ts +2 -0
  158. package/dist/item/item.parser.d.ts +3 -0
  159. package/dist/item/item.parser.js +7 -0
  160. package/dist/item/item.schema.d.ts +174 -0
  161. package/dist/item/item.schema.js +8 -0
  162. package/dist/item/item.types.d.ts +108 -0
  163. package/dist/item/item.types.js +0 -0
  164. package/dist/monster/monster.ai-schema.d.ts +67 -0
  165. package/dist/monster/monster.ai-schema.js +6 -0
  166. package/dist/monster/monster.codec.d.ts +13 -0
  167. package/dist/monster/monster.enrichment.d.ts +10 -0
  168. package/dist/monster/monster.enrichment.js +19 -0
  169. package/dist/monster/monster.entity-type.d.ts +2 -0
  170. package/dist/monster/monster.generatable.d.ts +2 -0
  171. package/dist/monster/monster.parser.d.ts +3 -0
  172. package/dist/monster/monster.parser.js +6 -0
  173. package/dist/monster/monster.resolve.d.ts +10 -0
  174. package/dist/monster/monster.types.d.ts +29 -0
  175. package/dist/monster/monster.types.js +1 -0
  176. package/dist/npc/npc.ai-schema.d.ts +6 -0
  177. package/dist/npc/npc.entity-type.d.ts +2 -0
  178. package/dist/npc/npc.generatable.d.ts +2 -0
  179. package/dist/optional-feature/optional-feature.codec.d.ts +14 -0
  180. package/dist/optional-feature/optional-feature.codec.js +11 -0
  181. package/dist/optional-feature/optional-feature.entity-type.d.ts +2 -0
  182. package/dist/optional-feature/optional-feature.parser.d.ts +3 -0
  183. package/dist/optional-feature/optional-feature.parser.js +10 -0
  184. package/dist/optional-feature/optional-feature.schema.d.ts +236 -0
  185. package/dist/optional-feature/optional-feature.schema.js +9 -0
  186. package/dist/pack.d.ts +11 -0
  187. package/dist/pc/conditions.constants.d.ts +3 -0
  188. package/dist/pc/conditions.constants.js +8 -0
  189. package/dist/pc/decision-recognizer.d.ts +4 -0
  190. package/dist/pc/decision-recognizer.js +8 -0
  191. package/dist/pc/pc.conditions.d.ts +3 -0
  192. package/dist/pc/pc.conditions.js +6 -0
  193. package/dist/pc/pc.decision-engine.d.ts +97 -0
  194. package/dist/pc/pc.decision-engine.js +19 -0
  195. package/dist/pc/pc.equipment.d.ts +12 -0
  196. package/dist/pc/pc.equipment.js +15 -0
  197. package/dist/pc/pc.feature-effects.d.ts +95 -0
  198. package/dist/pc/pc.feature-effects.js +9 -0
  199. package/dist/pc/pc.formula-context.d.ts +4 -0
  200. package/dist/pc/pc.formula-context.js +11 -0
  201. package/dist/pc/pc.parser.d.ts +3 -0
  202. package/dist/pc/pc.parser.js +41 -0
  203. package/dist/pc/pc.pools.d.ts +12 -0
  204. package/dist/pc/pc.pools.js +15 -0
  205. package/dist/pc/pc.proficiencies.d.ts +8 -0
  206. package/dist/pc/pc.proficiencies.js +47 -0
  207. package/dist/pc/pc.proficiency-query.d.ts +11 -0
  208. package/dist/pc/pc.proficiency-query.js +17 -0
  209. package/dist/pc/pc.recalc.d.ts +105 -0
  210. package/dist/pc/pc.recalc.js +662 -0
  211. package/dist/pc/pc.resolver.d.ts +34 -0
  212. package/dist/pc/pc.resolver.js +267 -0
  213. package/dist/pc/pc.resource-seed.d.ts +10 -0
  214. package/dist/pc/pc.resource-seed.js +40 -0
  215. package/dist/pc/pc.rest.d.ts +23 -0
  216. package/dist/pc/pc.rest.js +128 -0
  217. package/dist/pc/pc.schema.d.ts +294 -0
  218. package/dist/pc/pc.schema.js +7 -0
  219. package/dist/pc/pc.slotting.d.ts +22 -0
  220. package/dist/pc/pc.slotting.js +20 -0
  221. package/dist/pc/pc.spellcasting.d.ts +56 -0
  222. package/dist/pc/pc.spellcasting.js +16 -0
  223. package/dist/pc/pc.table-column.d.ts +12 -0
  224. package/dist/pc/pc.table-column.js +8 -0
  225. package/dist/pc/pc.types.d.ts +514 -0
  226. package/dist/pc/pc.types.js +0 -0
  227. package/dist/race/race.codec.d.ts +9 -0
  228. package/dist/race/race.codec.js +13 -0
  229. package/dist/race/race.entity-type.d.ts +2 -0
  230. package/dist/race/race.parser.d.ts +3 -0
  231. package/dist/race/race.parser.js +12 -0
  232. package/dist/race/race.schema.d.ts +67 -0
  233. package/dist/race/race.schema.js +11 -0
  234. package/dist/race/race.types.d.ts +44 -0
  235. package/dist/race/race.types.js +0 -0
  236. package/dist/schemas/attack-schema.d.ts +38 -0
  237. package/dist/schemas/choice-schema.d.ts +5 -0
  238. package/dist/schemas/choice-schema.js +7 -0
  239. package/dist/schemas/duration-schema.d.ts +13 -0
  240. package/dist/schemas/duration-schema.js +6 -0
  241. package/dist/schemas/equipment-grant-schema.d.ts +6 -0
  242. package/dist/schemas/equipment-grant-schema.js +12 -0
  243. package/dist/schemas/feature-effect-schema.d.ts +131 -0
  244. package/dist/schemas/feature-effect-schema.js +6 -0
  245. package/dist/schemas/feature-schema.d.ts +2 -0
  246. package/dist/schemas/feature-schema.js +10 -0
  247. package/dist/schemas/index.d.ts +6 -0
  248. package/dist/schemas/resource-schema.d.ts +95 -0
  249. package/dist/schemas/resource-schema.js +12 -0
  250. package/dist/schemas/selection-pool-schema.d.ts +34 -0
  251. package/dist/schemas/selection-pool-schema.js +10 -0
  252. package/dist/spell/spell.access.d.ts +15 -0
  253. package/dist/spell/spell.access.js +25 -0
  254. package/dist/spell/spell.ai-schema.d.ts +24 -0
  255. package/dist/spell/spell.ai-schema.js +6 -0
  256. package/dist/spell/spell.codec.d.ts +3 -0
  257. package/dist/spell/spell.codec.js +8 -0
  258. package/dist/spell/spell.enrichment.d.ts +2 -0
  259. package/dist/spell/spell.enrichment.js +9 -0
  260. package/dist/spell/spell.entity-type.d.ts +2 -0
  261. package/dist/spell/spell.filter.d.ts +15 -0
  262. package/dist/spell/spell.filter.js +87 -0
  263. package/dist/spell/spell.generatable.d.ts +2 -0
  264. package/dist/spell/spell.parser.d.ts +3 -0
  265. package/dist/spell/spell.parser.js +7 -0
  266. package/dist/spell/spell.scaling.d.ts +14 -0
  267. package/dist/spell/spell.scaling.js +28 -0
  268. package/dist/spell/spell.schema.d.ts +31 -0
  269. package/dist/spell/spell.schema.js +6 -0
  270. package/dist/spell/spell.types.d.ts +25 -0
  271. package/dist/spell/spell.types.js +0 -0
  272. package/dist/srd-store.d.ts +53 -0
  273. package/dist/subclass/subclass.codec.d.ts +11 -0
  274. package/dist/subclass/subclass.codec.js +14 -0
  275. package/dist/subclass/subclass.entity-type.d.ts +2 -0
  276. package/dist/subclass/subclass.parser.d.ts +3 -0
  277. package/dist/subclass/subclass.parser.js +13 -0
  278. package/dist/subclass/subclass.schema.d.ts +118 -0
  279. package/dist/subclass/subclass.schema.js +12 -0
  280. package/dist/subclass/subclass.types.d.ts +20 -0
  281. package/dist/subclass/subclass.types.js +0 -0
  282. package/dist/types/abilities.d.ts +8 -0
  283. package/dist/types/abilities.js +0 -0
  284. package/dist/types/ac.d.ts +5 -0
  285. package/dist/types/attack.d.ts +22 -0
  286. package/dist/types/attack.js +0 -0
  287. package/dist/types/casting-option.d.ts +14 -0
  288. package/dist/types/casting-option.js +0 -0
  289. package/dist/types/choice.d.ts +66 -0
  290. package/dist/types/choice.js +6 -0
  291. package/dist/types/edition.d.ts +4 -0
  292. package/dist/types/edition.js +0 -0
  293. package/dist/types/equipment-grant.d.ts +41 -0
  294. package/dist/types/equipment-grant.js +0 -0
  295. package/dist/types/feature-effect.d.ts +79 -0
  296. package/dist/types/feature-effect.js +0 -0
  297. package/dist/types/feature.d.ts +41 -0
  298. package/dist/types/feature.js +0 -0
  299. package/dist/types/formula-context.d.ts +7 -0
  300. package/dist/types/formula-context.js +0 -0
  301. package/dist/types/hp.d.ts +4 -0
  302. package/dist/types/index.d.ts +10 -0
  303. package/dist/types/item-conditions.types.d.ts +63 -0
  304. package/dist/types/item-conditions.types.js +0 -0
  305. package/dist/types/optional-feature.types.d.ts +60 -0
  306. package/dist/types/optional-feature.types.js +0 -0
  307. package/dist/types/resource.d.ts +44 -0
  308. package/dist/types/resource.js +0 -0
  309. package/dist/types/selection-pool.d.ts +37 -0
  310. package/dist/types/selection-pool.js +0 -0
  311. package/dist/types/speed.d.ts +8 -0
  312. package/dist/weapon/weapon.codec.d.ts +12 -0
  313. package/dist/weapon/weapon.codec.js +8 -0
  314. package/dist/weapon/weapon.entity-type.d.ts +2 -0
  315. package/dist/weapon/weapon.parser.d.ts +3 -0
  316. package/dist/weapon/weapon.parser.js +7 -0
  317. package/dist/weapon/weapon.schema.d.ts +34 -0
  318. package/dist/weapon/weapon.schema.js +6 -0
  319. package/dist/weapon/weapon.types.d.ts +36 -0
  320. package/dist/weapon/weapon.types.js +0 -0
  321. package/package.json +32 -0
  322. package/src/data-srd/ATTRIBUTION.md +2 -0
@@ -0,0 +1,233 @@
1
+ // src/pc/pc.conditions.ts
2
+ var ZERO_EFFECTS = {
3
+ speed_multiplier: 1,
4
+ speed_reduction_ft: 0,
5
+ speed_floor_zero: false,
6
+ hp_max_multiplier: 1,
7
+ d20_test_penalty: 0,
8
+ exhaustion_level: 0,
9
+ attack_disadvantage: false,
10
+ attack_advantage: false,
11
+ attack_advantage_against: false,
12
+ ability_check_disadvantage: false,
13
+ save_disadvantage_dex: false,
14
+ save_autofail_str: false,
15
+ save_autofail_dex: false,
16
+ saves_disadvantage_all: false,
17
+ actions_disabled: false,
18
+ reactions_disabled: false,
19
+ sources: []
20
+ };
21
+ var CONDITION_EFFECTS_2014 = {
22
+ blinded: { attack_disadvantage: true, attack_advantage_against: true },
23
+ charmed: {},
24
+ deafened: {},
25
+ frightened: { attack_disadvantage: true, ability_check_disadvantage: true },
26
+ grappled: { speed_floor_zero: true },
27
+ incapacitated: { actions_disabled: true, reactions_disabled: true },
28
+ invisible: { attack_advantage: true },
29
+ paralyzed: {
30
+ speed_floor_zero: true,
31
+ save_autofail_str: true,
32
+ save_autofail_dex: true,
33
+ attack_advantage_against: true,
34
+ actions_disabled: true,
35
+ reactions_disabled: true
36
+ },
37
+ petrified: {
38
+ speed_floor_zero: true,
39
+ save_autofail_str: true,
40
+ save_autofail_dex: true,
41
+ attack_advantage_against: true,
42
+ actions_disabled: true,
43
+ reactions_disabled: true
44
+ },
45
+ poisoned: { attack_disadvantage: true, ability_check_disadvantage: true },
46
+ prone: { attack_disadvantage: true },
47
+ restrained: {
48
+ speed_floor_zero: true,
49
+ attack_disadvantage: true,
50
+ attack_advantage_against: true,
51
+ save_disadvantage_dex: true
52
+ },
53
+ stunned: {
54
+ save_autofail_str: true,
55
+ save_autofail_dex: true,
56
+ attack_advantage_against: true,
57
+ actions_disabled: true,
58
+ reactions_disabled: true
59
+ },
60
+ unconscious: {
61
+ speed_floor_zero: true,
62
+ save_autofail_str: true,
63
+ save_autofail_dex: true,
64
+ attack_advantage_against: true,
65
+ actions_disabled: true,
66
+ reactions_disabled: true
67
+ }
68
+ };
69
+ var CONDITION_EFFECTS_2024 = {
70
+ ...CONDITION_EFFECTS_2014,
71
+ grappled: { speed_floor_zero: true, attack_disadvantage: true }
72
+ };
73
+ var EXHAUSTION_EFFECTS_2014 = {
74
+ 0: {},
75
+ 1: { ability_check_disadvantage: true },
76
+ 2: { ability_check_disadvantage: true, speed_multiplier: 0.5 },
77
+ 3: {
78
+ ability_check_disadvantage: true,
79
+ speed_multiplier: 0.5,
80
+ attack_disadvantage: true,
81
+ saves_disadvantage_all: true
82
+ },
83
+ 4: {
84
+ ability_check_disadvantage: true,
85
+ speed_multiplier: 0.5,
86
+ attack_disadvantage: true,
87
+ saves_disadvantage_all: true,
88
+ hp_max_multiplier: 0.5
89
+ },
90
+ 5: {
91
+ ability_check_disadvantage: true,
92
+ speed_multiplier: 0.5,
93
+ attack_disadvantage: true,
94
+ saves_disadvantage_all: true,
95
+ hp_max_multiplier: 0.5,
96
+ speed_floor_zero: true
97
+ },
98
+ 6: {
99
+ ability_check_disadvantage: true,
100
+ speed_multiplier: 0.5,
101
+ attack_disadvantage: true,
102
+ saves_disadvantage_all: true,
103
+ hp_max_multiplier: 0.5,
104
+ speed_floor_zero: true
105
+ }
106
+ };
107
+ function exhaustionEffects2024(level) {
108
+ if (level <= 0) return {};
109
+ return {
110
+ d20_test_penalty: -2 * level,
111
+ speed_reduction_ft: 5 * level
112
+ };
113
+ }
114
+ var CONDITION_TOOLTIPS_2014 = {
115
+ blinded: ["Auto-fail any check requiring sight."],
116
+ charmed: [
117
+ "Can't attack the charmer or target them with harmful effects.",
118
+ "Charmer has advantage on social checks against you."
119
+ ],
120
+ deafened: ["Auto-fail any check requiring hearing."],
121
+ frightened: [
122
+ "Disadvantage on attacks/checks while source in line of sight.",
123
+ "Can't willingly move closer to source."
124
+ ],
125
+ grappled: ["Speed = 0. Ends if grappler is incapacitated or you're moved out of reach."],
126
+ incapacitated: ["Can't take actions or reactions."],
127
+ invisible: [
128
+ "Heavily obscured for hiding.",
129
+ "Your attacks have advantage; attacks against you have disadvantage.",
130
+ "Detectable by noise/tracks."
131
+ ],
132
+ paralyzed: [
133
+ "Incapacitated. Speed 0.",
134
+ "Auto-fail STR/DEX saves.",
135
+ "Attacks against have advantage; melee within 5ft auto-crit."
136
+ ],
137
+ petrified: [
138
+ "Incapacitated. Speed 0.",
139
+ "Resist all damage. Immune to poison/disease.",
140
+ "Auto-fail STR/DEX saves."
141
+ ],
142
+ poisoned: ["Disadvantage on attack rolls and ability checks."],
143
+ prone: [
144
+ "Attacks against within 5ft have advantage; beyond 5ft have disadvantage.",
145
+ "Your attacks have disadvantage."
146
+ ],
147
+ restrained: [
148
+ "Speed 0. Disadvantage on attacks and DEX saves.",
149
+ "Attacks against have advantage."
150
+ ],
151
+ stunned: [
152
+ "Incapacitated. Auto-fail STR/DEX saves.",
153
+ "Attacks against have advantage."
154
+ ],
155
+ unconscious: [
156
+ "Incapacitated, prone, dropped held items. Speed 0.",
157
+ "Auto-fail STR/DEX saves.",
158
+ "Attacks against have advantage; melee within 5ft auto-crit."
159
+ ]
160
+ };
161
+ var CONDITION_TOOLTIPS_2024 = {
162
+ ...CONDITION_TOOLTIPS_2014,
163
+ grappled: [
164
+ "Speed = 0. Disadvantage on attack rolls against creatures other than the grappler.",
165
+ "Ends if grappler is incapacitated or you're moved out of reach."
166
+ ]
167
+ };
168
+ function computeConditionEffects(state, edition, _scores) {
169
+ var _a, _b;
170
+ const out = { ...ZERO_EFFECTS, sources: [] };
171
+ const conditionTable = edition === "2024" ? CONDITION_EFFECTS_2024 : CONDITION_EFFECTS_2014;
172
+ const tooltipTable = edition === "2024" ? CONDITION_TOOLTIPS_2024 : CONDITION_TOOLTIPS_2014;
173
+ const sortedConditions = [...new Set(state.conditions)].sort();
174
+ for (const slug of sortedConditions) {
175
+ const partial = conditionTable[slug];
176
+ if (!partial) continue;
177
+ mergePartial(out, partial);
178
+ out.sources.push({
179
+ condition: slug,
180
+ effects: (_a = tooltipTable[slug]) != null ? _a : []
181
+ });
182
+ }
183
+ const exhLevel = clamp((_b = state.exhaustion) != null ? _b : 0, 0, 6);
184
+ out.exhaustion_level = exhLevel;
185
+ if (exhLevel > 0) {
186
+ const exhPartial = edition === "2024" ? exhaustionEffects2024(exhLevel) : EXHAUSTION_EFFECTS_2014[exhLevel];
187
+ mergePartial(out, exhPartial);
188
+ out.sources.push({
189
+ condition: "exhaustion",
190
+ level: exhLevel,
191
+ effects: exhaustionTooltip(exhLevel, edition)
192
+ });
193
+ }
194
+ return out;
195
+ }
196
+ function mergePartial(out, partial) {
197
+ for (const k of Object.keys(partial)) {
198
+ const v = partial[k];
199
+ if (typeof v === "boolean") {
200
+ out[k] = out[k] || v;
201
+ } else if (typeof v === "number") {
202
+ if (k === "speed_multiplier" || k === "hp_max_multiplier") {
203
+ out[k] = Math.min(out[k], v);
204
+ } else {
205
+ out[k] = out[k] + v;
206
+ }
207
+ }
208
+ }
209
+ }
210
+ function clamp(n, lo, hi) {
211
+ return Math.max(lo, Math.min(hi, Math.floor(n)));
212
+ }
213
+ function exhaustionTooltip(level, edition) {
214
+ if (edition === "2024") {
215
+ return [
216
+ `\u2212${2 * level} on all d20 tests (attacks, saves, ability checks).`,
217
+ `Speed reduced by ${5 * level} ft.`,
218
+ level >= 6 ? "Death." : `Long rest reduces by 1 level.`
219
+ ];
220
+ }
221
+ const lines = [];
222
+ if (level >= 1) lines.push("Disadvantage on ability checks.");
223
+ if (level >= 2) lines.push("Speed halved.");
224
+ if (level >= 3) lines.push("Disadvantage on attack rolls and saving throws.");
225
+ if (level >= 4) lines.push("Hit point maximum halved.");
226
+ if (level >= 5) lines.push("Speed reduced to 0.");
227
+ if (level >= 6) lines.push("Death.");
228
+ return lines;
229
+ }
230
+
231
+ export {
232
+ computeConditionEffects
233
+ };
@@ -0,0 +1,271 @@
1
+ import {
2
+ abilityModifier
3
+ } from "./chunk-NAEPSZAM.js";
4
+
5
+ // src/dnd/srd-tag-converter.ts
6
+ var ABILITY_KEYS = ["str", "dex", "con", "int", "wis", "cha"];
7
+ var STATIC_FALLBACK_CONTEXT = {
8
+ abilities: { str: 0, dex: 0, con: 0, int: 0, wis: 0, cha: 0 },
9
+ profBonus: 0,
10
+ actionName: "",
11
+ actionCategory: "trait"
12
+ };
13
+ var NATURAL_MELEE_NAMES = /\b(bite|claws?|slam|gore|tail|hooves|tusks?|talons?|fist|horns?)\b/i;
14
+ var FINESSE_WEAPON_NAMES = /\b(shortsword|rapier|dagger|whip|scimitar)\b/i;
15
+ var RANGED_WEAPON_NAMES = /\b(bow|crossbow|sling|dart|blowgun|javelin)\b/i;
16
+ var SPELL_ATTACK_PHRASES = /\bspell\s+attack\b/i;
17
+ function preferredAbilitiesForAttack(actionName, desc, spellAbility) {
18
+ const combined = `${actionName} ${desc}`;
19
+ if (SPELL_ATTACK_PHRASES.test(combined) && spellAbility) return [spellAbility];
20
+ if (RANGED_WEAPON_NAMES.test(actionName)) return ["dex"];
21
+ if (FINESSE_WEAPON_NAMES.test(actionName)) return ["str", "dex"];
22
+ if (NATURAL_MELEE_NAMES.test(actionName)) return ["str", "dex"];
23
+ return ["str", "dex"];
24
+ }
25
+ function identifyAbility(damageBonus, preferred, mods) {
26
+ if (damageBonus === null) return null;
27
+ const candidates = ABILITY_KEYS.filter((k) => mods[k] === damageBonus);
28
+ if (candidates.length === 0) return null;
29
+ if (candidates.length === 1) return candidates[0];
30
+ for (const p of preferred) {
31
+ if (candidates.includes(p)) return p;
32
+ }
33
+ return [...candidates].sort()[0];
34
+ }
35
+ function parseDamageBonusFromHitText(desc, attackPos) {
36
+ const window = desc.slice(attackPos, attackPos + 250);
37
+ const damageRe = /Hit:\s*(?:\d+\s*\()?\d+d\d+(?:\s*([+-])\s*(\d+))?\s*\)?\s*\w*\s+damage/i;
38
+ const m = window.match(damageRe);
39
+ if (!m) return null;
40
+ if (m[1] === void 0 || m[2] === void 0) return 0;
41
+ return m[1] === "-" ? -Number(m[2]) : Number(m[2]);
42
+ }
43
+ function parseDamageBonusFor2024(desc, attackPos) {
44
+ const window = desc.slice(attackPos, attackPos + 250);
45
+ const damageRe = /(?:\d+\s*\()?\d+d\d+(?:\s*([+-])\s*(\d+))?\s*\)?\s*\w*\s+damage/i;
46
+ const m = window.match(damageRe);
47
+ if (!m) return null;
48
+ if (m[1] === void 0 || m[2] === void 0) return 0;
49
+ return m[1] === "-" ? -Number(m[2]) : Number(m[2]);
50
+ }
51
+ function convertDescToTags(desc, ctx) {
52
+ try {
53
+ if (!ctx.abilities) return desc;
54
+ const mods = computeMods(ctx.abilities);
55
+ const dcTargets = computeDcTargets(mods, ctx.profBonus);
56
+ let result = desc;
57
+ result = result.replace(
58
+ /(Strength|Dexterity|Constitution|Intelligence|Wisdom|Charisma)\s+Saving\s+Throw:\s+DC\s+(\d+)/gi,
59
+ (_match, abilityWord, n) => {
60
+ const dc = Number(n);
61
+ const abil = abilityWordToKey(abilityWord);
62
+ if (abil && dcTargets[abil] === dc) {
63
+ return `${abilityWord} Saving Throw: \`dc:${abil.toUpperCase()}\``;
64
+ }
65
+ return `${abilityWord} Saving Throw: \`dc:${dc}\``;
66
+ }
67
+ );
68
+ result = result.replace(
69
+ /DC (\d+)\s+(Strength|Dexterity|Constitution|Intelligence|Wisdom|Charisma)/gi,
70
+ (_match, n, abilityWord) => {
71
+ const dc = Number(n);
72
+ const abil = abilityWordToKey(abilityWord);
73
+ if (abil && dcTargets[abil] === dc) {
74
+ return `\`dc:${abil.toUpperCase()}\` ${abilityWord}`;
75
+ }
76
+ return `\`dc:${dc}\` ${abilityWord}`;
77
+ }
78
+ );
79
+ result = result.replace(
80
+ /(Melee|Ranged|Spell)\s+Attack\s+Roll:\s+([+-])(\d+),/g,
81
+ (match, kind, sign, n, offset) => {
82
+ const attackBonus = sign === "-" ? -Number(n) : Number(n);
83
+ const before = desc.slice(Math.max(0, offset - 200), offset);
84
+ const actionMatch = before.match(/(?:^|\.\s+)([A-Z][\w\s,'-]{1,40})\./);
85
+ const actionName = actionMatch ? actionMatch[1] : ctx.actionName;
86
+ const damageBonus = parseDamageBonusFor2024(desc, offset + match.length);
87
+ const preferred = kind.toLowerCase() === "spell" && ctx.spellAbility ? [ctx.spellAbility] : preferredAbilitiesForAttack(actionName, desc, ctx.spellAbility);
88
+ const ability = identifyAbility(damageBonus, preferred, mods);
89
+ const literal = attackBonus >= 0 ? `+${attackBonus}` : `${attackBonus}`;
90
+ if (ability === null) {
91
+ return `${kind} Attack Roll: \`atk:${literal}\`,`;
92
+ }
93
+ if (attackBonus === mods[ability] + ctx.profBonus) {
94
+ return `${kind} Attack Roll: \`atk:${ability.toUpperCase()}+PB\`,`;
95
+ }
96
+ if (attackBonus === mods[ability]) {
97
+ return `${kind} Attack Roll: \`atk:${ability.toUpperCase()}\`,`;
98
+ }
99
+ return `${kind} Attack Roll: \`atk:${literal}\`,`;
100
+ }
101
+ );
102
+ result = result.replace(
103
+ /([+-])(\d+)\s+to\s+hit/g,
104
+ (_match, sign, n, attackPos) => {
105
+ const attackBonus = sign === "-" ? -Number(n) : Number(n);
106
+ const before = desc.slice(Math.max(0, attackPos - 200), attackPos);
107
+ const actionMatch = before.match(/(?:^|\.\s+)([A-Z][\w\s,'-]{1,40})\./);
108
+ const actionName = actionMatch ? actionMatch[1] : ctx.actionName;
109
+ const damageBonus = parseDamageBonusFromHitText(desc, attackPos);
110
+ const preferred = preferredAbilitiesForAttack(actionName, desc, ctx.spellAbility);
111
+ const ability = identifyAbility(damageBonus, preferred, mods);
112
+ if (ability === null) {
113
+ const literal2 = attackBonus >= 0 ? `+${attackBonus}` : `${attackBonus}`;
114
+ return `\`atk:${literal2}\``;
115
+ }
116
+ if (attackBonus === mods[ability] + ctx.profBonus) {
117
+ return `\`atk:${ability.toUpperCase()}+PB\``;
118
+ }
119
+ if (attackBonus === mods[ability]) {
120
+ return `\`atk:${ability.toUpperCase()}\``;
121
+ }
122
+ const literal = attackBonus >= 0 ? `+${attackBonus}` : `${attackBonus}`;
123
+ return `\`atk:${literal}\``;
124
+ }
125
+ );
126
+ result = result.replace(
127
+ /(?:(\d+)\s*\()?(\d+d\d+)(?:\s*([+-])\s*(\d+))?\s*\)?(?:\s+(\w+))?\s+damage/gi,
128
+ (_match, _average, dice, sign, bonusStr, typeWord) => {
129
+ var _a;
130
+ let inner = dice;
131
+ if (bonusStr != null) {
132
+ const bonus = sign === "-" ? -Number(bonusStr) : Number(bonusStr);
133
+ const matchingAbilities = ABILITY_KEYS.filter((k) => mods[k] === bonus);
134
+ if (matchingAbilities.length > 0) {
135
+ const preferred = preferredAbilitiesForAttack(ctx.actionName, "", ctx.spellAbility);
136
+ const pick = (_a = preferred.find((p) => matchingAbilities.includes(p))) != null ? _a : [...matchingAbilities].sort()[0];
137
+ inner = `${dice}+${pick.toUpperCase()}`;
138
+ } else {
139
+ inner = `${dice}${bonus >= 0 ? "+" : ""}${bonus}`;
140
+ }
141
+ }
142
+ const typeSuffix = typeWord ? ` ${typeWord} damage` : " damage";
143
+ return `\`dmg:${inner}\`${typeSuffix}`;
144
+ }
145
+ );
146
+ result = result.replace(
147
+ /Hit:\s*(\d+)\s+(\w+)?\s*damage/gi,
148
+ (_match, n, typeWord) => {
149
+ const tt = typeWord ? ` ${typeWord} damage` : " damage";
150
+ return `Hit: \`dmg:${n}\`${tt}`;
151
+ }
152
+ );
153
+ result = result.replace(
154
+ /(?<!`)DC (\d+)(?!\s*(?:Strength|Dexterity|Constitution|Intelligence|Wisdom|Charisma))/gi,
155
+ (_match, n) => {
156
+ const dc = Number(n);
157
+ const candidates = ABILITY_KEYS.filter((k) => dcTargets[k] === dc);
158
+ if (ctx.spellAbility && candidates.includes(ctx.spellAbility)) {
159
+ return `\`dc:${ctx.spellAbility.toUpperCase()}\``;
160
+ }
161
+ if (candidates.length === 1) {
162
+ return `\`dc:${candidates[0].toUpperCase()}\``;
163
+ }
164
+ if (candidates.length > 1) {
165
+ const abil = disambiguateAbility(candidates, ctx, desc);
166
+ return `\`dc:${abil.toUpperCase()}\``;
167
+ }
168
+ return `\`dc:${dc}\``;
169
+ }
170
+ );
171
+ result = result.replace(
172
+ /`[^`]*`|(?<!\w)(\d+d\d+(?:\s*[+-]\s*\d+)?)(?!\w)/g,
173
+ (match, dice) => {
174
+ if (dice) return `\`dice:${dice.replace(/\s+/g, "")}\``;
175
+ return match;
176
+ }
177
+ );
178
+ return result;
179
+ } catch (e) {
180
+ return desc;
181
+ }
182
+ }
183
+ function computeMods(abilities) {
184
+ return {
185
+ str: abilityModifier(abilities.str),
186
+ dex: abilityModifier(abilities.dex),
187
+ con: abilityModifier(abilities.con),
188
+ int: abilityModifier(abilities.int),
189
+ wis: abilityModifier(abilities.wis),
190
+ cha: abilityModifier(abilities.cha)
191
+ };
192
+ }
193
+ function computeDcTargets(mods, profBonus) {
194
+ return {
195
+ str: 8 + profBonus + mods.str,
196
+ dex: 8 + profBonus + mods.dex,
197
+ con: 8 + profBonus + mods.con,
198
+ int: 8 + profBonus + mods.int,
199
+ wis: 8 + profBonus + mods.wis,
200
+ cha: 8 + profBonus + mods.cha
201
+ };
202
+ }
203
+ function disambiguateAbility(candidates, ctx, desc) {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h;
205
+ if (candidates.length === 1) return candidates[0];
206
+ const combined = `${desc} ${ctx.actionName}`.toLowerCase();
207
+ const prefers = (abil) => candidates.includes(abil) ? abil : void 0;
208
+ if (/melee\s+or\s+ranged\s+weapon\s+attack/.test(combined)) {
209
+ return (_b = (_a = prefers("str")) != null ? _a : prefers("dex")) != null ? _b : candidates[0];
210
+ }
211
+ if (/melee\s+weapon\s+attack/.test(combined)) {
212
+ return (_d = (_c = prefers("str")) != null ? _c : prefers("dex")) != null ? _d : candidates[0];
213
+ }
214
+ if (/ranged\s+weapon\s+attack/.test(combined)) {
215
+ return (_e = prefers("dex")) != null ? _e : candidates[0];
216
+ }
217
+ if (/spell\s+attack/.test(combined)) {
218
+ if (ctx.spellAbility && candidates.includes(ctx.spellAbility)) {
219
+ return ctx.spellAbility;
220
+ }
221
+ return (_f = prefers("wis")) != null ? _f : candidates[0];
222
+ }
223
+ const rangedWords = /\b(bow|crossbow|dart|sling)\b/;
224
+ const meleeWords = /\b(bite|claw|slam|tail|gore|horns?|fist|hoof|talons?)\b/;
225
+ if (rangedWords.test(ctx.actionName.toLowerCase())) {
226
+ return (_g = prefers("dex")) != null ? _g : candidates[0];
227
+ }
228
+ if (meleeWords.test(ctx.actionName.toLowerCase())) {
229
+ return (_h = prefers("str")) != null ? _h : candidates[0];
230
+ }
231
+ return [...candidates].sort()[0];
232
+ }
233
+ function abilityWordToKey(word) {
234
+ const lower = word.toLowerCase();
235
+ switch (lower) {
236
+ case "strength":
237
+ return "str";
238
+ case "dexterity":
239
+ return "dex";
240
+ case "constitution":
241
+ return "con";
242
+ case "intelligence":
243
+ return "int";
244
+ case "wisdom":
245
+ return "wis";
246
+ case "charisma":
247
+ return "cha";
248
+ }
249
+ return void 0;
250
+ }
251
+ function detectSpellcastingAbility(traits) {
252
+ if (!traits) return void 0;
253
+ for (const trait of traits) {
254
+ for (const entry of trait.entries) {
255
+ const match = entry.match(/spellcasting ability is (intelligence|wisdom|charisma)/i);
256
+ if (match) {
257
+ const name = match[1].toLowerCase();
258
+ if (name === "intelligence") return "int";
259
+ if (name === "wisdom") return "wis";
260
+ if (name === "charisma") return "cha";
261
+ }
262
+ }
263
+ }
264
+ return void 0;
265
+ }
266
+
267
+ export {
268
+ STATIC_FALLBACK_CONTEXT,
269
+ convertDescToTags,
270
+ detectSpellcastingAbility
271
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ parseOptionalFeature
3
+ } from "./chunk-4F6AIZ36.js";
4
+
5
+ // src/optional-feature/optional-feature.codec.ts
6
+ import yaml from "js-yaml";
7
+ var optionalFeatureCodec = {
8
+ parse(doc) {
9
+ return parseOptionalFeature(doc.body);
10
+ },
11
+ serialize(entity) {
12
+ return yaml.dump(entity, { lineWidth: -1, sortKeys: false });
13
+ }
14
+ };
15
+
16
+ export {
17
+ optionalFeatureCodec
18
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ parseClass
3
+ } from "./chunk-FUK7QSN5.js";
4
+
5
+ // src/class/class.codec.ts
6
+ import yaml from "js-yaml";
7
+ var classCodec = {
8
+ parse(doc) {
9
+ return parseClass(doc.body);
10
+ },
11
+ serialize(entity) {
12
+ return yaml.dump(entity, { lineWidth: -1, sortKeys: false });
13
+ }
14
+ };
15
+
16
+ export {
17
+ classCodec
18
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ parseSubclass
3
+ } from "./chunk-PMADYMUI.js";
4
+
5
+ // src/subclass/subclass.codec.ts
6
+ import yaml from "js-yaml";
7
+ var subclassCodec = {
8
+ parse(doc) {
9
+ return parseSubclass(doc.body);
10
+ },
11
+ serialize(entity) {
12
+ return yaml.dump(entity, { lineWidth: -1, sortKeys: false });
13
+ }
14
+ };
15
+
16
+ export {
17
+ subclassCodec
18
+ };