@maka/maka-cli 5.3.17 → 5.4.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 (218) hide show
  1. package/bundle/typescript/package.json +1 -1
  2. package/bundle/typescript/src/commands/game/sideQuest/archetypes.d.ts +43 -0
  3. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js +131 -0
  4. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js.map +1 -0
  5. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.d.ts +14 -0
  6. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js +79 -0
  7. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js.map +1 -0
  8. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.d.ts +42 -0
  9. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js +224 -0
  10. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js.map +1 -0
  11. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.d.ts +28 -0
  12. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js +101 -0
  13. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js.map +1 -0
  14. package/bundle/typescript/src/commands/game/sideQuest/commands/call.d.ts +19 -0
  15. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js +149 -0
  16. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js.map +1 -0
  17. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.d.ts +58 -0
  18. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js +378 -0
  19. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js.map +1 -0
  20. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.d.ts +11 -1
  21. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +8 -3
  22. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -1
  23. package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +6 -0
  24. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js +4 -0
  25. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js.map +1 -1
  26. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.d.ts +15 -0
  27. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js +60 -0
  28. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js.map +1 -0
  29. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.d.ts +13 -0
  30. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js +31 -0
  31. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js.map +1 -0
  32. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.d.ts +6 -0
  33. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js +27 -0
  34. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js.map +1 -0
  35. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.d.ts +4 -0
  36. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js +40 -0
  37. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js.map +1 -1
  38. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.d.ts +13 -0
  39. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js +43 -0
  40. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js.map +1 -0
  41. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +7 -1
  42. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -1
  43. package/bundle/typescript/src/commands/game/sideQuest/commands/go.d.ts +11 -0
  44. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +115 -4
  45. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
  46. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.d.ts +25 -0
  47. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js +176 -0
  48. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js.map +1 -0
  49. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.d.ts +12 -0
  50. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js +39 -0
  51. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js.map +1 -0
  52. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.d.ts +17 -0
  53. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js +64 -0
  54. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js.map +1 -0
  55. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.d.ts +10 -3
  56. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js +11 -33
  57. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js.map +1 -1
  58. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +35 -4
  59. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
  60. package/bundle/typescript/src/commands/game/sideQuest/commands/map.d.ts +12 -0
  61. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js +46 -0
  62. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js.map +1 -0
  63. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.d.ts +12 -0
  64. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js +55 -0
  65. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js.map +1 -0
  66. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.d.ts +9 -0
  67. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js +18 -0
  68. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js.map +1 -0
  69. package/bundle/typescript/src/commands/game/sideQuest/commands/project.d.ts +19 -0
  70. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js +54 -0
  71. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js.map +1 -0
  72. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js +6 -5
  73. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js.map +1 -1
  74. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.d.ts +12 -0
  75. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js +52 -0
  76. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js.map +1 -0
  77. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.d.ts +14 -0
  78. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js +40 -0
  79. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js.map +1 -0
  80. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.d.ts +15 -0
  81. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js +59 -0
  82. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js.map +1 -0
  83. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +23 -2
  84. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js.map +1 -1
  85. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +20 -3
  86. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js.map +1 -1
  87. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.d.ts +12 -0
  88. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js +49 -0
  89. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js.map +1 -0
  90. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.d.ts +13 -0
  91. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js +50 -0
  92. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js.map +1 -0
  93. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js +32 -11
  94. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js.map +1 -1
  95. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.d.ts +14 -0
  96. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js +65 -0
  97. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js.map +1 -0
  98. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.d.ts +12 -0
  99. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js +41 -0
  100. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js.map +1 -0
  101. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.d.ts +21 -0
  102. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js +43 -0
  103. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js.map +1 -0
  104. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.d.ts +20 -0
  105. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js +45 -0
  106. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js.map +1 -0
  107. package/bundle/typescript/src/commands/game/sideQuest/commands/take.d.ts +8 -0
  108. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +80 -1
  109. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
  110. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js +1 -0
  111. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js.map +1 -1
  112. package/bundle/typescript/src/commands/game/sideQuest/commands/use.d.ts +24 -0
  113. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +101 -1
  114. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
  115. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js +2 -1
  116. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js.map +1 -1
  117. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js +7 -2
  118. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js.map +1 -1
  119. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js +2 -1
  120. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js.map +1 -1
  121. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js +2 -0
  122. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js.map +1 -1
  123. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.d.ts +8 -1
  124. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js +138 -21
  125. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -1
  126. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.d.ts +119 -0
  127. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js +816 -0
  128. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js.map +1 -0
  129. package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +70 -9
  130. package/bundle/typescript/src/commands/game/sideQuest/game.js +403 -164
  131. package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
  132. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.d.ts +16 -0
  133. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js +101 -0
  134. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js.map +1 -0
  135. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.d.ts +15 -0
  136. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js +95 -0
  137. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js.map +1 -0
  138. package/bundle/typescript/src/commands/game/sideQuest/models/door.d.ts +10 -0
  139. package/bundle/typescript/src/commands/game/sideQuest/models/door.js +15 -2
  140. package/bundle/typescript/src/commands/game/sideQuest/models/door.js.map +1 -1
  141. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.d.ts +10 -0
  142. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js +54 -4
  143. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js.map +1 -1
  144. package/bundle/typescript/src/commands/game/sideQuest/models/item.d.ts +41 -0
  145. package/bundle/typescript/src/commands/game/sideQuest/models/item.js +106 -3
  146. package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
  147. package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +25 -0
  148. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +220 -47
  149. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
  150. package/bundle/typescript/src/commands/game/sideQuest/models/player.d.ts +213 -0
  151. package/bundle/typescript/src/commands/game/sideQuest/models/player.js +525 -9
  152. package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
  153. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.d.ts +75 -1
  154. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js +174 -6
  155. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js.map +1 -1
  156. package/bundle/typescript/src/commands/game/sideQuest/models/room.d.ts +20 -0
  157. package/bundle/typescript/src/commands/game/sideQuest/models/room.js +39 -18
  158. package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
  159. package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +69 -0
  160. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +175 -2
  161. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
  162. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +80 -1
  163. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +7 -2
  164. package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.d.ts +1 -0
  165. package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.d.ts +1 -0
  166. package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +1 -0
  167. package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.d.ts +1 -0
  168. package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.d.ts +34 -0
  169. package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.d.ts +15 -1
  170. package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.d.ts +3 -0
  171. package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +5 -0
  172. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.d.ts +15 -0
  173. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js +2 -0
  174. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js.map +1 -0
  175. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.d.ts +1 -0
  176. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js +5 -0
  177. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js.map +1 -1
  178. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.d.ts +1 -0
  179. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js +1 -0
  180. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js.map +1 -1
  181. package/bundle/typescript/src/commands/game/sideQuest/ui.d.ts +3 -0
  182. package/bundle/typescript/src/commands/game/sideQuest/ui.js +95 -5
  183. package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
  184. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.d.ts +60 -0
  185. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js +138 -0
  186. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js.map +1 -0
  187. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.d.ts +143 -0
  188. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js +328 -0
  189. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js.map +1 -0
  190. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.d.ts +2 -0
  191. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js +12 -0
  192. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js.map +1 -0
  193. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.d.ts +22 -0
  194. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js +34 -0
  195. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js.map +1 -0
  196. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.d.ts +36 -0
  197. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js +92 -0
  198. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js.map +1 -0
  199. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.d.ts +44 -0
  200. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js +193 -0
  201. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js.map +1 -0
  202. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.d.ts +16 -0
  203. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js +36 -0
  204. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js.map +1 -0
  205. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +54 -7
  206. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
  207. package/bundle/typescript/src/commands/set/global.sub.cmd.js +59 -5
  208. package/bundle/typescript/src/commands/set/global.sub.cmd.js.map +1 -1
  209. package/bundle/typescript/src/tools/ai/ai.class.d.ts +35 -0
  210. package/bundle/typescript/src/tools/ai/ai.class.js +112 -0
  211. package/bundle/typescript/src/tools/ai/ai.class.js.map +1 -0
  212. package/bundle/typescript/src/tools/fsi/fsi.interfaces.d.ts +1 -0
  213. package/bundle/typescript/src/tools/fsi/fsi.interfaces.js.map +1 -1
  214. package/bundle/typescript/src/tools/https/https.class.d.ts +2 -1
  215. package/bundle/typescript/src/tools/https/https.class.js +43 -0
  216. package/bundle/typescript/src/tools/https/https.class.js.map +1 -1
  217. package/bundle/typescript/src/tools/https/https.interface.d.ts +8 -0
  218. package/package.json +1 -1
@@ -0,0 +1,101 @@
1
+ import { Command } from './command.js';
2
+ /**
3
+ * Shared implementation for pick/hack/cast. The gate check (already
4
+ * solved? prerequisite met? does this puzzle even have this bypassType?)
5
+ * always runs first and synchronously, so a doomed attempt never makes the
6
+ * player sit through an interactive challenge they were never going to be
7
+ * allowed to attempt. Each concrete command differs in its verb,
8
+ * description, bypass type, the "nothing to do that to" message, and
9
+ * optionally how the outcome itself gets determined (see
10
+ * determineOutcome() -- defaults to a coin flip; lockpicking overrides it
11
+ * with a real minigame).
12
+ */
13
+ export class BypassCommand extends Command {
14
+ /** Default: a flat coin flip. Override for a type with its own minigame. */
15
+ async determineOutcome() {
16
+ return Math.random() < 0.5;
17
+ }
18
+ /**
19
+ * There's no typed answer here to disambiguate with (unlike solve.ts),
20
+ * so with more than one barrier in the room the player has to name which
21
+ * one: a direction ("pick north", for a locked door) or a word from the
22
+ * barrier's own name ("pick maglock"). With only one candidate, a bare
23
+ * "pick" still works exactly as before.
24
+ */
25
+ resolveTarget(args, targets) {
26
+ const raw = args.join(' ').trim().toLowerCase();
27
+ if (!raw) {
28
+ if (targets.length === 1)
29
+ return { target: targets[0] };
30
+ const options = targets.map(t => t.direction ?? t.label).join(', ');
31
+ return { error: `There's more than one thing to ${this.bypassType === 'lockpick' ? 'pick' : this.bypassType === 'hack' ? 'hack' : 'cast'} at here -- say which: ${options}.` };
32
+ }
33
+ if (this.isValidDirection(raw)) {
34
+ const match = targets.find(t => t.direction === raw);
35
+ return match ? { target: match } : { error: `There's nothing to bypass in that direction.` };
36
+ }
37
+ const matches = targets.filter(t => t.label.toLowerCase().includes(raw));
38
+ if (matches.length === 1)
39
+ return { target: matches[0] };
40
+ if (matches.length > 1)
41
+ return { error: `That could mean more than one thing here -- be more specific.` };
42
+ return { error: `There's nothing here called "${raw}".` };
43
+ }
44
+ async execute(args) {
45
+ const room = this.actor.currentLocation;
46
+ const targets = (room?.getPuzzleTargets() ?? []).filter(t => t.puzzle.bypassType === this.bypassType);
47
+ if (targets.length === 0) {
48
+ return this.noPuzzleMessage;
49
+ }
50
+ const { target, error } = this.resolveTarget(args, targets);
51
+ if (!target) {
52
+ return error ?? this.noPuzzleMessage;
53
+ }
54
+ const gate = target.puzzle.checkBypassGate(this.bypassType);
55
+ if (!gate.allowed) {
56
+ return gate.message ?? `You can't do that here.`;
57
+ }
58
+ const succeeded = await this.determineOutcome();
59
+ const result = target.puzzle.resolveBypass(this.bypassType, succeeded);
60
+ if (result.success) {
61
+ if (target.door) {
62
+ target.door.isLocked = false;
63
+ this.scene.updateExits(room);
64
+ this.scene.addWorldEvent(`${this.actor.name} bypassed (${this.bypassType}) the way ${target.direction} in ${room.name}.`);
65
+ }
66
+ else if (target.puzzle.rewardItem) {
67
+ this.actor.inventory.addItem(target.puzzle.rewardItem);
68
+ this.scene.addWorldEvent(`${this.actor.name} bypassed "${target.puzzle.name}" (${this.bypassType}) in ${room.name}.`);
69
+ this.scene.updateInventory(this.scene.getPlayer().inventory);
70
+ }
71
+ }
72
+ if (result.alarmed) {
73
+ // The consequence for a failed bypass: NPCs already listen for world
74
+ // events (see scene.ts's getWorldEventsSummary()), so this alone lets
75
+ // them react organically without a dedicated alarm/alert subsystem.
76
+ this.scene.addWorldEvent(`${this.actor.name}'s ${this.bypassType} attempt on "${target.puzzle.name}" in ${room.name} went loud.`);
77
+ }
78
+ this.logger.write(`${this.actor.name} attempted to ${this.bypassType} "${target.puzzle.name}": ${result.success ? 'success' : 'failure'}${result.alarmed ? ' (alarmed)' : ''}`);
79
+ this.actor.performAction(this.bypassType, result.message);
80
+ // A failed bypass is instant, unrecoverable death -- there's no partial
81
+ // credit for tripping an alarm or a ward's backlash mid-run. Reuses the
82
+ // same endGame() a player-kill already uses (see kill.ts): freezes
83
+ // input and self-announces directly to the screen, so the fatal reason
84
+ // stays on screen instead of vanishing the instant blessed's alternate
85
+ // buffer tears down. That announcement happens synchronously before
86
+ // this returns, so it renders BEFORE this command's own return value --
87
+ // found via a real session where an immediate process.exit() killed the
88
+ // alternate screen before the player had any chance to read why. Only
89
+ // ends the actual player's session: an NPC has no `game` in its context
90
+ // (see command.ts), so this is a no-op for an NPC's own failed attempt.
91
+ if (result.alarmed && this.game) {
92
+ await this.scene.endGame();
93
+ this.logger.logWithColor(result.message, 'red');
94
+ this.logger.logWithColor(`💀 GAME OVER -- your run ends here.`, 'red');
95
+ this.logger.logWithColor(`Press ctrl-c to quit.`, 'red');
96
+ return '';
97
+ }
98
+ return result.message;
99
+ }
100
+ }
101
+ //# sourceMappingURL=bypass-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bypass-command.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/bypass-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAIjD;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,aAAc,SAAQ,OAAO;IAIjD,4EAA4E;IAClE,KAAK,CAAC,gBAAgB;QAC9B,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CAAC,IAAc,EAAE,OAAuB;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAEhD,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpE,OAAO,EAAE,KAAK,EAAE,kCAAkC,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,0BAA0B,OAAO,GAAG,EAAE,CAAC;QACjL,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B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CAAC;QAED,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import { Command, ICommand } from './command.js';
2
+ export declare class CallCommand extends Command implements ICommand {
3
+ protected static verb: string;
4
+ protected static description: string;
5
+ execute(args: string[]): Promise<string>;
6
+ private hasEquippedCommlink;
7
+ private hasCommlink;
8
+ /**
9
+ * Multi-word names ("Mr. Johnson") shouldn't require the player to quote
10
+ * them just to call someone, and partial names shouldn't fail -- found
11
+ * via real sessions where "call Mr. Johnson" (period parsing), then
12
+ * "call mr" and "call Mr. J" (partials) all bounced. Tries progressively
13
+ * shorter word-prefixes of the input (longest first), resolving each
14
+ * through the same fuzzy matcher "take"/"attack"/"cast" use (punctuation
15
+ * and typo tolerant; an ambiguous fragment deliberately misses).
16
+ * Whatever's left over after the matched name becomes the message.
17
+ */
18
+ private resolveTargetAndMessage;
19
+ }
@@ -0,0 +1,149 @@
1
+ import { Command } from './command.js';
2
+ import { Category } from '../types/shared/item-enum.js';
3
+ import { parseArgsWithQuotes } from './talk.js';
4
+ import { CALL_ICON, CALL_COLOR } from '../utilities/comm-style.js';
5
+ import { FIXER_NAME } from '../factories/scene-seed-generator.js';
6
+ import { fuzzyPickName } from '../utilities/fuzzy-match.js';
7
+ export class CallCommand extends Command {
8
+ static verb = 'call';
9
+ static description = 'Call someone remotely over a commlink (no need to be in the same room; commlink must be equipped).';
10
+ async execute(args) {
11
+ if (!args || args.length === 0) {
12
+ return 'Usage: call <name> [message]';
13
+ }
14
+ const rawWords = parseArgsWithQuotes(args.join(' '));
15
+ if (!this.hasEquippedCommlink(this.actor)) {
16
+ return `You need to equip a commlink before you can call anyone.`;
17
+ }
18
+ // Running silent kills the broadcast both ways (see silent.ts).
19
+ if (this.actor.runningSilent) {
20
+ return `You're running silent -- your link isn't broadcasting. Go loud ("silent") before calling anyone.`;
21
+ }
22
+ // Hacked dark is a different kind of quiet (see hack.ts PAN attacks).
23
+ if (this.actor.arOffline) {
24
+ return `Your AR is CUT -- someone cracked your PAN and your link is dead air. "reboot" first.`;
25
+ }
26
+ const { target, remainingWords } = this.resolveTargetAndMessage(rawWords);
27
+ if (!target) {
28
+ return `You don't know anyone by the name "${rawWords[0]}" to call.`;
29
+ }
30
+ if (target === this.actor) {
31
+ return "You can't call yourself.";
32
+ }
33
+ if (!this.hasCommlink(target)) {
34
+ return `You don't get through -- ${target.name} doesn't seem to have a commlink.`;
35
+ }
36
+ if (target.runningSilent) {
37
+ return `You can't raise ${target.name} -- their link isn't broadcasting. They're running silent.`;
38
+ }
39
+ const message = remainingWords.join(' ');
40
+ const greeting = message || `(calling) You there, ${target.name}?`;
41
+ this.actor.performAction('calls', target.name);
42
+ this.logger.write(`${this.actor.name} calls ${target.name}: "${greeting}"`);
43
+ // Cleanly disconnect any stale prior call on either side before linking
44
+ // the new one -- otherwise a former partner would be left thinking
45
+ // they're still connected (their own "say" would keep routing to
46
+ // someone who's since moved on). See end-call.ts for the explicit
47
+ // version of this same disconnect.
48
+ if (this.actor.activeCallPartner && this.actor.activeCallPartner !== target) {
49
+ this.actor.activeCallPartner.activeCallPartner = undefined;
50
+ }
51
+ if (target.activeCallPartner && target.activeCallPartner !== this.actor) {
52
+ target.activeCallPartner.activeCallPartner = undefined;
53
+ }
54
+ // Symmetric: either side can now reach the other with an ordinary
55
+ // "say", not just this initial hail -- see say.ts. Stays connected
56
+ // until "end-call" (or a new call replaces it, per above).
57
+ this.actor.activeCallPartner = target;
58
+ target.activeCallPartner = this.actor;
59
+ // If the caller is holding this run's win-condition macguffin and
60
+ // calls its intended recipient, treat the call itself as the hand-off.
61
+ // Fixers work deals over comms, not face to face -- there's no in-world
62
+ // reason a physical "give" should ever be required for a job-giver
63
+ // who's meant to be unreachable in person. Resolved synchronously
64
+ // (doesn't depend on the NPC's reply), so it's reflected in this
65
+ // command's own return text right away.
66
+ let deliveryNote = '';
67
+ let deliveredItemName = '';
68
+ const wc = this.scene.getWinCondition();
69
+ if (wc?.type === 'give' && wc.toNpc?.toLowerCase() === target.name.toLowerCase()) {
70
+ const item = this.actor.inventory.getItem(wc.item);
71
+ if (item) {
72
+ const delivered = this.actor.inventory.transferItemTo(item.name, target.inventory);
73
+ if (delivered) {
74
+ this.scene.updateInventory(this.scene.getPlayer().inventory);
75
+ this.scene.checkWinCondition(item.name, target.name);
76
+ deliveryNote = ` You relay that you have the ${item.name} -- consider it delivered.`;
77
+ deliveredItemName = item.name;
78
+ }
79
+ }
80
+ }
81
+ // Fold the delivery into what the NPC actually hears (not just the
82
+ // player-facing confirmation above) -- otherwise an NPC whose reply is
83
+ // AI-generated has no way to know the job's already done, and keeps
84
+ // asking about it on a callback.
85
+ const heardMessage = deliveredItemName
86
+ ? `${greeting} [System note: ${this.actor.name} just delivered "${deliveredItemName}" to you over this call.]`
87
+ : greeting;
88
+ // Deliberately does NOT require sharing a room with the target -- the
89
+ // whole point of a commlink call is reaching someone you can't walk up
90
+ // to (a fixer working from a hideout you'll never set foot in, say).
91
+ // Deliberately NOT awaited: the target's reply (if any) comes from an
92
+ // AI round-trip and announces itself to the screen on its own once it
93
+ // arrives. Awaiting it here would block this confirmation behind that
94
+ // delay, so the reply could render before "You call X" does -- making
95
+ // it look like the call was never actually made.
96
+ void Promise.resolve(target.hear(this.actor, heardMessage)).catch(err => {
97
+ this.logger.error(`${target.name} failed to handle a call from ${this.actor.name}: ${err}`);
98
+ });
99
+ // Calling ${FIXER_NAME} once the job's done is what actually gets you
100
+ // the next one -- the in-fiction equivalent of typing "continue", which
101
+ // still works too as an explicit fallback. Deliberately checks the
102
+ // fixer's identity directly, NOT the win condition's toNpc: a job's
103
+ // "give" target is often a one-off contact ${FIXER_NAME} pointed the
104
+ // runner toward, not ${FIXER_NAME} himself (see the "broker, not always
105
+ // the destination" convention), so it's ${FIXER_NAME} specifically who
106
+ // lines up the next gig, regardless of who this job's delivery went to.
107
+ // Not gated on this call being the one that JUST completed the job:
108
+ // checking in on an already-finished job (e.g. delivered via "give"
109
+ // instead) triggers it just as well. Runs in the background (see
110
+ // Game.draftNextSceneInBackground()) -- job generation can take 20-40+
111
+ // seconds, and this confirmation shouldn't wait behind it.
112
+ if (this.game && this.scene.isCompleted() && target.name === FIXER_NAME) {
113
+ this.game.draftNextSceneInBackground();
114
+ }
115
+ return `{${CALL_COLOR}-fg}${CALL_ICON} You call ${target.name}: "${greeting}"${deliveryNote}{/${CALL_COLOR}-fg}`;
116
+ }
117
+ hasEquippedCommlink(actor) {
118
+ return actor.equipment.head?.commlink != null;
119
+ }
120
+ hasCommlink(actor) {
121
+ const inInventory = actor.inventory.getAllItems().some(item => item.category === Category.Commlink);
122
+ return inInventory || this.hasEquippedCommlink(actor);
123
+ }
124
+ /**
125
+ * Multi-word names ("Mr. Johnson") shouldn't require the player to quote
126
+ * them just to call someone, and partial names shouldn't fail -- found
127
+ * via real sessions where "call Mr. Johnson" (period parsing), then
128
+ * "call mr" and "call Mr. J" (partials) all bounced. Tries progressively
129
+ * shorter word-prefixes of the input (longest first), resolving each
130
+ * through the same fuzzy matcher "take"/"attack"/"cast" use (punctuation
131
+ * and typo tolerant; an ambiguous fragment deliberately misses).
132
+ * Whatever's left over after the matched name becomes the message.
133
+ */
134
+ resolveTargetAndMessage(words) {
135
+ // Includes the caller too, so "call <own name>" resolves into the
136
+ // actual "can't call yourself" check below rather than a confusing
137
+ // "don't know anyone" -- self is never a real target.
138
+ const candidates = [this.actor, ...this.scene.allActors];
139
+ const names = candidates.map(a => a.name);
140
+ for (let i = words.length; i >= 1; i--) {
141
+ const picked = fuzzyPickName(words.slice(0, i).join(' '), names);
142
+ if (picked) {
143
+ return { target: candidates.find(a => a.name === picked), remainingWords: words.slice(i) };
144
+ }
145
+ }
146
+ return { target: undefined, remainingWords: [] };
147
+ }
148
+ }
149
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/call.ts"],"names":[],"mappings":"AAAA,OAAO,EA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,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;;;OASG;IACK,uBAAuB,CAAC,KAAe;QAC7C,kEAAkE;QAClE,mEAAmE;QACnE,sDAAsD;QACtD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAE1C,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YACjE,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,CAAC;QACH,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IACnD,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { BypassCommand } from './bypass-command.js';
2
+ import { PuzzleBypassType } from '../types/seed/puzzle-seed.js';
3
+ /**
4
+ * Gear-driven spellcasting (see Player's magic section): you know a spell
5
+ * if you carry its SpellFormula (or any Grimoire), and the best Focus on
6
+ * you scales the casting pool. "cast <spell> [at <target>]" casts; a bare
7
+ * "cast" (or "cast <direction/barrier>") is still the ward-bypass route
8
+ * inherited from BypassCommand -- now gated on actually having magic gear,
9
+ * instead of being a free-floating coin flip anyone could attempt.
10
+ */
11
+ export declare class CastCommand extends BypassCommand {
12
+ protected static verb: string;
13
+ protected static description: string;
14
+ protected bypassType: PuzzleBypassType;
15
+ protected noPuzzleMessage: string;
16
+ execute(args?: string[]): Promise<string>;
17
+ /**
18
+ * Lenient spell-name matching: the exact key, or a unique fragment of at
19
+ * least 3 characters ("bolt"/"mana" -> manabolt). Anything that doesn't
20
+ * resolve falls through to the ward-bypass path, which is what a
21
+ * direction or barrier name ("cast north", "cast maglock") needs.
22
+ */
23
+ private resolveSpellName;
24
+ private castSpell;
25
+ /**
26
+ * Support spells (heal/armor) default to SELF but can target an ally:
27
+ * "cast heal on jinx". Touch range -- the target must share the room --
28
+ * and the same fuzzy name matching as everything else. Returns an error
29
+ * string instead of a target when the name can't be resolved here.
30
+ */
31
+ private resolveAllyTarget;
32
+ /** How the caster's pool reads in narration: focus-assisted, raw talent, or book-learned. */
33
+ private castingLabel;
34
+ /**
35
+ * Drain, resolved AFTER the spell: resist with Body, take whatever gets
36
+ * through as STUN damage -- casting doesn't cut you, it wrings you out.
37
+ * A full stun track is a knockout, and overflow past it spills into the
38
+ * physical track (enough drain doesn't just put you down, it starts
39
+ * killing you). Callers check drainCollapse() afterward.
40
+ */
41
+ private applyDrain;
42
+ /**
43
+ * What the drain just did to the caster, if anything: overflow filling
44
+ * the physical track is a burnout DEATH; a full stun track alone is a
45
+ * knockout -- out of the run, but honestly narrated as unconsciousness.
46
+ */
47
+ private drainCollapse;
48
+ private castManabolt;
49
+ private castHeal;
50
+ private castArmor;
51
+ /**
52
+ * Non-combat casts are a single block, no exchange pacing needed: the
53
+ * player's own casts return the text for ui.ts to print, while an NPC's
54
+ * cast self-announces to a witnessing player (its return value only ever
55
+ * feeds its AI history) -- same rationale as CombatExchange.
56
+ */
57
+ private finishSpell;
58
+ }