@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,68 @@
1
+ // src/item/item.conditions.ts
2
+ function unwrapSlug(maybeWiki) {
3
+ if (!maybeWiki) return "";
4
+ const m = /^\[\[([^\]]+)\]\]$/.exec(maybeWiki);
5
+ return (m ? m[1] : maybeWiki).toLowerCase();
6
+ }
7
+ function evaluateCondition(cond, ctx) {
8
+ var _a;
9
+ switch (cond.kind) {
10
+ case "no_armor":
11
+ return ctx.derived.equippedSlots.armor === void 0 ? "true" : "false";
12
+ case "no_shield":
13
+ return ctx.derived.equippedSlots.shield === void 0 ? "true" : "false";
14
+ case "wielding_two_handed": {
15
+ const main = (_a = ctx.derived.equippedSlots.mainhand) == null ? void 0 : _a.entity;
16
+ if (!main || typeof main !== "object" || !("properties" in main)) return "false";
17
+ const props = main.properties;
18
+ if (!Array.isArray(props)) return "false";
19
+ return props.some((p) => p === "two_handed") ? "true" : "false";
20
+ }
21
+ case "is_class": {
22
+ const target = cond.value.toLowerCase();
23
+ return ctx.classList.some((c) => unwrapSlug(c.name) === target) ? "true" : "false";
24
+ }
25
+ case "is_race":
26
+ return unwrapSlug(ctx.race) === cond.value.toLowerCase() ? "true" : "false";
27
+ case "is_subclass":
28
+ return ctx.subclasses.some((s) => s.toLowerCase() === cond.value.toLowerCase()) ? "true" : "false";
29
+ // Tier 2-4 - always informational in v1.
30
+ case "vs_creature_type":
31
+ case "vs_attack_type":
32
+ case "on_attack_type":
33
+ case "with_weapon_property":
34
+ case "vs_spell_save":
35
+ case "lighting":
36
+ case "underwater":
37
+ case "movement_state":
38
+ case "has_condition":
39
+ case "is_concentrating":
40
+ case "bloodied":
41
+ return "informational";
42
+ case "raw":
43
+ return "informational";
44
+ case "any_of": {
45
+ let sawInformational = false;
46
+ for (const branch of cond.conditions) {
47
+ const o = evaluateCondition(branch, ctx);
48
+ if (o === "true") return "true";
49
+ if (o === "informational") sawInformational = true;
50
+ }
51
+ return sawInformational ? "informational" : "false";
52
+ }
53
+ }
54
+ }
55
+ function evaluateConditions(conds, ctx) {
56
+ let sawInformational = false;
57
+ for (const c of conds) {
58
+ const o = evaluateCondition(c, ctx);
59
+ if (o === "false") return "false";
60
+ if (o === "informational") sawInformational = true;
61
+ }
62
+ return sawInformational ? "informational" : "true";
63
+ }
64
+
65
+ export {
66
+ evaluateCondition,
67
+ evaluateConditions
68
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ backgroundEntitySchema
3
+ } from "./chunk-A7T5L7SS.js";
4
+
5
+ // src/background/background.parser.ts
6
+ import { parseYaml } from "@archivist-gg/core";
7
+ function parseBackground(source) {
8
+ const raw = parseYaml(source, ["name", "slug"]);
9
+ if (!raw.success) return raw;
10
+ const result = backgroundEntitySchema.safeParse({ edition: "2014", ...raw.data });
11
+ if (!result.success) {
12
+ return { success: false, error: `background schema validation failed: ${result.error.message}` };
13
+ }
14
+ return { success: true, data: result.data };
15
+ }
16
+
17
+ export {
18
+ parseBackground
19
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ parseFeat
3
+ } from "./chunk-GIOH5JB5.js";
4
+
5
+ // src/feat/feat.codec.ts
6
+ import yaml from "js-yaml";
7
+ var featCodec = {
8
+ parse(doc) {
9
+ return parseFeat(doc.body);
10
+ },
11
+ serialize(entity) {
12
+ return yaml.dump(entity, { lineWidth: -1, sortKeys: false });
13
+ }
14
+ };
15
+
16
+ export {
17
+ featCodec
18
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ featureSchema
3
+ } from "./chunk-DABBCYTT.js";
4
+ import {
5
+ choiceSchema
6
+ } from "./chunk-CDW7R2QT.js";
7
+
8
+ // src/race/race.schema.ts
9
+ import { z } from "zod";
10
+ var abilityEnum = z.enum(["str", "dex", "con", "int", "wis", "cha"]);
11
+ var editionEnum = z.enum(["2014", "2024"]);
12
+ var sizeEnum = z.enum(["tiny", "small", "medium", "large", "huge"]);
13
+ var wikilinkRegex = /^\[\[[^[\]]+\]\]$/;
14
+ var speedSchema = z.object({
15
+ walk: z.number().int().nonnegative().optional(),
16
+ fly: z.number().int().nonnegative().optional(),
17
+ swim: z.number().int().nonnegative().optional(),
18
+ climb: z.number().int().nonnegative().optional(),
19
+ burrow: z.number().int().nonnegative().optional(),
20
+ hover: z.boolean().optional()
21
+ });
22
+ var visionSchema = z.object({
23
+ darkvision: z.number().int().nonnegative().optional(),
24
+ blindsight: z.number().int().nonnegative().optional(),
25
+ tremorsense: z.number().int().nonnegative().optional(),
26
+ truesight: z.number().int().nonnegative().optional()
27
+ });
28
+ var fixedAsiSchema = z.object({ ability: abilityEnum, amount: z.number().int() });
29
+ var choiceAsiSchema = z.object({
30
+ choose: z.number().int().positive(),
31
+ pool: z.array(abilityEnum).nonempty(),
32
+ amount: z.number().int()
33
+ });
34
+ var asiSchema = z.union([fixedAsiSchema, choiceAsiSchema]);
35
+ var languagesSchema = z.object({
36
+ fixed: z.array(z.string()),
37
+ choice: z.object({
38
+ count: z.number().int().positive(),
39
+ from: z.union([z.string(), z.array(z.string())])
40
+ }).optional()
41
+ });
42
+ var raceEntitySchema = z.object({
43
+ slug: z.string().min(1),
44
+ name: z.string().min(1),
45
+ edition: editionEnum,
46
+ source: z.string().min(1),
47
+ description: z.string(),
48
+ size: sizeEnum,
49
+ speed: speedSchema,
50
+ ability_score_increases: z.array(asiSchema),
51
+ age: z.string(),
52
+ alignment: z.string(),
53
+ vision: visionSchema,
54
+ languages: languagesSchema,
55
+ variant_label: z.string().min(1),
56
+ traits: z.array(featureSchema),
57
+ choices: z.array(choiceSchema).optional(),
58
+ subspecies_of: z.string().regex(wikilinkRegex).optional()
59
+ });
60
+
61
+ export {
62
+ raceEntitySchema
63
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ classEntitySchema
3
+ } from "./chunk-Z6GXV2GO.js";
4
+
5
+ // src/class/class.parser.ts
6
+ import { parseYaml } from "@archivist-gg/core";
7
+ function parseClass(source) {
8
+ const raw = parseYaml(source, ["name", "slug"]);
9
+ if (!raw.success) return raw;
10
+ const result = classEntitySchema.safeParse({ edition: "2014", ...raw.data });
11
+ if (!result.success) {
12
+ return { success: false, error: `class schema validation failed: ${result.error.message}` };
13
+ }
14
+ return { success: true, data: result.data };
15
+ }
16
+
17
+ export {
18
+ parseClass
19
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ featEntitySchema
3
+ } from "./chunk-BAXWWGFJ.js";
4
+
5
+ // src/feat/feat.parser.ts
6
+ import { parseYaml } from "@archivist-gg/core";
7
+ function parseFeat(source) {
8
+ const raw = parseYaml(source, ["name", "slug"]);
9
+ if (!raw.success) return raw;
10
+ const result = featEntitySchema.safeParse({ edition: "2014", ...raw.data });
11
+ if (!result.success) {
12
+ return { success: false, error: `feat schema validation failed: ${result.error.message}` };
13
+ }
14
+ return { success: true, data: result.data };
15
+ }
16
+
17
+ export {
18
+ parseFeat
19
+ };
@@ -0,0 +1,25 @@
1
+ import {
2
+ STATIC_FALLBACK_CONTEXT,
3
+ convertDescToTags
4
+ } from "./chunk-RAWJTA45.js";
5
+
6
+ // src/item/item.enrichment.ts
7
+ function enrichItem(raw) {
8
+ var _a, _b, _c;
9
+ const enriched = {
10
+ ...raw,
11
+ source: (_a = raw.source) != null ? _a : "Homebrew",
12
+ attunement: (_b = raw.attunement) != null ? _b : false,
13
+ curse: (_c = raw.curse) != null ? _c : false
14
+ };
15
+ if (Array.isArray(enriched.entries)) {
16
+ enriched.entries = enriched.entries.map(
17
+ (e) => convertDescToTags(e, STATIC_FALLBACK_CONTEXT)
18
+ );
19
+ }
20
+ return enriched;
21
+ }
22
+
23
+ export {
24
+ enrichItem
25
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ STATIC_FALLBACK_CONTEXT,
3
+ convertDescToTags
4
+ } from "./chunk-RAWJTA45.js";
5
+
6
+ // src/spell/spell.enrichment.ts
7
+ function enrichSpell(raw) {
8
+ var _a, _b, _c, _d;
9
+ const duration = raw.duration;
10
+ const concentration = (_b = raw.concentration) != null ? _b : (_a = duration == null ? void 0 : duration.toLowerCase().includes("concentration")) != null ? _a : false;
11
+ const classes = ((_c = raw.classes) == null ? void 0 : _c.length) ? raw.classes : ["Wizard", "Sorcerer"];
12
+ const enriched = {
13
+ ...raw,
14
+ concentration,
15
+ ritual: (_d = raw.ritual) != null ? _d : false,
16
+ classes
17
+ };
18
+ if (typeof enriched.description === "string") {
19
+ enriched.description = convertDescToTags(enriched.description, STATIC_FALLBACK_CONTEXT);
20
+ }
21
+ if (Array.isArray(enriched.at_higher_levels)) {
22
+ enriched.at_higher_levels = enriched.at_higher_levels.map(
23
+ (p) => convertDescToTags(p, STATIC_FALLBACK_CONTEXT)
24
+ );
25
+ }
26
+ return enriched;
27
+ }
28
+
29
+ export {
30
+ enrichSpell
31
+ };
@@ -0,0 +1,44 @@
1
+ import {
2
+ armorEntitySchema
3
+ } from "./chunk-XJNECUPT.js";
4
+
5
+ // src/armor/armor.parser.ts
6
+ import { parseYaml } from "@archivist-gg/core";
7
+ var KNOWN_KEYS = /* @__PURE__ */ new Set([
8
+ "name",
9
+ "slug",
10
+ "category",
11
+ "ac",
12
+ "strength_requirement",
13
+ "stealth_disadvantage",
14
+ "weight",
15
+ "cost",
16
+ "rarity",
17
+ "source",
18
+ "page",
19
+ "edition",
20
+ "entries",
21
+ "raw"
22
+ ]);
23
+ function parseArmor(source) {
24
+ var _a;
25
+ const raw = parseYaml(source, ["name", "slug", "category", "ac"]);
26
+ if (!raw.success) return raw;
27
+ const result = armorEntitySchema.safeParse(raw.data);
28
+ if (!result.success) {
29
+ return { success: false, error: `armor schema validation failed: ${result.error.message}` };
30
+ }
31
+ const entity = result.data;
32
+ const extras = {};
33
+ for (const [k, v] of Object.entries(raw.data)) {
34
+ if (!KNOWN_KEYS.has(k)) extras[k] = v;
35
+ }
36
+ if (Object.keys(extras).length > 0) {
37
+ entity.raw = { ...(_a = entity.raw) != null ? _a : {}, ...extras };
38
+ }
39
+ return { success: true, data: entity };
40
+ }
41
+
42
+ export {
43
+ parseArmor
44
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ raceEntitySchema
3
+ } from "./chunk-FFULAF2P.js";
4
+
5
+ // src/race/race.parser.ts
6
+ import { parseYaml } from "@archivist-gg/core";
7
+ function parseRace(source) {
8
+ const raw = parseYaml(source, ["name", "slug"]);
9
+ if (!raw.success) return raw;
10
+ const result = raceEntitySchema.safeParse({ edition: "2014", ...raw.data });
11
+ if (!result.success) {
12
+ return { success: false, error: `race schema validation failed: ${result.error.message}` };
13
+ }
14
+ return { success: true, data: result.data };
15
+ }
16
+
17
+ export {
18
+ parseRace
19
+ };
File without changes
@@ -0,0 +1,269 @@
1
+ import {
2
+ readTableColumn
3
+ } from "./chunk-5XUXXAQJ.js";
4
+ import {
5
+ bareSlug
6
+ } from "./chunk-J2RYSZMQ.js";
7
+ import {
8
+ abilityModifier
9
+ } from "./chunk-NAEPSZAM.js";
10
+
11
+ // src/pc/pc.spellcasting.ts
12
+ function resolveSpellcasting(rc) {
13
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
14
+ const sub = (_b = (_a = rc.subclass) == null ? void 0 : _a.spellcasting) != null ? _b : null;
15
+ const cls = (_d = (_c = rc.entity) == null ? void 0 : _c.spellcasting) != null ? _d : null;
16
+ const sc = sub != null ? sub : cls;
17
+ if (!sc) return null;
18
+ const table = (_i = (_h = sub ? (_e = rc.subclass) == null ? void 0 : _e.table : (_f = rc.entity) == null ? void 0 : _f.table) != null ? _h : (_g = rc.entity) == null ? void 0 : _g.table) != null ? _i : {};
19
+ return {
20
+ ability: sc.ability,
21
+ casterType: sc.caster_type,
22
+ preparation: sc.preparation,
23
+ spellList: sc.spell_list,
24
+ table
25
+ };
26
+ }
27
+ function normalizeKnownSpell(entry) {
28
+ var _a, _b;
29
+ if (typeof entry === "string") {
30
+ return { slug: bareSlug(entry), classSlug: null, source: "class", preparedFlag: void 0, alwaysPrepared: false };
31
+ }
32
+ return {
33
+ slug: bareSlug(entry.spell),
34
+ classSlug: entry.class ? bareSlug(entry.class) : null,
35
+ source: (_a = entry.source) != null ? _a : "class",
36
+ preparedFlag: entry.prepared,
37
+ alwaysPrepared: (_b = entry.always_prepared) != null ? _b : false
38
+ };
39
+ }
40
+ var FULL_CASTER_SLOTS = [
41
+ /* 1 */
42
+ [2, 0, 0, 0, 0, 0, 0, 0, 0],
43
+ /* 2 */
44
+ [3, 0, 0, 0, 0, 0, 0, 0, 0],
45
+ /* 3 */
46
+ [4, 2, 0, 0, 0, 0, 0, 0, 0],
47
+ /* 4 */
48
+ [4, 3, 0, 0, 0, 0, 0, 0, 0],
49
+ /* 5 */
50
+ [4, 3, 2, 0, 0, 0, 0, 0, 0],
51
+ /* 6 */
52
+ [4, 3, 3, 0, 0, 0, 0, 0, 0],
53
+ /* 7 */
54
+ [4, 3, 3, 1, 0, 0, 0, 0, 0],
55
+ /* 8 */
56
+ [4, 3, 3, 2, 0, 0, 0, 0, 0],
57
+ /* 9 */
58
+ [4, 3, 3, 3, 1, 0, 0, 0, 0],
59
+ /* 10 */
60
+ [4, 3, 3, 3, 2, 0, 0, 0, 0],
61
+ /* 11 */
62
+ [4, 3, 3, 3, 2, 1, 0, 0, 0],
63
+ /* 12 */
64
+ [4, 3, 3, 3, 2, 1, 0, 0, 0],
65
+ /* 13 */
66
+ [4, 3, 3, 3, 2, 1, 1, 0, 0],
67
+ /* 14 */
68
+ [4, 3, 3, 3, 2, 1, 1, 0, 0],
69
+ /* 15 */
70
+ [4, 3, 3, 3, 2, 1, 1, 1, 0],
71
+ /* 16 */
72
+ [4, 3, 3, 3, 2, 1, 1, 1, 0],
73
+ /* 17 */
74
+ [4, 3, 3, 3, 2, 1, 1, 1, 1],
75
+ /* 18 */
76
+ [4, 3, 3, 3, 3, 1, 1, 1, 1],
77
+ /* 19 */
78
+ [4, 3, 3, 3, 3, 2, 1, 1, 1],
79
+ /* 20 */
80
+ [4, 3, 3, 3, 3, 2, 2, 1, 1]
81
+ ];
82
+ var HALF_CASTER_SLOTS = [
83
+ /* 1 */
84
+ [0, 0, 0, 0, 0],
85
+ /* 2 */
86
+ [2, 0, 0, 0, 0],
87
+ /* 3 */
88
+ [3, 0, 0, 0, 0],
89
+ /* 4 */
90
+ [3, 0, 0, 0, 0],
91
+ /* 5 */
92
+ [4, 2, 0, 0, 0],
93
+ /* 6 */
94
+ [4, 2, 0, 0, 0],
95
+ /* 7 */
96
+ [4, 3, 0, 0, 0],
97
+ /* 8 */
98
+ [4, 3, 0, 0, 0],
99
+ /* 9 */
100
+ [4, 3, 2, 0, 0],
101
+ /* 10 */
102
+ [4, 3, 2, 0, 0],
103
+ /* 11 */
104
+ [4, 3, 3, 0, 0],
105
+ /* 12 */
106
+ [4, 3, 3, 0, 0],
107
+ /* 13 */
108
+ [4, 3, 3, 1, 0],
109
+ /* 14 */
110
+ [4, 3, 3, 1, 0],
111
+ /* 15 */
112
+ [4, 3, 3, 2, 0],
113
+ /* 16 */
114
+ [4, 3, 3, 2, 0],
115
+ /* 17 */
116
+ [4, 3, 3, 3, 1],
117
+ /* 18 */
118
+ [4, 3, 3, 3, 1],
119
+ /* 19 */
120
+ [4, 3, 3, 3, 2],
121
+ /* 20 */
122
+ [4, 3, 3, 3, 2]
123
+ ];
124
+ var THIRD_CASTER_SLOTS = [
125
+ /* 1 */
126
+ [0, 0, 0, 0],
127
+ /* 2 */
128
+ [0, 0, 0, 0],
129
+ /* 3 */
130
+ [2, 0, 0, 0],
131
+ /* 4 */
132
+ [3, 0, 0, 0],
133
+ /* 5 */
134
+ [3, 0, 0, 0],
135
+ /* 6 */
136
+ [3, 0, 0, 0],
137
+ /* 7 */
138
+ [4, 2, 0, 0],
139
+ /* 8 */
140
+ [4, 2, 0, 0],
141
+ /* 9 */
142
+ [4, 2, 0, 0],
143
+ /* 10 */
144
+ [4, 3, 0, 0],
145
+ /* 11 */
146
+ [4, 3, 0, 0],
147
+ /* 12 */
148
+ [4, 3, 0, 0],
149
+ /* 13 */
150
+ [4, 3, 2, 0],
151
+ /* 14 */
152
+ [4, 3, 2, 0],
153
+ /* 15 */
154
+ [4, 3, 2, 0],
155
+ /* 16 */
156
+ [4, 3, 3, 0],
157
+ /* 17 */
158
+ [4, 3, 3, 0],
159
+ /* 18 */
160
+ [4, 3, 3, 0],
161
+ /* 19 */
162
+ [4, 3, 3, 1],
163
+ /* 20 */
164
+ [4, 3, 3, 1]
165
+ ];
166
+ var PACT_MAGIC = [
167
+ /* 1 */
168
+ { level: 1, total: 1 },
169
+ /* 2 */
170
+ { level: 1, total: 2 },
171
+ /* 3 */
172
+ { level: 2, total: 2 },
173
+ /* 4 */
174
+ { level: 2, total: 2 },
175
+ /* 5 */
176
+ { level: 3, total: 2 },
177
+ /* 6 */
178
+ { level: 3, total: 2 },
179
+ /* 7 */
180
+ { level: 4, total: 2 },
181
+ /* 8 */
182
+ { level: 4, total: 2 },
183
+ /* 9 */
184
+ { level: 5, total: 2 },
185
+ /* 10 */
186
+ { level: 5, total: 2 },
187
+ /* 11 */
188
+ { level: 5, total: 3 },
189
+ /* 12 */
190
+ { level: 5, total: 3 },
191
+ /* 13 */
192
+ { level: 5, total: 3 },
193
+ /* 14 */
194
+ { level: 5, total: 3 },
195
+ /* 15 */
196
+ { level: 5, total: 3 },
197
+ /* 16 */
198
+ { level: 5, total: 3 },
199
+ /* 17 */
200
+ { level: 5, total: 4 },
201
+ /* 18 */
202
+ { level: 5, total: 4 },
203
+ /* 19 */
204
+ { level: 5, total: 4 },
205
+ /* 20 */
206
+ { level: 5, total: 4 }
207
+ ];
208
+ function rowToRecord(row) {
209
+ const out = {};
210
+ row.forEach((n, i) => {
211
+ if (n > 0) out[i + 1] = n;
212
+ });
213
+ return out;
214
+ }
215
+ function deriveSpellSlots(classes) {
216
+ let fullLevels = 0, halfLevels = 0, thirdLevels = 0, warlockLevel = 0;
217
+ const regular = [];
218
+ for (const c of classes) {
219
+ if (c.casterType === "pact") {
220
+ warlockLevel += c.level;
221
+ continue;
222
+ }
223
+ regular.push({ caster: c.casterType, level: c.level });
224
+ if (c.casterType === "full") fullLevels += c.level;
225
+ else if (c.casterType === "half") halfLevels += c.level;
226
+ else if (c.casterType === "third") thirdLevels += c.level;
227
+ }
228
+ let standard = {};
229
+ if (regular.length === 1) {
230
+ const only = regular[0];
231
+ const idx = only.level - 1;
232
+ if (only.caster === "half") {
233
+ if (idx >= 0 && idx < HALF_CASTER_SLOTS.length) standard = rowToRecord(HALF_CASTER_SLOTS[idx]);
234
+ } else if (only.caster === "third") {
235
+ if (idx >= 0 && idx < THIRD_CASTER_SLOTS.length) standard = rowToRecord(THIRD_CASTER_SLOTS[idx]);
236
+ } else {
237
+ if (only.level >= 1 && only.level <= FULL_CASTER_SLOTS.length) standard = rowToRecord(FULL_CASTER_SLOTS[only.level - 1]);
238
+ }
239
+ } else if (regular.length >= 2) {
240
+ const cl = fullLevels + Math.floor(halfLevels / 2) + Math.floor(thirdLevels / 3);
241
+ if (cl >= 1 && cl <= FULL_CASTER_SLOTS.length) standard = rowToRecord(FULL_CASTER_SLOTS[cl - 1]);
242
+ }
243
+ const pact = warlockLevel >= 1 && warlockLevel <= PACT_MAGIC.length ? PACT_MAGIC[warlockLevel - 1] : null;
244
+ return { standard, pact };
245
+ }
246
+ function computeSpellLimits(inputs) {
247
+ const out = [];
248
+ for (const i of inputs) {
249
+ const p = i.profile;
250
+ const cantripsKnown = readTableColumn(p.table, i.level, ["Cantrips Known", "Cantrips"]);
251
+ const mod = abilityModifier(i.abilityScore);
252
+ let preparedOrKnown;
253
+ if (p.preparation === "prepared") {
254
+ const levelTerm = p.casterType === "half" ? Math.floor(i.level / 2) : i.level;
255
+ preparedOrKnown = Math.max(1, mod + levelTerm);
256
+ } else {
257
+ preparedOrKnown = readTableColumn(p.table, i.level, ["Spells Known", "Prepared Spells"]);
258
+ }
259
+ out.push({ classSlug: i.classSlug, kind: p.preparation, cantripsKnown, preparedOrKnown });
260
+ }
261
+ return out;
262
+ }
263
+
264
+ export {
265
+ resolveSpellcasting,
266
+ normalizeKnownSpell,
267
+ deriveSpellSlots,
268
+ computeSpellLimits
269
+ };
@@ -0,0 +1,16 @@
1
+ // src/class/class.slug.ts
2
+ function bareSlug(ref) {
3
+ if (typeof ref !== "string") return "";
4
+ const m = ref.match(/^\[\[(.+?)\]\]$/);
5
+ return (m ? m[1] : ref).toLowerCase();
6
+ }
7
+ function baseClassName(ref) {
8
+ const bare = bareSlug(ref);
9
+ const sep = bare.indexOf("_");
10
+ return sep >= 0 ? bare.slice(sep + 1) : bare;
11
+ }
12
+
13
+ export {
14
+ bareSlug,
15
+ baseClassName
16
+ };
@@ -0,0 +1,36 @@
1
+ // src/pc/decision-recognizer.ts
2
+ var DECISION_SIGNAL = [/\bchoose (one|two|three|a|an)\b/i, /\bof your choice\b/i, /\byour choice of\b/i];
3
+ var ASI_OR_FEAT = {
4
+ kind: "select-inline",
5
+ id: "asi-or-feat",
6
+ count: 1,
7
+ options: [
8
+ {
9
+ value: "asi",
10
+ label: "Ability Score Increase",
11
+ choices: [{ kind: "ability-points", id: "asi", points: 2, max_per: 2 }]
12
+ },
13
+ {
14
+ value: "feat",
15
+ label: "Feat",
16
+ choices: [{ kind: "select-entity", id: "feat", entity_type: "feat", count: 1 }]
17
+ }
18
+ ]
19
+ };
20
+ var TABLE = {
21
+ "ability-score-improvement": [ASI_OR_FEAT],
22
+ "expertise": [{ kind: "select-proficiency", id: "expertise", count: 2, domain: "skill", from_proficient: true, expertise: true }],
23
+ "fighting-style": [{ kind: "select-entity", id: "fighting-style", count: 1, entity_type: "optional-feature", where: { feature_type: "fighting_style", available_to: "self" } }]
24
+ };
25
+ function recognizeDecision(feature) {
26
+ var _a, _b;
27
+ const slug = ((_a = feature.id) != null ? _a : feature.name).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
28
+ if (TABLE[slug]) return TABLE[slug];
29
+ const desc = (_b = feature.description) != null ? _b : "";
30
+ return DECISION_SIGNAL.some((re) => re.test(desc)) ? "informational" : null;
31
+ }
32
+
33
+ export {
34
+ DECISION_SIGNAL,
35
+ recognizeDecision
36
+ };
@@ -0,0 +1,31 @@
1
+ // src/encounter/encounter.ai-schema.ts
2
+ import { z } from "zod";
3
+ var encounterInputSchema = z.object({
4
+ party_size: z.number().min(1).max(10).describe("Number of players"),
5
+ party_level: z.number().min(1).max(20).describe("Average party level"),
6
+ difficulty: z.enum(["easy", "medium", "hard", "deadly"]),
7
+ environment: z.string().optional().describe('e.g., "swamp", "dungeon", "forest"'),
8
+ theme: z.string().optional().describe('e.g., "undead horde", "dragon lair"')
9
+ });
10
+ var encounterMonsterSchema = z.object({
11
+ name: z.string(),
12
+ cr: z.string(),
13
+ count: z.number(),
14
+ role: z.string()
15
+ });
16
+ var encounterOutputSchema = z.object({
17
+ monsters: z.array(encounterMonsterSchema),
18
+ tactics: z.string(),
19
+ terrain: z.string(),
20
+ notes: z.string(),
21
+ xp_budget: z.object({
22
+ target: z.number(),
23
+ actual: z.number(),
24
+ difficulty_rating: z.string()
25
+ })
26
+ });
27
+
28
+ export {
29
+ encounterInputSchema,
30
+ encounterOutputSchema
31
+ };