@rpgm-tools/neo-angband-core 0.18.0 → 0.20.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 (946) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/perceive.d.ts.map +1 -1
  3. package/dist/agent/perceive.js +2 -2
  4. package/dist/agent/perceive.js.map +1 -1
  5. package/dist/cmd.d.ts +44 -2
  6. package/dist/cmd.d.ts.map +1 -1
  7. package/dist/cmd.js +59 -3
  8. package/dist/cmd.js.map +1 -1
  9. package/dist/combat/blow-vectors.d.ts +78 -0
  10. package/dist/combat/blow-vectors.d.ts.map +1 -0
  11. package/dist/combat/blow-vectors.fixtures.d.ts +19 -0
  12. package/dist/combat/blow-vectors.fixtures.d.ts.map +1 -0
  13. package/dist/combat/blow-vectors.fixtures.js +81 -0
  14. package/dist/combat/blow-vectors.fixtures.js.map +1 -0
  15. package/dist/combat/blow-vectors.js +195 -0
  16. package/dist/combat/blow-vectors.js.map +1 -0
  17. package/dist/combat/brand-slay.d.ts +22 -9
  18. package/dist/combat/brand-slay.d.ts.map +1 -1
  19. package/dist/combat/brand-slay.js +37 -10
  20. package/dist/combat/brand-slay.js.map +1 -1
  21. package/dist/combat/index.d.ts +1 -1
  22. package/dist/combat/index.js +1 -1
  23. package/dist/combat/melee.d.ts +25 -13
  24. package/dist/combat/melee.d.ts.map +1 -1
  25. package/dist/combat/melee.js +23 -19
  26. package/dist/combat/melee.js.map +1 -1
  27. package/dist/combat/mon-melee.d.ts +166 -7
  28. package/dist/combat/mon-melee.d.ts.map +1 -1
  29. package/dist/combat/mon-melee.js +469 -338
  30. package/dist/combat/mon-melee.js.map +1 -1
  31. package/dist/combat/ranged.d.ts +15 -13
  32. package/dist/combat/ranged.d.ts.map +1 -1
  33. package/dist/combat/ranged.js +31 -29
  34. package/dist/combat/ranged.js.map +1 -1
  35. package/dist/constants.d.ts +14 -0
  36. package/dist/constants.d.ts.map +1 -1
  37. package/dist/constants.js +14 -0
  38. package/dist/constants.js.map +1 -1
  39. package/dist/datafile.d.ts +48 -0
  40. package/dist/datafile.d.ts.map +1 -0
  41. package/dist/datafile.js +102 -0
  42. package/dist/datafile.js.map +1 -0
  43. package/dist/effects/effect-info-registry.d.ts +237 -0
  44. package/dist/effects/effect-info-registry.d.ts.map +1 -0
  45. package/dist/effects/effect-info-registry.js +138 -0
  46. package/dist/effects/effect-info-registry.js.map +1 -0
  47. package/dist/effects/effect-info-vectors.d.ts +92 -0
  48. package/dist/effects/effect-info-vectors.d.ts.map +1 -0
  49. package/dist/effects/effect-info-vectors.fixtures.d.ts +18 -0
  50. package/dist/effects/effect-info-vectors.fixtures.d.ts.map +1 -0
  51. package/dist/effects/effect-info-vectors.fixtures.js +51 -0
  52. package/dist/effects/effect-info-vectors.fixtures.js.map +1 -0
  53. package/dist/effects/effect-info-vectors.js +315 -0
  54. package/dist/effects/effect-info-vectors.js.map +1 -0
  55. package/dist/effects/effect-info.d.ts +5 -1
  56. package/dist/effects/effect-info.d.ts.map +1 -1
  57. package/dist/effects/effect-info.js +245 -143
  58. package/dist/effects/effect-info.js.map +1 -1
  59. package/dist/effects/effect.d.ts +4 -3
  60. package/dist/effects/effect.d.ts.map +1 -1
  61. package/dist/effects/effect.js +88 -70
  62. package/dist/effects/effect.js.map +1 -1
  63. package/dist/effects/handlers.d.ts +1 -1
  64. package/dist/effects/handlers.d.ts.map +1 -1
  65. package/dist/effects/handlers.js +5 -2
  66. package/dist/effects/handlers.js.map +1 -1
  67. package/dist/effects/interpreter.d.ts +11 -0
  68. package/dist/effects/interpreter.d.ts.map +1 -1
  69. package/dist/effects/interpreter.js +13 -0
  70. package/dist/effects/interpreter.js.map +1 -1
  71. package/dist/game/cave-cmd.d.ts +9 -5
  72. package/dist/game/cave-cmd.d.ts.map +1 -1
  73. package/dist/game/cave-cmd.js +56 -11
  74. package/dist/game/cave-cmd.js.map +1 -1
  75. package/dist/game/cave-square.d.ts +42 -0
  76. package/dist/game/cave-square.d.ts.map +1 -0
  77. package/dist/game/cave-square.js +73 -0
  78. package/dist/game/cave-square.js.map +1 -0
  79. package/dist/game/char-sheet.d.ts +12 -8
  80. package/dist/game/char-sheet.d.ts.map +1 -1
  81. package/dist/game/char-sheet.js +41 -8
  82. package/dist/game/char-sheet.js.map +1 -1
  83. package/dist/game/chest.d.ts +2 -3
  84. package/dist/game/chest.d.ts.map +1 -1
  85. package/dist/game/chest.js +17 -6
  86. package/dist/game/chest.js.map +1 -1
  87. package/dist/game/context.d.ts +244 -22
  88. package/dist/game/context.d.ts.map +1 -1
  89. package/dist/game/context.js +109 -17
  90. package/dist/game/context.js.map +1 -1
  91. package/dist/game/describe.d.ts +13 -0
  92. package/dist/game/describe.d.ts.map +1 -1
  93. package/dist/game/describe.js +32 -4
  94. package/dist/game/describe.js.map +1 -1
  95. package/dist/game/display.d.ts +123 -8
  96. package/dist/game/display.d.ts.map +1 -1
  97. package/dist/game/display.js +273 -35
  98. package/dist/game/display.js.map +1 -1
  99. package/dist/game/dump-level.d.ts +1 -1
  100. package/dist/game/dump-level.d.ts.map +1 -1
  101. package/dist/game/dump-level.js +4 -3
  102. package/dist/game/dump-level.js.map +1 -1
  103. package/dist/game/effect-attack.d.ts.map +1 -1
  104. package/dist/game/effect-attack.js +37 -30
  105. package/dist/game/effect-attack.js.map +1 -1
  106. package/dist/game/effect-detect.d.ts +4 -4
  107. package/dist/game/effect-detect.d.ts.map +1 -1
  108. package/dist/game/effect-detect.js +42 -9
  109. package/dist/game/effect-detect.js.map +1 -1
  110. package/dist/game/effect-env.d.ts +7 -1
  111. package/dist/game/effect-env.d.ts.map +1 -1
  112. package/dist/game/effect-env.js +1 -0
  113. package/dist/game/effect-env.js.map +1 -1
  114. package/dist/game/effect-general.d.ts +5 -3
  115. package/dist/game/effect-general.d.ts.map +1 -1
  116. package/dist/game/effect-general.js +99 -47
  117. package/dist/game/effect-general.js.map +1 -1
  118. package/dist/game/effect-item.d.ts +2 -1
  119. package/dist/game/effect-item.d.ts.map +1 -1
  120. package/dist/game/effect-item.js +146 -86
  121. package/dist/game/effect-item.js.map +1 -1
  122. package/dist/game/effect-melee.d.ts +10 -4
  123. package/dist/game/effect-melee.d.ts.map +1 -1
  124. package/dist/game/effect-melee.js +44 -19
  125. package/dist/game/effect-melee.js.map +1 -1
  126. package/dist/game/effect-monster.d.ts +26 -4
  127. package/dist/game/effect-monster.d.ts.map +1 -1
  128. package/dist/game/effect-monster.js +52 -9
  129. package/dist/game/effect-monster.js.map +1 -1
  130. package/dist/game/effect-teleport.d.ts +58 -19
  131. package/dist/game/effect-teleport.d.ts.map +1 -1
  132. package/dist/game/effect-teleport.js +153 -28
  133. package/dist/game/effect-teleport.js.map +1 -1
  134. package/dist/game/effect-terrain.d.ts +2 -4
  135. package/dist/game/effect-terrain.d.ts.map +1 -1
  136. package/dist/game/effect-terrain.js +39 -23
  137. package/dist/game/effect-terrain.js.map +1 -1
  138. package/dist/game/equip-cmp.d.ts +17 -6
  139. package/dist/game/equip-cmp.d.ts.map +1 -1
  140. package/dist/game/equip-cmp.js +53 -31
  141. package/dist/game/equip-cmp.js.map +1 -1
  142. package/dist/game/floor.d.ts +48 -4
  143. package/dist/game/floor.d.ts.map +1 -1
  144. package/dist/game/floor.js +64 -4
  145. package/dist/game/floor.js.map +1 -1
  146. package/dist/game/gear.d.ts +118 -16
  147. package/dist/game/gear.d.ts.map +1 -1
  148. package/dist/game/gear.js +185 -26
  149. package/dist/game/gear.js.map +1 -1
  150. package/dist/game/harness.d.ts +2 -1
  151. package/dist/game/harness.d.ts.map +1 -1
  152. package/dist/game/harness.js +12 -1
  153. package/dist/game/harness.js.map +1 -1
  154. package/dist/game/ignore-cmd.d.ts +47 -8
  155. package/dist/game/ignore-cmd.d.ts.map +1 -1
  156. package/dist/game/ignore-cmd.js +76 -8
  157. package/dist/game/ignore-cmd.js.map +1 -1
  158. package/dist/game/inscription-confirm.d.ts +13 -6
  159. package/dist/game/inscription-confirm.d.ts.map +1 -1
  160. package/dist/game/inscription-confirm.js +13 -6
  161. package/dist/game/inscription-confirm.js.map +1 -1
  162. package/dist/game/known.d.ts +254 -40
  163. package/dist/game/known.d.ts.map +1 -1
  164. package/dist/game/known.js +382 -80
  165. package/dist/game/known.js.map +1 -1
  166. package/dist/game/loop.d.ts +4 -3
  167. package/dist/game/loop.d.ts.map +1 -1
  168. package/dist/game/loop.js +49 -29
  169. package/dist/game/loop.js.map +1 -1
  170. package/dist/game/lore-color.d.ts.map +1 -1
  171. package/dist/game/lore-color.js +13 -1
  172. package/dist/game/lore-color.js.map +1 -1
  173. package/dist/game/mon-cast.d.ts +3 -4
  174. package/dist/game/mon-cast.d.ts.map +1 -1
  175. package/dist/game/mon-cast.js +39 -7
  176. package/dist/game/mon-cast.js.map +1 -1
  177. package/dist/game/mon-cmd.d.ts +4 -5
  178. package/dist/game/mon-cmd.d.ts.map +1 -1
  179. package/dist/game/mon-cmd.js +83 -33
  180. package/dist/game/mon-cmd.js.map +1 -1
  181. package/dist/game/mon-death.d.ts +8 -4
  182. package/dist/game/mon-death.d.ts.map +1 -1
  183. package/dist/game/mon-death.js +6 -9
  184. package/dist/game/mon-death.js.map +1 -1
  185. package/dist/game/mon-group.d.ts +9 -5
  186. package/dist/game/mon-group.d.ts.map +1 -1
  187. package/dist/game/mon-group.js +9 -5
  188. package/dist/game/mon-group.js.map +1 -1
  189. package/dist/game/mon-message.d.ts +90 -40
  190. package/dist/game/mon-message.d.ts.map +1 -1
  191. package/dist/game/mon-message.js +266 -59
  192. package/dist/game/mon-message.js.map +1 -1
  193. package/dist/game/mon-place.d.ts +11 -1
  194. package/dist/game/mon-place.d.ts.map +1 -1
  195. package/dist/game/mon-place.js +15 -3
  196. package/dist/game/mon-place.js.map +1 -1
  197. package/dist/game/mon-ranged.d.ts +2 -1
  198. package/dist/game/mon-ranged.d.ts.map +1 -1
  199. package/dist/game/mon-ranged.js +11 -5
  200. package/dist/game/mon-ranged.js.map +1 -1
  201. package/dist/game/mon-side.d.ts +3 -2
  202. package/dist/game/mon-side.d.ts.map +1 -1
  203. package/dist/game/mon-side.js +19 -21
  204. package/dist/game/mon-side.js.map +1 -1
  205. package/dist/game/monster-turn.d.ts +24 -11
  206. package/dist/game/monster-turn.d.ts.map +1 -1
  207. package/dist/game/monster-turn.js +118 -87
  208. package/dist/game/monster-turn.js.map +1 -1
  209. package/dist/game/notice.d.ts +36 -0
  210. package/dist/game/notice.d.ts.map +1 -0
  211. package/dist/game/notice.js +79 -0
  212. package/dist/game/notice.js.map +1 -0
  213. package/dist/game/obj-cmd.d.ts +14 -3
  214. package/dist/game/obj-cmd.d.ts.map +1 -1
  215. package/dist/game/obj-cmd.js +130 -38
  216. package/dist/game/obj-cmd.js.map +1 -1
  217. package/dist/game/obj-list.d.ts +13 -2
  218. package/dist/game/obj-list.d.ts.map +1 -1
  219. package/dist/game/obj-list.js +42 -27
  220. package/dist/game/obj-list.js.map +1 -1
  221. package/dist/game/object-inspect.d.ts +9 -0
  222. package/dist/game/object-inspect.d.ts.map +1 -1
  223. package/dist/game/object-inspect.js +4 -0
  224. package/dist/game/object-inspect.js.map +1 -1
  225. package/dist/game/pickup.d.ts +0 -2
  226. package/dist/game/pickup.d.ts.map +1 -1
  227. package/dist/game/pickup.js +18 -3
  228. package/dist/game/pickup.js.map +1 -1
  229. package/dist/game/player-side-vectors.d.ts +174 -0
  230. package/dist/game/player-side-vectors.d.ts.map +1 -0
  231. package/dist/game/player-side-vectors.fixtures.d.ts +33 -0
  232. package/dist/game/player-side-vectors.fixtures.d.ts.map +1 -0
  233. package/dist/game/player-side-vectors.fixtures.js +191 -0
  234. package/dist/game/player-side-vectors.fixtures.js.map +1 -0
  235. package/dist/game/player-side-vectors.js +292 -0
  236. package/dist/game/player-side-vectors.js.map +1 -0
  237. package/dist/game/player-side.d.ts +129 -1
  238. package/dist/game/player-side.d.ts.map +1 -1
  239. package/dist/game/player-side.js +520 -338
  240. package/dist/game/player-side.js.map +1 -1
  241. package/dist/game/player-turn.d.ts +27 -7
  242. package/dist/game/player-turn.d.ts.map +1 -1
  243. package/dist/game/player-turn.js +181 -34
  244. package/dist/game/player-turn.js.map +1 -1
  245. package/dist/game/poly.d.ts +38 -0
  246. package/dist/game/poly.d.ts.map +1 -0
  247. package/dist/game/poly.js +82 -0
  248. package/dist/game/poly.js.map +1 -0
  249. package/dist/game/project-cast.d.ts +20 -3
  250. package/dist/game/project-cast.d.ts.map +1 -1
  251. package/dist/game/project-cast.js +58 -6
  252. package/dist/game/project-cast.js.map +1 -1
  253. package/dist/game/project-feat-vectors.d.ts +124 -0
  254. package/dist/game/project-feat-vectors.d.ts.map +1 -0
  255. package/dist/game/project-feat-vectors.fixtures.d.ts +13 -0
  256. package/dist/game/project-feat-vectors.fixtures.d.ts.map +1 -0
  257. package/dist/game/project-feat-vectors.fixtures.js +94 -0
  258. package/dist/game/project-feat-vectors.fixtures.js.map +1 -0
  259. package/dist/game/project-feat-vectors.js +229 -0
  260. package/dist/game/project-feat-vectors.js.map +1 -0
  261. package/dist/game/project-feat.d.ts +53 -1
  262. package/dist/game/project-feat.d.ts.map +1 -1
  263. package/dist/game/project-feat.js +374 -247
  264. package/dist/game/project-feat.js.map +1 -1
  265. package/dist/game/project-monster.d.ts +31 -8
  266. package/dist/game/project-monster.d.ts.map +1 -1
  267. package/dist/game/project-monster.js +56 -23
  268. package/dist/game/project-monster.js.map +1 -1
  269. package/dist/game/project-obj.d.ts +62 -0
  270. package/dist/game/project-obj.d.ts.map +1 -1
  271. package/dist/game/project-obj.js +72 -41
  272. package/dist/game/project-obj.js.map +1 -1
  273. package/dist/game/project-player.d.ts +8 -0
  274. package/dist/game/project-player.d.ts.map +1 -1
  275. package/dist/game/project-player.js.map +1 -1
  276. package/dist/game/projection-handlers.d.ts +89 -0
  277. package/dist/game/projection-handlers.d.ts.map +1 -0
  278. package/dist/game/projection-handlers.js +101 -0
  279. package/dist/game/projection-handlers.js.map +1 -0
  280. package/dist/game/quest.d.ts +23 -0
  281. package/dist/game/quest.d.ts.map +1 -1
  282. package/dist/game/quest.js +42 -0
  283. package/dist/game/quest.js.map +1 -1
  284. package/dist/game/ranged-cmd.d.ts +13 -2
  285. package/dist/game/ranged-cmd.d.ts.map +1 -1
  286. package/dist/game/ranged-cmd.js +38 -17
  287. package/dist/game/ranged-cmd.js.map +1 -1
  288. package/dist/game/repeat.d.ts +115 -0
  289. package/dist/game/repeat.d.ts.map +1 -0
  290. package/dist/game/repeat.js +111 -0
  291. package/dist/game/repeat.js.map +1 -0
  292. package/dist/game/shape-inspect.d.ts +74 -0
  293. package/dist/game/shape-inspect.d.ts.map +1 -0
  294. package/dist/game/shape-inspect.js +114 -0
  295. package/dist/game/shape-inspect.js.map +1 -0
  296. package/dist/game/spell-cmd.d.ts +15 -4
  297. package/dist/game/spell-cmd.d.ts.map +1 -1
  298. package/dist/game/spell-cmd.js +35 -6
  299. package/dist/game/spell-cmd.js.map +1 -1
  300. package/dist/game/spoil.d.ts.map +1 -1
  301. package/dist/game/spoil.js +90 -41
  302. package/dist/game/spoil.js.map +1 -1
  303. package/dist/game/steal.d.ts +3 -3
  304. package/dist/game/steal.d.ts.map +1 -1
  305. package/dist/game/steal.js +9 -4
  306. package/dist/game/steal.js.map +1 -1
  307. package/dist/game/take-hit-hooks.d.ts.map +1 -1
  308. package/dist/game/take-hit-hooks.js +4 -12
  309. package/dist/game/take-hit-hooks.js.map +1 -1
  310. package/dist/game/target-loop.d.ts +23 -12
  311. package/dist/game/target-loop.d.ts.map +1 -1
  312. package/dist/game/target-loop.js +55 -20
  313. package/dist/game/target-loop.js.map +1 -1
  314. package/dist/game/target.d.ts +4 -4
  315. package/dist/game/target.d.ts.map +1 -1
  316. package/dist/game/target.js +19 -8
  317. package/dist/game/target.js.map +1 -1
  318. package/dist/game/ui-entry-registry.d.ts +124 -0
  319. package/dist/game/ui-entry-registry.d.ts.map +1 -0
  320. package/dist/game/ui-entry-registry.js +102 -0
  321. package/dist/game/ui-entry-registry.js.map +1 -0
  322. package/dist/game/ui-entry.d.ts +153 -24
  323. package/dist/game/ui-entry.d.ts.map +1 -1
  324. package/dist/game/ui-entry.js +656 -333
  325. package/dist/game/ui-entry.js.map +1 -1
  326. package/dist/game/wizard.d.ts +47 -25
  327. package/dist/game/wizard.d.ts.map +1 -1
  328. package/dist/game/wizard.js +123 -37
  329. package/dist/game/wizard.js.map +1 -1
  330. package/dist/game/world.d.ts.map +1 -1
  331. package/dist/game/world.js +6 -0
  332. package/dist/game/world.js.map +1 -1
  333. package/dist/gen/cave.d.ts +49 -8
  334. package/dist/gen/cave.d.ts.map +1 -1
  335. package/dist/gen/cave.js +200 -28
  336. package/dist/gen/cave.js.map +1 -1
  337. package/dist/gen/gen-monster.d.ts +4 -2
  338. package/dist/gen/gen-monster.d.ts.map +1 -1
  339. package/dist/gen/gen-monster.js +11 -8
  340. package/dist/gen/gen-monster.js.map +1 -1
  341. package/dist/gen/generate.d.ts +54 -9
  342. package/dist/gen/generate.d.ts.map +1 -1
  343. package/dist/gen/generate.js +55 -8
  344. package/dist/gen/generate.js.map +1 -1
  345. package/dist/gen/glyph-vectors.d.ts +109 -0
  346. package/dist/gen/glyph-vectors.d.ts.map +1 -0
  347. package/dist/gen/glyph-vectors.fixtures.d.ts +18 -0
  348. package/dist/gen/glyph-vectors.fixtures.d.ts.map +1 -0
  349. package/dist/gen/glyph-vectors.fixtures.js +94 -0
  350. package/dist/gen/glyph-vectors.fixtures.js.map +1 -0
  351. package/dist/gen/glyph-vectors.js +218 -0
  352. package/dist/gen/glyph-vectors.js.map +1 -0
  353. package/dist/gen/glyph.d.ts +104 -0
  354. package/dist/gen/glyph.d.ts.map +1 -0
  355. package/dist/gen/glyph.js +72 -0
  356. package/dist/gen/glyph.js.map +1 -0
  357. package/dist/gen/room.d.ts +26 -2
  358. package/dist/gen/room.d.ts.map +1 -1
  359. package/dist/gen/room.js +414 -264
  360. package/dist/gen/room.js.map +1 -1
  361. package/dist/gen/util.d.ts +12 -3
  362. package/dist/gen/util.d.ts.map +1 -1
  363. package/dist/gen/util.js +31 -9
  364. package/dist/gen/util.js.map +1 -1
  365. package/dist/i18n/i18n.d.ts +207 -0
  366. package/dist/i18n/i18n.d.ts.map +1 -0
  367. package/dist/i18n/i18n.js +405 -0
  368. package/dist/i18n/i18n.js.map +1 -0
  369. package/dist/i18n/text.d.ts +62 -0
  370. package/dist/i18n/text.d.ts.map +1 -0
  371. package/dist/i18n/text.js +120 -0
  372. package/dist/i18n/text.js.map +1 -0
  373. package/dist/index.d.ts +26 -0
  374. package/dist/index.d.ts.map +1 -1
  375. package/dist/index.js +42 -0
  376. package/dist/index.js.map +1 -1
  377. package/dist/mod/extension.d.ts +135 -0
  378. package/dist/mod/extension.d.ts.map +1 -0
  379. package/dist/mod/extension.js +95 -0
  380. package/dist/mod/extension.js.map +1 -0
  381. package/dist/mod/ids.d.ts +22 -0
  382. package/dist/mod/ids.d.ts.map +1 -1
  383. package/dist/mod/ids.js +196 -22
  384. package/dist/mod/ids.js.map +1 -1
  385. package/dist/mod/message-declarations.d.ts +132 -0
  386. package/dist/mod/message-declarations.d.ts.map +1 -0
  387. package/dist/mod/message-declarations.js +223 -0
  388. package/dist/mod/message-declarations.js.map +1 -0
  389. package/dist/mod/record-keys.d.ts +44 -0
  390. package/dist/mod/record-keys.d.ts.map +1 -0
  391. package/dist/mod/record-keys.js +101 -0
  392. package/dist/mod/record-keys.js.map +1 -0
  393. package/dist/mod/registry-host.d.ts +639 -1
  394. package/dist/mod/registry-host.d.ts.map +1 -1
  395. package/dist/mod/registry-host.js +408 -1
  396. package/dist/mod/registry-host.js.map +1 -1
  397. package/dist/mod/save-blocks.d.ts +8 -3
  398. package/dist/mod/save-blocks.d.ts.map +1 -1
  399. package/dist/mod/save-blocks.js +153 -14
  400. package/dist/mod/save-blocks.js.map +1 -1
  401. package/dist/mon/bind.d.ts +5 -0
  402. package/dist/mon/bind.d.ts.map +1 -1
  403. package/dist/mon/bind.js +18 -13
  404. package/dist/mon/bind.js.map +1 -1
  405. package/dist/mon/knowledge-groups.d.ts +0 -6
  406. package/dist/mon/knowledge-groups.d.ts.map +1 -1
  407. package/dist/mon/knowledge-groups.js +13 -9
  408. package/dist/mon/knowledge-groups.js.map +1 -1
  409. package/dist/mon/lore-describe.d.ts +46 -10
  410. package/dist/mon/lore-describe.d.ts.map +1 -1
  411. package/dist/mon/lore-describe.js +77 -24
  412. package/dist/mon/lore-describe.js.map +1 -1
  413. package/dist/mon/lore-file.d.ts +126 -0
  414. package/dist/mon/lore-file.d.ts.map +1 -0
  415. package/dist/mon/lore-file.js +301 -0
  416. package/dist/mon/lore-file.js.map +1 -0
  417. package/dist/mon/lore.d.ts +15 -3
  418. package/dist/mon/lore.d.ts.map +1 -1
  419. package/dist/mon/lore.js +19 -6
  420. package/dist/mon/lore.js.map +1 -1
  421. package/dist/mon/make.d.ts +4 -2
  422. package/dist/mon/make.d.ts.map +1 -1
  423. package/dist/mon/make.js +4 -2
  424. package/dist/mon/make.js.map +1 -1
  425. package/dist/mon/monster.d.ts +1 -1
  426. package/dist/mon/monster.js +1 -1
  427. package/dist/mon/predicate.d.ts +14 -9
  428. package/dist/mon/predicate.d.ts.map +1 -1
  429. package/dist/mon/predicate.js +17 -11
  430. package/dist/mon/predicate.js.map +1 -1
  431. package/dist/mon/project-mon.d.ts +64 -7
  432. package/dist/mon/project-mon.d.ts.map +1 -1
  433. package/dist/mon/project-mon.js +61 -9
  434. package/dist/mon/project-mon.js.map +1 -1
  435. package/dist/mon/spell-declarations.d.ts +44 -0
  436. package/dist/mon/spell-declarations.d.ts.map +1 -0
  437. package/dist/mon/spell-declarations.js +57 -0
  438. package/dist/mon/spell-declarations.js.map +1 -0
  439. package/dist/mon/spell-registry.d.ts +136 -0
  440. package/dist/mon/spell-registry.d.ts.map +1 -0
  441. package/dist/mon/spell-registry.js +178 -0
  442. package/dist/mon/spell-registry.js.map +1 -0
  443. package/dist/mon/spell.js +2 -2
  444. package/dist/mon/spell.js.map +1 -1
  445. package/dist/mon/steal.d.ts +31 -4
  446. package/dist/mon/steal.d.ts.map +1 -1
  447. package/dist/mon/steal.js +20 -7
  448. package/dist/mon/steal.js.map +1 -1
  449. package/dist/mon/take-hit.d.ts +8 -3
  450. package/dist/mon/take-hit.d.ts.map +1 -1
  451. package/dist/mon/take-hit.js +8 -3
  452. package/dist/mon/take-hit.js.map +1 -1
  453. package/dist/mon/timed.d.ts +15 -9
  454. package/dist/mon/timed.d.ts.map +1 -1
  455. package/dist/mon/timed.js +13 -8
  456. package/dist/mon/timed.js.map +1 -1
  457. package/dist/mon/types.d.ts +23 -5
  458. package/dist/mon/types.d.ts.map +1 -1
  459. package/dist/mon/types.js +18 -1
  460. package/dist/mon/types.js.map +1 -1
  461. package/dist/msg.d.ts +66 -1
  462. package/dist/msg.d.ts.map +1 -1
  463. package/dist/msg.js +69 -1
  464. package/dist/msg.js.map +1 -1
  465. package/dist/obj/artifact-fake.d.ts +47 -15
  466. package/dist/obj/artifact-fake.d.ts.map +1 -1
  467. package/dist/obj/artifact-fake.js +47 -18
  468. package/dist/obj/artifact-fake.js.map +1 -1
  469. package/dist/obj/artifact-known.d.ts +4 -4
  470. package/dist/obj/artifact-known.js +3 -3
  471. package/dist/obj/bind.d.ts +25 -2
  472. package/dist/obj/bind.d.ts.map +1 -1
  473. package/dist/obj/bind.js +54 -13
  474. package/dist/obj/bind.js.map +1 -1
  475. package/dist/obj/desc-vectors.d.ts +68 -0
  476. package/dist/obj/desc-vectors.d.ts.map +1 -0
  477. package/dist/obj/desc-vectors.fixtures.d.ts +12 -0
  478. package/dist/obj/desc-vectors.fixtures.d.ts.map +1 -0
  479. package/dist/obj/desc-vectors.fixtures.js +95 -0
  480. package/dist/obj/desc-vectors.fixtures.js.map +1 -0
  481. package/dist/obj/desc-vectors.js +86 -0
  482. package/dist/obj/desc-vectors.js.map +1 -0
  483. package/dist/obj/desc.d.ts +17 -2
  484. package/dist/obj/desc.d.ts.map +1 -1
  485. package/dist/obj/desc.js +129 -54
  486. package/dist/obj/desc.js.map +1 -1
  487. package/dist/obj/effects-info.d.ts.map +1 -1
  488. package/dist/obj/effects-info.js +87 -58
  489. package/dist/obj/effects-info.js.map +1 -1
  490. package/dist/obj/fake-object.d.ts +70 -0
  491. package/dist/obj/fake-object.d.ts.map +1 -0
  492. package/dist/obj/fake-object.js +104 -0
  493. package/dist/obj/fake-object.js.map +1 -0
  494. package/dist/obj/ignore.d.ts +55 -12
  495. package/dist/obj/ignore.d.ts.map +1 -1
  496. package/dist/obj/ignore.js +68 -31
  497. package/dist/obj/ignore.js.map +1 -1
  498. package/dist/obj/knowledge.d.ts +48 -5
  499. package/dist/obj/knowledge.d.ts.map +1 -1
  500. package/dist/obj/knowledge.js +171 -153
  501. package/dist/obj/knowledge.js.map +1 -1
  502. package/dist/obj/known-object.d.ts +68 -8
  503. package/dist/obj/known-object.d.ts.map +1 -1
  504. package/dist/obj/known-object.js +90 -10
  505. package/dist/obj/known-object.js.map +1 -1
  506. package/dist/obj/make.d.ts +16 -5
  507. package/dist/obj/make.d.ts.map +1 -1
  508. package/dist/obj/make.js +52 -30
  509. package/dist/obj/make.js.map +1 -1
  510. package/dist/obj/object-info.d.ts +11 -1
  511. package/dist/obj/object-info.d.ts.map +1 -1
  512. package/dist/obj/object-info.js +94 -8
  513. package/dist/obj/object-info.js.map +1 -1
  514. package/dist/obj/object.d.ts +50 -5
  515. package/dist/obj/object.d.ts.map +1 -1
  516. package/dist/obj/object.js +373 -149
  517. package/dist/obj/object.js.map +1 -1
  518. package/dist/obj/power.d.ts +23 -4
  519. package/dist/obj/power.d.ts.map +1 -1
  520. package/dist/obj/power.js +232 -66
  521. package/dist/obj/power.js.map +1 -1
  522. package/dist/obj/randart-build.d.ts +27 -22
  523. package/dist/obj/randart-build.d.ts.map +1 -1
  524. package/dist/obj/randart-build.js +457 -403
  525. package/dist/obj/randart-build.js.map +1 -1
  526. package/dist/obj/randart-data.d.ts +62 -24
  527. package/dist/obj/randart-data.d.ts.map +1 -1
  528. package/dist/obj/randart-data.js +348 -221
  529. package/dist/obj/randart-data.js.map +1 -1
  530. package/dist/obj/randart-file.d.ts +21 -0
  531. package/dist/obj/randart-file.d.ts.map +1 -0
  532. package/dist/obj/randart-file.js +119 -0
  533. package/dist/obj/randart-file.js.map +1 -0
  534. package/dist/obj/randart-log.d.ts +63 -0
  535. package/dist/obj/randart-log.d.ts.map +1 -0
  536. package/dist/obj/randart-log.js +72 -0
  537. package/dist/obj/randart-log.js.map +1 -0
  538. package/dist/obj/randart-registry.d.ts +178 -0
  539. package/dist/obj/randart-registry.d.ts.map +1 -0
  540. package/dist/obj/randart-registry.js +140 -0
  541. package/dist/obj/randart-registry.js.map +1 -0
  542. package/dist/obj/randart-vectors.d.ts +97 -0
  543. package/dist/obj/randart-vectors.d.ts.map +1 -0
  544. package/dist/obj/randart-vectors.fixtures.d.ts +18 -0
  545. package/dist/obj/randart-vectors.fixtures.d.ts.map +1 -0
  546. package/dist/obj/randart-vectors.fixtures.js +50 -0
  547. package/dist/obj/randart-vectors.fixtures.js.map +1 -0
  548. package/dist/obj/randart-vectors.js +311 -0
  549. package/dist/obj/randart-vectors.js.map +1 -0
  550. package/dist/obj/randart.d.ts +53 -15
  551. package/dist/obj/randart.d.ts.map +1 -1
  552. package/dist/obj/randart.js +166 -44
  553. package/dist/obj/randart.js.map +1 -1
  554. package/dist/obj/rune-registry.d.ts +180 -0
  555. package/dist/obj/rune-registry.d.ts.map +1 -0
  556. package/dist/obj/rune-registry.js +161 -0
  557. package/dist/obj/rune-registry.js.map +1 -0
  558. package/dist/obj/rune-vectors.d.ts +99 -0
  559. package/dist/obj/rune-vectors.d.ts.map +1 -0
  560. package/dist/obj/rune-vectors.fixtures.d.ts +44 -0
  561. package/dist/obj/rune-vectors.fixtures.d.ts.map +1 -0
  562. package/dist/obj/rune-vectors.fixtures.js +125 -0
  563. package/dist/obj/rune-vectors.fixtures.js.map +1 -0
  564. package/dist/obj/rune-vectors.js +159 -0
  565. package/dist/obj/rune-vectors.js.map +1 -0
  566. package/dist/obj/tval-registry.d.ts +174 -0
  567. package/dist/obj/tval-registry.d.ts.map +1 -0
  568. package/dist/obj/tval-registry.js +151 -0
  569. package/dist/obj/tval-registry.js.map +1 -0
  570. package/dist/obj/tval-vectors.d.ts +85 -0
  571. package/dist/obj/tval-vectors.d.ts.map +1 -0
  572. package/dist/obj/tval-vectors.fixtures.d.ts +24 -0
  573. package/dist/obj/tval-vectors.fixtures.d.ts.map +1 -0
  574. package/dist/obj/tval-vectors.fixtures.js +41 -0
  575. package/dist/obj/tval-vectors.fixtures.js.map +1 -0
  576. package/dist/obj/tval-vectors.js +76 -0
  577. package/dist/obj/tval-vectors.js.map +1 -0
  578. package/dist/obj/types.d.ts +43 -7
  579. package/dist/obj/types.d.ts.map +1 -1
  580. package/dist/obj/types.js.map +1 -1
  581. package/dist/obj/value.d.ts.map +1 -1
  582. package/dist/obj/value.js +23 -20
  583. package/dist/obj/value.js.map +1 -1
  584. package/dist/parser.d.ts +96 -0
  585. package/dist/parser.d.ts.map +1 -0
  586. package/dist/parser.js +116 -0
  587. package/dist/parser.js.map +1 -0
  588. package/dist/player/bind.d.ts.map +1 -1
  589. package/dist/player/bind.js +3 -2
  590. package/dist/player/bind.js.map +1 -1
  591. package/dist/player/birth.d.ts +3 -2
  592. package/dist/player/birth.d.ts.map +1 -1
  593. package/dist/player/birth.js +4 -3
  594. package/dist/player/birth.js.map +1 -1
  595. package/dist/player/calcs.d.ts +58 -23
  596. package/dist/player/calcs.d.ts.map +1 -1
  597. package/dist/player/calcs.js +93 -36
  598. package/dist/player/calcs.js.map +1 -1
  599. package/dist/player/death.d.ts +50 -0
  600. package/dist/player/death.d.ts.map +1 -0
  601. package/dist/player/death.js +46 -0
  602. package/dist/player/death.js.map +1 -0
  603. package/dist/player/options-file.d.ts +155 -0
  604. package/dist/player/options-file.d.ts.map +1 -0
  605. package/dist/player/options-file.js +295 -0
  606. package/dist/player/options-file.js.map +1 -0
  607. package/dist/player/options.d.ts +3 -2
  608. package/dist/player/options.d.ts.map +1 -1
  609. package/dist/player/options.js +3 -2
  610. package/dist/player/options.js.map +1 -1
  611. package/dist/player/player.d.ts +50 -3
  612. package/dist/player/player.d.ts.map +1 -1
  613. package/dist/player/player.js +10 -1
  614. package/dist/player/player.js.map +1 -1
  615. package/dist/player/shape-lore.d.ts +12 -8
  616. package/dist/player/shape-lore.d.ts.map +1 -1
  617. package/dist/player/shape-lore.js +31 -15
  618. package/dist/player/shape-lore.js.map +1 -1
  619. package/dist/player/spell.d.ts.map +1 -1
  620. package/dist/player/spell.js +24 -2
  621. package/dist/player/spell.js.map +1 -1
  622. package/dist/player/timed.d.ts +5 -3
  623. package/dist/player/timed.d.ts.map +1 -1
  624. package/dist/player/timed.js +11 -2
  625. package/dist/player/timed.js.map +1 -1
  626. package/dist/player/types.d.ts +29 -4
  627. package/dist/player/types.d.ts.map +1 -1
  628. package/dist/player/types.js +24 -1
  629. package/dist/player/types.js.map +1 -1
  630. package/dist/score/display.d.ts.map +1 -1
  631. package/dist/score/display.js +39 -18
  632. package/dist/score/display.js.map +1 -1
  633. package/dist/score/score.d.ts +7 -7
  634. package/dist/score/score.js +3 -3
  635. package/dist/score/types.d.ts +51 -0
  636. package/dist/score/types.d.ts.map +1 -1
  637. package/dist/score/types.js.map +1 -1
  638. package/dist/session/boot.d.ts +28 -2
  639. package/dist/session/boot.d.ts.map +1 -1
  640. package/dist/session/boot.js +43 -2
  641. package/dist/session/boot.js.map +1 -1
  642. package/dist/session/game.d.ts +15 -0
  643. package/dist/session/game.d.ts.map +1 -1
  644. package/dist/session/game.js +727 -144
  645. package/dist/session/game.js.map +1 -1
  646. package/dist/session/save-migrate.d.ts +3 -3
  647. package/dist/session/save-migrate.d.ts.map +1 -1
  648. package/dist/session/save-migrate.js +505 -22
  649. package/dist/session/save-migrate.js.map +1 -1
  650. package/dist/session/save.d.ts +513 -36
  651. package/dist/session/save.d.ts.map +1 -1
  652. package/dist/session/save.js +864 -65
  653. package/dist/session/save.js.map +1 -1
  654. package/dist/sound/engine.d.ts +17 -0
  655. package/dist/sound/engine.d.ts.map +1 -1
  656. package/dist/sound/engine.js +55 -6
  657. package/dist/sound/engine.js.map +1 -1
  658. package/dist/sound/index.d.ts +2 -0
  659. package/dist/sound/index.d.ts.map +1 -1
  660. package/dist/sound/index.js +2 -0
  661. package/dist/sound/index.js.map +1 -1
  662. package/dist/sound/message-types.d.ts +89 -0
  663. package/dist/sound/message-types.d.ts.map +1 -0
  664. package/dist/sound/message-types.js +126 -0
  665. package/dist/sound/message-types.js.map +1 -0
  666. package/dist/sound/sound-registry.d.ts +93 -0
  667. package/dist/sound/sound-registry.d.ts.map +1 -0
  668. package/dist/sound/sound-registry.js +117 -0
  669. package/dist/sound/sound-registry.js.map +1 -0
  670. package/dist/store/bind.d.ts +1 -1
  671. package/dist/store/bind.d.ts.map +1 -1
  672. package/dist/store/bind.js +4 -3
  673. package/dist/store/bind.js.map +1 -1
  674. package/dist/store/mass-produce-vectors.d.ts +40 -0
  675. package/dist/store/mass-produce-vectors.d.ts.map +1 -0
  676. package/dist/store/mass-produce-vectors.fixtures.d.ts +13 -0
  677. package/dist/store/mass-produce-vectors.fixtures.d.ts.map +1 -0
  678. package/dist/store/mass-produce-vectors.fixtures.js +52 -0
  679. package/dist/store/mass-produce-vectors.fixtures.js.map +1 -0
  680. package/dist/store/mass-produce-vectors.js +44 -0
  681. package/dist/store/mass-produce-vectors.js.map +1 -0
  682. package/dist/store/store.d.ts +113 -15
  683. package/dist/store/store.d.ts.map +1 -1
  684. package/dist/store/store.js +213 -91
  685. package/dist/store/store.js.map +1 -1
  686. package/dist/store/transact.d.ts +37 -10
  687. package/dist/store/transact.d.ts.map +1 -1
  688. package/dist/store/transact.js +42 -23
  689. package/dist/store/transact.js.map +1 -1
  690. package/dist/store/types.d.ts +3 -2
  691. package/dist/store/types.d.ts.map +1 -1
  692. package/dist/store/types.js +1 -1
  693. package/dist/version.d.ts +1 -1
  694. package/dist/version.js +1 -1
  695. package/dist/visuals/glyph-table.d.ts +2 -2
  696. package/dist/visuals/glyph-table.js +2 -2
  697. package/dist/visuals/hallucination.d.ts +140 -0
  698. package/dist/visuals/hallucination.d.ts.map +1 -0
  699. package/dist/visuals/hallucination.js +122 -0
  700. package/dist/visuals/hallucination.js.map +1 -0
  701. package/dist/visuals/index.d.ts +2 -0
  702. package/dist/visuals/index.d.ts.map +1 -1
  703. package/dist/visuals/index.js +2 -0
  704. package/dist/visuals/index.js.map +1 -1
  705. package/dist/visuals/map-text.d.ts +13 -4
  706. package/dist/visuals/map-text.d.ts.map +1 -1
  707. package/dist/visuals/map-text.js +6 -5
  708. package/dist/visuals/map-text.js.map +1 -1
  709. package/dist/visuals/object-glyph.d.ts +61 -0
  710. package/dist/visuals/object-glyph.d.ts.map +1 -0
  711. package/dist/visuals/object-glyph.js +57 -0
  712. package/dist/visuals/object-glyph.js.map +1 -0
  713. package/dist/visuals/prefs.d.ts +174 -27
  714. package/dist/visuals/prefs.d.ts.map +1 -1
  715. package/dist/visuals/prefs.js +223 -46
  716. package/dist/visuals/prefs.js.map +1 -1
  717. package/dist/visuals/tile-prefs.d.ts +26 -0
  718. package/dist/visuals/tile-prefs.d.ts.map +1 -1
  719. package/dist/visuals/tile-prefs.js +28 -0
  720. package/dist/visuals/tile-prefs.js.map +1 -1
  721. package/dist/world/feature.d.ts +2 -1
  722. package/dist/world/feature.d.ts.map +1 -1
  723. package/dist/world/feature.js +2 -0
  724. package/dist/world/feature.js.map +1 -1
  725. package/dist/world/project.d.ts +10 -2
  726. package/dist/world/project.d.ts.map +1 -1
  727. package/dist/world/project.js +18 -6
  728. package/dist/world/project.js.map +1 -1
  729. package/dist/world/projection.d.ts +37 -3
  730. package/dist/world/projection.d.ts.map +1 -1
  731. package/dist/world/projection.js +69 -7
  732. package/dist/world/projection.js.map +1 -1
  733. package/dist/world/trap.d.ts +3 -2
  734. package/dist/world/trap.d.ts.map +1 -1
  735. package/dist/world/trap.js +2 -1
  736. package/dist/world/trap.js.map +1 -1
  737. package/dist/world/view.d.ts +1 -1
  738. package/dist/world/view.d.ts.map +1 -1
  739. package/dist/world/view.js +11 -3
  740. package/dist/world/view.js.map +1 -1
  741. package/package.json +1 -1
  742. package/src/agent/perceive.ts +2 -3
  743. package/src/cmd.ts +67 -3
  744. package/src/combat/blow-vectors.fixtures.ts +99 -0
  745. package/src/combat/blow-vectors.json +482 -0
  746. package/src/combat/blow-vectors.ts +280 -0
  747. package/src/combat/brand-slay.ts +42 -11
  748. package/src/combat/index.ts +1 -1
  749. package/src/combat/melee.ts +37 -19
  750. package/src/combat/mon-melee.ts +611 -364
  751. package/src/combat/ranged.ts +43 -26
  752. package/src/constants.ts +15 -0
  753. package/src/datafile.ts +148 -0
  754. package/src/effects/effect-info-registry.ts +313 -0
  755. package/src/effects/effect-info-vectors.fixtures.ts +61 -0
  756. package/src/effects/effect-info-vectors.json +11532 -0
  757. package/src/effects/effect-info-vectors.ts +376 -0
  758. package/src/effects/effect-info.ts +313 -167
  759. package/src/effects/effect.ts +96 -62
  760. package/src/effects/handlers.ts +5 -2
  761. package/src/effects/interpreter.ts +14 -0
  762. package/src/game/cave-cmd.ts +54 -11
  763. package/src/game/cave-square.ts +80 -0
  764. package/src/game/char-sheet.ts +59 -16
  765. package/src/game/chest.ts +25 -8
  766. package/src/game/context.ts +324 -27
  767. package/src/game/describe.ts +34 -4
  768. package/src/game/display.ts +359 -41
  769. package/src/game/dump-level.ts +4 -3
  770. package/src/game/effect-attack.ts +42 -30
  771. package/src/game/effect-detect.ts +45 -8
  772. package/src/game/effect-env.ts +8 -0
  773. package/src/game/effect-general.ts +115 -51
  774. package/src/game/effect-item.ts +168 -87
  775. package/src/game/effect-melee.ts +51 -18
  776. package/src/game/effect-monster.ts +55 -9
  777. package/src/game/effect-teleport.ts +183 -39
  778. package/src/game/effect-terrain.ts +39 -23
  779. package/src/game/equip-cmp.ts +513 -480
  780. package/src/game/floor.ts +74 -4
  781. package/src/game/gear.ts +228 -25
  782. package/src/game/harness.ts +12 -1
  783. package/src/game/ignore-cmd.ts +96 -8
  784. package/src/game/inscription-confirm.ts +15 -7
  785. package/src/game/known.ts +475 -85
  786. package/src/game/loop.ts +695 -670
  787. package/src/game/lore-color.ts +13 -1
  788. package/src/game/mon-cast.ts +39 -12
  789. package/src/game/mon-cmd.ts +98 -36
  790. package/src/game/mon-death.ts +14 -12
  791. package/src/game/mon-group.ts +9 -5
  792. package/src/game/mon-message.ts +362 -65
  793. package/src/game/mon-place.ts +15 -3
  794. package/src/game/mon-ranged.ts +14 -5
  795. package/src/game/mon-side.ts +20 -18
  796. package/src/game/monster-turn.ts +128 -91
  797. package/src/game/notice.ts +85 -0
  798. package/src/game/obj-cmd.ts +145 -39
  799. package/src/game/obj-list.ts +44 -26
  800. package/src/game/object-inspect.ts +13 -0
  801. package/src/game/pickup.ts +29 -5
  802. package/src/game/player-side-vectors.fixtures.ts +215 -0
  803. package/src/game/player-side-vectors.json +6914 -0
  804. package/src/game/player-side-vectors.ts +420 -0
  805. package/src/game/player-side.ts +622 -340
  806. package/src/game/player-turn.ts +228 -32
  807. package/src/game/poly.ts +107 -0
  808. package/src/game/project-cast.ts +72 -6
  809. package/src/game/project-feat-vectors.fixtures.ts +106 -0
  810. package/src/game/project-feat-vectors.json +6554 -0
  811. package/src/game/project-feat-vectors.ts +323 -0
  812. package/src/game/project-feat.ts +417 -248
  813. package/src/game/project-monster.ts +93 -33
  814. package/src/game/project-obj-vectors.json +1 -0
  815. package/src/game/project-obj.ts +115 -47
  816. package/src/game/project-player.ts +8 -0
  817. package/src/game/projection-handlers.ts +121 -0
  818. package/src/game/quest.ts +48 -0
  819. package/src/game/ranged-cmd.ts +50 -14
  820. package/src/game/repeat.ts +147 -0
  821. package/src/game/shape-inspect.ts +166 -0
  822. package/src/game/spell-cmd.ts +39 -6
  823. package/src/game/spoil.ts +93 -40
  824. package/src/game/steal.ts +9 -4
  825. package/src/game/take-hit-hooks.ts +4 -11
  826. package/src/game/target-loop.ts +57 -18
  827. package/src/game/target.ts +18 -7
  828. package/src/game/ui-entry-registry.ts +159 -0
  829. package/src/game/ui-entry.ts +2531 -2075
  830. package/src/game/wizard.ts +128 -37
  831. package/src/game/world.ts +6 -0
  832. package/src/gen/cave.ts +3057 -2858
  833. package/src/gen/gen-monster.ts +11 -8
  834. package/src/gen/generate.ts +576 -523
  835. package/src/gen/glyph-vectors.fixtures.ts +122 -0
  836. package/src/gen/glyph-vectors.json +5996 -0
  837. package/src/gen/glyph-vectors.ts +280 -0
  838. package/src/gen/glyph.ts +132 -0
  839. package/src/gen/room.ts +446 -265
  840. package/src/gen/util.ts +33 -10
  841. package/src/i18n/i18n.ts +492 -0
  842. package/src/i18n/text.ts +117 -0
  843. package/src/index.ts +57 -0
  844. package/src/mod/extension.ts +171 -0
  845. package/src/mod/hooks.ts +521 -521
  846. package/src/mod/ids.ts +239 -21
  847. package/src/mod/message-declarations.ts +293 -0
  848. package/src/mod/record-keys.ts +103 -0
  849. package/src/mod/registry-host.ts +1095 -1
  850. package/src/mod/save-blocks.ts +162 -15
  851. package/src/mon/bind.ts +28 -18
  852. package/src/mon/knowledge-groups.ts +13 -13
  853. package/src/mon/lore-describe.ts +96 -28
  854. package/src/mon/lore-file.ts +375 -0
  855. package/src/mon/lore.ts +19 -6
  856. package/src/mon/make.ts +4 -2
  857. package/src/mon/monster.ts +1 -1
  858. package/src/mon/predicate.ts +17 -11
  859. package/src/mon/project-mon.ts +88 -9
  860. package/src/mon/spell-declarations.ts +80 -0
  861. package/src/mon/spell-registry.ts +221 -0
  862. package/src/mon/spell.ts +2 -2
  863. package/src/mon/steal.ts +39 -7
  864. package/src/mon/take-hit.ts +8 -3
  865. package/src/mon/timed.ts +15 -9
  866. package/src/mon/types.ts +38 -5
  867. package/src/msg.ts +83 -1
  868. package/src/obj/artifact-fake.ts +48 -18
  869. package/src/obj/artifact-known.ts +4 -4
  870. package/src/obj/bind.ts +56 -13
  871. package/src/obj/desc-vectors.fixtures.ts +119 -0
  872. package/src/obj/desc-vectors.json +2360 -0
  873. package/src/obj/desc-vectors.ts +128 -0
  874. package/src/obj/desc.ts +159 -55
  875. package/src/obj/effects-info.ts +90 -59
  876. package/src/obj/fake-object.ts +135 -0
  877. package/src/obj/ignore.ts +95 -28
  878. package/src/obj/knowledge.ts +293 -141
  879. package/src/obj/known-object.ts +126 -11
  880. package/src/obj/make.ts +56 -31
  881. package/src/obj/object-info.ts +104 -7
  882. package/src/obj/object.ts +403 -153
  883. package/src/obj/power.ts +298 -60
  884. package/src/obj/randart-build.ts +601 -459
  885. package/src/obj/randart-data.ts +427 -252
  886. package/src/obj/randart-file.ts +130 -0
  887. package/src/obj/randart-log.ts +78 -0
  888. package/src/obj/randart-registry.ts +247 -0
  889. package/src/obj/randart-vectors.fixtures.ts +61 -0
  890. package/src/obj/randart-vectors.json +836 -0
  891. package/src/obj/randart-vectors.ts +369 -0
  892. package/src/obj/randart.ts +214 -44
  893. package/src/obj/rune-registry.ts +270 -0
  894. package/src/obj/rune-vectors.fixtures.ts +164 -0
  895. package/src/obj/rune-vectors.json +121 -0
  896. package/src/obj/rune-vectors.ts +229 -0
  897. package/src/obj/tval-kind-vectors.json +391 -0
  898. package/src/obj/tval-registry.ts +243 -0
  899. package/src/obj/tval-vectors.fixtures.ts +50 -0
  900. package/src/obj/tval-vectors.json +38 -0
  901. package/src/obj/tval-vectors.ts +126 -0
  902. package/src/obj/types.ts +40 -7
  903. package/src/obj/value.ts +26 -20
  904. package/src/parser.ts +125 -0
  905. package/src/player/bind.ts +5 -2
  906. package/src/player/birth.ts +4 -3
  907. package/src/player/calcs.ts +123 -42
  908. package/src/player/death.ts +78 -0
  909. package/src/player/options-file.ts +351 -0
  910. package/src/player/options.ts +3 -2
  911. package/src/player/player.ts +60 -4
  912. package/src/player/shape-lore.ts +40 -18
  913. package/src/player/spell.ts +31 -2
  914. package/src/player/timed.ts +14 -4
  915. package/src/player/types.ts +30 -4
  916. package/src/score/display.ts +38 -17
  917. package/src/score/score.ts +8 -8
  918. package/src/score/types.ts +52 -0
  919. package/src/session/boot.ts +101 -1
  920. package/src/session/game.ts +835 -167
  921. package/src/session/save-migrate.ts +598 -23
  922. package/src/session/save.ts +1177 -92
  923. package/src/sound/engine.ts +59 -4
  924. package/src/sound/index.ts +2 -0
  925. package/src/sound/message-types.ts +164 -0
  926. package/src/sound/sound-registry.ts +149 -0
  927. package/src/store/bind.ts +4 -3
  928. package/src/store/mass-produce-vectors.fixtures.ts +64 -0
  929. package/src/store/mass-produce-vectors.json +1169 -0
  930. package/src/store/mass-produce-vectors.ts +67 -0
  931. package/src/store/store.ts +282 -77
  932. package/src/store/transact.ts +67 -26
  933. package/src/store/types.ts +3 -2
  934. package/src/version.ts +1 -1
  935. package/src/visuals/glyph-table.ts +2 -2
  936. package/src/visuals/hallucination.ts +200 -0
  937. package/src/visuals/index.ts +2 -0
  938. package/src/visuals/map-text.ts +6 -5
  939. package/src/visuals/object-glyph.ts +81 -0
  940. package/src/visuals/prefs.ts +1236 -981
  941. package/src/visuals/tile-prefs.ts +215 -183
  942. package/src/world/feature.ts +4 -1
  943. package/src/world/project.ts +19 -4
  944. package/src/world/projection.ts +79 -8
  945. package/src/world/trap.ts +26 -22
  946. package/src/world/view.ts +11 -1
@@ -0,0 +1,130 @@
1
+ /**
2
+ * randart.txt (obj-randart.c:3061-3167, PORT_TODO 5.5) - the optional data
3
+ * file do_randart writes alongside randart.log when its `create_file` argument
4
+ * is true.
5
+ *
6
+ * WHAT IT IS FOR. randart.txt is a real artifact.txt: a player who rolls a set
7
+ * they like can read exactly what they got, and the file is in the grammar the
8
+ * parser already reads, so it can be diffed against the standard set or handed
9
+ * to a mod. That is why it is a separate file from randart.log rather than
10
+ * another section of it.
11
+ *
12
+ * WHAT DIFFERS FROM THE C, and why:
13
+ *
14
+ * - Upstream reuses the `log_file` global as the handle, having just closed
15
+ * randart.log with it. Nothing is shared but the variable, so the port keeps
16
+ * the two files properly apart and this module never touches the log sink.
17
+ * - The C writes line by line through file_putf. HostIo.write is a whole-file
18
+ * call, so this returns the document as a string and do_randart writes once.
19
+ * - `graphics:` needs the kind's display char and attr. Upstream converts a
20
+ * wide char with text_wctomb and an attr index with attr_to_text; the port
21
+ * already stores both as strings on ObjectKind, so the conversion has no
22
+ * counterpart and the values go out directly.
23
+ */
24
+ import { writeElements, writeFlags, writeMods } from "../datafile.js";
25
+ import { OBJECT_FLAG_ENTRIES } from "../generated/index.js";
26
+ import type { ObjRegistry } from "./bind.js";
27
+ import { objectShortName, tvalFindName } from "./bind.js";
28
+ import { OF_SIZE } from "./types.js";
29
+ import type { Artifact } from "./types.js";
30
+
31
+ /** randart.txt, in ANGBAND_DIR_USER. */
32
+ export const RANDART_TXT = "randart.txt";
33
+
34
+ /**
35
+ * The obj_flags[] table write_randart_entry builds inline: "NONE" at index 0,
36
+ * then list-object-flags.h in order. Index 0 is the sentinel OF_NONE, which is
37
+ * never set, so its name is only ever a placeholder that keeps the rest aligned.
38
+ */
39
+ const OBJ_FLAG_NAMES: readonly string[] = [
40
+ "NONE",
41
+ ...OBJECT_FLAG_ENTRIES.map((e) => e.name),
42
+ ];
43
+
44
+ /**
45
+ * write_randart_entry (obj-randart.c:3061-3167): one artifact.txt record.
46
+ *
47
+ * Returns "" for an artifact with no name - upstream's "Ignore non-existent
48
+ * artifacts" guard, which is how the unused slots in a_info are skipped.
49
+ */
50
+ export function writeRandartEntry(reg: ObjRegistry, art: Artifact): string {
51
+ if (!art.name) return "";
52
+ const kind = reg.lookupKind(art.tval, art.sval);
53
+
54
+ let out = "";
55
+ out += `# ${art.text}\n`;
56
+ out += `name:${art.name}\n`;
57
+ out += `base-object:${tvalFindName(art.tval)}:${objectShortName(kind ? kind.name : "")}\n`;
58
+
59
+ /* Graphics only for kinds past the ordinary ones - i.e. the artifact has a
60
+ * base item invented for it, so nothing else defines its glyph. */
61
+ if (kind && kind.kidx >= reg.ordinaryKindCount) {
62
+ out += `graphics:${kind.dChar}:${kind.dAttr}\n`;
63
+ }
64
+
65
+ out += `level:${String(art.level)}\n`;
66
+ out += `weight:${String(art.weight)}\n`;
67
+ out += `cost:${String(art.cost)}\n`;
68
+ out += `alloc:${String(art.allocProb)}:${String(art.allocMin)} to ${String(art.allocMax)}\n`;
69
+ out += `attack:${String(art.dd)}d${String(art.ds)}:${String(art.toH)}:${String(art.toD)}\n`;
70
+ out += `armor:${String(art.ac)}:${String(art.toA)}\n`;
71
+
72
+ out += writeFlags("flags:", art.flags, OF_SIZE, OBJ_FLAG_NAMES);
73
+ out += writeMods(art.modifiers);
74
+ out += writeElements(art.elInfo);
75
+
76
+ if (art.slays) {
77
+ for (let j = 1; j < reg.slays.length; j++) {
78
+ if (art.slays[j]) out += `slay:${reg.slays[j]!.code}\n`;
79
+ }
80
+ }
81
+ if (art.brands) {
82
+ for (let j = 1; j < reg.brands.length; j++) {
83
+ if (art.brands[j]) out += `brand:${reg.brands[j]!.code}\n`;
84
+ }
85
+ }
86
+ if (art.curses) {
87
+ for (let j = 1; j < reg.curses.length; j++) {
88
+ const power = art.curses[j] ?? 0;
89
+ if (power !== 0) out += `curse:${reg.curses[j]!.name}:${String(power)}\n`;
90
+ }
91
+ }
92
+
93
+ /* The artifact's own activation wins; otherwise the base item's, if it has
94
+ * one. An artifact with neither writes no act:/time: pair at all. */
95
+ const act = art.activation ?? kind?.activation ?? null;
96
+ const time = art.activation ? art.time : kind?.time;
97
+ if (act && time) {
98
+ out += `act:${act.name}\n`;
99
+ out += `time:${String(time.base)}+${String(time.dice)}d${String(time.sides)}\n`;
100
+ }
101
+
102
+ /* Upstream writes the description twice - once as a leading comment and once
103
+ * as the record's own desc: line. Both are kept. */
104
+ out += `desc:${art.text}\n`;
105
+ out += "\n";
106
+ return out;
107
+ }
108
+
109
+ /**
110
+ * do_randart's `create_file` block (obj-randart.c:3195-3215): the seed header
111
+ * followed by every artifact's entry, from index 1.
112
+ *
113
+ * The seed is written as C's `%08lx` - lower-case hex, zero-padded to eight
114
+ * digits - so the file names the seed that produced it and a player can
115
+ * reproduce the set.
116
+ */
117
+ export function writeRandartFile(
118
+ reg: ObjRegistry,
119
+ arts: readonly (Artifact | null)[],
120
+ randartSeed: number,
121
+ ): string {
122
+ let out = `# Artifact file for random artifacts with seed ${(randartSeed >>> 0)
123
+ .toString(16)
124
+ .padStart(8, "0")}\n\n\n`;
125
+ for (let i = 1; i < arts.length; i++) {
126
+ const art = arts[i];
127
+ if (art) out += writeRandartEntry(reg, art);
128
+ }
129
+ return out;
130
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * `randart.log`: the artifact-generation log, ported from the two file-scope
3
+ * statics that carry it in the C.
4
+ *
5
+ * WHAT THIS IS. `do_randart` opens ANGBAND_DIR_USER/randart.log for writing
6
+ * before it touches an artifact and closes it after (obj-randart.c
7
+ * L3165-L3193), and every step of the design loop narrates itself into it -
8
+ * 174 `file_putf(log_file, ...)` sites in obj-randart.c and 59 `log_obj(...)`
9
+ * sites in obj-power.c, which is where a randart's POWER is worked out. It is
10
+ * the only account of why a generated artifact came out the way it did, and the
11
+ * maintainer's disposition on 2026-08-04 was **pursue parity**, so it is a port
12
+ * with no asterisk rather than a spoiler dump to drop.
13
+ *
14
+ * A MODULE-LEVEL SINK, DELIBERATELY. Upstream has exactly this shape: two
15
+ * statics (`log_file` in obj-randart.c, `object_log` in obj-power.c) that are
16
+ * NULL for the whole game except inside do_randart, and `log_obj` opens with
17
+ * `if (!object_log) return;`. Threading a log parameter through all 233 sites
18
+ * would touch every signature in three modules to model a variable that is
19
+ * global in the original. The port collapses the two statics into one because
20
+ * they only ever point at the same file: object_power's `log_file` argument is
21
+ * always do_randart's, and the one other caller that passes a different file is
22
+ * `object_value_real`'s pricing log, which is behind `#ifdef PRICE_DEBUG` and
23
+ * ships off (see randartLogPriceDebugNote).
24
+ *
25
+ * THE POWER LOG IS NOT DEAD WHEN THE SINK IS NULL - it is *skipped*, cheaply.
26
+ * `objectPower` runs on every item the game prices, so the guard has to be a
27
+ * null check and the message must not be built when there is no sink. That is
28
+ * why the emitters take a thunk at the sites where formatting is not free.
29
+ */
30
+
31
+ /** A sink for one already-formatted log line (upstream: file_putf). */
32
+ export type RandartLog = (text: string) => void;
33
+
34
+ let sink: RandartLog | null = null;
35
+
36
+ /**
37
+ * Install the log sink, or null to close it. do_randart's file_open/file_close
38
+ * pair (obj-randart.c L3166, L3190) is spelt as setRandartLog(f) /
39
+ * setRandartLog(null) so an aborted generation cannot leave it open.
40
+ */
41
+ export function setRandartLog(log: RandartLog | null): void {
42
+ sink = log;
43
+ }
44
+
45
+ /** Whether a log is open, i.e. upstream's `if (!object_log) return;`. */
46
+ export function randartLogOpen(): boolean {
47
+ return sink !== null;
48
+ }
49
+
50
+ /**
51
+ * `file_putf(log_file, ...)` / `log_obj(...)`: append one already-formatted
52
+ * chunk. Upstream's format strings carry their own "\n" (several deliberately
53
+ * do NOT - see damage_dice_power, which ends "for damage dice, " so the next
54
+ * line continues it), so callers pass the text exactly as the C composes it and
55
+ * this adds nothing.
56
+ */
57
+ export function randartLog(text: string): void {
58
+ if (sink) sink(text);
59
+ }
60
+
61
+ /**
62
+ * The same, for a line whose formatting is not free. Upstream pays that cost
63
+ * unconditionally because file_vputf is inside log_obj; the port must not,
64
+ * because objectPower is on the item-pricing path for every object in the game.
65
+ */
66
+ export function randartLogf(build: () => string): void {
67
+ if (sink) sink(build());
68
+ }
69
+
70
+ /**
71
+ * `object_value_real`'s `pricing.log` (obj-power.c L1119-L1204) is NOT this
72
+ * log and is NOT ported. It is guarded by `#ifdef PRICE_DEBUG`, which no
73
+ * shipped configuration defines, so its seven file_putf sites are dead in every
74
+ * build a player can obtain. Recorded here rather than left to be rediscovered
75
+ * as a gap by the next census, which counts format strings and cannot see a
76
+ * preprocessor condition.
77
+ */
78
+ export const PRICE_DEBUG_LOG_NOT_PORTED = true;
@@ -0,0 +1,247 @@
1
+ /**
2
+ * The RANDOM ARTIFACT registry: what an ability does, what an item class starts
3
+ * with, which bucket it counts toward, and whether an activation is redundant.
4
+ *
5
+ * WHY THIS IS A REGISTRY. `artifact.json` has always accepted a new record, so a
6
+ * mod could always ship a fixed artifact. What it could not do was reach the
7
+ * RANDOM artifact generator, which is a different thing entirely: four closed
8
+ * `switch` statements decided every property a randart can have, and each failed
9
+ * silently rather than loudly.
10
+ *
11
+ * - `addAbilityAux` (randart-build.ts, keyed on the `ART_IDX` ability, 87
12
+ * cases) - the largest dispatch in the port. A mod-coined ability index took
13
+ * the default arm, which is `break`: the design loop spent power on it and
14
+ * the artifact got NOTHING.
15
+ * - `artifactPrep` (randart-build.ts, keyed on the base item's tval, 15) - the
16
+ * starting to-hit / to-dam / AC an item class is given. An unlisted tval got
17
+ * zero of each, so a mod's new item class produced randarts that started
18
+ * blank and could never be told apart from a bug.
19
+ * - the item-class census (randart-data.ts, keyed on tval, 14) - which
20
+ * `data.*Total` bucket a standard artifact counts toward. That census feeds
21
+ * the frequency table the design loop SPENDS, so a mod's item class landing
22
+ * in `otherTotal` skews what every randart in the game becomes.
23
+ * - the redundancy test (randart-build.ts, keyed on the `EFPROP` kind, 9) -
24
+ * whether an activation only duplicates something the artifact already has.
25
+ * An unknown kind takes upstream's conservative default (keep it), which is
26
+ * right for core and useless to a mod that coined a new property kind.
27
+ *
28
+ * FOUR TABLES, THREE KEYS, kept separate because upstream's keys are: the
29
+ * ability index, the tval, and the EFPROP kind name three different things and
30
+ * collapsing them would force a mod to register the same behaviour twice.
31
+ *
32
+ * WHAT A HANDLER GETS, AND WHY IT IS NOT A PILE OF CALLBACKS. Every primitive
33
+ * core's own arms use - `addFlag`, `addMod`, `addResist`, `addBrand`, `addSlay`,
34
+ * `addToHit`, `addToDam`, `addToAC`, `addLowResist`, `addHighResist`,
35
+ * `addImmunity`, `addStat`, `addSustain`, `addDamageDice`, `addWeightMod`,
36
+ * `addActivation` - is exported and reachable through `ctx.core`. So the context
37
+ * carries STATE (the registry, the artifact, the base kind, the target power,
38
+ * the set data, the rng) and nothing else. A mod's handler is written exactly
39
+ * the way core's arms are written.
40
+ *
41
+ * That reachability was NOT free, and it is the trap this seam nearly shipped
42
+ * with. The helpers were exported from `randart-build.ts` but the module was
43
+ * never re-exported from core's index, so none of them were in `ctx.core` - a
44
+ * mod could register a handler and had no way to write its body. `index.ts` now
45
+ * exports `randart-build.js` and `randart-data.js` for exactly that reason. A
46
+ * seam whose primitives a mod cannot reach is a seam a mod cannot use.
47
+ *
48
+ * ORDER AND RNG. Core's handlers are the case bodies lifted unchanged, so the
49
+ * draw sequence is identical - which is what `randart-vectors.json` exists to
50
+ * prove, 834 vectors recorded before this file existed, the per-arm families
51
+ * carrying an RNG probe because a changed draw count is invisible in the
52
+ * artifact and diverges every artifact after it. A MOD's handler draws from the
53
+ * same `rng`, so it changes the stream from that ability onward. That is
54
+ * inherent in adding behaviour to generation and is why a modded game is not
55
+ * seed-compatible with an unmodded one.
56
+ *
57
+ * WHY MODULE-LEVEL. The same 2026-08-09 ruling that justified
58
+ * `EffectInfoRegistry`: disabling a mod always takes effect on the next RELOAD,
59
+ * so a module-level table cannot violate the mod default policy. A fresh page is
60
+ * a fresh module instance and the host installs each plugin at most once per
61
+ * realm, so a disabled mod's registrations are gone on the next boot because the
62
+ * table they lived in is. `resetRandartRegistry()` is the same restoration
63
+ * without a fresh realm; it has no production caller by design.
64
+ */
65
+
66
+ import type { Rng } from "../rng.js";
67
+ import type { ObjRegistry } from "./bind.js";
68
+ import type { EffectObjectProperty } from "./randart-build.js";
69
+ import type { ArtifactSetData } from "./randart-data.js";
70
+ import type { Artifact, ObjectKind } from "./types.js";
71
+
72
+ /* ------------------------------------------------------------------ *
73
+ * Table 1: what an ability does, keyed on the ART_IDX index.
74
+ * ------------------------------------------------------------------ */
75
+
76
+ /** The state one `add_ability_aux` arm is given (obj-randart.c L2150). */
77
+ export interface RandartAbilityContext {
78
+ /** The object registry, for the flag / brand / slay / element tables. */
79
+ readonly reg: ObjRegistry;
80
+ /** The artifact being built. Handlers mutate this. */
81
+ readonly art: Artifact;
82
+ /** The base item kind, or null when the tval/sval pair names none. */
83
+ readonly kind: ObjectKind | null;
84
+ /** The power the design loop is aiming at (gates AGGRAVATE, sizes ACTIV). */
85
+ readonly targetPower: number;
86
+ /** The measured profile of the standard set: increments, powers, frequencies. */
87
+ readonly data: ArtifactSetData;
88
+ /** The generation stream. Drawing from it moves every later artifact. */
89
+ readonly rng: Rng;
90
+ }
91
+
92
+ /**
93
+ * What one ability does to an artifact. Write it the way core's arms are
94
+ * written: call the exported `addFlag` / `addMod` / `addResist` / ... helpers,
95
+ * which handle the "already has it" case and the randart.log line.
96
+ */
97
+ export type RandartAbilityHandler = (ctx: RandartAbilityContext) => void;
98
+
99
+ /* ------------------------------------------------------------------ *
100
+ * Table 2: an item class's starting stats, keyed on tval.
101
+ * ------------------------------------------------------------------ */
102
+
103
+ /** The state one `artifact_prep` item-class arm is given. */
104
+ export interface RandartPrepContext {
105
+ readonly reg: ObjRegistry;
106
+ /** The artifact, already given the base kind's own values. */
107
+ readonly art: Artifact;
108
+ /** The base item kind this artifact was built from. */
109
+ readonly kind: ObjectKind;
110
+ readonly data: ArtifactSetData;
111
+ readonly rng: Rng;
112
+ }
113
+
114
+ /**
115
+ * The basic stats an item class starts with. Upstream gives weapons to-hit and
116
+ * to-dam, armour to-AC, and everything else nothing at all - an unregistered
117
+ * tval takes that last arm, which is upstream's own default rather than a hole.
118
+ */
119
+ export type RandartPrepHandler = (ctx: RandartPrepContext) => void;
120
+
121
+ /* ------------------------------------------------------------------ *
122
+ * Table 3: the item-class census, keyed on tval.
123
+ * ------------------------------------------------------------------ */
124
+
125
+ /**
126
+ * Which `data.*Total` bucket a standard artifact counts toward. This feeds the
127
+ * frequency table the design loop spends, so it is not bookkeeping: a class in
128
+ * the wrong bucket changes what every randart in the game becomes.
129
+ *
130
+ * `TV.NULL` is registered as an explicit no-op rather than left to the default,
131
+ * because upstream distinguishes "an empty artifact slot" from "an item class I
132
+ * have no bucket for" - the first counts toward nothing, the second toward
133
+ * `otherTotal`.
134
+ */
135
+ export type RandartCensusHandler = (data: ArtifactSetData) => void;
136
+
137
+ /* ------------------------------------------------------------------ *
138
+ * Table 4: activation redundancy, keyed on the EFPROP kind.
139
+ * ------------------------------------------------------------------ */
140
+
141
+ /** The state one redundancy arm is given (obj-randart.c L2420). */
142
+ export interface RandartRedundancyContext {
143
+ readonly reg: ObjRegistry;
144
+ /** The artifact whose activation is on trial. */
145
+ readonly art: Artifact;
146
+ /** The summarized property this arm is judging. */
147
+ readonly prop: EffectObjectProperty;
148
+ }
149
+
150
+ /**
151
+ * Whether the activation is STILL redundant after considering this property.
152
+ * Return false the moment the activation does something the artifact does not
153
+ * already do - upstream stops at the first `false` and keeps the activation.
154
+ * An unregistered kind takes upstream's conservative default (not redundant),
155
+ * which is the safe direction: a kept activation is a weaker artifact than
156
+ * intended, a dropped one is a missing power.
157
+ */
158
+ export type RandartRedundancyHandler = (
159
+ ctx: RandartRedundancyContext,
160
+ ) => boolean;
161
+
162
+ /* ------------------------------------------------------------------ *
163
+ * The tables.
164
+ * ------------------------------------------------------------------ */
165
+
166
+ /**
167
+ * One keyed table. Written once and used four times, because the four differ
168
+ * only in their key and handler types.
169
+ */
170
+ export class RandartTable<K, H> {
171
+ private readonly table = new Map<K, H>();
172
+
173
+ /** Install (or replace) the handler for one key. */
174
+ set(key: K, handler: H): void {
175
+ this.table.set(key, handler);
176
+ }
177
+
178
+ /**
179
+ * The handler installed for a key right now, or null. This is what a mod
180
+ * calls to WRAP core - keep the returned handler, install its own, and call
181
+ * through. Wrapping matters more here than almost anywhere else: an ability
182
+ * that draws a different NUMBER of random values changes every artifact
183
+ * generated after it, so a handler that reimplements core's from scratch and
184
+ * gets the draw count wrong is a whole-set divergence, not a local one.
185
+ */
186
+ handlerFor(key: K): H | null {
187
+ return this.table.get(key) ?? null;
188
+ }
189
+
190
+ /** Whether anything handles this key. */
191
+ has(key: K): boolean {
192
+ return this.table.has(key);
193
+ }
194
+
195
+ /** Every key handled, in registration order (core's first). */
196
+ keys(): readonly K[] {
197
+ return [...this.table.keys()];
198
+ }
199
+ }
200
+
201
+ /** Random artifact construction, in four tables under three keys. */
202
+ export class RandartRegistry {
203
+ /** What an ability does, keyed on the ART_IDX index. */
204
+ readonly abilities = new RandartTable<number, RandartAbilityHandler>();
205
+ /** An item class's starting stats, keyed on tval. */
206
+ readonly prep = new RandartTable<number, RandartPrepHandler>();
207
+ /** The item-class census bucket, keyed on tval. */
208
+ readonly census = new RandartTable<number, RandartCensusHandler>();
209
+ /** Activation redundancy, keyed on the EFPROP kind. */
210
+ readonly redundancy = new RandartTable<number, RandartRedundancyHandler>();
211
+ }
212
+
213
+ /* ------------------------------------------------------------------ *
214
+ * The live registry.
215
+ * ------------------------------------------------------------------ */
216
+
217
+ /**
218
+ * Core's own seeders. The modules that OWN a table register their arms here at
219
+ * import time, and each is also the only module that READS its table - so "the
220
+ * module is loaded" and "core's arms are installed" cannot come apart. A seeder
221
+ * somebody has to remember to call is a seeder that gets forgotten on one path,
222
+ * and the failure mode here is silent: every randart comes out blank.
223
+ */
224
+ const seeders: Array<(reg: RandartRegistry) => void> = [];
225
+
226
+ let live = new RandartRegistry();
227
+
228
+ /** Install a set of core arms, now and on every reset. A MOD never calls this. */
229
+ export function seedRandart(seed: (reg: RandartRegistry) => void): void {
230
+ seeders.push(seed);
231
+ seed(live);
232
+ }
233
+
234
+ /** The live registry. Module-level; see this file's header for why that is safe. */
235
+ export function randartRegistry(): RandartRegistry {
236
+ return live;
237
+ }
238
+
239
+ /**
240
+ * Back to core's arms alone, dropping every mod registration - the same state a
241
+ * reload produces, without needing a fresh realm. No production caller by
242
+ * design; see this file's header.
243
+ */
244
+ export function resetRandartRegistry(): void {
245
+ live = new RandartRegistry();
246
+ for (const seed of seeders) seed(live);
247
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The registry and constants a randart vector is recorded against, built from
3
+ * the real shipped content pack.
4
+ *
5
+ * SEPARATE FILE, and it reads the disk: keeping node:fs out of
6
+ * `randart-vectors.ts` means that module stays importable from anywhere. ONE
7
+ * copy, shared by `randart-vectors.test.ts` and by
8
+ * `scripts/gen-randart-vectors.mjs`, so the test and the generator cannot
9
+ * disagree about what they are measuring.
10
+ *
11
+ * The projections are bound for a reason that is not decoration: `add_brand`
12
+ * (obj-randart.c:1951) compares the brand it picked against `projections[i].name`
13
+ * to grant the matching resist, so a registry without them cannot run
14
+ * `do_randart` at all.
15
+ */
16
+
17
+ import { readFileSync } from "node:fs";
18
+ import { bindConstants } from "../constants.js";
19
+ import type { Constants } from "../constants.js";
20
+ import { bindProjections } from "../world/projection.js";
21
+ import type { ProjectionRecordJson } from "../world/projection.js";
22
+ import { ObjRegistry } from "./bind.js";
23
+ import type { ObjPackJson } from "./types.js";
24
+ import type { RandartVectorFixtures } from "./randart-vectors.js";
25
+
26
+ function loadJson<T>(name: string): T {
27
+ return JSON.parse(
28
+ readFileSync(new URL(`../../../content/pack/${name}.json`, import.meta.url), "utf8"),
29
+ ) as T;
30
+ }
31
+
32
+ export function randartVectorFixtures(): RandartVectorFixtures {
33
+ /* Parsed ONCE; a fresh ObjRegistry is built per call from the same records,
34
+ * because the whole-set family wants a registry no earlier seed has run
35
+ * against. */
36
+ const pack = {
37
+ objectBase: loadJson("object_base"),
38
+ object: loadJson("object"),
39
+ egoItem: loadJson("ego_item"),
40
+ artifact: loadJson("artifact"),
41
+ curse: loadJson("curse"),
42
+ brand: loadJson("brand"),
43
+ slay: loadJson("slay"),
44
+ activation: loadJson("activation"),
45
+ objectProperty: loadJson("object_property"),
46
+ flavor: loadJson("flavor"),
47
+ } as ObjPackJson;
48
+ const projectionRecords = loadJson<{ records: ProjectionRecordJson[] }>(
49
+ "projection",
50
+ ).records;
51
+ const constants = bindConstants(loadJson("constants"));
52
+
53
+ return {
54
+ registry(): ObjRegistry {
55
+ const reg = new ObjRegistry(pack);
56
+ reg.projections = bindProjections(projectionRecords);
57
+ return reg;
58
+ },
59
+ constants: (): Constants => constants,
60
+ };
61
+ }