@maka/maka-cli 5.3.16 → 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 (220) hide show
  1. package/bundle/typescript/package.json +1 -1
  2. package/bundle/typescript/src/commands/create.js +1 -1
  3. package/bundle/typescript/src/commands/create.js.map +1 -1
  4. package/bundle/typescript/src/commands/game/sideQuest/archetypes.d.ts +43 -0
  5. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js +131 -0
  6. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js.map +1 -0
  7. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.d.ts +14 -0
  8. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js +79 -0
  9. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js.map +1 -0
  10. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.d.ts +42 -0
  11. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js +224 -0
  12. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js.map +1 -0
  13. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.d.ts +28 -0
  14. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js +101 -0
  15. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js.map +1 -0
  16. package/bundle/typescript/src/commands/game/sideQuest/commands/call.d.ts +19 -0
  17. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js +149 -0
  18. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js.map +1 -0
  19. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.d.ts +58 -0
  20. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js +378 -0
  21. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js.map +1 -0
  22. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.d.ts +11 -1
  23. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +8 -3
  24. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -1
  25. package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +6 -0
  26. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js +4 -0
  27. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js.map +1 -1
  28. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.d.ts +15 -0
  29. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js +60 -0
  30. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js.map +1 -0
  31. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.d.ts +13 -0
  32. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js +31 -0
  33. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js.map +1 -0
  34. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.d.ts +6 -0
  35. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js +27 -0
  36. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js.map +1 -0
  37. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.d.ts +4 -0
  38. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js +40 -0
  39. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js.map +1 -1
  40. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.d.ts +13 -0
  41. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js +43 -0
  42. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js.map +1 -0
  43. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +7 -1
  44. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -1
  45. package/bundle/typescript/src/commands/game/sideQuest/commands/go.d.ts +11 -0
  46. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +115 -4
  47. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
  48. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.d.ts +25 -0
  49. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js +176 -0
  50. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js.map +1 -0
  51. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.d.ts +12 -0
  52. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js +39 -0
  53. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js.map +1 -0
  54. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.d.ts +17 -0
  55. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js +64 -0
  56. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js.map +1 -0
  57. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.d.ts +10 -3
  58. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js +11 -33
  59. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js.map +1 -1
  60. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +35 -4
  61. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
  62. package/bundle/typescript/src/commands/game/sideQuest/commands/map.d.ts +12 -0
  63. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js +46 -0
  64. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js.map +1 -0
  65. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.d.ts +12 -0
  66. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js +55 -0
  67. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js.map +1 -0
  68. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.d.ts +9 -0
  69. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js +18 -0
  70. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js.map +1 -0
  71. package/bundle/typescript/src/commands/game/sideQuest/commands/project.d.ts +19 -0
  72. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js +54 -0
  73. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js.map +1 -0
  74. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js +6 -5
  75. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js.map +1 -1
  76. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.d.ts +12 -0
  77. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js +52 -0
  78. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js.map +1 -0
  79. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.d.ts +14 -0
  80. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js +40 -0
  81. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js.map +1 -0
  82. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.d.ts +15 -0
  83. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js +59 -0
  84. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js.map +1 -0
  85. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +23 -2
  86. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js.map +1 -1
  87. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +20 -3
  88. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js.map +1 -1
  89. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.d.ts +12 -0
  90. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js +49 -0
  91. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js.map +1 -0
  92. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.d.ts +13 -0
  93. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js +50 -0
  94. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js.map +1 -0
  95. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js +32 -11
  96. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js.map +1 -1
  97. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.d.ts +14 -0
  98. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js +65 -0
  99. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js.map +1 -0
  100. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.d.ts +12 -0
  101. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js +41 -0
  102. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js.map +1 -0
  103. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.d.ts +21 -0
  104. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js +43 -0
  105. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js.map +1 -0
  106. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.d.ts +20 -0
  107. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js +45 -0
  108. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js.map +1 -0
  109. package/bundle/typescript/src/commands/game/sideQuest/commands/take.d.ts +8 -0
  110. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +80 -1
  111. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
  112. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js +1 -0
  113. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js.map +1 -1
  114. package/bundle/typescript/src/commands/game/sideQuest/commands/use.d.ts +24 -0
  115. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +101 -1
  116. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
  117. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js +2 -1
  118. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js.map +1 -1
  119. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js +7 -2
  120. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js.map +1 -1
  121. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js +2 -1
  122. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js.map +1 -1
  123. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js +2 -0
  124. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js.map +1 -1
  125. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.d.ts +8 -1
  126. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js +138 -21
  127. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -1
  128. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.d.ts +119 -0
  129. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js +816 -0
  130. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js.map +1 -0
  131. package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +70 -9
  132. package/bundle/typescript/src/commands/game/sideQuest/game.js +403 -164
  133. package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
  134. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.d.ts +16 -0
  135. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js +101 -0
  136. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js.map +1 -0
  137. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.d.ts +15 -0
  138. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js +95 -0
  139. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js.map +1 -0
  140. package/bundle/typescript/src/commands/game/sideQuest/models/door.d.ts +10 -0
  141. package/bundle/typescript/src/commands/game/sideQuest/models/door.js +15 -2
  142. package/bundle/typescript/src/commands/game/sideQuest/models/door.js.map +1 -1
  143. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.d.ts +10 -0
  144. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js +54 -4
  145. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js.map +1 -1
  146. package/bundle/typescript/src/commands/game/sideQuest/models/item.d.ts +41 -0
  147. package/bundle/typescript/src/commands/game/sideQuest/models/item.js +106 -3
  148. package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
  149. package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +25 -0
  150. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +220 -47
  151. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
  152. package/bundle/typescript/src/commands/game/sideQuest/models/player.d.ts +213 -0
  153. package/bundle/typescript/src/commands/game/sideQuest/models/player.js +525 -9
  154. package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
  155. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.d.ts +75 -1
  156. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js +174 -6
  157. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js.map +1 -1
  158. package/bundle/typescript/src/commands/game/sideQuest/models/room.d.ts +20 -0
  159. package/bundle/typescript/src/commands/game/sideQuest/models/room.js +39 -18
  160. package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
  161. package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +69 -0
  162. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +175 -2
  163. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
  164. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +80 -1
  165. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +7 -2
  166. package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.d.ts +1 -0
  167. package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.d.ts +1 -0
  168. package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +1 -0
  169. package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.d.ts +1 -0
  170. package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.d.ts +34 -0
  171. package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.d.ts +15 -1
  172. package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.d.ts +3 -0
  173. package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +5 -0
  174. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.d.ts +15 -0
  175. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js +2 -0
  176. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js.map +1 -0
  177. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.d.ts +1 -0
  178. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js +5 -0
  179. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js.map +1 -1
  180. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.d.ts +1 -0
  181. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js +1 -0
  182. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js.map +1 -1
  183. package/bundle/typescript/src/commands/game/sideQuest/ui.d.ts +3 -0
  184. package/bundle/typescript/src/commands/game/sideQuest/ui.js +95 -5
  185. package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
  186. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.d.ts +60 -0
  187. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js +138 -0
  188. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js.map +1 -0
  189. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.d.ts +143 -0
  190. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js +328 -0
  191. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js.map +1 -0
  192. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.d.ts +2 -0
  193. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js +12 -0
  194. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js.map +1 -0
  195. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.d.ts +22 -0
  196. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js +34 -0
  197. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js.map +1 -0
  198. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.d.ts +36 -0
  199. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js +92 -0
  200. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js.map +1 -0
  201. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.d.ts +44 -0
  202. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js +193 -0
  203. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js.map +1 -0
  204. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.d.ts +16 -0
  205. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js +36 -0
  206. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js.map +1 -0
  207. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +54 -7
  208. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
  209. package/bundle/typescript/src/commands/set/global.sub.cmd.js +59 -5
  210. package/bundle/typescript/src/commands/set/global.sub.cmd.js.map +1 -1
  211. package/bundle/typescript/src/tools/ai/ai.class.d.ts +35 -0
  212. package/bundle/typescript/src/tools/ai/ai.class.js +112 -0
  213. package/bundle/typescript/src/tools/ai/ai.class.js.map +1 -0
  214. package/bundle/typescript/src/tools/fsi/fsi.interfaces.d.ts +1 -0
  215. package/bundle/typescript/src/tools/fsi/fsi.interfaces.js.map +1 -1
  216. package/bundle/typescript/src/tools/https/https.class.d.ts +2 -1
  217. package/bundle/typescript/src/tools/https/https.class.js +43 -0
  218. package/bundle/typescript/src/tools/https/https.class.js.map +1 -1
  219. package/bundle/typescript/src/tools/https/https.interface.d.ts +8 -0
  220. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
+ export type PuzzleBypassType = 'lockpick' | 'hack' | 'spell';
1
2
  export interface IPuzzleSeedJson {
2
3
  name: string;
3
- room: string;
4
+ room?: string;
4
5
  riddle: string;
5
6
  requiredPhrase?: string;
6
7
  requiredItem?: string;
@@ -8,4 +9,17 @@ export interface IPuzzleSeedJson {
8
9
  successMessage?: string;
9
10
  failureMessage?: string;
10
11
  hobbyTags?: string[];
12
+ /** Name of another puzzle in this same scene that must be solved first. */
13
+ requiresPuzzle?: string;
14
+ /** Shown when attempting to solve this puzzle before requiresPuzzle is met. */
15
+ lockedMessage?: string;
16
+ /**
17
+ * Optional risky alternate route to the same reward, matching this
18
+ * barrier's in-fiction nature (a lock -> "pick", a terminal -> "hack", a
19
+ * ward -> "cast") -- a coin-flip chance to bypass without ever knowing
20
+ * requiredPhrase, but a failed attempt is loud (see Puzzle.attemptBypass).
21
+ * Leave unset for a puzzle with no such physical/technical/magical route
22
+ * (e.g. a purely social one, solvable only by knowing the actual answer).
23
+ */
24
+ bypassType?: PuzzleBypassType;
11
25
  }
@@ -7,6 +7,9 @@ export interface IRoomSeedJson {
7
7
  owner?: string;
8
8
  tags?: string[];
9
9
  exits: IExitSeedJson[];
10
+ reachable?: boolean;
11
+ hasNode?: boolean;
12
+ warded?: boolean;
10
13
  supportedLifestyles?: {
11
14
  residenceTiers?: string[];
12
15
  employmentTags?: string[];
@@ -3,6 +3,7 @@ import { INPCSeedJson } from './npc-seed.js';
3
3
  import { IItemSeedJson } from './item-seed.js';
4
4
  import { IPuzzleSeedJson } from './puzzle-seed.js';
5
5
  import { IPlayerSeedJson } from './player-seed.js';
6
+ import { IWinConditionSeedJson } from './win-condition-seed.js';
6
7
  export interface ISceneSeedJson {
7
8
  name: string;
8
9
  currency: {
@@ -17,4 +18,8 @@ export interface ISceneSeedJson {
17
18
  story: string;
18
19
  /** The logging-in player who will be actively controlled */
19
20
  player: IPlayerSeedJson;
21
+ /** Optional -- not authored on the two static scenes. When set, the scene
22
+ * is a "completable" run: meeting it triggers a reward and an offer to
23
+ * continue into a new, harder scene. */
24
+ winCondition?: IWinConditionSeedJson;
20
25
  }
@@ -0,0 +1,15 @@
1
+ export interface IWinConditionSeedJson {
2
+ type: 'give' | 'possess';
3
+ item: string;
4
+ toNpc?: string;
5
+ rewardItem?: string;
6
+ completionMessage: string;
7
+ /**
8
+ * The job's agreed pay in nuyen. The engine ACTUALLY transfers this to
9
+ * the player on completion (certified credstick), and every NPC's AI
10
+ * prompt is told the exact figure so what the fixer promises is what
11
+ * gets paid -- found via a real session where dialogue offered 50k and
12
+ * the seed's loot credstick held 2000.
13
+ */
14
+ payout?: number;
15
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=win-condition-seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"win-condition-seed.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/seed/win-condition-seed.ts"],"names":[],"mappings":""}
@@ -60,6 +60,7 @@ export declare abstract class AbstractDoor {
60
60
  abstract roomB: Room;
61
61
  abstract isLocked: boolean;
62
62
  unlockItemOrSolution?: string;
63
+ puzzle?: Puzzle;
63
64
  abstract logger: Logger;
64
65
  abstract isLockable: boolean;
65
66
  abstract getOtherSide(currentRoom: Room): Room;
@@ -20,6 +20,11 @@ export class AbstractRoom extends EventEmitter {
20
20
  */
21
21
  export class AbstractDoor {
22
22
  unlockItemOrSolution;
23
+ // A door can be guarded by a real Puzzle instead of (or alongside) a
24
+ // physical key -- the only difference from a room's puzzle is that
25
+ // success unlocks the door rather than granting an item. See
26
+ // Door.attachPuzzle().
27
+ puzzle;
23
28
  }
24
29
  /**
25
30
  * The Inventory class represents a collection of items that can be carried by a player or stored
@@ -1 +1 @@
1
- {"version":3,"file":"abstracts.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/abstracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAsBtC;;;GAGG;AACH,MAAM,OAAgB,aAAa;CAkBlC;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAa,SAAQ,YAAY;IAK9C,MAAM,CAAU;CAaxB;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAY;IAKhC,oBAAoB,CAAU;CAQ/B;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAiB;CAWtC;AAED;;;GAGG;AACH,MAAM,OAAgB,YAAY;CAYjC;AAED;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,YAAY;IAOvD;QACE,KAAK,EAAE,CAAC,CAAC,0BAA0B;IACrC,CAAC;CAsBF;AAED;;;;GAIG;AACH,MAAM,OAAgB,cAAc;CAgBnC"}
1
+ {"version":3,"file":"abstracts.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/abstracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAsBtC;;;GAGG;AACH,MAAM,OAAgB,aAAa;CAkBlC;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAa,SAAQ,YAAY;IAK9C,MAAM,CAAU;CAaxB;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAY;IAKhC,oBAAoB,CAAU;IAC9B,qEAAqE;IACrE,mEAAmE;IACnE,6DAA6D;IAC7D,uBAAuB;IACvB,MAAM,CAAU;CAQjB;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAiB;CAWtC;AAED;;;GAGG;AACH,MAAM,OAAgB,YAAY;CAYjC;AAED;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,YAAY;IAOvD;QACE,KAAK,EAAE,CAAC,CAAC,0BAA0B;IACrC,CAAC;CAsBF;AAED;;;;GAIG;AACH,MAAM,OAAgB,cAAc;CAgBnC"}
@@ -46,6 +46,7 @@ export declare enum Category {
46
46
  Clothing = "clothing",
47
47
  ArmorClothing = "armor clothing",
48
48
  Medical = "medical",
49
+ StimPatch = "stim patch",
49
50
  Tool = "tool",
50
51
  Consumable = "consumable",
51
52
  Sensor = "sensor",
@@ -54,6 +54,7 @@ export var Category;
54
54
  Category["Clothing"] = "clothing";
55
55
  Category["ArmorClothing"] = "armor clothing";
56
56
  Category["Medical"] = "medical";
57
+ Category["StimPatch"] = "stim patch";
57
58
  Category["Tool"] = "tool";
58
59
  Category["Consumable"] = "consumable";
59
60
  Category["Sensor"] = "sensor";
@@ -1 +1 @@
1
- {"version":3,"file":"item-enum.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/item-enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,IAMX;AAND,WAAY,IAAI;IACd,qBAAa,CAAA;IACX,uBAAe,CAAA;IACf,yBAAiB,CAAA;IACjB,uBAAe,CAAA;IACf,gCAAwB,CAAA;AAC5B,CAAC,EANW,IAAI,KAAJ,IAAI,QAMf;AAED,MAAM,CAAN,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACf,+BAAqB,CAAA;IACrB,uBAAa,CAAA;IACb,iCAAuB,CAAA;IACvB,0CAAgC,CAAA;AACpC,CAAC,EANW,MAAM,KAAN,MAAM,QAMjB;AAED,MAAM,CAAN,IAAY,QAmEX;AAnED,WAAY,QAAQ;IAClB,SAAS;IACT,6BAAiB,CAAA;IACjB,wCAA4B,CAAA;IAC5B,0CAA8B,CAAA;IAC9B,qCAAyB,CAAA;IACzB,mCAAuB,CAAA;IACvB,oCAAwB,CAAA;IACxB,2BAAe,CAAA;IACf,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,kCAAsB,CAAA;IACtB,kCAAsB,CAAA;IACtB,2BAAe,CAAA;IACf,6BAAiB,CAAA;IAEjB,sCAAsC;IACtC,mCAAuB,CAAA;IACvB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,iCAAqB,CAAA;IAErB,yBAAyB;IACzB,iCAAqB,CAAA;IACrB,mCAAuB,CAAA;IACvB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,uCAA2B,CAAA;IAC3B,oCAAwB,CAAA;IAExB,QAAQ;IACR,2BAAe,CAAA;IACf,0CAA8B,CAAA;IAC9B,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IAErB,mBAAmB;IACnB,iCAAqB,CAAA;IACrB,4CAAgC,CAAA;IAChC,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,oCAAwB,CAAA;IACxB,kDAAsC,CAAA;IACtC,uBAAW,CAAA;IACX,+BAAmB,CAAA;IAEnB,qBAAqB;IACrB,uBAAW,CAAA;IACX,gCAAoB,CAAA;IACpB,+BAAmB,CAAA;IACnB,oDAAwC,CAAA;IACxC,mCAAuB,CAAA;IAEvB,iBAAiB;IACjB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,+BAAmB,CAAA;AACrB,CAAC,EAnEW,QAAQ,KAAR,QAAQ,QAmEnB"}
1
+ {"version":3,"file":"item-enum.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/item-enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,IAMX;AAND,WAAY,IAAI;IACd,qBAAa,CAAA;IACX,uBAAe,CAAA;IACf,yBAAiB,CAAA;IACjB,uBAAe,CAAA;IACf,gCAAwB,CAAA;AAC5B,CAAC,EANW,IAAI,KAAJ,IAAI,QAMf;AAED,MAAM,CAAN,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACf,+BAAqB,CAAA;IACrB,uBAAa,CAAA;IACb,iCAAuB,CAAA;IACvB,0CAAgC,CAAA;AACpC,CAAC,EANW,MAAM,KAAN,MAAM,QAMjB;AAED,MAAM,CAAN,IAAY,QAoEX;AApED,WAAY,QAAQ;IAClB,SAAS;IACT,6BAAiB,CAAA;IACjB,wCAA4B,CAAA;IAC5B,0CAA8B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
5
  useAi: boolean;
6
+ generationNotice?: string;
7
+ /** Archetype name picked at launch -- sets the player's attribute sheet. */
8
+ archetype?: string;
6
9
  }
7
10
  export declare function main(playerName: string, sceneSeed: ISceneSeedJson, options: IMainGameConfig): Promise<void>;
@@ -3,6 +3,10 @@ import { capitalCase } from 'change-case';
3
3
  import Game from './game.js';
4
4
  import { Player, Room, } from './models/_index.js';
5
5
  import { Logger } from './utilities/logger.js';
6
+ import { getArchetype, createArchetypeGear } from './archetypes.js';
7
+ import { Category } from './types/shared/item-enum.js';
8
+ import { STANCE_CYCLE } from './models/player.js';
9
+ import { AutoFight } from './utilities/auto-fight.js';
6
10
  export async function main(playerName, sceneSeed, options) {
7
11
  // Create a screen object
8
12
  const screen = blessed.screen({
@@ -21,19 +25,81 @@ export async function main(playerName, sceneSeed, options) {
21
25
  description: 'A featureless room where lost souls drift.',
22
26
  roomType: 'void'
23
27
  });
24
- const player = new Player({ playerName, startLocation: nexus });
28
+ // The archetype spread picked at launch becomes the player's sheet,
29
+ // and its requisite gear comes with it -- granted on top of the
30
+ // scene's generic loadout, wearables equipped so a samurai starts
31
+ // with the Predator in hand and a Face wearing the good suit.
32
+ const archetype = getArchetype(options.archetype);
33
+ const player = new Player({ playerName, startLocation: nexus, combat: archetype.combat });
34
+ const EQUIP_ON_START = new Set([
35
+ Category.Weapon, Category.MeleeWeapon, Category.RangedWeapon,
36
+ Category.Armor, Category.BodyArmor, Category.ArmorClothing,
37
+ Category.Helmet, Category.Hat, Category.Gloves, Category.Boots, Category.Commlink,
38
+ ]);
39
+ for (const item of createArchetypeGear(archetype)) {
40
+ player.addInventory(item);
41
+ item.owner = playerName;
42
+ if (EQUIP_ON_START.has(item.category)) {
43
+ try {
44
+ player.equip(item);
45
+ }
46
+ catch { /* a second weapon just stays holstered */ }
47
+ }
48
+ }
25
49
  // Create the game instance
26
50
  const game = await Game.getInstance(player, sceneSeed);
27
51
  const ready = await game.init(options, screen);
28
52
  // Print welcome message or initial room description
29
- game.logBox.setContent(ready); // getWelcomeMessage should return the initial game introduction or room description
53
+ const notice = options.generationNotice
54
+ ? `{yellow-fg}${options.generationNotice}{/yellow-fg}\n\n`
55
+ : '';
56
+ game.logBox.setContent(notice + ready); // getWelcomeMessage should return the initial game introduction or room description
30
57
  game.updateEquipment(game.player.equipment);
31
58
  game.updateInventory(game.player.inventory, capitalCase(game.scene.getCurrencyType()));
32
59
  game.updateExits(game.player.currentLocation);
60
+ game.updateStatus();
61
+ // Tab cycles the fight autopilot: manual -> guarded -> aggressive (see
62
+ // utilities/auto-fight.ts; "stance" is the typed twin). Bound on the
63
+ // input box because that's where focus lives during play.
64
+ game.inputBox.key(['tab'], () => {
65
+ // Blessed's textarea reader appends the literal '\t' to the box
66
+ // value on this same keypress (listener order isn't guaranteed
67
+ // either way) -- strip it now AND on the next tick so Tab stays a
68
+ // pure control key.
69
+ const stripTab = () => {
70
+ const v = game.inputBox.getValue();
71
+ if (v.includes('\t')) {
72
+ game.inputBox.setValue(v.replace(/\t/g, ''));
73
+ }
74
+ };
75
+ stripTab();
76
+ setImmediate(() => { stripTab(); screen.render(); });
77
+ const cycle = STANCE_CYCLE;
78
+ const next = cycle[(cycle.indexOf(game.player.autoStance) + 1) % cycle.length];
79
+ game.player.autoStance = next;
80
+ game.autoFight.cancelPending();
81
+ // white for manual, not gray -- gray is ANSI bright-black, illegible
82
+ // on stock dark palettes (same fix as the HUD stance in game.ts).
83
+ const color = next === 'aggressive' ? 'red' : next === 'guarded' ? 'yellow' : 'white';
84
+ gameLog.logWithColor(`⚔ Stance: ${next.toUpperCase()} -- ${AutoFight.describe(next)}.`, color);
85
+ game.updateStatus();
86
+ screen.render();
87
+ });
33
88
  game.inputBox.key(['enter'], () => {
34
89
  void (async () => {
35
90
  try {
36
91
  const input = game.inputBox.getValue();
92
+ // Typing takes over: any submitted command cancels a pending
93
+ // auto-fight action (the interruptible beat -- see
94
+ // utilities/auto-fight.ts). The next settled exchange re-arms it.
95
+ game.autoFight.cancelPending();
96
+ // Clear the box the moment the command is submitted, not after
97
+ // it resolves -- a slow command (combat narration beats, an AI
98
+ // round trip on a call) used to leave the typed text sitting in
99
+ // the box for seconds, and worse, the late clear would wipe
100
+ // whatever the player had started typing NEXT during the wait.
101
+ game.inputBox.clearValue();
102
+ screen.render();
37
103
  const response = await game.handleInput(input); // handleInput is the method that processes commands
38
104
  if (['take', 'equip', 'unequip'].includes(input.split(' ')[0])) {
39
105
  // Example usage: update the inventory with a new list of items
@@ -43,6 +109,11 @@ export async function main(playerName, sceneSeed, options) {
43
109
  if (['go', 'lock', 'unlock'].includes(input.split(' ')[0])) {
44
110
  game.updateExits(game.player.currentLocation);
45
111
  }
112
+ // Unconditional (not gated on the verb typed) since a call can
113
+ // also end on the NPC's own initiative -- this stays in sync
114
+ // with whatever state actually resulted, not just what the
115
+ // player directly asked for.
116
+ game.updateStatus();
46
117
  if (input.split(' ')[0] === 'clear') {
47
118
  game.logBox.setContent('');
48
119
  }
@@ -53,9 +124,28 @@ export async function main(playerName, sceneSeed, options) {
53
124
  process.exit(0); // Exit the game
54
125
  }
55
126
  game.logBox.pushLine(response);
56
- game.logBox.scroll(1);
57
- game.inputBox.clearValue();
58
- game.inputBox.focus();
127
+ game.logBox.scrollTo(game.logBox.getScrollHeight());
128
+ // NEVER blind-focus() the input box here. Blessed's _focus() has
129
+ // no old === el guard, so focusing the box while it's already
130
+ // focused fires a self-blur that cancels the active input reader
131
+ // and starts another -- and because the reader attaches its
132
+ // keypress listener on a DELAYED tick, a fast (all-microtask)
133
+ // command lands this cancel while the previous attach is still
134
+ // pending: the cancel removes nothing, both attaches then land,
135
+ // and the orphaned listener doubles every subsequent keystroke
136
+ // (found via a real session typing "exit" and getting "eexxiitt").
137
+ // The submit path already re-focuses the box internally
138
+ // (rewindFocus), so the common case needs no touch at all; only
139
+ // actually restart things when focus genuinely went elsewhere
140
+ // (e.g. a lockpick/hack minigame took the screen) or reading
141
+ // somehow stopped while still focused.
142
+ const inputBox = game.inputBox;
143
+ if (screen.focused !== inputBox) {
144
+ inputBox.focus();
145
+ }
146
+ else if (!inputBox._reading) {
147
+ inputBox.readInput();
148
+ }
59
149
  screen.render();
60
150
  }
61
151
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../../../../src/commands/game/sideQuest/ui.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,MAAM,EACN,IAAI,GACL,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAU/C,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,UAAkB,EAClB,SAAyB,EACzB,OAAwB;IAExB,yBAAyB;IACzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,2BAA2B;KACnC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAGH,oBAAoB;IACpB,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhE,IAAI,CAAC;QAEH,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC;YACrB,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhE,2BAA2B;QAC3B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CAAC;IAClB,CAAC;AACH,CAAC;AAED,sCAAsC;AACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,mDAAmD;AACnD,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type Game from '../game.js';
2
+ import type { Player, FightStance } from '../models/player.js';
3
+ import type { NPC } from '../models/npc.js';
4
+ /**
5
+ * Fight-or-flight autopilot -- the FIGHT half. The player sets a
6
+ * temperature (Tab in the UI, or the "stance" command) and the game keeps
7
+ * swinging for them; flight stays manual, always, because stopping YOUR
8
+ * swings never stops THEIRS -- the only real defense is the door, and
9
+ * that's the player's call.
10
+ *
11
+ * manual -- today's behavior, every action typed
12
+ * guarded -- auto-fights, but wins non-lethally: switches to subdue
13
+ * when the target is nearly down, and stands down the
14
+ * moment they surrender
15
+ * aggressive -- fights until they're dead; a surrender changes nothing
16
+ *
17
+ * Wiring: CombatExchange.finishExchange() -> Scene.notifyExchangeSettled()
18
+ * -> onExchangeSettled() here. If the player was a combatant and the
19
+ * stance says fight, the next action is scheduled a short, interruptible
20
+ * beat later (REENGAGE_DELAY_MS). Submitting ANY command in the UI cancels
21
+ * the pending action and takes over (see ui.ts) -- the beat exists exactly
22
+ * so fleeing and healing stay possible mid-autofight. Everything is
23
+ * revalidated at fire time: the fight may have ended, moved, or been
24
+ * surrendered out of during the delay.
25
+ *
26
+ * Auto actions lead with whatever hits hardest: a caster whose manabolt
27
+ * out-damages their equipped weapon throws the bolt (and eats the drain);
28
+ * everyone else uses the gun/blade/fists they're holding. A dry gun's
29
+ * refusal (reload prompt) is surfaced to the player and auto simply waits
30
+ * for them to deal with it -- reloading is a decision, not a reflex.
31
+ */
32
+ export declare class AutoFight {
33
+ private game;
34
+ static REENGAGE_DELAY_MS: number;
35
+ private static MANABOLT_POWER;
36
+ private pending?;
37
+ constructor(game: Game);
38
+ /** The pending auto action, dropped. The player typed, or the stance changed. */
39
+ cancelPending(): void;
40
+ /**
41
+ * Called after every combat exchange resolves (player-involved or not).
42
+ * Schedules the player's next action when the autopilot should act.
43
+ */
44
+ onExchangeSettled(combatants: (Player | NPC)[]): void;
45
+ /**
46
+ * The beat elapsed uninterrupted -- act, if the fight still stands.
47
+ * Every guard here re-checks live state: the target may have died, fled,
48
+ * surrendered, or started another exchange during the delay.
49
+ */
50
+ private fire;
51
+ /**
52
+ * Lead with what hits hardest -- except Guarded near the end, which
53
+ * finishes non-lethally: when the target is within a few boxes of death,
54
+ * the next auto action is a subdue (stun damage, bare hands) instead of
55
+ * another killing blow.
56
+ */
57
+ private chooseAction;
58
+ /** One-line HUD/announce description for a stance. */
59
+ static describe(stance: FightStance): string;
60
+ }
@@ -0,0 +1,138 @@
1
+ import { Logger } from './logger.js';
2
+ /**
3
+ * Fight-or-flight autopilot -- the FIGHT half. The player sets a
4
+ * temperature (Tab in the UI, or the "stance" command) and the game keeps
5
+ * swinging for them; flight stays manual, always, because stopping YOUR
6
+ * swings never stops THEIRS -- the only real defense is the door, and
7
+ * that's the player's call.
8
+ *
9
+ * manual -- today's behavior, every action typed
10
+ * guarded -- auto-fights, but wins non-lethally: switches to subdue
11
+ * when the target is nearly down, and stands down the
12
+ * moment they surrender
13
+ * aggressive -- fights until they're dead; a surrender changes nothing
14
+ *
15
+ * Wiring: CombatExchange.finishExchange() -> Scene.notifyExchangeSettled()
16
+ * -> onExchangeSettled() here. If the player was a combatant and the
17
+ * stance says fight, the next action is scheduled a short, interruptible
18
+ * beat later (REENGAGE_DELAY_MS). Submitting ANY command in the UI cancels
19
+ * the pending action and takes over (see ui.ts) -- the beat exists exactly
20
+ * so fleeing and healing stay possible mid-autofight. Everything is
21
+ * revalidated at fire time: the fight may have ended, moved, or been
22
+ * surrendered out of during the delay.
23
+ *
24
+ * Auto actions lead with whatever hits hardest: a caster whose manabolt
25
+ * out-damages their equipped weapon throws the bolt (and eats the drain);
26
+ * everyone else uses the gun/blade/fists they're holding. A dry gun's
27
+ * refusal (reload prompt) is surfaced to the player and auto simply waits
28
+ * for them to deal with it -- reloading is a decision, not a reflex.
29
+ */
30
+ export class AutoFight {
31
+ game;
32
+ static REENGAGE_DELAY_MS = 2000;
33
+ // Manabolt's damage base, mirrored from cast.ts SPELLS (power). Used
34
+ // only for the "what hits hardest" comparison.
35
+ static MANABOLT_POWER = 4;
36
+ pending;
37
+ constructor(game) {
38
+ this.game = game;
39
+ }
40
+ /** The pending auto action, dropped. The player typed, or the stance changed. */
41
+ cancelPending() {
42
+ if (this.pending) {
43
+ clearTimeout(this.pending);
44
+ this.pending = undefined;
45
+ }
46
+ }
47
+ /**
48
+ * Called after every combat exchange resolves (player-involved or not).
49
+ * Schedules the player's next action when the autopilot should act.
50
+ */
51
+ onExchangeSettled(combatants) {
52
+ const player = this.game.player;
53
+ if (!combatants.includes(player))
54
+ return;
55
+ if (player.autoStance === 'manual')
56
+ return;
57
+ const target = combatants.find(c => c !== player);
58
+ if (!target)
59
+ return;
60
+ this.cancelPending();
61
+ this.pending = setTimeout(() => {
62
+ this.pending = undefined;
63
+ void this.fire(target);
64
+ }, AutoFight.REENGAGE_DELAY_MS);
65
+ }
66
+ /**
67
+ * The beat elapsed uninterrupted -- act, if the fight still stands.
68
+ * Every guard here re-checks live state: the target may have died, fled,
69
+ * surrendered, or started another exchange during the delay.
70
+ */
71
+ async fire(target) {
72
+ const player = this.game.player;
73
+ const logger = Logger.getInstance();
74
+ if (player.autoStance === 'manual')
75
+ return;
76
+ if (player.isIncapacitated() || target.isIncapacitated())
77
+ return;
78
+ if (player.currentLocation !== target.currentLocation)
79
+ return;
80
+ // Cross-plane fights don't exist: a dump or a return mid-beat (see
81
+ // utilities/planes.ts) ends the engagement, autopilot included.
82
+ if (player.plane !== target.plane)
83
+ return;
84
+ // A fresh exchange is already in flight -- when IT settles,
85
+ // onExchangeSettled reschedules us. No waiting here.
86
+ if (player.inExchange || target.inExchange)
87
+ return;
88
+ // Guarded honors a surrender -- the fight is over, hold fire. The
89
+ // stand-down is announced once; no reschedule, so the autopilot stays
90
+ // quiet unless violence actually resumes (a new exchange re-arms it).
91
+ if (player.autoStance === 'guarded' && target.surrendered) {
92
+ logger.logWithColor(`⚔ ${target.name} has surrendered -- you hold fire. (guarded)`, 'yellow');
93
+ this.game.updateStatus();
94
+ return;
95
+ }
96
+ const cmd = this.chooseAction(player, target);
97
+ // Cyan, not gray: the autopilot announcing it acted must be legible on
98
+ // stock dark palettes (gray = ANSI bright-black, near-invisible there).
99
+ logger.logWithColor(`⚔ [${player.autoStance}] ${cmd}`, 'cyan');
100
+ const result = await this.game.handleInput(cmd);
101
+ // Player-initiated exchanges self-announce ('' result); anything else
102
+ // (a dry-gun reload prompt, a refusal) is information the player needs.
103
+ if (result) {
104
+ logger.log(result);
105
+ }
106
+ this.game.updateStatus();
107
+ }
108
+ /**
109
+ * Lead with what hits hardest -- except Guarded near the end, which
110
+ * finishes non-lethally: when the target is within a few boxes of death,
111
+ * the next auto action is a subdue (stun damage, bare hands) instead of
112
+ * another killing blow.
113
+ */
114
+ chooseAction(player, target) {
115
+ // Subduing takes real hands (meat plane only); a guarded decker
116
+ // "killing" ice is just crashing a program, and astral entities go
117
+ // down by force -- no non-lethal switch off the meat plane.
118
+ if (player.autoStance === 'guarded' && player.plane === 'meat' &&
119
+ target.maxConditionBoxes - target.damageTaken <= 3) {
120
+ return `subdue ${target.name}`;
121
+ }
122
+ // Magic doesn't compile in the Matrix (see cast.ts); everywhere else,
123
+ // lead with the harder hit.
124
+ if (player.plane !== 'matrix' && player.isCaster() && AutoFight.MANABOLT_POWER > player.getWeaponProfile().damage) {
125
+ return `cast manabolt at ${target.name}`;
126
+ }
127
+ return `attack ${target.name}`;
128
+ }
129
+ /** One-line HUD/announce description for a stance. */
130
+ static describe(stance) {
131
+ switch (stance) {
132
+ case 'manual': return 'you type every action yourself';
133
+ case 'guarded': return 'auto-fight; subdues instead of killing when they are nearly down, holds fire on surrender';
134
+ case 'aggressive': return 'auto-fight to the death; surrender means nothing';
135
+ }
136
+ }
137
+ }
138
+ //# sourceMappingURL=auto-fight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-fight.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/auto-fight.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,SAAS;IASA;IARpB,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAEhC,qEAAqE;IACrE,+CAA+C;IACvC,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC;IAE1B,OAAO,CAAiC;IAEhD,YAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAElC,iFAAiF;IACjF,aAAa;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,UAA4B;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO;QACzC,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ;YAAE,OAAO;QAC3C,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI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