briyah 2.0.1 → 2.0.3

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 (223) hide show
  1. package/LICENSE +216 -0
  2. package/README.md +19 -10
  3. package/data/common/config/markup +1 -1
  4. package/data/common/config/model_prices.json +46369 -46361
  5. package/data/common/config/rpg_models.json +60 -0
  6. package/data/common/prompts/narrator/create_chapter.prompt +12 -1
  7. package/data/common/prompts/pdf_converter/convert_pdf_page.prompt +8 -1
  8. package/data/common/prompts/perceive.prompt +287 -291
  9. package/data/packs/dnd5e/agents/player.json +11 -11
  10. package/data/packs/dnd5e/artifacts/background-acolyte.md +66 -0
  11. package/data/packs/dnd5e/artifacts/character_creator-basics.md +31 -13
  12. package/data/packs/dnd5e/artifacts/class-barbarian.md +4 -1
  13. package/data/packs/dnd5e/artifacts/class-bard.md +2 -1
  14. package/data/packs/dnd5e/artifacts/class-cleric.md +2 -1
  15. package/data/packs/dnd5e/artifacts/class-druid.md +3 -1
  16. package/data/packs/dnd5e/artifacts/class-fighter.md +3 -1
  17. package/data/packs/dnd5e/artifacts/class-monk.md +2 -1
  18. package/data/packs/dnd5e/artifacts/class-paladin.md +2 -1
  19. package/data/packs/dnd5e/artifacts/class-ranger.md +3 -1
  20. package/data/packs/dnd5e/artifacts/class-rogue.md +3 -1
  21. package/data/packs/dnd5e/artifacts/class-sorcerer.md +2 -1
  22. package/data/packs/dnd5e/artifacts/class-warlock.md +3 -1
  23. package/data/packs/dnd5e/artifacts/class-wizard.md +2 -1
  24. package/data/packs/dnd5e/artifacts/manifest.json +6 -0
  25. package/data/packs/dnd5e/pack.json +1 -1
  26. package/data/packs/dnd5e/prompts/battle_master/perceive.prompt +491 -378
  27. package/data/packs/dnd5e/prompts/campaign_designer/perceive.prompt +24 -7
  28. package/data/packs/dnd5e/prompts/character_creator/defaults_config.json +21 -31
  29. package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +236 -99
  30. package/data/packs/dnd5e/prompts/dnd_player/defaults_config.json +5 -5
  31. package/data/packs/dnd5e/prompts/dnd_player/perceive.prompt +28 -10
  32. package/data/packs/dnd5e/prompts/dnd_room_moderator/defaults_config.json +9 -9
  33. package/data/packs/dnd5e/prompts/dnd_room_moderator/moderate.prompt +13 -10
  34. package/data/packs/dnd5e/prompts/dungeon_master/defaults_config.json +32 -30
  35. package/data/packs/dnd5e/prompts/dungeon_master/perceive.prompt +794 -764
  36. package/data/packs/dnd5e/rooms/campaign.json +15 -0
  37. package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +3 -0
  38. package/dist-sdk/server/src/ai/LLM/anthropic.service.js +40 -11
  39. package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +1 -0
  40. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +16 -0
  41. package/dist-sdk/server/src/ai/LLM/deepseek.service.js +5 -3
  42. package/dist-sdk/server/src/ai/agent-store.service.js +1 -1
  43. package/dist-sdk/server/src/ai/artifact.service.d.ts +2 -0
  44. package/dist-sdk/server/src/ai/artifact.service.js +6 -0
  45. package/dist-sdk/server/src/ai/pack-artifacts.d.ts +2 -0
  46. package/dist-sdk/server/src/ai/pack-artifacts.js +65 -8
  47. package/dist-sdk/server/src/app/user-service-factory.js +6 -1
  48. package/dist-sdk/server/src/app/user-service-manager.js +1 -1
  49. package/dist-sdk/server/src/app.controller.d.ts +9 -1
  50. package/dist-sdk/server/src/app.controller.js +123 -12
  51. package/dist-sdk/server/src/app.service.d.ts +24 -2
  52. package/dist-sdk/server/src/app.service.js +123 -109
  53. package/dist-sdk/server/src/auth/auth.controller.js +4 -0
  54. package/dist-sdk/server/src/auth/auth.service.d.ts +2 -1
  55. package/dist-sdk/server/src/auth/dto/phone-login.dto.d.ts +2 -1
  56. package/dist-sdk/server/src/documents/pdf-conversion.d.ts +43 -0
  57. package/dist-sdk/server/src/documents/pdf-conversion.js +175 -0
  58. package/dist-sdk/server/src/room/nickname.d.ts +1 -0
  59. package/dist-sdk/server/src/room/nickname.js +15 -0
  60. package/dist-sdk/server/src/room/room-store.service.d.ts +1 -0
  61. package/dist-sdk/server/src/room/room-store.service.js +9 -1
  62. package/dist-sdk/server/src/room/room.d.ts +43 -3
  63. package/dist-sdk/server/src/room/room.js +317 -35
  64. package/dist-sdk/server/src/rpg/rpg-models.d.ts +9 -0
  65. package/dist-sdk/server/src/rpg/rpg-models.js +128 -0
  66. package/dist-sdk/server/src/rpg/rpg-roster.d.ts +8 -0
  67. package/dist-sdk/server/src/rpg/rpg-roster.js +34 -0
  68. package/dist-sdk/server/src/rpg/rpg.service.d.ts +29 -0
  69. package/dist-sdk/server/src/rpg/rpg.service.js +199 -0
  70. package/dist-sdk/server/src/sdk/index.d.ts +4 -2
  71. package/dist-sdk/server/src/sdk/index.js +6 -1
  72. package/dist-sdk/server/src/story/story.service.d.ts +2 -1
  73. package/dist-sdk/server/src/story/story.service.js +42 -4
  74. package/dist-sdk/server/src/tools/core/index.d.ts +3 -0
  75. package/dist-sdk/server/src/tools/core/index.js +9 -0
  76. package/dist-sdk/server/src/tools/core/rename.tool.d.ts +2 -0
  77. package/dist-sdk/server/src/tools/core/rename.tool.js +61 -0
  78. package/dist-sdk/server/src/tools/native-tool.types.d.ts +15 -0
  79. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +0 -21
  80. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +1 -56
  81. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +10 -0
  82. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +67 -0
  83. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +5 -0
  84. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +7 -1
  85. package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +4 -3
  86. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +6 -0
  87. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +92 -0
  88. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +32 -5
  89. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +177 -28
  90. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +1 -13
  91. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +15 -145
  92. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +7 -0
  93. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +11 -0
  94. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +5 -0
  95. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +45 -2
  96. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +3 -0
  97. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +21 -0
  98. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +45 -0
  99. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +6 -4
  100. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +17 -0
  101. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +56 -4
  102. package/dist-sdk/server/src/tools/packs/dnd5e/index.js +3 -0
  103. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +117 -15
  104. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +2 -0
  105. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +96 -0
  106. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +40 -3
  107. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +36 -27
  108. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +7 -4
  109. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +15 -1
  110. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +73 -0
  111. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +49 -13
  112. package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +68 -2
  113. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +1 -0
  114. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +119 -14
  115. package/dist-sdk/server/src/tools/packs/index.d.ts +2 -0
  116. package/dist-sdk/server/src/tools/packs/index.js +16 -5
  117. package/dist-sdk/server/src/tools/shared/coerce.d.ts +13 -0
  118. package/dist-sdk/server/src/tools/shared/coerce.js +147 -0
  119. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +3 -2
  120. package/dist-sdk/server/src/tools/tool-execution.service.js +4 -1
  121. package/dist-sdk/shared/types/app.types.d.ts +63 -0
  122. package/dist-sdk/shared/types/app.types.js +2 -1
  123. package/docs/assets/hierarchy.js +1 -1
  124. package/docs/assets/navigation.js +1 -1
  125. package/docs/assets/search.js +1 -1
  126. package/docs/classes/Agent.html +73 -73
  127. package/docs/classes/Briyah.html +16 -16
  128. package/docs/classes/BriyahConfigService.html +7 -7
  129. package/docs/classes/NativeToolRegistry.html +10 -10
  130. package/docs/classes/PackInstantiationService.html +7 -7
  131. package/docs/classes/PackService.html +13 -13
  132. package/docs/classes/Room.html +216 -95
  133. package/docs/classes/RoomMessage.html +22 -22
  134. package/docs/enums/MessageAction.html +18 -18
  135. package/docs/functions/availableToolPacks.html +5 -5
  136. package/docs/functions/buildMarkdown.html +54 -0
  137. package/docs/functions/dnd5eTools.html +4 -4
  138. package/docs/functions/installToolPacks.html +8 -5
  139. package/docs/functions/pageMarker.html +45 -0
  140. package/docs/functions/registerToolPacks.html +4 -4
  141. package/docs/functions/splitMarkdownIntoPages.html +51 -0
  142. package/docs/functions/stripWrappingFence.html +52 -0
  143. package/docs/hierarchy.html +13 -9
  144. package/docs/index.html +11 -8
  145. package/docs/interfaces/AgentCreationOptions.html +12 -12
  146. package/docs/interfaces/AgentInfo.html +30 -30
  147. package/docs/interfaces/AgentMessagesResponse.html +8 -8
  148. package/docs/interfaces/AppService.html +276 -198
  149. package/docs/interfaces/Artifact.html +9 -9
  150. package/docs/interfaces/ArtifactMetadata.html +13 -13
  151. package/docs/interfaces/ArtifactWriteOptions.html +7 -7
  152. package/docs/interfaces/AttachDocumentResponse.html +6 -6
  153. package/docs/interfaces/BriyahConfigOptions.html +12 -12
  154. package/docs/interfaces/ChapterInfo.html +6 -6
  155. package/docs/interfaces/Character.html +10 -10
  156. package/docs/interfaces/ConversionAgent.html +78 -0
  157. package/docs/interfaces/CreateAgentResponse.html +5 -5
  158. package/docs/interfaces/CreateRoomResponse.html +6 -6
  159. package/docs/interfaces/CreateStoryResponse.html +5 -5
  160. package/docs/interfaces/FileList.html +5 -5
  161. package/docs/interfaces/FileMetadata.html +10 -10
  162. package/docs/interfaces/IConfigService.html +5 -5
  163. package/docs/interfaces/InstantiateModels.html +6 -6
  164. package/docs/interfaces/InstantiateRoomResult.html +7 -7
  165. package/docs/interfaces/LoadedPack.html +16 -16
  166. package/docs/interfaces/LoggingOptions.html +9 -9
  167. package/docs/interfaces/Message.html +9 -9
  168. package/docs/interfaces/ModelChoice.html +7 -7
  169. package/docs/interfaces/ModelInfo.html +8 -8
  170. package/docs/interfaces/NativeToolDefinition.html +10 -10
  171. package/docs/interfaces/PackAgentTemplate.html +9 -9
  172. package/docs/interfaces/PackRoomTemplate.html +11 -11
  173. package/docs/interfaces/PackView.html +20 -20
  174. package/docs/interfaces/PdfConversionOptions.html +102 -0
  175. package/docs/interfaces/PdfConversionResult.html +97 -0
  176. package/docs/interfaces/PdfMarkdownOptions.html +198 -0
  177. package/docs/interfaces/PdfMarkdownResult.html +106 -0
  178. package/docs/interfaces/PdfPageMarkdown.html +94 -0
  179. package/docs/interfaces/PreparedPromptResponse.html +6 -6
  180. package/docs/interfaces/ProcessTextResponse.html +10 -10
  181. package/docs/interfaces/PromptFile.html +7 -7
  182. package/docs/interfaces/PromptFileContent.html +8 -8
  183. package/docs/interfaces/PromptFilesResponse.html +5 -5
  184. package/docs/interfaces/PromptFolder.html +8 -8
  185. package/docs/interfaces/PromptFolderDefaults.html +19 -19
  186. package/docs/interfaces/PromptFolderDefaultsResponse.html +7 -7
  187. package/docs/interfaces/PromptFoldersResponse.html +5 -5
  188. package/docs/interfaces/RoomDetails.html +19 -19
  189. package/docs/interfaces/RoomErrorUpdate.html +8 -8
  190. package/docs/interfaces/RoomInfo.html +10 -10
  191. package/docs/interfaces/RoomMessageUpdate.html +13 -13
  192. package/docs/interfaces/RoomMessagesResponse.html +6 -6
  193. package/docs/interfaces/SendMessageResult.html +6 -6
  194. package/docs/interfaces/StoryErrorEvent.html +8 -8
  195. package/docs/interfaces/StoryIdea.html +8 -8
  196. package/docs/interfaces/StoryInfo.html +28 -28
  197. package/docs/interfaces/StoryIntroduceCharacterEvent.html +7 -7
  198. package/docs/interfaces/StoryProgressChapterEvent.html +6 -6
  199. package/docs/interfaces/StoryState.html +12 -12
  200. package/docs/interfaces/StoryStateEvent.html +7 -7
  201. package/docs/interfaces/ToolArtifact.html +9 -9
  202. package/docs/interfaces/ToolCaller.html +7 -7
  203. package/docs/interfaces/ToolDefinition.html +9 -9
  204. package/docs/interfaces/ToolHelpers.html +17 -8
  205. package/docs/interfaces/ToolPackDocuments.html +100 -0
  206. package/docs/interfaces/ToolParameter.html +8 -8
  207. package/docs/interfaces/ToolRoomAccess.html +49 -16
  208. package/docs/interfaces/ToolSummary.html +8 -8
  209. package/docs/interfaces/ToolsResponse.html +7 -7
  210. package/docs/interfaces/Transaction.html +13 -13
  211. package/docs/interfaces/TransactionHistoryResponse.html +6 -6
  212. package/docs/modules.html +8 -8
  213. package/docs/types/PackOrigin.html +4 -4
  214. package/docs/types/PromptScope.html +4 -4
  215. package/docs/types/RoomTurnMode.html +4 -4
  216. package/docs/types/RoomUpdate.html +4 -4
  217. package/docs/types/RosterOverrides.html +4 -4
  218. package/docs/types/ToolContext.html +4 -4
  219. package/docs/types/ToolRunResult.html +4 -4
  220. package/package.json +32 -3
  221. package/src/tools/packs/dnd5e/README.md +147 -66
  222. package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.d.ts +0 -20
  223. package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.js +0 -112
@@ -1,22 +1 @@
1
- export interface BackgroundFeature {
2
- n: string;
3
- text: string;
4
- }
5
- export interface BackgroundSuggestions {
6
- traits: string[];
7
- ideals: string[];
8
- bonds: string[];
9
- flaws: string[];
10
- }
11
- export interface BackgroundRules {
12
- name: string;
13
- skills: string[];
14
- tools?: string[];
15
- languageChoices?: number;
16
- equipment?: string[];
17
- coin?: Record<string, number>;
18
- feature: BackgroundFeature;
19
- suggestions?: BackgroundSuggestions;
20
- }
21
- export declare const BACKGROUNDS: Record<string, BackgroundRules>;
22
1
  export declare const BACKGROUNDS_RULE = "A background gives two skill proficiencies, often one or more tool proficiencies, sometimes extra languages, a package of starting equipment, and a feature. If a proficiency would duplicate one you already have, take a different one of the same kind. You may customize a background: replace its feature with another, choose any two skills, and choose any two tool proficiencies or languages. If you spend coin on gear instead, you do not take the background equipment package.";
@@ -1,59 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BACKGROUNDS_RULE = exports.BACKGROUNDS = void 0;
4
- exports.BACKGROUNDS = {
5
- acolyte: {
6
- name: 'Acolyte',
7
- skills: ['insight', 'religion'],
8
- languageChoices: 2,
9
- equipment: [
10
- 'holy symbol',
11
- 'prayer book',
12
- 'incense x5',
13
- 'vestments',
14
- 'common clothes',
15
- ],
16
- coin: { gp: 15 },
17
- feature: {
18
- n: 'Shelter of the Faithful',
19
- text: 'You command the respect of those who share your faith and can perform its ceremonies. You and your companions can expect free healing and care at a temple or shrine of your faith, though you must provide any material components. Those who share your religion will support you — but only you — at a modest lifestyle. You may also have ties to a specific temple, where you have a residence and can call on the priests for assistance that is not hazardous, while you remain in good standing.',
20
- },
21
- suggestions: {
22
- traits: [
23
- 'I idolize a particular hero of my faith and constantly refer to their deeds.',
24
- 'I can find common ground between the fiercest enemies, always working toward peace.',
25
- 'I see omens in every event. The gods try to speak to us; we just need to listen.',
26
- 'Nothing can shake my optimistic attitude.',
27
- 'I quote (or misquote) sacred texts and proverbs in almost every situation.',
28
- 'I am tolerant (or intolerant) of other faiths and respect (or condemn) other gods.',
29
- "I've enjoyed fine food, drink and high society. Rough living grates on me.",
30
- "I've spent so long in the temple that I have little experience of the outside world.",
31
- ],
32
- ideals: [
33
- 'Tradition. The ancient traditions of worship and sacrifice must be preserved. (Lawful)',
34
- 'Charity. I always try to help those in need, whatever the personal cost. (Good)',
35
- 'Change. We must help bring about the changes the gods are working in the world. (Chaotic)',
36
- "Power. I hope one day to rise to the top of my faith's hierarchy. (Lawful)",
37
- 'Faith. I trust that my deity will guide my actions. (Lawful)',
38
- "Aspiration. I seek to prove myself worthy of my god's favour. (Any)",
39
- ],
40
- bonds: [
41
- 'I would die to recover an ancient relic of my faith that was lost long ago.',
42
- 'I will someday get revenge on the corrupt hierarchy who branded me a heretic.',
43
- 'I owe my life to the priest who took me in when my parents died.',
44
- 'Everything I do is for the common people.',
45
- 'I will do anything to protect the temple where I served.',
46
- 'I seek to preserve a sacred text my enemies consider heretical.',
47
- ],
48
- flaws: [
49
- 'I judge others harshly, and myself even more severely.',
50
- "I put too much trust in those who wield power within my temple's hierarchy.",
51
- 'My piety sometimes leads me to blindly trust those who profess faith in my god.',
52
- 'I am inflexible in my thinking.',
53
- 'I am suspicious of strangers and expect the worst of them.',
54
- 'Once I pick a goal I become obsessed with it, to the detriment of everything else.',
55
- ],
56
- },
57
- },
58
- };
3
+ exports.BACKGROUNDS_RULE = void 0;
59
4
  exports.BACKGROUNDS_RULE = 'A background gives two skill proficiencies, often one or more tool proficiencies, sometimes extra languages, a package of starting equipment, and a feature. If a proficiency would duplicate one you already have, take a different one of the same kind. You may customize a background: replace its feature with another, choose any two skills, and choose any two tool proficiencies or languages. If you spend coin on gear instead, you do not take the background equipment package.';
@@ -0,0 +1,10 @@
1
+ export interface CantripAttack {
2
+ dmg: string;
3
+ type: string;
4
+ range: string;
5
+ note?: string;
6
+ beams?: boolean;
7
+ }
8
+ export declare const CANTRIP_ATTACKS: Record<string, CantripAttack>;
9
+ export declare function cantripDice(characterLevel: number): number;
10
+ export declare function cantripDamage(cantrip: CantripAttack, characterLevel: number): string;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANTRIP_ATTACKS = void 0;
4
+ exports.cantripDice = cantripDice;
5
+ exports.cantripDamage = cantripDamage;
6
+ exports.CANTRIP_ATTACKS = {
7
+ 'fire bolt': {
8
+ dmg: '1d10',
9
+ type: 'fire',
10
+ range: '120 ft',
11
+ note: 'A flammable object hit by this spell ignites if it is not being worn or carried.',
12
+ },
13
+ 'ray of frost': {
14
+ dmg: '1d8',
15
+ type: 'cold',
16
+ range: '60 ft',
17
+ note: "On a hit, the target's speed is reduced by 10 feet until the start of your next turn.",
18
+ },
19
+ 'chill touch': {
20
+ dmg: '1d8',
21
+ type: 'necrotic',
22
+ range: '120 ft',
23
+ note: 'On a hit, the target cannot regain hit points until the start of your next turn. An undead target also has disadvantage on attack rolls against you until the end of your next turn.',
24
+ },
25
+ 'shocking grasp': {
26
+ dmg: '1d8',
27
+ type: 'lightning',
28
+ range: '5 ft',
29
+ note: 'You have advantage on the attack roll if the target is wearing metal armour. On a hit, the target cannot take reactions until the start of your next turn.',
30
+ },
31
+ 'produce flame': {
32
+ dmg: '1d8',
33
+ type: 'fire',
34
+ range: '30 ft',
35
+ note: 'Hurling the flame ends the spell.',
36
+ },
37
+ 'thorn whip': {
38
+ dmg: '1d6',
39
+ type: 'piercing',
40
+ range: '30 ft',
41
+ note: 'On a hit, you pull a Large or smaller target up to 10 feet closer to you.',
42
+ },
43
+ 'eldritch blast': {
44
+ dmg: '1d10',
45
+ type: 'force',
46
+ range: '120 ft',
47
+ beams: true,
48
+ note: 'One beam at 1st level, and another at 5th, 11th and 17th. Each beam is a separate attack roll, rolled one call at a time or batched together.',
49
+ },
50
+ };
51
+ function cantripDice(characterLevel) {
52
+ if (characterLevel >= 17)
53
+ return 4;
54
+ if (characterLevel >= 11)
55
+ return 3;
56
+ if (characterLevel >= 5)
57
+ return 2;
58
+ return 1;
59
+ }
60
+ function cantripDamage(cantrip, characterLevel) {
61
+ const match = /^(\d+)d(\d+)$/.exec(cantrip.dmg);
62
+ if (!match)
63
+ return cantrip.dmg;
64
+ if (cantrip.beams)
65
+ return cantrip.dmg;
66
+ return `${cantripDice(characterLevel)}d${match[2]}`;
67
+ }
@@ -1,4 +1,9 @@
1
1
  export declare const ITEM_WEIGHTS: Record<string, number>;
2
+ export interface GearUses {
3
+ uses: number;
4
+ note?: string;
5
+ }
6
+ export declare const GEAR_USES: Record<string, GearUses>;
2
7
  export declare const CARRY_MULTIPLIER = 15;
3
8
  export declare const PUSH_DRAG_LIFT_MULTIPLIER = 30;
4
9
  export declare const ENCUMBERED_MULTIPLIER = 5;
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HEAVILY_ENCUMBERED_MULTIPLIER = exports.ENCUMBERED_MULTIPLIER = exports.PUSH_DRAG_LIFT_MULTIPLIER = exports.CARRY_MULTIPLIER = exports.ITEM_WEIGHTS = void 0;
3
+ exports.HEAVILY_ENCUMBERED_MULTIPLIER = exports.ENCUMBERED_MULTIPLIER = exports.PUSH_DRAG_LIFT_MULTIPLIER = exports.CARRY_MULTIPLIER = exports.GEAR_USES = exports.ITEM_WEIGHTS = void 0;
4
4
  const gear_generated_1 = require("./gear.generated");
5
5
  exports.ITEM_WEIGHTS = gear_generated_1.GENERATED_ITEM_WEIGHTS;
6
+ exports.GEAR_USES = {
7
+ "healer's kit": {
8
+ uses: 10,
9
+ note: 'Spending a use stabilizes a creature at 0 hit points without a Wisdom (Medicine) check. It restores no hit points and does nothing for a conscious creature.',
10
+ },
11
+ };
6
12
  exports.CARRY_MULTIPLIER = 15;
7
13
  exports.PUSH_DRAG_LIFT_MULTIPLIER = 30;
8
14
  exports.ENCUMBERED_MULTIPLIER = 5;
@@ -96,14 +96,15 @@ function resolveMonster(name, campaign) {
96
96
  }
97
97
  function availableMonsters(campaign, filter) {
98
98
  const needle = (0, coerce_1.nameKey)(filter || '');
99
- const keep = (name) => !needle || (0, coerce_1.nameKey)(name).includes(needle);
99
+ const keep = (block) => !needle ||
100
+ [block.name, block.kind, block.size].some((field) => field && (0, coerce_1.nameKey)(field).includes(needle));
100
101
  const campaignAll = Object.values(campaign)
101
- .map((block) => block.name)
102
102
  .filter(keep)
103
+ .map((block) => block.name)
103
104
  .sort();
104
105
  const shippedAll = [...shippedIndex().values()]
105
- .map((block) => block.name)
106
106
  .filter(keep)
107
+ .map((block) => block.name)
107
108
  .sort();
108
109
  return {
109
110
  campaign: campaignAll.slice(0, exports.MONSTER_LIST_CAP),
@@ -0,0 +1,6 @@
1
+ import { AttackEntry, SheetState } from './sheet';
2
+ export declare function syncCantripAttacks(state: SheetState): {
3
+ added: string[];
4
+ removed: string[];
5
+ };
6
+ export declare function cantripAttack(state: SheetState, name: string): AttackEntry;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.syncCantripAttacks = syncCantripAttacks;
37
+ exports.cantripAttack = cantripAttack;
38
+ const cantrips_1 = require("../data/cantrips");
39
+ const rules = __importStar(require("./rules"));
40
+ function key(name) {
41
+ return name.trim().toLowerCase();
42
+ }
43
+ function syncCantripAttacks(state) {
44
+ if (state.foe)
45
+ return { added: [], removed: [] };
46
+ const known = new Map();
47
+ for (const spell of state.spells || []) {
48
+ if (cantrips_1.CANTRIP_ATTACKS[key(spell)])
49
+ known.set(key(spell), spell);
50
+ }
51
+ const added = [];
52
+ const removed = [];
53
+ const kept = [];
54
+ for (const attack of state.attacks) {
55
+ const cantrip = cantrips_1.CANTRIP_ATTACKS[key(attack.n)];
56
+ if (!cantrip) {
57
+ kept.push(attack);
58
+ continue;
59
+ }
60
+ if (known.has(key(attack.n)))
61
+ continue;
62
+ removed.push(attack.n);
63
+ }
64
+ for (const [, name] of known) {
65
+ kept.push(cantripAttack(state, name));
66
+ if (!state.attacks.some((attack) => key(attack.n) === key(name)))
67
+ added.push(name);
68
+ }
69
+ state.attacks = kept;
70
+ return { added, removed };
71
+ }
72
+ function cantripAttack(state, name) {
73
+ const cantrip = cantrips_1.CANTRIP_ATTACKS[key(name)];
74
+ const entry = {
75
+ n: titleCase(name),
76
+ atk: rules.spellAttackBonus(state),
77
+ dmg: (0, cantrips_1.cantripDamage)(cantrip, rules.totalLevel(state)),
78
+ type: cantrip.type,
79
+ range: cantrip.range,
80
+ props: ['spell', 'cantrip'],
81
+ };
82
+ if (cantrip.note)
83
+ entry.note = cantrip.note;
84
+ return entry;
85
+ }
86
+ function titleCase(name) {
87
+ return name
88
+ .trim()
89
+ .split(/\s+/)
90
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
91
+ .join(' ');
92
+ }
@@ -1,20 +1,35 @@
1
1
  import { AbilityKey } from '../data/srd';
2
- import { Rng } from './dice';
2
+ import { MagicItem } from '../data/magic-items';
3
+ import { GearUses } from '../data/gear';
4
+ import { DamageRoll, Rng } from './dice';
3
5
  import { RaceApplication } from './races';
4
- import { BackgroundApplication } from './backgrounds';
5
6
  import { ToolGrantResult } from './kits';
6
- import { AttackEntry, InventoryItem, SheetState } from './sheet';
7
+ import { AttackEntry, BoonEntry, InventoryItem, SheetState } from './sheet';
7
8
  export interface Refusal {
8
9
  violation: string;
9
10
  message: string;
10
11
  rule?: string;
11
12
  options?: string[];
12
13
  }
14
+ export interface BoonApplication {
15
+ boon: string;
16
+ die: string;
17
+ rolled: number;
18
+ what: string;
19
+ before: number;
20
+ total: number;
21
+ dc?: number;
22
+ passed?: boolean;
23
+ turned?: boolean;
24
+ damage?: DamageRoll;
25
+ rider?: string;
26
+ }
13
27
  export interface MutationSuccess {
14
28
  ok: true;
15
29
  state: SheetState;
16
30
  summary: string;
17
31
  details?: string[];
32
+ applied?: BoonApplication;
18
33
  }
19
34
  export interface MutationRefusal {
20
35
  ok: false;
@@ -34,6 +49,7 @@ export interface CharacterSpec {
34
49
  skills?: string[];
35
50
  expertise?: string[];
36
51
  tools?: string[];
52
+ languages?: string[];
37
53
  equipment?: string[];
38
54
  attacks?: AttackEntry[];
39
55
  spells?: string[];
@@ -48,15 +64,14 @@ export interface CharacterSpec {
48
64
  level: number;
49
65
  }[];
50
66
  feats?: string[];
51
- backgroundEquipment?: boolean;
52
67
  raceAbilityChoices?: Partial<Record<AbilityKey, number>>;
53
68
  applyRacialBonuses?: boolean;
54
69
  }
55
70
  export declare const STANDARD_ARRAY: number[];
56
71
  export declare function buildCharacter(name: string, spec: CharacterSpec, owner?: string): SheetState;
57
72
  export declare function lastRaceResult(): RaceApplication;
58
- export declare function lastBackgroundResult(): BackgroundApplication;
59
73
  export declare function lastClassToolResult(): ToolGrantResult;
74
+ export declare function itemUses(name: string, campaign?: Record<string, MagicItem>): GearUses | undefined;
60
75
  export declare function parseItemEntry(entry: string): InventoryItem;
61
76
  export declare function applyClassFeatureUses(state: SheetState): void;
62
77
  export declare function recomputeDerived(state: SheetState): void;
@@ -73,6 +88,8 @@ export declare function recordDeathSave(input: SheetState, roll: number): Mutati
73
88
  export declare function shortRest(input: SheetState, hitDiceToSpend: number, rng?: Rng): MutationResult;
74
89
  export declare function longRest(input: SheetState): MutationResult;
75
90
  export declare function spendResource(input: SheetState, resource: string, amount: number, slotLevel?: number): MutationResult;
91
+ export declare function grantBoon(input: SheetState, boon: BoonEntry): MutationResult;
92
+ export declare function spendBoon(input: SheetState, name: string, rng?: Rng): MutationResult;
76
93
  export declare function addCondition(state: SheetState, name: string, duration?: string): boolean;
77
94
  export declare function removeCondition(state: SheetState, name: string): boolean;
78
95
  export declare function setExhaustion(state: SheetState, level: number): number;
@@ -87,6 +104,16 @@ export interface CoinResult {
87
104
  refusal?: Refusal;
88
105
  }
89
106
  export declare function adjustCoin(state: SheetState, entries: string[]): CoinResult;
107
+ export interface CoinShare {
108
+ entries: string[];
109
+ summary: string;
110
+ }
111
+ export interface CoinDivision {
112
+ shares: CoinShare[];
113
+ total: string;
114
+ refusal?: Refusal;
115
+ }
116
+ export declare function divideCoin(entries: string[], shares: number): CoinDivision;
90
117
  export declare function describeCoin(state: SheetState): string;
91
118
  export declare function setEquipped(state: SheetState, names: string[], equipped: boolean): {
92
119
  changed: string[];