@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,28 @@
1
+ // src/spell/spell.scaling.ts
2
+ function spellScales(spell) {
3
+ var _a, _b, _c, _d;
4
+ return ((_b = (_a = spell.casting_options) == null ? void 0 : _a.length) != null ? _b : 0) > 0 || ((_d = (_c = spell.at_higher_levels) == null ? void 0 : _c.length) != null ? _d : 0) > 0;
5
+ }
6
+ function spellEffectAtSlot(spell, slotLevel) {
7
+ var _a, _b;
8
+ const opt = ((_a = spell.casting_options) != null ? _a : []).find((o) => o.type === `slot_level_${slotLevel}`);
9
+ if (!opt) return null;
10
+ if (opt.damage_roll) return opt.damage_roll;
11
+ if (typeof opt.target_count === "number") {
12
+ if (opt.target_count === slotLevel) return null;
13
+ return `${opt.target_count} targets`;
14
+ }
15
+ if (opt.duration) return opt.duration;
16
+ return (_b = opt.desc) != null ? _b : null;
17
+ }
18
+ function upcastLevelsFor(spell, ownedSlotLevels) {
19
+ var _a;
20
+ const base = (_a = spell.level) != null ? _a : 0;
21
+ if (base < 1 || !spellScales(spell)) return [];
22
+ return ownedSlotLevels.filter((l) => l > base).sort((a, b) => a - b);
23
+ }
24
+ export {
25
+ spellEffectAtSlot,
26
+ spellScales,
27
+ upcastLevelsFor
28
+ };
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ export declare const spellEntitySchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ level: z.ZodOptional<z.ZodNumber>;
5
+ school: z.ZodOptional<z.ZodString>;
6
+ casting_time: z.ZodOptional<z.ZodString>;
7
+ range: z.ZodOptional<z.ZodString>;
8
+ components: z.ZodOptional<z.ZodString>;
9
+ duration: z.ZodOptional<z.ZodString>;
10
+ concentration: z.ZodOptional<z.ZodBoolean>;
11
+ ritual: z.ZodOptional<z.ZodBoolean>;
12
+ classes: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ at_higher_levels: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ damage: z.ZodOptional<z.ZodObject<{
16
+ types: z.ZodArray<z.ZodString>;
17
+ }, z.core.$strip>>;
18
+ saving_throw: z.ZodOptional<z.ZodObject<{
19
+ ability: z.ZodString;
20
+ }, z.core.$strip>>;
21
+ casting_options: z.ZodOptional<z.ZodArray<z.ZodObject<{
22
+ type: z.ZodString;
23
+ damage_roll: z.ZodOptional<z.ZodString>;
24
+ target_count: z.ZodOptional<z.ZodNumber>;
25
+ duration: z.ZodOptional<z.ZodString>;
26
+ range: z.ZodOptional<z.ZodNumber>;
27
+ concentration: z.ZodOptional<z.ZodBoolean>;
28
+ shape_size: z.ZodOptional<z.ZodNumber>;
29
+ desc: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>>>;
31
+ }, z.core.$strict>;
@@ -0,0 +1,6 @@
1
+ import {
2
+ spellEntitySchema
3
+ } from "../chunk-Y4I74YEG.js";
4
+ export {
5
+ spellEntitySchema
6
+ };
@@ -0,0 +1,25 @@
1
+ import type { CastingOption } from "@archivist-gg/dnd5e/types/casting-option";
2
+ export type { CastingOption };
3
+ export interface Spell {
4
+ name: string;
5
+ level?: number;
6
+ school?: string;
7
+ casting_time?: string;
8
+ range?: string;
9
+ components?: string;
10
+ duration?: string;
11
+ concentration?: boolean;
12
+ ritual?: boolean;
13
+ classes?: string[];
14
+ description?: string;
15
+ at_higher_levels?: string[];
16
+ damage?: {
17
+ types: string[];
18
+ };
19
+ saving_throw?: {
20
+ ability: string;
21
+ };
22
+ casting_options?: CastingOption[];
23
+ source?: string;
24
+ edition?: "2014" | "2024" | string;
25
+ }
File without changes
@@ -0,0 +1,53 @@
1
+ export interface SrdEntity {
2
+ slug: string;
3
+ name: string;
4
+ entityType: string;
5
+ data: Record<string, unknown>;
6
+ }
7
+ export type SrdEntityType = "monster" | "spell" | "item" | "armor" | "weapon" | "feat" | "condition" | "class" | "subclass" | "background" | "race" | "optional-feature";
8
+ export type SrdDataSources = Record<string, Record<string, unknown>[]>;
9
+ export declare class SrdStore {
10
+ /** slug -> SrdEntity for O(1) lookup */
11
+ private bySlug;
12
+ /** entityType -> SrdEntity[] for type-scoped operations */
13
+ private byType;
14
+ /**
15
+ * Load entities from a map of source-key -> raw JSON arrays.
16
+ * Source keys are resolved through TYPE_MAP (e.g. "monster" -> "monster",
17
+ * "magicitems" -> "item"). If a key is not in TYPE_MAP it is used as-is.
18
+ */
19
+ loadFromData(sources: SrdDataSources): void;
20
+ /**
21
+ * Load all bundled SRD JSON files from the canonical pipeline runtime.
22
+ * Both 2014 and 2024 editions are merged into a single store; entities are
23
+ * disambiguated by their edition-prefixed slugs (e.g. "srd-5e_aboleth" vs
24
+ * "srd-2024_aboleth").
25
+ */
26
+ loadFromBundledJson(): void;
27
+ /**
28
+ * O(1) lookup by slug.
29
+ */
30
+ getBySlug(slug: string): SrdEntity | undefined;
31
+ /**
32
+ * Ranked search: exact match > starts-with > contains.
33
+ * Case-insensitive. Optionally filtered by entityType.
34
+ */
35
+ search(query: string, entityType?: string, limit?: number): SrdEntity[];
36
+ /**
37
+ * Return all entities of a given type.
38
+ */
39
+ getAllOfType(entityType: string): SrdEntity[];
40
+ /**
41
+ * Return all registered entity type strings.
42
+ */
43
+ getTypes(): string[];
44
+ /**
45
+ * Total number of entities across all types.
46
+ */
47
+ count(): number;
48
+ /**
49
+ * @deprecated Use getBySlug() instead. Kept for backward compatibility.
50
+ * Exact name match (case-insensitive). Searches all types or a specific type.
51
+ */
52
+ getByName(name: string, entityType?: string): SrdEntity | null;
53
+ }
@@ -0,0 +1,11 @@
1
+ import type { DocCodec } from "@archivist-gg/core";
2
+ import type { SubclassEntity } from "./subclass.types.js";
3
+ /**
4
+ * Normalizing codec (0c.1a). `parse` delegates to `parseSubclass`, which validates
5
+ * against `subclassEntitySchema`. `subclass.types` is this entity's dnd5e home for
6
+ * `SubclassEntity` (consumed by the PC resolver/types); its `Edition`/`SpellcastingConfig`
7
+ * imports resolve dnd5e-internally from `class.types`. `serialize` stays `yaml.dump`
8
+ * (the edit-save path uses obsidian's separate serializer; gate (d) verifies `yaml.dump`
9
+ * round-trips through `parseSubclass`).
10
+ */
11
+ export declare const subclassCodec: DocCodec<SubclassEntity>;
@@ -0,0 +1,14 @@
1
+ import {
2
+ subclassCodec
3
+ } from "../chunk-SSXBYF3P.js";
4
+ import "../chunk-PMADYMUI.js";
5
+ import "../chunk-B7UXKNLD.js";
6
+ import "../chunk-4TIJKN6O.js";
7
+ import "../chunk-DABBCYTT.js";
8
+ import "../chunk-WYGD2UGN.js";
9
+ import "../chunk-PZOWBI3B.js";
10
+ import "../chunk-CDW7R2QT.js";
11
+ import "../chunk-NXR3BD2V.js";
12
+ export {
13
+ subclassCodec
14
+ };
@@ -0,0 +1,2 @@
1
+ import type { EntityType } from "@archivist-gg/core";
2
+ export declare const subclassEntityType: EntityType;
@@ -0,0 +1,3 @@
1
+ import type { SubclassEntity } from "./subclass.types.js";
2
+ import { ParseResult } from "@archivist-gg/core";
3
+ export declare function parseSubclass(source: string): ParseResult<SubclassEntity>;
@@ -0,0 +1,13 @@
1
+ import {
2
+ parseSubclass
3
+ } from "../chunk-PMADYMUI.js";
4
+ import "../chunk-B7UXKNLD.js";
5
+ import "../chunk-4TIJKN6O.js";
6
+ import "../chunk-DABBCYTT.js";
7
+ import "../chunk-WYGD2UGN.js";
8
+ import "../chunk-PZOWBI3B.js";
9
+ import "../chunk-CDW7R2QT.js";
10
+ import "../chunk-NXR3BD2V.js";
11
+ export {
12
+ parseSubclass
13
+ };
@@ -0,0 +1,118 @@
1
+ import { z } from "zod";
2
+ export declare const subclassEntitySchema: z.ZodObject<{
3
+ slug: z.ZodString;
4
+ name: z.ZodString;
5
+ parent_class: z.ZodString;
6
+ edition: z.ZodEnum<{
7
+ 2014: "2014";
8
+ 2024: "2024";
9
+ }>;
10
+ source: z.ZodString;
11
+ description: z.ZodString;
12
+ spellcasting: z.ZodOptional<z.ZodNullable<z.ZodObject<{
13
+ caster_type: z.ZodEnum<{
14
+ pact: "pact";
15
+ full: "full";
16
+ half: "half";
17
+ third: "third";
18
+ }>;
19
+ ability: z.ZodEnum<{
20
+ str: "str";
21
+ dex: "dex";
22
+ con: "con";
23
+ int: "int";
24
+ wis: "wis";
25
+ cha: "cha";
26
+ }>;
27
+ preparation: z.ZodEnum<{
28
+ known: "known";
29
+ prepared: "prepared";
30
+ }>;
31
+ spell_list: z.ZodString;
32
+ }, z.core.$strip>>>;
33
+ table: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
34
+ columns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
35
+ }, z.core.$strip>>>;
36
+ features_by_level: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
37
+ resources: z.ZodArray<z.ZodObject<{
38
+ id: z.ZodString;
39
+ name: z.ZodString;
40
+ max_formula: z.ZodString;
41
+ scales_at: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ level: z.ZodNumber;
43
+ max: z.ZodString;
44
+ }, z.core.$strict>>>;
45
+ die: z.ZodOptional<z.ZodObject<{
46
+ base: z.ZodString;
47
+ scaling: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
48
+ }, z.core.$strip>>;
49
+ reset: z.ZodEnum<{
50
+ "short-rest": "short-rest";
51
+ "long-rest": "long-rest";
52
+ dawn: "dawn";
53
+ dusk: "dusk";
54
+ turn: "turn";
55
+ round: "round";
56
+ custom: "custom";
57
+ }>;
58
+ consumes: z.ZodOptional<z.ZodObject<{
59
+ resource: z.ZodString;
60
+ amount: z.ZodNumber;
61
+ }, z.core.$strip>>;
62
+ recovery: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
+ id: z.ZodString;
64
+ name: z.ZodString;
65
+ amount: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
66
+ action: z.ZodOptional<z.ZodEnum<{
67
+ action: "action";
68
+ "bonus-action": "bonus-action";
69
+ reaction: "reaction";
70
+ free: "free";
71
+ special: "special";
72
+ }>>;
73
+ uses: z.ZodOptional<z.ZodNumber>;
74
+ reset: z.ZodEnum<{
75
+ "short-rest": "short-rest";
76
+ "long-rest": "long-rest";
77
+ dawn: "dawn";
78
+ dusk: "dusk";
79
+ turn: "turn";
80
+ round: "round";
81
+ custom: "custom";
82
+ }>;
83
+ }, z.core.$strip>>>;
84
+ }, z.core.$strip>>;
85
+ selection_pools: z.ZodOptional<z.ZodArray<z.ZodObject<{
86
+ id: z.ZodString;
87
+ label: z.ZodString;
88
+ source: z.ZodObject<{
89
+ entity_type: z.ZodLiteral<"optional-feature">;
90
+ where: z.ZodObject<{
91
+ feature_type: z.ZodString;
92
+ available_to: z.ZodLiteral<"self">;
93
+ }, z.core.$strip>;
94
+ }, z.core.$strip>;
95
+ count: z.ZodObject<{
96
+ column: z.ZodString;
97
+ }, z.core.$strip>;
98
+ replaceable: z.ZodOptional<z.ZodBoolean>;
99
+ }, z.core.$strip>>>;
100
+ pool_grants: z.ZodOptional<z.ZodArray<z.ZodObject<{
101
+ pool: z.ZodString;
102
+ grants: z.ZodArray<z.ZodObject<{
103
+ feature: z.ZodString;
104
+ at_level: z.ZodNumber;
105
+ }, z.core.$strip>>;
106
+ }, z.core.$strip>>>;
107
+ tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
108
+ id: z.ZodString;
109
+ label: z.ZodString;
110
+ renders: z.ZodObject<{
111
+ pool: z.ZodString;
112
+ layout: z.ZodOptional<z.ZodEnum<{
113
+ "spell-like": "spell-like";
114
+ blocks: "blocks";
115
+ }>>;
116
+ }, z.core.$strip>;
117
+ }, z.core.$strip>>>;
118
+ }, z.core.$strip>;
@@ -0,0 +1,12 @@
1
+ import {
2
+ subclassEntitySchema
3
+ } from "../chunk-B7UXKNLD.js";
4
+ import "../chunk-4TIJKN6O.js";
5
+ import "../chunk-DABBCYTT.js";
6
+ import "../chunk-WYGD2UGN.js";
7
+ import "../chunk-PZOWBI3B.js";
8
+ import "../chunk-CDW7R2QT.js";
9
+ import "../chunk-NXR3BD2V.js";
10
+ export {
11
+ subclassEntitySchema
12
+ };
@@ -0,0 +1,20 @@
1
+ import type { Feature, Resource } from "@archivist-gg/dnd5e";
2
+ import type { Edition, SpellcastingConfig } from "@archivist-gg/dnd5e/class/class.types";
3
+ import type { SelectionPool, PoolGrant, TabDecl } from "@archivist-gg/dnd5e/types/selection-pool";
4
+ export interface SubclassEntity {
5
+ slug: string;
6
+ name: string;
7
+ parent_class: string;
8
+ edition: Edition;
9
+ source: string;
10
+ description: string;
11
+ spellcasting?: SpellcastingConfig | null;
12
+ table?: Record<number, {
13
+ columns?: Record<string, string | number>;
14
+ }>;
15
+ features_by_level: Record<number, Feature[]>;
16
+ resources: Resource[];
17
+ selection_pools?: SelectionPool[];
18
+ pool_grants?: PoolGrant[];
19
+ tabs?: TabDecl[];
20
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ export interface Abilities {
2
+ str: number;
3
+ dex: number;
4
+ con: number;
5
+ int: number;
6
+ wis: number;
7
+ cha: number;
8
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ export interface AC {
2
+ ac: number;
3
+ from?: string[];
4
+ condition?: string;
5
+ }
@@ -0,0 +1,22 @@
1
+ import type { Ability } from "./choice.js";
2
+ export interface AttackRange {
3
+ normal?: number;
4
+ long?: number;
5
+ reach?: number;
6
+ }
7
+ export interface Attack {
8
+ name: string;
9
+ type: "melee" | "ranged" | "spell";
10
+ ability?: Ability[] | Ability;
11
+ bonus?: number;
12
+ damage?: string;
13
+ damage_type?: string;
14
+ extra_damage?: {
15
+ dice: string;
16
+ type: string;
17
+ };
18
+ action?: "action" | "bonus-action" | "reaction";
19
+ properties?: string[];
20
+ range?: AttackRange;
21
+ condition?: string;
22
+ }
File without changes
@@ -0,0 +1,14 @@
1
+ /** A single alternate casting mode for a spell (e.g. a different shape, range,
2
+ * or scaling). Lives in dnd5e so the build-time SRD spell merger can consume
3
+ * it without a tools→obsidian reverse edge; obsidian `spell.types` re-exports
4
+ * it for the renderer/parser. */
5
+ export interface CastingOption {
6
+ type: string;
7
+ damage_roll?: string;
8
+ target_count?: number;
9
+ duration?: string;
10
+ range?: number;
11
+ concentration?: boolean;
12
+ shape_size?: number;
13
+ desc?: string;
14
+ }
File without changes
@@ -0,0 +1,66 @@
1
+ import type { Abilities } from "./abilities.js";
2
+ import type { FeatureEffect } from "./feature-effect.js";
3
+ export type Ability = keyof Abilities;
4
+ export type SkillSlug = "acrobatics" | "animal-handling" | "arcana" | "athletics" | "deception" | "history" | "insight" | "intimidation" | "investigation" | "medicine" | "nature" | "perception" | "performance" | "persuasion" | "religion" | "sleight-of-hand" | "stealth" | "survival";
5
+ export declare const ALL_SKILL_SLUGS: SkillSlug[];
6
+ export type FeatCategory = "origin" | "general" | "fighting-style" | "epic-boon";
7
+ /** Closed, enumerated registry filter — YAML can never express a query the
8
+ * engine would apply unsafely. `"self"` resolves against the owning
9
+ * class/subclass at ledger-build time. */
10
+ export interface EntityFilter {
11
+ feature_type?: string;
12
+ category?: string;
13
+ parent_class?: "self";
14
+ available_to?: "self";
15
+ /** Weapon proficiency class. Matched against a weapon entity's compound
16
+ * `category` (e.g. "martial-melee") by prefix, so "martial" covers both
17
+ * martial-melee and martial-ranged. */
18
+ weapon_category?: "simple" | "martial";
19
+ /** Armor proficiency class. Matched against an armor entity's `category`
20
+ * field exactly; "shield" selects shields. */
21
+ armor_category?: "light" | "medium" | "heavy" | "shield";
22
+ }
23
+ export interface InlineOption {
24
+ value: string;
25
+ label: string;
26
+ description?: string;
27
+ /** Applied via a synthesized resolved feature when the option is selected. */
28
+ effects?: FeatureEffect[];
29
+ /** Nested decisions revealed when this option is selected (recursive). */
30
+ choices?: Choice[];
31
+ }
32
+ /** The four game-agnostic decision primitives. All game knowledge (which
33
+ * options, which counts) lives in data — authored in the SRD overlay or
34
+ * inline in homebrew entity notes. `id` is the persistence key under
35
+ * `ClassEntry.choices[level]` / `Character.origin_choices`. */
36
+ export type Choice = {
37
+ kind: "select-inline";
38
+ id: string;
39
+ label?: string;
40
+ count?: number;
41
+ options: InlineOption[];
42
+ } | {
43
+ kind: "select-entity";
44
+ id: string;
45
+ label?: string;
46
+ count?: number;
47
+ entity_type: string;
48
+ from?: string[];
49
+ where?: EntityFilter;
50
+ } | {
51
+ kind: "select-proficiency";
52
+ id: string;
53
+ label?: string;
54
+ count: number;
55
+ domain: "skill" | "tool" | "language" | "save";
56
+ from?: string[];
57
+ from_proficient?: boolean;
58
+ expertise?: boolean;
59
+ } | {
60
+ kind: "ability-points";
61
+ id: string;
62
+ label?: string;
63
+ points: number;
64
+ max_per: number;
65
+ pool?: Ability[];
66
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ ALL_SKILL_SLUGS
3
+ } from "../chunk-BH6AMZVY.js";
4
+ export {
5
+ ALL_SKILL_SLUGS
6
+ };
@@ -0,0 +1,4 @@
1
+ /** The two D&D 5e rules editions Archivist canonicalizes content for.
2
+ * Single source of truth — obsidian `class.types` and the dnd5e entity
3
+ * types both import it from here. */
4
+ export type Edition = "2014" | "2024";
File without changes
@@ -0,0 +1,41 @@
1
+ /** One thing a starting-equipment option grants. `item` is a BARE compendium
2
+ * slug (e.g. "chain-mail"); the seeder resolves it to the full edition slug.
3
+ * `category` is a player-picked class of item ("martial-weapon",
4
+ * "simple-weapon", "martial-melee-weapon", "any-armor", "shield", …) resolved
5
+ * by a nested select-entity. `gold` is gp folded into the bundle. */
6
+ export type EquipmentGrant = {
7
+ item: string;
8
+ qty?: number;
9
+ } | {
10
+ category: string;
11
+ qty?: number;
12
+ } | {
13
+ gold: number;
14
+ };
15
+ /** One selectable option of a `kind:"choice"` starting-equipment entry. `label`
16
+ * is the human display string (the `.pc-cb-eqopt` text); `grants` is what seeds. */
17
+ export interface EquipmentOption {
18
+ label: string;
19
+ grants: EquipmentGrant[];
20
+ }
21
+ /** Structured starting equipment. Shared by class + background. A `fixed` entry
22
+ * may carry a `label` for the un-parsed (prose fallback) case where `grants`
23
+ * is empty — it then displays but seeds nothing (graceful degradation). */
24
+ export type StartingEquipmentEntry = {
25
+ kind: "choice";
26
+ options: EquipmentOption[];
27
+ } | {
28
+ kind: "fixed";
29
+ label?: string;
30
+ grants: EquipmentGrant[];
31
+ } | {
32
+ kind: "gold";
33
+ amount: number;
34
+ };
35
+ /** Buy-with-Gold budget. `fixed` gp (2024) or a `dice`×`multiplier` roll (2014
36
+ * "XdY × 10"); average is derived by the consumer. */
37
+ export interface StartingGold {
38
+ fixed?: number;
39
+ dice?: string;
40
+ multiplier?: number;
41
+ }
File without changes
@@ -0,0 +1,79 @@
1
+ import type { Ability } from "./choice.js";
2
+ export type SenseType = "darkvision" | "blindsight" | "tremorsense" | "truesight";
3
+ export type FeatureEffect = {
4
+ kind: "initiative-bonus";
5
+ value: number;
6
+ } | {
7
+ kind: "immune-condition";
8
+ condition: string;
9
+ while?: string;
10
+ } | {
11
+ kind: "resistance";
12
+ damage_type: string;
13
+ } | {
14
+ kind: "hp-per-level-bonus";
15
+ value: number;
16
+ } | {
17
+ kind: "speed-bonus";
18
+ mode: "walk" | "fly" | "swim" | "climb" | "burrow";
19
+ value: number;
20
+ set?: boolean;
21
+ } | {
22
+ kind: "sense";
23
+ type: SenseType;
24
+ range: number;
25
+ } | {
26
+ kind: "apply-condition";
27
+ condition: string;
28
+ duration?: string;
29
+ ends_on?: string[];
30
+ save_repeat?: {
31
+ ability: string;
32
+ timing: string;
33
+ };
34
+ } | {
35
+ kind: "damage-bonus";
36
+ damage_type: string;
37
+ amount: string;
38
+ applies_to?: "weapon" | "spell" | "all";
39
+ condition?: string;
40
+ } | {
41
+ kind: "proficiency";
42
+ proficiency_type: "skill" | "tool" | "language" | "saving-throw" | "armor" | "weapon";
43
+ value: string;
44
+ } | {
45
+ kind: "ac-bonus";
46
+ value: number;
47
+ requires_armor?: boolean;
48
+ } | {
49
+ kind: "unarmored-ac";
50
+ abilities: Ability[];
51
+ base?: number;
52
+ allow_shield?: boolean;
53
+ } | {
54
+ kind: "weapon-ability";
55
+ ability: Ability | "spellcasting";
56
+ weapons?: string | string[];
57
+ } | {
58
+ kind: "roll-modifier";
59
+ mode: "advantage" | "disadvantage";
60
+ roll: "ability-check" | "saving-throw" | "attack";
61
+ scope?: string;
62
+ condition?: string;
63
+ } | {
64
+ kind: "crit-range";
65
+ min_roll: number;
66
+ applies_to?: "weapon" | "spell" | "all";
67
+ condition?: string;
68
+ } | {
69
+ kind: "extra-attack";
70
+ count: number;
71
+ } | {
72
+ kind: "reroll-damage";
73
+ max_reroll: number;
74
+ applies_to?: "weapon" | "spell" | "all";
75
+ once_per_die?: boolean;
76
+ } | {
77
+ kind: "attack-rule";
78
+ flag: "no-ranged-in-melee-disadvantage";
79
+ };
File without changes