@v12-engine/engine 0.1.0 → 0.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 (951) hide show
  1. package/dist/abilities/amounts.d.ts +28 -0
  2. package/dist/abilities/amounts.js +74 -0
  3. package/dist/abilities/amounts.js.map +1 -0
  4. package/dist/abilities/buffs.d.ts +106 -6
  5. package/dist/abilities/buffs.js +443 -0
  6. package/dist/abilities/buffs.js.map +1 -0
  7. package/dist/abilities/castTold.d.ts +2 -0
  8. package/dist/abilities/castTold.js +66 -0
  9. package/dist/abilities/castTold.js.map +1 -0
  10. package/dist/abilities/chance.d.ts +38 -0
  11. package/dist/abilities/chance.js +77 -0
  12. package/dist/abilities/chance.js.map +1 -0
  13. package/dist/abilities/charges.d.ts +18 -0
  14. package/dist/abilities/charges.js +101 -0
  15. package/dist/abilities/charges.js.map +1 -0
  16. package/dist/abilities/control.d.ts +28 -0
  17. package/dist/abilities/control.js +113 -0
  18. package/dist/abilities/control.js.map +1 -0
  19. package/dist/abilities/dispel.js +51 -0
  20. package/dist/abilities/dispel.js.map +1 -0
  21. package/dist/abilities/effectFields.d.ts +1 -1
  22. package/dist/abilities/effectFields.js +676 -0
  23. package/dist/abilities/effectFields.js.map +1 -0
  24. package/dist/abilities/effectIndex.d.ts +27 -0
  25. package/dist/abilities/effectIndex.js +64 -0
  26. package/dist/abilities/effectIndex.js.map +1 -0
  27. package/dist/abilities/effects/buff.d.ts +9 -3
  28. package/dist/abilities/effects/buff.js +84 -0
  29. package/dist/abilities/effects/buff.js.map +1 -0
  30. package/dist/abilities/effects/conditions.d.ts +2 -0
  31. package/dist/abilities/effects/conditions.js +41 -0
  32. package/dist/abilities/effects/conditions.js.map +1 -0
  33. package/dist/abilities/effects/core.js +54 -0
  34. package/dist/abilities/effects/core.js.map +1 -0
  35. package/dist/abilities/effects/damage.d.ts +1 -1
  36. package/dist/abilities/effects/damage.js +43 -0
  37. package/dist/abilities/effects/damage.js.map +1 -0
  38. package/dist/abilities/effects/heal.d.ts +2 -2
  39. package/dist/abilities/effects/heal.js +51 -0
  40. package/dist/abilities/effects/heal.js.map +1 -0
  41. package/dist/abilities/effects/missile.d.ts +13 -1
  42. package/dist/abilities/effects/missile.js +104 -0
  43. package/dist/abilities/effects/missile.js.map +1 -0
  44. package/dist/abilities/effects/morph.d.ts +5 -0
  45. package/dist/abilities/effects/morph.js +43 -0
  46. package/dist/abilities/effects/morph.js.map +1 -0
  47. package/dist/abilities/effects/moves.d.ts +16 -4
  48. package/dist/abilities/effects/moves.js +212 -0
  49. package/dist/abilities/effects/moves.js.map +1 -0
  50. package/dist/abilities/effects/passives.d.ts +19 -9
  51. package/dist/abilities/effects/passives.js +131 -0
  52. package/dist/abilities/effects/passives.js.map +1 -0
  53. package/dist/abilities/effects/proxy.d.ts +5 -0
  54. package/dist/abilities/effects/proxy.js +60 -0
  55. package/dist/abilities/effects/proxy.js.map +1 -0
  56. package/dist/abilities/effects/sight.d.ts +2 -2
  57. package/dist/abilities/effects/sight.js +39 -0
  58. package/dist/abilities/effects/sight.js.map +1 -0
  59. package/dist/abilities/effects/spawn.d.ts +5 -2
  60. package/dist/abilities/effects/spawn.js +40 -0
  61. package/dist/abilities/effects/spawn.js.map +1 -0
  62. package/dist/abilities/effects/timed.d.ts +2 -2
  63. package/dist/abilities/effects/timed.js +96 -0
  64. package/dist/abilities/effects/timed.js.map +1 -0
  65. package/dist/abilities/effects/trade.d.ts +1 -1
  66. package/dist/abilities/effects/trade.js +25 -0
  67. package/dist/abilities/effects/trade.js.map +1 -0
  68. package/dist/abilities/effects.d.ts +97 -23
  69. package/dist/abilities/effects.js +860 -0
  70. package/dist/abilities/effects.js.map +1 -0
  71. package/dist/abilities/land.d.ts +38 -4
  72. package/dist/abilities/land.js +189 -0
  73. package/dist/abilities/land.js.map +1 -0
  74. package/dist/abilities/recast.d.ts +45 -0
  75. package/dist/abilities/recast.js +118 -0
  76. package/dist/abilities/recast.js.map +1 -0
  77. package/dist/abilities/scaled.js +40 -0
  78. package/dist/abilities/scaled.js.map +1 -0
  79. package/dist/abilities/screen.d.ts +6 -0
  80. package/dist/abilities/screen.js +83 -0
  81. package/dist/abilities/screen.js.map +1 -0
  82. package/dist/abilities/shapes.d.ts +66 -0
  83. package/dist/abilities/shapes.js +122 -0
  84. package/dist/abilities/shapes.js.map +1 -0
  85. package/dist/abilities/text.d.ts +14 -2
  86. package/dist/abilities/text.js +204 -0
  87. package/dist/abilities/text.js.map +1 -0
  88. package/dist/abilities/triggers.d.ts +98 -0
  89. package/dist/abilities/triggers.js +351 -0
  90. package/dist/abilities/triggers.js.map +1 -0
  91. package/dist/abilityChanges.d.ts +131 -0
  92. package/dist/abilityChanges.js +345 -0
  93. package/dist/abilityChanges.js.map +1 -0
  94. package/dist/ai/area.d.ts +4 -1
  95. package/dist/ai/brain.d.ts +4 -1
  96. package/dist/ai/brain.js +844 -0
  97. package/dist/ai/brain.js.map +1 -0
  98. package/dist/ai/budget.js +74 -0
  99. package/dist/ai/budget.js.map +1 -0
  100. package/dist/ai/checks.d.ts +9 -1
  101. package/dist/ai/checks.js +242 -0
  102. package/dist/ai/checks.js.map +1 -0
  103. package/dist/ai/computer.d.ts +11 -4
  104. package/dist/ai/computer.js +251 -0
  105. package/dist/ai/computer.js.map +1 -0
  106. package/dist/ai/defence.d.ts +4 -0
  107. package/dist/ai/defence.js +430 -0
  108. package/dist/ai/defence.js.map +1 -0
  109. package/dist/ai/define.d.ts +3 -2
  110. package/dist/ai/define.js +31 -0
  111. package/dist/ai/define.js.map +1 -0
  112. package/dist/ai/economy.d.ts +10 -7
  113. package/dist/ai/economy.js +780 -0
  114. package/dist/ai/economy.js.map +1 -0
  115. package/dist/ai/geometry.js +38 -0
  116. package/dist/ai/geometry.js.map +1 -0
  117. package/dist/ai/goals.d.ts +1 -0
  118. package/dist/ai/goals.js +560 -0
  119. package/dist/ai/goals.js.map +1 -0
  120. package/dist/ai/knowledge.d.ts +72 -7
  121. package/dist/ai/knowledge.js +804 -0
  122. package/dist/ai/knowledge.js.map +1 -0
  123. package/dist/ai/lanes.d.ts +10 -2
  124. package/dist/ai/lanes.js +715 -0
  125. package/dist/ai/lanes.js.map +1 -0
  126. package/dist/ai/melee/build.js +264 -0
  127. package/dist/ai/melee/build.js.map +1 -0
  128. package/dist/ai/melee/goals.d.ts +7 -0
  129. package/dist/ai/melee/goals.js +720 -0
  130. package/dist/ai/melee/goals.js.map +1 -0
  131. package/dist/ai/melee/heroes.js +68 -0
  132. package/dist/ai/melee/heroes.js.map +1 -0
  133. package/dist/ai/melee/index.d.ts +1 -1
  134. package/dist/ai/melee/index.js +51 -0
  135. package/dist/ai/melee/index.js.map +1 -0
  136. package/dist/ai/melee/production.js +29 -0
  137. package/dist/ai/melee/production.js.map +1 -0
  138. package/dist/ai/melee/surrender.js +64 -0
  139. package/dist/ai/melee/surrender.js.map +1 -0
  140. package/dist/ai/micro.d.ts +9 -0
  141. package/dist/ai/micro.js +1316 -0
  142. package/dist/ai/micro.js.map +1 -0
  143. package/dist/ai/mission.d.ts +9 -2
  144. package/dist/ai/mission.js +538 -0
  145. package/dist/ai/mission.js.map +1 -0
  146. package/dist/ai/missionRules.d.ts +1 -1
  147. package/dist/ai/missionRules.js +26 -0
  148. package/dist/ai/missionRules.js.map +1 -0
  149. package/dist/ai/module.d.ts +6 -2
  150. package/dist/ai/module.js +37 -0
  151. package/dist/ai/module.js.map +1 -0
  152. package/dist/ai/options.d.ts +3 -3
  153. package/dist/ai/plans/build.d.ts +20 -1
  154. package/dist/ai/plans/build.js +608 -0
  155. package/dist/ai/plans/build.js.map +1 -0
  156. package/dist/ai/plans/placement.d.ts +4 -1
  157. package/dist/ai/plans/placement.js +295 -0
  158. package/dist/ai/plans/placement.js.map +1 -0
  159. package/dist/ai/plans/plans.d.ts +9 -0
  160. package/dist/ai/plans/plans.js +110 -0
  161. package/dist/ai/plans/plans.js.map +1 -0
  162. package/dist/ai/plans/production.d.ts +14 -2
  163. package/dist/ai/plans/production.js +434 -0
  164. package/dist/ai/plans/production.js.map +1 -0
  165. package/dist/ai/plans/purse.d.ts +6 -3
  166. package/dist/ai/plans/purse.js +139 -0
  167. package/dist/ai/plans/purse.js.map +1 -0
  168. package/dist/ai/plans/tech.d.ts +6 -0
  169. package/dist/ai/plans/tech.js +122 -0
  170. package/dist/ai/plans/tech.js.map +1 -0
  171. package/dist/ai/profiles.d.ts +4 -4
  172. package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
  173. package/dist/ai/profiles.js.map +1 -0
  174. package/dist/ai/reach.js +54 -0
  175. package/dist/ai/reach.js.map +1 -0
  176. package/dist/ai/report.d.ts +8 -0
  177. package/dist/ai/report.js +87 -0
  178. package/dist/ai/report.js.map +1 -0
  179. package/dist/ai/roles.d.ts +4 -0
  180. package/dist/ai/roles.js +207 -0
  181. package/dist/ai/roles.js.map +1 -0
  182. package/dist/ai/rules.d.ts +8 -2
  183. package/dist/ai/rules.js +416 -0
  184. package/dist/ai/rules.js.map +1 -0
  185. package/dist/ai/scouting.d.ts +6 -0
  186. package/dist/ai/scouting.js +324 -0
  187. package/dist/ai/scouting.js.map +1 -0
  188. package/dist/ai/settings.js +99 -0
  189. package/dist/ai/settings.js.map +1 -0
  190. package/dist/ai/squads.d.ts +21 -2
  191. package/dist/ai/squads.js +916 -0
  192. package/dist/ai/squads.js.map +1 -0
  193. package/dist/ai/strength.js +320 -0
  194. package/dist/ai/strength.js.map +1 -0
  195. package/dist/ai/task.d.ts +3 -1
  196. package/dist/ai/task.js +17 -0
  197. package/dist/ai/task.js.map +1 -0
  198. package/dist/ai/tasks/attack.js +24 -0
  199. package/dist/ai/tasks/attack.js.map +1 -0
  200. package/dist/ai/tasks/capture.d.ts +3 -3
  201. package/dist/ai/tasks/capture.js +37 -0
  202. package/dist/ai/tasks/capture.js.map +1 -0
  203. package/dist/ai/tasks/creep.js +29 -0
  204. package/dist/ai/tasks/creep.js.map +1 -0
  205. package/dist/ai/tasks/defend.js +61 -0
  206. package/dist/ai/tasks/defend.js.map +1 -0
  207. package/dist/ai/tasks/drop.js +81 -0
  208. package/dist/ai/tasks/drop.js.map +1 -0
  209. package/dist/ai/tasks/escort.js +59 -0
  210. package/dist/ai/tasks/escort.js.map +1 -0
  211. package/dist/ai/tasks/gather.js +48 -0
  212. package/dist/ai/tasks/gather.js.map +1 -0
  213. package/dist/ai/tasks/harass.js +39 -0
  214. package/dist/ai/tasks/harass.js.map +1 -0
  215. package/dist/ai/tasks/hold.js +32 -0
  216. package/dist/ai/tasks/hold.js.map +1 -0
  217. package/dist/ai/tasks/index.js +34 -0
  218. package/dist/ai/tasks/index.js.map +1 -0
  219. package/dist/ai/tasks/move.js +26 -0
  220. package/dist/ai/tasks/move.js.map +1 -0
  221. package/dist/ai/tasks/patrol.js +59 -0
  222. package/dist/ai/tasks/patrol.js.map +1 -0
  223. package/dist/ai/tasks/retreat.js +28 -0
  224. package/dist/ai/tasks/retreat.js.map +1 -0
  225. package/dist/ai/tasks/scout.js +73 -0
  226. package/dist/ai/tasks/scout.js.map +1 -0
  227. package/dist/ai/tasks/shared.d.ts +1 -1
  228. package/dist/ai/tasks/shared.js +137 -0
  229. package/dist/ai/tasks/shared.js.map +1 -0
  230. package/dist/ai/team.d.ts +18 -1
  231. package/dist/ai/team.js +492 -0
  232. package/dist/ai/team.js.map +1 -0
  233. package/dist/ai/threat.d.ts +6 -0
  234. package/dist/ai/threat.js +206 -0
  235. package/dist/ai/threat.js.map +1 -0
  236. package/dist/ai/view.d.ts +21 -7
  237. package/dist/ai/view.js +677 -0
  238. package/dist/ai/view.js.map +1 -0
  239. package/dist/ai/waves.d.ts +6 -0
  240. package/dist/ai/waves.js +410 -0
  241. package/dist/ai/waves.js.map +1 -0
  242. package/dist/ai.js +54 -6239
  243. package/dist/aiTesting.d.ts +6 -3
  244. package/dist/aiTesting.js +229 -0
  245. package/dist/aiTesting.js.map +1 -0
  246. package/dist/areas.d.ts +4 -1
  247. package/dist/areas.js +295 -0
  248. package/dist/areas.js.map +1 -0
  249. package/dist/attacks.d.ts +3 -3
  250. package/dist/attacks.js +127 -0
  251. package/dist/attacks.js.map +1 -0
  252. package/dist/burning.d.ts +267 -0
  253. package/dist/burning.js +795 -0
  254. package/dist/burning.js.map +1 -0
  255. package/dist/bytes.js +21 -0
  256. package/dist/bytes.js.map +1 -0
  257. package/dist/callings.d.ts +71 -0
  258. package/dist/callings.js +157 -0
  259. package/dist/callings.js.map +1 -0
  260. package/dist/cameraOrders.d.ts +78 -0
  261. package/dist/cameraOrders.js +114 -0
  262. package/dist/cameraOrders.js.map +1 -0
  263. package/dist/camps.d.ts +70 -4
  264. package/dist/camps.js +501 -0
  265. package/dist/camps.js.map +1 -0
  266. package/dist/capture.d.ts +15 -3
  267. package/dist/capture.js +304 -0
  268. package/dist/capture.js.map +1 -0
  269. package/dist/cellLayers.d.ts +78 -13
  270. package/dist/cellLayers.js +275 -0
  271. package/dist/cellLayers.js.map +1 -0
  272. package/dist/cellPatches.d.ts +24 -0
  273. package/dist/cellPatches.js +73 -0
  274. package/dist/cellPatches.js.map +1 -0
  275. package/dist/cinematics.d.ts +10 -5
  276. package/dist/cinematics.js +161 -0
  277. package/dist/cinematics.js.map +1 -0
  278. package/dist/clock.d.ts +2 -2
  279. package/dist/clock.js +78 -0
  280. package/dist/clock.js.map +1 -0
  281. package/dist/commands.d.ts +36 -4
  282. package/dist/commands.js +636 -0
  283. package/dist/commands.js.map +1 -0
  284. package/dist/components.d.ts +31 -10
  285. package/dist/components.js +74 -0
  286. package/dist/components.js.map +1 -0
  287. package/dist/computers.d.ts +4 -4
  288. package/dist/computers.js +194 -0
  289. package/dist/computers.js.map +1 -0
  290. package/dist/concealment.d.ts +25 -2
  291. package/dist/concealment.js +409 -0
  292. package/dist/concealment.js.map +1 -0
  293. package/dist/coreComponents.js +130 -0
  294. package/dist/coreComponents.js.map +1 -0
  295. package/dist/createGame.d.ts +306 -0
  296. package/dist/createGame.js +405 -0
  297. package/dist/createGame.js.map +1 -0
  298. package/dist/dashing.d.ts +18 -2
  299. package/dist/dashing.js +41 -0
  300. package/dist/dashing.js.map +1 -0
  301. package/dist/debug.d.ts +8 -0
  302. package/dist/debug.js +5 -3
  303. package/dist/debug2.js +76 -0
  304. package/dist/debug2.js.map +1 -0
  305. package/dist/debugCommands.d.ts +6 -6
  306. package/dist/debugCommands.js +537 -0
  307. package/dist/debugCommands.js.map +1 -0
  308. package/dist/debugging.d.ts +1 -0
  309. package/dist/defaultSets.d.ts +183 -0
  310. package/dist/defaultSets.js +216 -0
  311. package/dist/defaultSets.js.map +1 -0
  312. package/dist/definitions.d.ts +6 -0
  313. package/dist/definitions.js +78 -0
  314. package/dist/definitions.js.map +1 -0
  315. package/dist/defs.d.ts +1895 -165
  316. package/dist/defs.js +380 -0
  317. package/dist/defs.js.map +1 -0
  318. package/dist/denying.d.ts +4 -4
  319. package/dist/denying.js +106 -0
  320. package/dist/denying.js.map +1 -0
  321. package/dist/destructibles.d.ts +2 -2
  322. package/dist/destructibles.js +36 -0
  323. package/dist/destructibles.js.map +1 -0
  324. package/dist/determinism.d.ts +4 -4
  325. package/dist/determinism.js +247 -0
  326. package/dist/determinism.js.map +1 -0
  327. package/dist/dialog.d.ts +17 -2
  328. package/dist/dialog.js +108 -0
  329. package/dist/dialog.js.map +1 -0
  330. package/dist/effectRefs.js +28 -0
  331. package/dist/effectRefs.js.map +1 -0
  332. package/dist/effects.d.ts +27 -11
  333. package/dist/effects.js +110 -0
  334. package/dist/effects.js.map +1 -0
  335. package/dist/endings.d.ts +1 -1
  336. package/dist/endings.js +78 -0
  337. package/dist/endings.js.map +1 -0
  338. package/dist/engagement.d.ts +40 -6
  339. package/dist/engagement.js +530 -0
  340. package/dist/engagement.js.map +1 -0
  341. package/dist/engineEvents.d.ts +72 -9
  342. package/dist/engineEvents.js +520 -0
  343. package/dist/engineEvents.js.map +1 -0
  344. package/dist/entity.d.ts +275 -26
  345. package/dist/entity.js +441 -0
  346. package/dist/entity.js.map +1 -0
  347. package/dist/entityIndex.d.ts +10 -3
  348. package/dist/entityIndex.js +149 -0
  349. package/dist/entityIndex.js.map +1 -0
  350. package/dist/errors.d.ts +6 -2
  351. package/dist/errors.js +59 -0
  352. package/dist/errors.js.map +1 -0
  353. package/dist/events.d.ts +11 -5
  354. package/dist/events.js +158 -0
  355. package/dist/events.js.map +1 -0
  356. package/dist/exactMath.js +273 -0
  357. package/dist/exactMath.js.map +1 -0
  358. package/dist/features.d.ts +1 -1
  359. package/dist/features.js +127 -0
  360. package/dist/features.js.map +1 -0
  361. package/dist/fields.d.ts +25 -5
  362. package/dist/fields.js +140 -0
  363. package/dist/fields.js.map +1 -0
  364. package/dist/fixture.d.ts +3 -3
  365. package/dist/fixture.js +512 -0
  366. package/dist/fixture.js.map +1 -0
  367. package/dist/fog.d.ts +26 -3
  368. package/dist/fog.js +333 -0
  369. package/dist/fog.js.map +1 -0
  370. package/dist/foliage.d.ts +476 -0
  371. package/dist/foliage.js +1478 -0
  372. package/dist/foliage.js.map +1 -0
  373. package/dist/foliageDebug.d.ts +57 -0
  374. package/dist/foliageDebug.js +172 -0
  375. package/dist/foliageDebug.js.map +1 -0
  376. package/dist/foliageRegrowth.d.ts +20 -0
  377. package/dist/foliageRegrowth.js +332 -0
  378. package/dist/foliageRegrowth.js.map +1 -0
  379. package/dist/formState.d.ts +67 -0
  380. package/dist/formState.js +65 -0
  381. package/dist/formState.js.map +1 -0
  382. package/dist/formation.d.ts +46 -8
  383. package/dist/formation.js +297 -0
  384. package/dist/formation.js.map +1 -0
  385. package/dist/forms.d.ts +58 -0
  386. package/dist/forms.js +146 -0
  387. package/dist/forms.js.map +1 -0
  388. package/dist/friendlyFire.d.ts +2 -2
  389. package/dist/friendlyFire.js +37 -0
  390. package/dist/friendlyFire.js.map +1 -0
  391. package/dist/game.d.ts +141 -48
  392. package/dist/game.js +834 -0
  393. package/dist/game.js.map +1 -0
  394. package/dist/gameData.d.ts +96 -22
  395. package/dist/gameData.js +1690 -0
  396. package/dist/gameData.js.map +1 -0
  397. package/dist/gameFiles.d.ts +3 -3
  398. package/dist/gameFiles.js +14 -0
  399. package/dist/gameFiles.js.map +1 -0
  400. package/dist/gates.js +92 -0
  401. package/dist/gates.js.map +1 -0
  402. package/dist/generate.d.ts +28 -1
  403. package/dist/generate.js +1062 -0
  404. package/dist/generate.js.map +1 -0
  405. package/dist/generateWorker.d.ts +7 -3
  406. package/dist/generateWorker.js +86 -0
  407. package/dist/generateWorker.js.map +1 -0
  408. package/dist/grid.d.ts +9 -0
  409. package/dist/grid.js +102 -0
  410. package/dist/grid.js.map +1 -0
  411. package/dist/ground.d.ts +17 -1
  412. package/dist/ground.js +375 -0
  413. package/dist/ground.js.map +1 -0
  414. package/dist/groundObjects.d.ts +70 -0
  415. package/dist/groundObjects.js +371 -0
  416. package/dist/groundObjects.js.map +1 -0
  417. package/dist/groundSpeed.d.ts +20 -3
  418. package/dist/groundSpeed.js +117 -0
  419. package/dist/groundSpeed.js.map +1 -0
  420. package/dist/hero.d.ts +126 -10
  421. package/dist/hero.js +432 -0
  422. package/dist/hero.js.map +1 -0
  423. package/dist/holds.d.ts +94 -0
  424. package/dist/holds.js +305 -0
  425. package/dist/holds.js.map +1 -0
  426. package/dist/home.d.ts +1 -1
  427. package/dist/home.js +30 -0
  428. package/dist/home.js.map +1 -0
  429. package/dist/hooks.d.ts +339 -57
  430. package/dist/hooks.js +105 -0
  431. package/dist/hooks.js.map +1 -0
  432. package/dist/hotReload.d.ts +6 -5
  433. package/dist/hotReload.js +145 -0
  434. package/dist/hotReload.js.map +1 -0
  435. package/dist/ids.d.ts +3 -3
  436. package/dist/ids.js +30 -0
  437. package/dist/ids.js.map +1 -0
  438. package/dist/idsFile.d.ts +36 -0
  439. package/dist/idsFile.js +134 -0
  440. package/dist/idsFile.js.map +1 -0
  441. package/dist/index.d.ts +105 -68
  442. package/dist/index.js +194 -4701
  443. package/dist/inspect.d.ts +29 -2
  444. package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
  445. package/dist/inspect.js.map +1 -0
  446. package/dist/inventory.d.ts +14 -1
  447. package/dist/inventory.js +84 -0
  448. package/dist/inventory.js.map +1 -0
  449. package/dist/items.d.ts +136 -8
  450. package/dist/items.js +585 -0
  451. package/dist/items.js.map +1 -0
  452. package/dist/lanes.d.ts +12 -3
  453. package/dist/lanes.js +496 -0
  454. package/dist/lanes.js.map +1 -0
  455. package/dist/life.d.ts +6 -2
  456. package/dist/life.js +287 -0
  457. package/dist/life.js.map +1 -0
  458. package/dist/log.d.ts +26 -3
  459. package/dist/log.js +192 -0
  460. package/dist/log.js.map +1 -0
  461. package/dist/manaBurn.d.ts +2 -2
  462. package/dist/manaBurn.js +75 -0
  463. package/dist/manaBurn.js.map +1 -0
  464. package/dist/map/file.d.ts +56 -3
  465. package/dist/map/file.js +264 -0
  466. package/dist/map/file.js.map +1 -0
  467. package/dist/map/images.js +61 -0
  468. package/dist/map/images.js.map +1 -0
  469. package/dist/map/look.d.ts +1 -1
  470. package/dist/map/look.js +30 -0
  471. package/dist/map/look.js.map +1 -0
  472. package/dist/map/pathProfile.js +183 -0
  473. package/dist/map/pathProfile.js.map +1 -0
  474. package/dist/map/resize.d.ts +4 -0
  475. package/dist/map/resize.js +136 -0
  476. package/dist/map/resize.js.map +1 -0
  477. package/dist/map/schema.js +257 -0
  478. package/dist/map/schema.js.map +1 -0
  479. package/dist/map/terrain.js +214 -0
  480. package/dist/map/terrain.js.map +1 -0
  481. package/dist/map/types.d.ts +92 -13
  482. package/dist/map/types.js +251 -0
  483. package/dist/map/types.js.map +1 -0
  484. package/dist/mapCheck/cells.js +94 -0
  485. package/dist/mapCheck/cells.js.map +1 -0
  486. package/dist/mapCheck/rules/foliage.d.ts +9 -0
  487. package/dist/mapCheck/rules/foliage.js +83 -0
  488. package/dist/mapCheck/rules/foliage.js.map +1 -0
  489. package/dist/mapCheck/rules/names.js +39 -0
  490. package/dist/mapCheck/rules/names.js.map +1 -0
  491. package/dist/mapCheck/rules/objects.d.ts +1 -1
  492. package/dist/mapCheck/rules/objects.js +56 -0
  493. package/dist/mapCheck/rules/objects.js.map +1 -0
  494. package/dist/mapCheck/rules/paths.js +32 -0
  495. package/dist/mapCheck/rules/paths.js.map +1 -0
  496. package/dist/mapCheck/rules/players.js +20 -0
  497. package/dist/mapCheck/rules/players.js.map +1 -0
  498. package/dist/mapCheck/rules/races.js +56 -0
  499. package/dist/mapCheck/rules/races.js.map +1 -0
  500. package/dist/mapCheck/rules/random.js +47 -0
  501. package/dist/mapCheck/rules/random.js.map +1 -0
  502. package/dist/mapCheck/rules/regions.js +30 -0
  503. package/dist/mapCheck/rules/regions.js.map +1 -0
  504. package/dist/mapCheck/rules/targets.js +31 -0
  505. package/dist/mapCheck/rules/targets.js.map +1 -0
  506. package/dist/mapCheck/rules/walking.js +45 -0
  507. package/dist/mapCheck/rules/walking.js.map +1 -0
  508. package/dist/mapCheck.d.ts +2 -2
  509. package/dist/mapCheck.js +63 -0
  510. package/dist/mapCheck.js.map +1 -0
  511. package/dist/mapFields.d.ts +25 -2
  512. package/dist/mapFields.js +134 -0
  513. package/dist/mapFields.js.map +1 -0
  514. package/dist/mapFile.js +176 -0
  515. package/dist/mapFile.js.map +1 -0
  516. package/dist/mapMeasure.d.ts +8 -0
  517. package/dist/mapMeasure.js +283 -0
  518. package/dist/mapMeasure.js.map +1 -0
  519. package/dist/mapMerge.d.ts +1 -0
  520. package/dist/mapMerge.js +172 -0
  521. package/dist/mapMerge.js.map +1 -0
  522. package/dist/mapObjectives.js +138 -0
  523. package/dist/mapObjectives.js.map +1 -0
  524. package/dist/mapObjects.js +80 -0
  525. package/dist/mapObjects.js.map +1 -0
  526. package/dist/math.d.ts +37 -7
  527. package/dist/math.js +155 -0
  528. package/dist/math.js.map +1 -0
  529. package/dist/messages.d.ts +71 -4
  530. package/dist/messages.js +29 -0
  531. package/dist/messages.js.map +1 -0
  532. package/dist/missionRules.d.ts +10 -2
  533. package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
  534. package/dist/missionRules.js.map +1 -0
  535. package/dist/mods.d.ts +39 -20
  536. package/dist/mods.js +271 -0
  537. package/dist/mods.js.map +1 -0
  538. package/dist/moves.d.ts +87 -0
  539. package/dist/moves.js +539 -0
  540. package/dist/moves.js.map +1 -0
  541. package/dist/names.d.ts +7 -0
  542. package/dist/names.js +122 -0
  543. package/dist/names.js.map +1 -0
  544. package/dist/navigation/agentParams.js +14 -0
  545. package/dist/navigation/agentParams.js.map +1 -0
  546. package/dist/navigation/air.d.ts +7 -3
  547. package/dist/navigation/air.js +401 -0
  548. package/dist/navigation/air.js.map +1 -0
  549. package/dist/navigation/builds.d.ts +34 -2
  550. package/dist/navigation/builds.js +287 -0
  551. package/dist/navigation/builds.js.map +1 -0
  552. package/dist/navigation/groundAreas.d.ts +59 -1
  553. package/dist/navigation/groundAreas.js +407 -0
  554. package/dist/navigation/groundAreas.js.map +1 -0
  555. package/dist/navigation/navigation.d.ts +98 -9
  556. package/dist/navigation/recast.d.ts +194 -18
  557. package/dist/navigation/recast.js +1379 -0
  558. package/dist/navigation/recast.js.map +1 -0
  559. package/dist/navigation/sidePaths.d.ts +8 -3
  560. package/dist/navigation/sidePaths.js +241 -0
  561. package/dist/navigation/sidePaths.js.map +1 -0
  562. package/dist/navigation/sized.js +243 -0
  563. package/dist/navigation/sized.js.map +1 -0
  564. package/dist/nearest.js +32 -0
  565. package/dist/nearest.js.map +1 -0
  566. package/dist/noise.js +59 -0
  567. package/dist/noise.js.map +1 -0
  568. package/dist/objectives.d.ts +12 -3
  569. package/dist/objectives.js +144 -0
  570. package/dist/objectives.js.map +1 -0
  571. package/dist/orders/basic.d.ts +5 -5
  572. package/dist/orders/basic.js +417 -0
  573. package/dist/orders/basic.js.map +1 -0
  574. package/dist/orders/build.js +278 -0
  575. package/dist/orders/build.js.map +1 -0
  576. package/dist/orders/cast.d.ts +13 -3
  577. package/dist/orders/cast.js +558 -0
  578. package/dist/orders/cast.js.map +1 -0
  579. package/dist/orders/facts.js +16 -0
  580. package/dist/orders/facts.js.map +1 -0
  581. package/dist/orders/harvest.d.ts +21 -5
  582. package/dist/orders/harvest.js +540 -0
  583. package/dist/orders/harvest.js.map +1 -0
  584. package/dist/orders/idle.d.ts +3 -1
  585. package/dist/orders/idle.js +234 -0
  586. package/dist/orders/idle.js.map +1 -0
  587. package/dist/orders/items.js +92 -0
  588. package/dist/orders/items.js.map +1 -0
  589. package/dist/orders/queue.js +108 -0
  590. package/dist/orders/queue.js.map +1 -0
  591. package/dist/orders/waiting.d.ts +39 -0
  592. package/dist/orders/waiting.js +149 -0
  593. package/dist/orders/waiting.js.map +1 -0
  594. package/dist/pack.schema.js +13 -0
  595. package/dist/pack.schema.js.map +1 -0
  596. package/dist/pack.schema.json +7622 -841
  597. package/dist/packs/director/index.d.ts +13 -5
  598. package/dist/packs/director/index.js +204 -0
  599. package/dist/packs/director/index.js.map +1 -0
  600. package/dist/packs/heroes/campaign.d.ts +3 -2
  601. package/dist/packs/heroes/campaign.js +241 -0
  602. package/dist/packs/heroes/campaign.js.map +1 -0
  603. package/dist/packs/heroes/carry.d.ts +6 -0
  604. package/dist/packs/heroes/carry.js +112 -0
  605. package/dist/packs/heroes/carry.js.map +1 -0
  606. package/dist/packs/heroes/commands.js +115 -0
  607. package/dist/packs/heroes/commands.js.map +1 -0
  608. package/dist/packs/heroes/fallen.d.ts +43 -0
  609. package/dist/packs/heroes/fallen.js +61 -0
  610. package/dist/packs/heroes/fallen.js.map +1 -0
  611. package/dist/packs/heroes/hire.js +60 -0
  612. package/dist/packs/heroes/hire.js.map +1 -0
  613. package/dist/packs/heroes/index.d.ts +7 -6
  614. package/dist/packs/heroes/index.js +130 -0
  615. package/dist/packs/heroes/index.js.map +1 -0
  616. package/dist/packs/heroes/loop.d.ts +95 -0
  617. package/dist/packs/heroes/loop.js +250 -0
  618. package/dist/packs/heroes/loop.js.map +1 -0
  619. package/dist/packs/heroes/making.d.ts +6 -3
  620. package/dist/packs/heroes/making.js +55 -0
  621. package/dist/packs/heroes/making.js.map +1 -0
  622. package/dist/packs/heroes/respawn.d.ts +3 -3
  623. package/dist/packs/heroes/respawn.js +87 -0
  624. package/dist/packs/heroes/respawn.js.map +1 -0
  625. package/dist/packs/heroes/sets.d.ts +32 -0
  626. package/dist/packs/heroes/sets.js +51 -0
  627. package/dist/packs/heroes/sets.js.map +1 -0
  628. package/dist/packs/heroes/spells.d.ts +16 -0
  629. package/dist/packs/heroes/spells.js +269 -0
  630. package/dist/packs/heroes/spells.js.map +1 -0
  631. package/dist/packs/items/defaults.d.ts +43 -0
  632. package/dist/packs/items/defaults.js +1504 -0
  633. package/dist/packs/items/defaults.js.map +1 -0
  634. package/dist/packs/items/index.d.ts +27 -0
  635. package/dist/packs/items/index.js +214 -0
  636. package/dist/packs/items/index.js.map +1 -0
  637. package/dist/packs/moba/index.d.ts +3 -3
  638. package/dist/packs/moba/index.js +174 -0
  639. package/dist/packs/moba/index.js.map +1 -0
  640. package/dist/packs/pack.d.ts +15 -15
  641. package/dist/packs/pack.js +14 -0
  642. package/dist/packs/pack.js.map +1 -0
  643. package/dist/packs.d.ts +15 -7
  644. package/dist/packs.js +222 -0
  645. package/dist/packs.js.map +1 -0
  646. package/dist/paths.d.ts +2 -0
  647. package/dist/paths.js +109 -0
  648. package/dist/paths.js.map +1 -0
  649. package/dist/plain.js +57 -0
  650. package/dist/plain.js.map +1 -0
  651. package/dist/player.d.ts +33 -10
  652. package/dist/player.js +159 -0
  653. package/dist/player.js.map +1 -0
  654. package/dist/portals.d.ts +1 -1
  655. package/dist/portals.js +194 -0
  656. package/dist/portals.js.map +1 -0
  657. package/dist/prefabs.d.ts +25 -2
  658. package/dist/prefabs.js +239 -0
  659. package/dist/prefabs.js.map +1 -0
  660. package/dist/presetBuildings.js +58 -0
  661. package/dist/presetBuildings.js.map +1 -0
  662. package/dist/presetFoliage.d.ts +27 -0
  663. package/dist/presetFoliage.js +98 -0
  664. package/dist/presetFoliage.js.map +1 -0
  665. package/dist/presetGround.js +65 -0
  666. package/dist/presetGround.js.map +1 -0
  667. package/dist/proxies.d.ts +12 -0
  668. package/dist/proxies.js +79 -0
  669. package/dist/proxies.js.map +1 -0
  670. package/dist/query.d.ts +56 -0
  671. package/dist/query.js +88 -0
  672. package/dist/query.js.map +1 -0
  673. package/dist/races.d.ts +15 -14
  674. package/dist/races.js +172 -0
  675. package/dist/races.js.map +1 -0
  676. package/dist/randomGroups.js +91 -0
  677. package/dist/randomGroups.js.map +1 -0
  678. package/dist/registry.d.ts +117 -53
  679. package/dist/registry.js +323 -0
  680. package/dist/registry.js.map +1 -0
  681. package/dist/remains.d.ts +11 -9
  682. package/dist/remains.js +188 -0
  683. package/dist/remains.js.map +1 -0
  684. package/dist/replication.d.ts +12 -7
  685. package/dist/replication.js +100 -0
  686. package/dist/replication.js.map +1 -0
  687. package/dist/rng.d.ts +2 -0
  688. package/dist/rng.js +40 -0
  689. package/dist/rng.js.map +1 -0
  690. package/dist/rules.d.ts +186 -99
  691. package/dist/rules.js +179 -0
  692. package/dist/rules.js.map +1 -0
  693. package/dist/rulesCheck.d.ts +5 -4
  694. package/dist/rulesCheck.js +693 -0
  695. package/dist/rulesCheck.js.map +1 -0
  696. package/dist/runes.d.ts +2 -2
  697. package/dist/runes.js +80 -0
  698. package/dist/runes.js.map +1 -0
  699. package/dist/save.d.ts +37 -12
  700. package/dist/save.js +532 -0
  701. package/dist/save.js.map +1 -0
  702. package/dist/scenario.d.ts +2 -2
  703. package/dist/scenario.js +99 -0
  704. package/dist/scenario.js.map +1 -0
  705. package/dist/scheduler.d.ts +3 -0
  706. package/dist/scheduler.js +156 -0
  707. package/dist/scheduler.js.map +1 -0
  708. package/dist/score.d.ts +19 -19
  709. package/dist/score.js +709 -0
  710. package/dist/score.js.map +1 -0
  711. package/dist/sequences.d.ts +10 -6
  712. package/dist/sequences.js +206 -0
  713. package/dist/sequences.js.map +1 -0
  714. package/dist/server/doorman.js +154 -0
  715. package/dist/server/doorman.js.map +1 -0
  716. package/dist/server/gameServer.d.ts +16 -1
  717. package/dist/server/gameServer.js +643 -0
  718. package/dist/server/gameServer.js.map +1 -0
  719. package/dist/server/index.d.ts +1 -1
  720. package/dist/server/lobby.js +199 -0
  721. package/dist/server/lobby.js.map +1 -0
  722. package/dist/server/log.js +18 -0
  723. package/dist/server/log.js.map +1 -0
  724. package/dist/server/match.js +267 -0
  725. package/dist/server/match.js.map +1 -0
  726. package/dist/server/mode.d.ts +18 -9
  727. package/dist/server/mode.js +220 -0
  728. package/dist/server/mode.js.map +1 -0
  729. package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
  730. package/dist/server/navigation-worker.js.map +1 -0
  731. package/dist/server/navigation.js +39 -0
  732. package/dist/server/navigation.js.map +1 -0
  733. package/dist/server/ops.d.ts +4 -0
  734. package/dist/server/ops.js +137 -0
  735. package/dist/server/ops.js.map +1 -0
  736. package/dist/server/packs.d.ts +3 -3
  737. package/dist/server/packs.js +32 -0
  738. package/dist/server/packs.js.map +1 -0
  739. package/dist/server/ratings.d.ts +5 -0
  740. package/dist/server/ratings.js +104 -0
  741. package/dist/server/ratings.js.map +1 -0
  742. package/dist/server/relay.d.ts +12 -2
  743. package/dist/server/relay.js +144 -0
  744. package/dist/server/relay.js.map +1 -0
  745. package/dist/server/rooms.d.ts +9 -2
  746. package/dist/server/rooms.js +442 -0
  747. package/dist/server/rooms.js.map +1 -0
  748. package/dist/server/seat.js +116 -0
  749. package/dist/server/seat.js.map +1 -0
  750. package/dist/server/seatSettings.d.ts +3 -3
  751. package/dist/server/seatSettings.js +63 -0
  752. package/dist/server/seatSettings.js.map +1 -0
  753. package/dist/server/secret.js +13 -0
  754. package/dist/server/secret.js.map +1 -0
  755. package/dist/server/start.d.ts +13 -6
  756. package/dist/server/start.js +76 -0
  757. package/dist/server/start.js.map +1 -0
  758. package/dist/server/websocket.d.ts +9 -1
  759. package/dist/server/websocket.js +306 -0
  760. package/dist/server/websocket.js.map +1 -0
  761. package/dist/server.js +15 -2861
  762. package/dist/session/can.js +26 -0
  763. package/dist/session/can.js.map +1 -0
  764. package/dist/session/commandReplay.d.ts +8 -2
  765. package/dist/session/commandReplay.js +293 -0
  766. package/dist/session/commandReplay.js.map +1 -0
  767. package/dist/session/debug.js +151 -0
  768. package/dist/session/debug.js.map +1 -0
  769. package/dist/session/delay.js +62 -0
  770. package/dist/session/delay.js.map +1 -0
  771. package/dist/session/delta.d.ts +14 -1
  772. package/dist/session/delta.js +407 -0
  773. package/dist/session/delta.js.map +1 -0
  774. package/dist/session/entityState.js +415 -0
  775. package/dist/session/entityState.js.map +1 -0
  776. package/dist/session/local.d.ts +47 -5
  777. package/dist/session/local.js +670 -0
  778. package/dist/session/local.js.map +1 -0
  779. package/dist/session/memory.d.ts +20 -2
  780. package/dist/session/memory.js +131 -0
  781. package/dist/session/memory.js.map +1 -0
  782. package/dist/session/protocol.d.ts +325 -31
  783. package/dist/session/protocol.js +55 -0
  784. package/dist/session/protocol.js.map +1 -0
  785. package/dist/session/remote.d.ts +74 -12
  786. package/dist/session/remote.js +1394 -0
  787. package/dist/session/remote.js.map +1 -0
  788. package/dist/session/replay.d.ts +11 -2
  789. package/dist/session/replay.js +160 -0
  790. package/dist/session/replay.js.map +1 -0
  791. package/dist/session/seed.js +12 -0
  792. package/dist/session/seed.js.map +1 -0
  793. package/dist/session/share.d.ts +5 -1
  794. package/dist/session/share.js +94 -0
  795. package/dist/session/share.js.map +1 -0
  796. package/dist/session/socket.d.ts +1 -1
  797. package/dist/session/socket.js +29 -0
  798. package/dist/session/socket.js.map +1 -0
  799. package/dist/session/wire.d.ts +5 -0
  800. package/dist/session/wire.js +84 -0
  801. package/dist/session/wire.js.map +1 -0
  802. package/dist/session/worker.d.ts +77 -12
  803. package/dist/session/worker.js +499 -0
  804. package/dist/session/worker.js.map +1 -0
  805. package/dist/shared.d.ts +31 -5
  806. package/dist/shared.js +166 -0
  807. package/dist/shared.js.map +1 -0
  808. package/dist/sides.d.ts +9 -3
  809. package/dist/sides.js +149 -0
  810. package/dist/sides.js.map +1 -0
  811. package/dist/sight.js +85 -0
  812. package/dist/sight.js.map +1 -0
  813. package/dist/simulate-worker.js +1 -1
  814. package/dist/simulate.d.ts +12 -8
  815. package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
  816. package/dist/simulate.js.map +1 -0
  817. package/dist/smart.js +77 -0
  818. package/dist/smart.js.map +1 -0
  819. package/dist/spatial.d.ts +32 -16
  820. package/dist/spatial.js +234 -0
  821. package/dist/spatial.js.map +1 -0
  822. package/dist/spawning.d.ts +1 -0
  823. package/dist/spawning.js +224 -0
  824. package/dist/spawning.js.map +1 -0
  825. package/dist/stances.d.ts +6 -3
  826. package/dist/stances.js +169 -0
  827. package/dist/stances.js.map +1 -0
  828. package/dist/start.d.ts +10 -10
  829. package/dist/start.js +75 -0
  830. package/dist/start.js.map +1 -0
  831. package/dist/stats.d.ts +42 -16
  832. package/dist/stats.js +290 -0
  833. package/dist/stats.js.map +1 -0
  834. package/dist/summoned.d.ts +52 -0
  835. package/dist/summoned.js +38 -0
  836. package/dist/summoned.js.map +1 -0
  837. package/dist/summons.d.ts +10 -13
  838. package/dist/summons.js +271 -0
  839. package/dist/summons.js.map +1 -0
  840. package/dist/systems/abilities.js +224 -0
  841. package/dist/systems/abilities.js.map +1 -0
  842. package/dist/systems/combat.d.ts +35 -1
  843. package/dist/systems/combat.js +677 -0
  844. package/dist/systems/combat.js.map +1 -0
  845. package/dist/systems/combatTold.d.ts +3 -1
  846. package/dist/systems/combatTold.js +85 -0
  847. package/dist/systems/combatTold.js.map +1 -0
  848. package/dist/systems/construction.js +80 -0
  849. package/dist/systems/construction.js.map +1 -0
  850. package/dist/systems/economy.d.ts +0 -6
  851. package/dist/systems/economy.js +128 -0
  852. package/dist/systems/economy.js.map +1 -0
  853. package/dist/systems/fog.d.ts +1 -1
  854. package/dist/systems/fog.js +120 -0
  855. package/dist/systems/fog.js.map +1 -0
  856. package/dist/systems/life.js +32 -0
  857. package/dist/systems/life.js.map +1 -0
  858. package/dist/systems/movement.d.ts +24 -12
  859. package/dist/systems/movement.js +1247 -0
  860. package/dist/systems/movement.js.map +1 -0
  861. package/dist/systems/orders.js +64 -0
  862. package/dist/systems/orders.js.map +1 -0
  863. package/dist/systems/production.js +322 -0
  864. package/dist/systems/production.js.map +1 -0
  865. package/dist/systems/productionQueue.js +120 -0
  866. package/dist/systems/productionQueue.js.map +1 -0
  867. package/dist/systems/victory.d.ts +1 -1
  868. package/dist/systems/victory.js +56 -0
  869. package/dist/systems/victory.js.map +1 -0
  870. package/dist/talk.d.ts +6 -6
  871. package/dist/talk.js +153 -0
  872. package/dist/talk.js.map +1 -0
  873. package/dist/targeting.d.ts +142 -0
  874. package/dist/targeting.js +49 -0
  875. package/dist/targeting.js.map +1 -0
  876. package/dist/tech.d.ts +20 -3
  877. package/dist/tech.js +239 -0
  878. package/dist/tech.js.map +1 -0
  879. package/dist/techTree.d.ts +7 -0
  880. package/dist/techTree.js +90 -0
  881. package/dist/techTree.js.map +1 -0
  882. package/dist/terrain.d.ts +59 -7
  883. package/dist/terrain.js +389 -0
  884. package/dist/terrain.js.map +1 -0
  885. package/dist/terrainSave.d.ts +6 -0
  886. package/dist/terrainSave.js +74 -0
  887. package/dist/terrainSave.js.map +1 -0
  888. package/dist/testing.d.ts +8 -7
  889. package/dist/testing.js +13 -739
  890. package/dist/testing.js.map +1 -1
  891. package/dist/tiles.d.ts +1 -1
  892. package/dist/tiles.js +43 -0
  893. package/dist/tiles.js.map +1 -0
  894. package/dist/timers.d.ts +29 -4
  895. package/dist/timers.js +242 -0
  896. package/dist/timers.js.map +1 -0
  897. package/dist/tomes.d.ts +4 -4
  898. package/dist/tomes.js +94 -0
  899. package/dist/tomes.js.map +1 -0
  900. package/dist/trade.js +103 -0
  901. package/dist/trade.js.map +1 -0
  902. package/dist/transport.d.ts +6 -1
  903. package/dist/transport.js +281 -0
  904. package/dist/transport.js.map +1 -0
  905. package/dist/tunables.d.ts +10 -3
  906. package/dist/tunables.js +56 -0
  907. package/dist/tunables.js.map +1 -0
  908. package/dist/unitResources.d.ts +67 -0
  909. package/dist/unitResources.js +266 -0
  910. package/dist/unitResources.js.map +1 -0
  911. package/dist/upkeep.d.ts +6 -1
  912. package/dist/upkeep.js +26 -0
  913. package/dist/upkeep.js.map +1 -0
  914. package/dist/veterancy.d.ts +8 -3
  915. package/dist/veterancy.js +131 -0
  916. package/dist/veterancy.js.map +1 -0
  917. package/dist/vision.d.ts +36 -0
  918. package/dist/vision.js +133 -0
  919. package/dist/vision.js.map +1 -0
  920. package/dist/walls.d.ts +1 -1
  921. package/dist/walls.js +278 -0
  922. package/dist/walls.js.map +1 -0
  923. package/dist/world.d.ts +606 -88
  924. package/dist/world.js +1263 -0
  925. package/dist/world.js.map +1 -0
  926. package/package.json +2 -2
  927. package/dist/ai.js.map +0 -1
  928. package/dist/attributes.d.ts +0 -66
  929. package/dist/brain-BvVdUhX8.js +0 -7659
  930. package/dist/brain-BvVdUhX8.js.map +0 -1
  931. package/dist/builds-C6LfgvEU.js +0 -460
  932. package/dist/builds-C6LfgvEU.js.map +0 -1
  933. package/dist/coreComponents-syuh2fPG.js +0 -5149
  934. package/dist/coreComponents-syuh2fPG.js.map +0 -1
  935. package/dist/debugCommands-CzjrSm66.js +0 -14739
  936. package/dist/debugCommands-CzjrSm66.js.map +0 -1
  937. package/dist/determinism-BCymQwiE.js +0 -518
  938. package/dist/determinism-BCymQwiE.js.map +0 -1
  939. package/dist/game-DiJEN-Ks.js +0 -5800
  940. package/dist/game-DiJEN-Ks.js.map +0 -1
  941. package/dist/index.js.map +0 -1
  942. package/dist/inspect-D9dWHmZ0.js.map +0 -1
  943. package/dist/local-Dkovq42k.js +0 -1379
  944. package/dist/local-Dkovq42k.js.map +0 -1
  945. package/dist/missionRules-C-bGxm0Q.js.map +0 -1
  946. package/dist/navigation-worker.js.map +0 -1
  947. package/dist/packs-g5thvmGn.js +0 -3199
  948. package/dist/packs-g5thvmGn.js.map +0 -1
  949. package/dist/profiles-B3NS9jwk.js.map +0 -1
  950. package/dist/server.js.map +0 -1
  951. package/dist/simulate-oXBiw1Ff.js.map +0 -1
@@ -0,0 +1,416 @@
1
+ import { defineModule } from "./module.js";
2
+ //#region src/ai/rules.ts
3
+ var inRange = (value, range, least = 1) => range.min === void 0 && range.max === void 0 ? value >= least : (range.min === void 0 || value >= range.min) && (range.max === void 0 || value <= range.max);
4
+ /** A value at a path of dots in plain data (`'waves.next'`): the value itself for no path */
5
+ function at(value, path) {
6
+ if (!path) return value;
7
+ let here = value;
8
+ for (const key of path.split(".")) {
9
+ if (!here || typeof here !== "object") return void 0;
10
+ here = here[key];
11
+ }
12
+ return here;
13
+ }
14
+ /** Whether a value is as asked: equal to `equals`, or a number within the range */
15
+ var matches = (value, asked) => "equals" in asked ? value === asked.equals : typeof value === "number" && inRange(value, asked, -Infinity);
16
+ /** Whose units: the brain's sets of them */
17
+ function whose(ai, of, known) {
18
+ const { view } = ai;
19
+ if (of === "enemy") return known ? view.enemies.known() : view.enemies;
20
+ if (of === "ally") return view.allies;
21
+ return view.mine;
22
+ }
23
+ /** Narrowed to a type, a role, a tag */
24
+ function kind(units, asked) {
25
+ let set = units;
26
+ if (asked.type !== void 0) set = set.ofType(asked.type);
27
+ if (asked.role !== void 0) set = set.withRole(asked.role);
28
+ if (asked.tag !== void 0) set = set.withTag(asked.tag);
29
+ return set;
30
+ }
31
+ /** Where a condition means: a named entity the player knows of, or a point; nothing for a name it does not know */
32
+ function place(ai, near) {
33
+ if (typeof near !== "string") return near;
34
+ const named = ai.view.named(near);
35
+ if (named) return {
36
+ x: named.x,
37
+ z: named.z
38
+ };
39
+ }
40
+ /** Whether a point is near a place: a region by name, a named entity or a point within `reach` */
41
+ function nearPlace(ai, point, near, reach) {
42
+ if (typeof near === "string" && ai.view.region(near)) return ai.view.inRegion(near, point);
43
+ const to = place(ai, near);
44
+ if (!to) return false;
45
+ const dx = point.x - to.x;
46
+ const dz = point.z - to.z;
47
+ return dx * dx + dz * dz <= reach * reach;
48
+ }
49
+ /**
50
+ * Whether a condition holds for the brain now: a function is asked, data is read as its form says. A form the kit
51
+ * does not know (a game's own not defined) is no, and the log says so once
52
+ *
53
+ * @beta
54
+ */
55
+ function evaluate(condition, ai) {
56
+ if (typeof condition === "function") return !!condition(ai);
57
+ if (!condition || typeof condition !== "object") return false;
58
+ const { view } = ai;
59
+ if ("all" in condition) return condition.all.every((each) => evaluate(each, ai));
60
+ if ("any" in condition) return condition.any.some((each) => evaluate(each, ai));
61
+ if ("not" in condition) return !evaluate(condition.not, ai);
62
+ if ("resource" in condition) return inRange(view.me.resources[condition.resource.id] ?? 0, condition.resource, -Infinity);
63
+ if ("units" in condition) {
64
+ const asked = condition.units;
65
+ let set = kind(whose(ai, asked.of, asked.known), asked);
66
+ if (asked.finished) set = set.finished();
67
+ if (asked.near !== void 0) {
68
+ const near = asked.near;
69
+ const reach = asked.within ?? 16;
70
+ set = set.where((unit) => nearPlace(ai, unit, near, reach));
71
+ }
72
+ return inRange(set.length, asked);
73
+ }
74
+ if ("supply" in condition) {
75
+ const { me } = view;
76
+ const asked = condition.supply;
77
+ return (!asked.free || inRange(me.supplyCap - me.supplyUsed, asked.free, -Infinity)) && (!asked.used || inRange(me.supplyUsed, asked.used, -Infinity)) && (!asked.cap || inRange(me.supplyCap, asked.cap, -Infinity));
78
+ }
79
+ if ("time" in condition) {
80
+ const { after, before } = condition.time;
81
+ return (after === void 0 || ai.time >= after) && (before === void 0 || ai.time < before);
82
+ }
83
+ if ("underAttack" in condition) {
84
+ const asked = condition.underAttack === true ? {} : condition.underAttack;
85
+ const hits = ai.knowledge.events.damage(asked.seconds ?? 5).filter((hit) => hit.owner === ai.playerId);
86
+ if (asked.near === void 0) return hits.length > 0;
87
+ const near = asked.near;
88
+ return hits.some((hit) => nearPlace(ai, hit.at, near, asked.reach ?? 16));
89
+ }
90
+ if ("seen" in condition) {
91
+ const asked = condition.seen;
92
+ const since = asked.within === void 0 ? -Infinity : ai.tick - asked.within * ai.session.tickRate;
93
+ for (const [type, seen] of Object.entries(ai.knowledge.enemy.typesSeen())) {
94
+ if (seen.last < since) continue;
95
+ if (asked.type !== void 0 && type !== asked.type) continue;
96
+ if (asked.role !== void 0 && !view.hasRole(type, asked.role)) continue;
97
+ return true;
98
+ }
99
+ return false;
100
+ }
101
+ if ("difficulty" in condition) {
102
+ const playing = ai.profile.difficulty ?? "normal";
103
+ return Array.isArray(condition.difficulty) ? condition.difficulty.includes(playing) : condition.difficulty === playing;
104
+ }
105
+ if ("told" in condition) return ai.told(condition.told).length > 0;
106
+ if ("chance" in condition) return ai.rng.next() < condition.chance;
107
+ if ("hero" in condition) {
108
+ const asked = condition.hero;
109
+ return view.me.heroes.some((hero) => (asked.type === void 0 || hero.type === asked.type) && (asked.alive === void 0 || hero.alive === asked.alive) && (!asked.level || inRange(hero.level, asked.level, -Infinity)));
110
+ }
111
+ if ("wave" in condition) {
112
+ const waves = ai.made("waves");
113
+ return inRange(waves?.given ? waves.index : ai.knowledge.own.attacks().length, condition.wave, -Infinity);
114
+ }
115
+ if ("objective" in condition) {
116
+ const { id, status } = condition.objective;
117
+ const objective = view.me.objectives.find((each) => each.id === id);
118
+ return !!objective && (Array.isArray(status) ? status.includes(objective.status) : objective.status === status);
119
+ }
120
+ if ("report" in condition) return matches(at(view.report, condition.report.path), condition.report);
121
+ if ("component" in condition) {
122
+ const asked = condition.component;
123
+ const entity = asked.entity !== void 0 ? view.named(asked.entity) : asked.type !== void 0 ? view.mine.ofType(asked.type).first() : void 0;
124
+ return !!entity && matches(at(entity.components?.[asked.id], asked.path), asked);
125
+ }
126
+ if ("region" in condition) {
127
+ const asked = condition.region;
128
+ if (!view.region(asked.name)) return false;
129
+ return inRange(kind(whose(ai, asked.of), asked).where((unit) => view.inRegion(asked.name, unit)).length, asked);
130
+ }
131
+ if ("is" in condition) {
132
+ const { is, args = {} } = condition;
133
+ const own = ai.def.conditions?.[is] ?? ai.registry.module?.ai?.conditions?.[is];
134
+ if (!own) {
135
+ warnOnce(ai, `a condition names "${is}", which neither the game nor the brain has (GameAi.conditions, BrainDef.conditions): it is no`);
136
+ return false;
137
+ }
138
+ return !!own(ai, args);
139
+ }
140
+ warnOnce(ai, `a condition of no form the kit knows (${Object.keys(condition).join(", ")}): it is no`);
141
+ return false;
142
+ }
143
+ var warned = /* @__PURE__ */ new WeakMap();
144
+ function warnOnce(ai, line) {
145
+ let said = warned.get(ai);
146
+ if (!said) warned.set(ai, said = /* @__PURE__ */ new Set());
147
+ if (said.has(line)) return;
148
+ said.add(line);
149
+ ai.log.warn("ai", line);
150
+ }
151
+ function builder(rule) {
152
+ return {
153
+ once: () => builder({
154
+ ...rule,
155
+ once: true
156
+ }),
157
+ every: (seconds) => builder({
158
+ ...rule,
159
+ every: seconds
160
+ }),
161
+ priority: (n) => builder({
162
+ ...rule,
163
+ priority: n
164
+ }),
165
+ named: (id) => builder({
166
+ ...rule,
167
+ id
168
+ }),
169
+ do: (action) => ({
170
+ ...rule,
171
+ action
172
+ })
173
+ };
174
+ }
175
+ /**
176
+ * A rule: `when(condition).do(action)`, with `once()`, `every(seconds)`, `priority(n)`, `named(id)` between. The
177
+ * condition is a function of the brain or plain data (`AiCondition`). `when.told(word)` fires once for each time the
178
+ * word is told, taking it, its action given the word's data
179
+ *
180
+ * @beta
181
+ */
182
+ var when = Object.assign((condition) => builder({ when: condition }), {
183
+ /** A rule that fires for each time the game tells the brain this word (`world.computers.tell`), and takes it */
184
+ told: (word) => builder({ when: { word } }) });
185
+ var isWord = (when) => typeof when === "object" && when !== null && "word" in when && typeof when.word === "string" && Object.keys(when).length === 1;
186
+ /** Does a rule's action */
187
+ function act(ai, action, data) {
188
+ if (typeof action === "function") action(ai, data);
189
+ else ai.tell(action.say, action.data, ai.tick);
190
+ }
191
+ /**
192
+ * The rules module: checks its rules each think, in their order (by `priority`, then as given), and does each one's
193
+ * action as its condition turns true. Ahead of the modules that act on units, where a brain lists it: what a rule
194
+ * takes is then not given orders by them first. Its id is `rules` (give `id` for a second one)
195
+ *
196
+ * @beta
197
+ */
198
+ var rules = (list, options = {}) => defineModule({
199
+ id: options.id ?? "rules",
200
+ make: (ai) => {
201
+ const named = list.map((rule, i) => ({
202
+ ...rule,
203
+ id: rule.id ?? `rule ${i + 1}`
204
+ }));
205
+ const seen = /* @__PURE__ */ new Set();
206
+ for (const rule of named) {
207
+ if (seen.has(rule.id)) throw new Error(`The brain "${ai.def.id}" has two rules called "${rule.id}"`);
208
+ seen.add(rule.id);
209
+ }
210
+ const ordered = named.map((rule, i) => ({
211
+ rule,
212
+ i
213
+ })).sort((a, b) => (b.rule.priority ?? 0) - (a.rule.priority ?? 0) || a.i - b.i);
214
+ let memory = {};
215
+ const of = (id) => memory[id] ??= { count: 0 };
216
+ const fire = (rule, data, word) => {
217
+ const kept = of(rule.id);
218
+ kept.fired = ai.tick;
219
+ kept.count++;
220
+ ai.decide(`rule "${rule.id}" fires${word ? `: told "${word.word}"` : ""}`, { kind: "rule" });
221
+ act(ai, rule.action, data);
222
+ };
223
+ return {
224
+ id: options.id ?? "rules",
225
+ phase: "hear",
226
+ version: 1,
227
+ think: () => {
228
+ for (const { rule } of ordered) {
229
+ const kept = of(rule.id);
230
+ if (rule.once && kept.count > 0) continue;
231
+ if (isWord(rule.when)) {
232
+ const words = ai.takeTold(rule.when.word, rule.once ? 1 : Infinity);
233
+ for (const word of words) fire(rule, word.data, word);
234
+ kept.was = words.length > 0;
235
+ continue;
236
+ }
237
+ const holds = evaluate(rule.when, ai);
238
+ const turned = holds && !kept.was;
239
+ kept.was = holds;
240
+ if (!holds) continue;
241
+ const again = rule.every !== void 0 && kept.fired !== void 0 && ai.tick - kept.fired >= Math.round(rule.every * ai.session.tickRate);
242
+ if (turned || again) fire(rule);
243
+ }
244
+ },
245
+ save: () => structuredClone(memory),
246
+ restore: (data) => {
247
+ memory = data && typeof data === "object" ? structuredClone(data) : {};
248
+ },
249
+ inspect: () => ({
250
+ rules: ordered.map(({ rule }) => {
251
+ const kept = of(rule.id);
252
+ return {
253
+ id: rule.id,
254
+ priority: rule.priority ?? 0,
255
+ once: !!rule.once,
256
+ holds: !!kept.was,
257
+ count: kept.count,
258
+ ...kept.fired !== void 0 && { fired: kept.fired }
259
+ };
260
+ }),
261
+ ...Object.keys(ai.goals.taken()).length && { taken: Object.fromEntries(Object.entries(ai.goals.taken()).map(([id, hold]) => [id, {
262
+ units: hold.units.length,
263
+ until: hold.until
264
+ }])) }
265
+ })
266
+ };
267
+ }
268
+ });
269
+ /** The squad the words put the army in, owned by the word's hold (`word:attack`) */
270
+ var WORD_SQUAD = "word";
271
+ /** The seconds each word holds the army for, where its data says none */
272
+ var WORD_SECONDS = {
273
+ attack: 60,
274
+ defend: 30,
275
+ retreat: 15,
276
+ hold: 30
277
+ };
278
+ /**
279
+ * The words module: answers the words any brain may be told (`world.computers.tell(player, word, data)`), taking them:
280
+ *
281
+ * - `attack` `{ at?, seconds? }`: the army (its fighters) attacks there, fighting what it meets on the way; where no
282
+ * place is given, at the nearest building of a rival's it knows of, else at the first rival's base the seat was told
283
+ * (`AiOptions.enemyBases`).
284
+ * - `defend` `{ at?, seconds? }`: the army goes to fight there, home when left out.
285
+ * - `retreat` `{ seconds? }`: the army comes home, fighting nothing on the way.
286
+ * - `hold` `{ seconds? }`: the army stands where it is, fighting what comes in reach.
287
+ * - `pause`: the brain sits still until told `resume` (or `world.computers.resume`); `resume` the brain answers itself.
288
+ *
289
+ * The army goes as one squad on the kit's task of the word (`attack`, `defend`, `retreat`, `hold`, in the squad
290
+ * `word`), so that where the brain has the `squads()` module it regroups, focuses, kites and falls back on the odds as
291
+ * any squad does. The army is the word's for `seconds` (attack 60, defend 30, retreat 15, hold 30): no goal claims it
292
+ * meanwhile, then the squad goes and the goals have it again. Its id is `words`; put it after `rules`, so that a rule's `{ say }` is answered that think
293
+ *
294
+ * @beta
295
+ */
296
+ var words = () => defineModule({
297
+ id: "words",
298
+ make: (ai) => {
299
+ const army = () => ai.view.mine.fighters().alive();
300
+ const point = (at) => {
301
+ if (at === void 0) return void 0;
302
+ if (typeof at !== "string") return at;
303
+ const named = ai.view.named(at);
304
+ if (named) return {
305
+ x: named.x,
306
+ z: named.z
307
+ };
308
+ const region = ai.view.region(at);
309
+ if (region) return {
310
+ x: region.shape.x,
311
+ z: region.shape.z
312
+ };
313
+ };
314
+ /**
315
+ * The army on the word's task: `plan` says what it does (`undefined`: nothing to do), and puts the squad on it.
316
+ * The army is a squad of the word's hold (`word:<word>`), so the squads module regroups, focuses, kites and falls
317
+ * back for it; when the hold lapses, the squad goes and the goals have the army again
318
+ */
319
+ const order = (word, data, plan) => {
320
+ const units = army();
321
+ if (!units.length) {
322
+ ai.decide(`told "${word}", with no army to do it`, { kind: "word" });
323
+ return;
324
+ }
325
+ const ids = units.map((unit) => unit.id);
326
+ const planned = plan(ids);
327
+ if (planned === void 0) return;
328
+ const owner = `word:${word}`;
329
+ ai.goals.take(ids, "told", {
330
+ id: owner,
331
+ seconds: data.seconds ?? WORD_SECONDS[word]
332
+ });
333
+ for (const other of Object.keys(WORD_SECONDS)) if (other !== word) ai.goals.release(`word:${other}`);
334
+ planned.give(ai.squads.make(WORD_SQUAD, ids, { owner }));
335
+ ai.decide(`told "${word}": ${planned.what}`, { kind: "word" });
336
+ };
337
+ return {
338
+ id: "words",
339
+ phase: "hear",
340
+ after: ["rules"],
341
+ think: () => {
342
+ for (const told of [...ai.told()]) {
343
+ const data = told.data && typeof told.data === "object" ? told.data : {};
344
+ switch (told.word) {
345
+ case "attack":
346
+ ai.takeTold("attack");
347
+ order("attack", data, (ids) => {
348
+ const centre = ai.view.mine.where((unit) => ids.includes(unit.id)).centre();
349
+ const target = point(data.at) ?? (centre && ai.view.enemies.known().buildings().nearest(centre)) ?? ai.options.enemyBases?.[0];
350
+ if (!target) {
351
+ ai.decide("told \"attack\", and knows of nowhere to attack", { kind: "word" });
352
+ return;
353
+ }
354
+ const at = {
355
+ x: target.x,
356
+ z: target.z
357
+ };
358
+ return {
359
+ what: `the army of ${ids.length} attacks at (${Math.round(target.x)}, ${Math.round(target.z)})`,
360
+ give: (squad) => squad.attack(at)
361
+ };
362
+ });
363
+ break;
364
+ case "defend":
365
+ ai.takeTold("defend");
366
+ order("defend", data, (ids) => {
367
+ const home = ai.view.home();
368
+ const target = point(data.at) ?? (home && {
369
+ x: home.x,
370
+ z: home.z
371
+ });
372
+ if (!target) return void 0;
373
+ return {
374
+ what: `the army of ${ids.length} goes to fight at (${Math.round(target.x)}, ${Math.round(target.z)})`,
375
+ give: (squad) => squad.defend(target)
376
+ };
377
+ });
378
+ break;
379
+ case "retreat":
380
+ ai.takeTold("retreat");
381
+ order("retreat", data, (ids) => {
382
+ const home = ai.view.home();
383
+ if (!home) return void 0;
384
+ const at = {
385
+ x: home.x,
386
+ z: home.z
387
+ };
388
+ return {
389
+ what: `the army of ${ids.length} comes home`,
390
+ give: (squad) => squad.retreat(at, "told to")
391
+ };
392
+ });
393
+ break;
394
+ case "hold":
395
+ ai.takeTold("hold");
396
+ order("hold", data, (ids) => {
397
+ return {
398
+ what: `the army of ${ids.length} holds where it stands`,
399
+ give: (squad) => squad.task("hold", {})
400
+ };
401
+ });
402
+ break;
403
+ case "pause":
404
+ ai.takeTold("pause");
405
+ ai.paused = true;
406
+ ai.decide("told \"pause\": sits still until told \"resume\"", { kind: "word" });
407
+ }
408
+ }
409
+ }
410
+ };
411
+ }
412
+ });
413
+ //#endregion
414
+ export { evaluate, rules, when, words };
415
+
416
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","names":[],"sources":["../../src/ai/rules.ts"],"sourcesContent":["import type { Vec2 } from '#engine/math'\nimport type { Waves } from './waves'\nimport type { ObjectiveStatus } from '#engine/objectives'\nimport type { EntityState } from '#engine/session/protocol'\nimport { type Brain, type Told } from './brain'\nimport { type AiModule, type AiModuleDef, defineModule } from './module'\nimport type { AiRole } from './roles'\nimport type { UnitSet } from './view'\nimport type { Squad } from './squads'\n\n/*\n * Rules and words from the game (AI plan, B2): what a mission scripts for its computer player, in the computer's own\n * terms. Before this, a mission that wanted \"when the hero crosses the river, the camp attacks\" wrote a system that\n * reached into the world and gave orders to the computer's units beside the computer that thought on its own, and the\n * two fought over them. Now it is a rule of the brain's:\n *\n * when({ units: { role: 'hero', of: 'enemy', near: 'the ford' } }).once().do((ai) => ai.tell('attack', { at: ford }))\n *\n * - **A condition** (`AiCondition`) is a question with a yes or no: a function of the brain, or plain data (`{ time: {\n * after: 300 } }`, `{ all: [...] }`) that a map's file, a mission's JSON, and later the editor can hold. The data\n * forms are listed in `docs/ai/scripting.md`, each with what it asks; a game adds its own (`GameAi.conditions`, a brain's `BrainDef.conditions`) and names it\n * (`{ is: 'mygame.bridgeDown', args: { name: 'north' } }`). Waves, build orders and target priorities (B3, C2, D2) take the same conditions.\n * - **A rule** (`when(condition).do(action)`) does its action when its condition becomes true: on the think it turns\n * from no to yes, not on every think it stays yes (a trigger, as a map editor's are). `once()` fires it the first\n * time only, ever; `every(seconds)` fires it again while the condition holds, at most so often; `priority(n)` checks\n * it before rules of less. Rules are a module (`rules([...])`), checked each think in order: put it ahead of the\n * modules that act, so that what a rule takes is not given orders by them first.\n * - **Words** are what the game tells a computer (`world.computers.tell(player, 'attack', { at })`): kept in the brain\n * until taken (a save keeps a word not yet heard), read with `ai.told(word)`, taken by a told rule (`when.told(word)`,\n * whose action gets the word's data) or by the `words()` module, which answers the words every brain may be told:\n * `attack`, `defend`, `retreat`, `hold`, `pause` (and `resume`, which the brain answers itself, paused as it is).\n * - **Who may move a unit.** A rule that orders units takes them first (`ai.goals.take(ids, 'told', { id, seconds })`):\n * no goal claims them while the rule holds them, and the melee player's focus fire leaves them be. What a rule took\n * is let go of when its time is up, and the goals have them again.\n *\n * What the rules remember (which fired, when, and whether each held at the last check) is plain data in the brain's\n * memory, so a loaded game does not fire a `once` rule twice.\n */\n\n/**\n * At least `min` and at most `max`, each left out for no bound: a count, an amount, a level\n *\n * @beta\n */\nexport interface AiRange {\n\t/** The lowest it may be; no lower bound when left out */\n\tmin?: number\n\t/** The highest it may be; no upper bound when left out */\n\tmax?: number\n}\n\n/**\n * Whose units a condition counts: the player’s own (the default), its rivals’ in sight, its allies’\n *\n * @beta\n */\nexport type AiWhose = 'mine' | 'enemy' | 'ally'\n\n/**\n * A condition as plain data: what a map's file, a mission's JSON or the editor holds. Each form is one question; the\n * table in `docs/ai/scripting.md` says what each asks\n *\n * @beta\n */\nexport type AiConditionData =\n\t/** Every one of them */\n\t| { all: AiCondition[] }\n\t/** One of them at least */\n\t| { any: AiCondition[] }\n\t/** The other way round */\n\t| { not: AiCondition }\n\t/** How much it has of a resource */\n\t| { resource: { id: string } & AiRange }\n\t/**\n\t * How many units there are, of a type, a role or a tag, whose (`of`), near a named entity, point or region (`near`,\n\t * `within`), finished only (`finished`); and for `of: 'enemy'`, those remembered out of sight too (`known`). At\n\t * least one where neither `min` nor `max` is given\n\t */\n\t| {\n\t\t\tunits: {\n\t\t\t\ttype?: string\n\t\t\t\trole?: AiRole\n\t\t\t\ttag?: string\n\t\t\t\tof?: AiWhose\n\t\t\t\tnear?: string | Vec2\n\t\t\t\twithin?: number\n\t\t\t\tfinished?: boolean\n\t\t\t\tknown?: boolean\n\t\t\t} & AiRange\n\t }\n\t/** Its supply: free (cap less used), used, cap */\n\t| { supply: { free?: AiRange; used?: AiRange; cap?: AiRange } }\n\t/** Seconds into the game: from `after`, before `before` */\n\t| { time: { after?: number; before?: number } }\n\t/**\n\t * Whether its own are being hit: damage seen to its entities within so many seconds (5 when left out), anywhere, or\n\t * near a named entity, a point or a region (`near`, `within` the reach: 16)\n\t */\n\t| { underAttack: true | { seconds?: number; near?: string | Vec2; reach?: number } }\n\t/** Whether a rival's unit of a type or a role was seen, within so many seconds where given (ever, when left out) */\n\t| { seen: { type?: string; role?: AiRole; within?: number } }\n\t/** The difficulty it plays on (its profile's: `AiOptions.difficulty`, normal when left out), one or any of a list */\n\t| { difficulty: string | string[] }\n\t/** Whether the game told it this word and nothing took it yet */\n\t| { told: string }\n\t/** Yes so often, by the brain's own numbers (`ai.rng`): `0.3` is three times in ten. The same game says the same */\n\t| { chance: number }\n\t/** Its heroes: one at least of this type (any where left out), alive where `alive` says, of a level */\n\t| { hero: { type?: string; alive?: boolean; level?: AiRange } }\n\t/** The index of the wave whose turn it is (`ai.waves.index`, the waves sent and skipped before it); where it has no waves, the attacks it sent (its knowledge's `own.attacks`) */\n\t| { wave: AiRange }\n\t/** One of its own objectives, by id, in this status (or any of these) */\n\t| { objective: { id: string; status: ObjectiveStatus | ObjectiveStatus[] } }\n\t/** A value of the game's report to this player (`Rules.report`), by its path (`'waves.next'`): equal to, or within */\n\t| { report: { path: string; equals?: unknown } & AiRange }\n\t/**\n\t * A value of a component the game replicates to this player (`Component.replicate`) on an entity: one the map or\n\t * the rules named (`entity`), or the first of its own of a type (`type`). By path in it, where it is an object\n\t */\n\t| { component: { id: string; entity?: string; type?: string; path?: string; equals?: unknown } & AiRange }\n\t/** How many units are in a region of the map, whose (`of`: its own when left out), of a type or a role */\n\t| { region: { name: string; of?: AiWhose; type?: string; role?: AiRole } & AiRange }\n\t/** A condition of the game's own or the brain's (`GameAi.conditions`, `BrainDef.conditions`), by id, with its arguments (`{ is: 'mygame.bridge', args: { name: 'north' } }`) */\n\t| { is: string; args?: Record<string, unknown> }\n\n/**\n * A condition: a question with a yes or no, as a function of the brain, or as plain data (`AiConditionData`)\n *\n * @beta\n */\nexport type AiCondition = ((ai: Brain) => boolean) | AiConditionData\n\n/**\n * A condition of a game's own or a brain's, for the data form (`{ is: id, args }`): a map's file names it, the game\n * (`GameAi.conditions`) or the brain (`BrainDef.conditions`) gives the code, by an id prefixed as components are\n * (`mygame.bridgeDown`)\n *\n * @beta\n */\nexport type AiConditionTest = (ai: Brain, args: Record<string, unknown>) => boolean\n\nconst inRange = (value: number, range: AiRange, least = 1) =>\n\trange.min === undefined && range.max === undefined\n\t\t? value >= least\n\t\t: (range.min === undefined || value >= range.min) && (range.max === undefined || value <= range.max)\n\n/** A value at a path of dots in plain data (`'waves.next'`): the value itself for no path */\nfunction at(value: unknown, path: string | undefined): unknown {\n\tif (!path) return value\n\tlet here = value\n\tfor (const key of path.split('.')) {\n\t\tif (!here || typeof here !== 'object') return undefined\n\t\there = (here as Record<string, unknown>)[key]\n\t}\n\treturn here\n}\n\n/** Whether a value is as asked: equal to `equals`, or a number within the range */\nconst matches = (value: unknown, asked: { equals?: unknown } & AiRange) =>\n\t'equals' in asked ? value === asked.equals : typeof value === 'number' && inRange(value, asked, -Infinity)\n\n/** Whose units: the brain's sets of them */\nfunction whose(ai: Brain, of: AiWhose | undefined, known?: boolean): UnitSet {\n\tconst { view } = ai\n\tif (of === 'enemy') return known ? view.enemies.known() : view.enemies\n\tif (of === 'ally') return view.allies\n\treturn view.mine\n}\n\n/** Narrowed to a type, a role, a tag */\nfunction kind(units: UnitSet, asked: { type?: string; role?: AiRole; tag?: string }): UnitSet {\n\tlet set = units\n\tif (asked.type !== undefined) set = set.ofType(asked.type)\n\tif (asked.role !== undefined) set = set.withRole(asked.role)\n\tif (asked.tag !== undefined) set = set.withTag(asked.tag)\n\treturn set\n}\n\n/** Where a condition means: a named entity the player knows of, or a point; nothing for a name it does not know */\nfunction place(ai: Brain, near: string | Vec2): Vec2 | undefined {\n\tif (typeof near !== 'string') return near\n\tconst named = ai.view.named(near)\n\tif (named) return { x: named.x, z: named.z }\n\treturn undefined\n}\n\n/** Whether a point is near a place: a region by name, a named entity or a point within `reach` */\nfunction nearPlace(ai: Brain, point: Vec2, near: string | Vec2, reach: number): boolean {\n\tif (typeof near === 'string' && ai.view.region(near)) return ai.view.inRegion(near, point)\n\tconst to = place(ai, near)\n\tif (!to) return false\n\tconst dx = point.x - to.x\n\tconst dz = point.z - to.z\n\treturn dx * dx + dz * dz <= reach * reach\n}\n\n/**\n * Whether a condition holds for the brain now: a function is asked, data is read as its form says. A form the kit\n * does not know (a game's own not defined) is no, and the log says so once\n *\n * @beta\n */\nexport function evaluate(condition: AiCondition, ai: Brain): boolean {\n\tif (typeof condition === 'function') return !!condition(ai)\n\tif (!condition || typeof condition !== 'object') return false\n\tconst { view } = ai\n\tif ('all' in condition) return condition.all.every((each) => evaluate(each, ai))\n\tif ('any' in condition) return condition.any.some((each) => evaluate(each, ai))\n\tif ('not' in condition) return !evaluate(condition.not, ai)\n\tif ('resource' in condition) return inRange(view.me.resources[condition.resource.id] ?? 0, condition.resource, -Infinity)\n\tif ('units' in condition) {\n\t\tconst asked = condition.units\n\t\tlet set = kind(whose(ai, asked.of, asked.known), asked)\n\t\tif (asked.finished) set = set.finished()\n\t\tif (asked.near !== undefined) {\n\t\t\tconst near = asked.near\n\t\t\tconst reach = asked.within ?? 16\n\t\t\tset = set.where((unit) => nearPlace(ai, unit, near, reach))\n\t\t}\n\t\treturn inRange(set.length, asked)\n\t}\n\tif ('supply' in condition) {\n\t\tconst { me } = view\n\t\tconst asked = condition.supply\n\t\treturn (\n\t\t\t(!asked.free || inRange(me.supplyCap - me.supplyUsed, asked.free, -Infinity)) &&\n\t\t\t(!asked.used || inRange(me.supplyUsed, asked.used, -Infinity)) &&\n\t\t\t(!asked.cap || inRange(me.supplyCap, asked.cap, -Infinity))\n\t\t)\n\t}\n\tif ('time' in condition) {\n\t\tconst { after, before } = condition.time\n\t\treturn (after === undefined || ai.time >= after) && (before === undefined || ai.time < before)\n\t}\n\tif ('underAttack' in condition) {\n\t\tconst asked = condition.underAttack === true ? {} : condition.underAttack\n\t\tconst hits = ai.knowledge.events.damage(asked.seconds ?? 5).filter((hit) => hit.owner === ai.playerId)\n\t\tif (asked.near === undefined) return hits.length > 0\n\t\tconst near = asked.near\n\t\treturn hits.some((hit) => nearPlace(ai, hit.at, near, asked.reach ?? 16))\n\t}\n\tif ('seen' in condition) {\n\t\tconst asked = condition.seen\n\t\tconst since = asked.within === undefined ? -Infinity : ai.tick - asked.within * ai.session.tickRate\n\t\tfor (const [type, seen] of Object.entries(ai.knowledge.enemy.typesSeen())) {\n\t\t\tif (seen.last < since) continue\n\t\t\tif (asked.type !== undefined && type !== asked.type) continue\n\t\t\tif (asked.role !== undefined && !view.hasRole(type, asked.role)) continue\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif ('difficulty' in condition) {\n\t\tconst playing = ai.profile.difficulty ?? 'normal'\n\t\treturn Array.isArray(condition.difficulty) ? condition.difficulty.includes(playing) : condition.difficulty === playing\n\t}\n\tif ('told' in condition) return ai.told(condition.told).length > 0\n\tif ('chance' in condition) return ai.rng.next() < condition.chance\n\tif ('hero' in condition) {\n\t\tconst asked = condition.hero\n\t\treturn view.me.heroes.some(\n\t\t\t(hero) =>\n\t\t\t\t(asked.type === undefined || hero.type === asked.type) &&\n\t\t\t\t(asked.alive === undefined || hero.alive === asked.alive) &&\n\t\t\t\t(!asked.level || inRange(hero.level, asked.level, -Infinity))\n\t\t)\n\t}\n\t// the index of the wave whose turn it is, where the brain has waves (D2); else the attacks it sent\n\tif ('wave' in condition) {\n\t\t// the waves it was given, where it has any, else the attacks it made\n\t\tconst waves = ai.made<Waves>('waves')\n\t\treturn inRange(waves?.given ? waves.index : ai.knowledge.own.attacks().length, condition.wave, -Infinity)\n\t}\n\tif ('objective' in condition) {\n\t\tconst { id, status } = condition.objective\n\t\tconst objective = view.me.objectives.find((each) => each.id === id)\n\t\treturn !!objective && (Array.isArray(status) ? status.includes(objective.status) : objective.status === status)\n\t}\n\tif ('report' in condition) return matches(at(view.report, condition.report.path), condition.report)\n\tif ('component' in condition) {\n\t\tconst asked = condition.component\n\t\tconst entity: EntityState | undefined =\n\t\t\tasked.entity !== undefined ? view.named(asked.entity) : asked.type !== undefined ? view.mine.ofType(asked.type).first() : undefined\n\t\treturn !!entity && matches(at(entity.components?.[asked.id], asked.path), asked)\n\t}\n\tif ('region' in condition) {\n\t\tconst asked = condition.region\n\t\tif (!view.region(asked.name)) return false\n\t\tconst set = kind(whose(ai, asked.of), asked).where((unit) => view.inRegion(asked.name, unit))\n\t\treturn inRange(set.length, asked)\n\t}\n\tif ('is' in condition) {\n\t\tconst { is, args = {} } = condition\n\t\tconst own = ai.def.conditions?.[is] ?? ai.registry.module?.ai?.conditions?.[is]\n\t\tif (!own) {\n\t\t\twarnOnce(ai, `a condition names \"${is}\", which neither the game nor the brain has (GameAi.conditions, BrainDef.conditions): it is no`)\n\t\t\treturn false\n\t\t}\n\t\treturn !!own(ai, args)\n\t}\n\twarnOnce(ai, `a condition of no form the kit knows (${Object.keys(condition).join(', ')}): it is no`)\n\treturn false\n}\n\nconst warned = new WeakMap<Brain, Set<string>>()\nfunction warnOnce(ai: Brain, line: string): void {\n\tlet said = warned.get(ai)\n\tif (!said) warned.set(ai, (said = new Set()))\n\tif (said.has(line)) return\n\tsaid.add(line)\n\tai.log.warn('ai', line)\n}\n\n/**\n * What a rule does, as plain data: a word the brain tells itself (`{ say: 'attack', data: { at } }`), answered by the\n * `words()` module or a told rule of its own, the same think where they come after the rules\n *\n * @beta\n */\nexport interface AiActionData {\n\t/** The word the brain tells itself, which the `words()` module or a rule of its own answers */\n\tsay: string\n\t/** What goes with the word, for whoever answers it; nothing when left out */\n\tdata?: unknown\n}\n\n/**\n * What a rule does: a function of the brain and, for a told rule, what came with the word; or plain data\n * (`AiActionData`)\n *\n * @beta\n */\nexport type AiAction = ((ai: Brain, data?: unknown) => void) | AiActionData\n\n/**\n * A rule of a brain (`when(condition).do(action)`): checked each think by the `rules()` module, its action done as\n * its condition becomes true. Code: given again by the brain's definition, as goals are; what it remembers is data\n *\n * @beta\n */\nexport interface AiRule {\n\t/** Its name: what the memory, the report and the log know it by. `rule 1`, `rule 2`… in the module's list when left out */\n\treadonly id?: string\n\t/** When it fires: a condition, or a word told (`when.told`) */\n\treadonly when: AiCondition | { word: string }\n\t/** What it does */\n\treadonly action: AiAction\n\t/** Whether it fires the first time only, ever */\n\treadonly once?: boolean\n\t/** Seconds: fired again while its condition holds, at most so often. Left out, it fires as it turns true */\n\treadonly every?: number\n\t/** Checked before rules of less: 0 when left out */\n\treadonly priority?: number\n}\n\n/**\n * A rule being written: `when(...)`, then any of `once`, `every`, `priority`, `named`, then `do`\n *\n * @beta\n */\nexport interface RuleBuilder {\n\t/** Fires the first time only, ever */\n\tonce(): RuleBuilder\n\t/** Fires again while the condition holds, at most every so many seconds */\n\tevery(seconds: number): RuleBuilder\n\t/** Checked before rules of less */\n\tpriority(n: number): RuleBuilder\n\t/** Its name, for the memory, the report and the log */\n\tnamed(id: string): RuleBuilder\n\t/** What it does: the rule */\n\tdo(action: AiAction): AiRule\n}\n\nfunction builder(rule: Omit<AiRule, 'action'>): RuleBuilder {\n\treturn {\n\t\tonce: () => builder({ ...rule, once: true }),\n\t\tevery: (seconds) => builder({ ...rule, every: seconds }),\n\t\tpriority: (n) => builder({ ...rule, priority: n }),\n\t\tnamed: (id) => builder({ ...rule, id }),\n\t\tdo: (action) => ({ ...rule, action })\n\t}\n}\n\n/**\n * A rule: `when(condition).do(action)`, with `once()`, `every(seconds)`, `priority(n)`, `named(id)` between. The\n * condition is a function of the brain or plain data (`AiCondition`). `when.told(word)` fires once for each time the\n * word is told, taking it, its action given the word's data\n *\n * @beta\n */\nexport const when = Object.assign((condition: AiCondition): RuleBuilder => builder({ when: condition }), {\n\t/** A rule that fires for each time the game tells the brain this word (`world.computers.tell`), and takes it */\n\ttold: (word: string): RuleBuilder => builder({ when: { word } })\n})\n\n/** What the rules remember of one rule */\ninterface RuleMemory {\n\t/** Whether its condition held at the last check: a rule fires as it turns true */\n\twas?: boolean\n\t/** The tick it last fired at */\n\tfired?: number\n\t/** How many times it fired */\n\tcount: number\n}\n\n/**\n * What a rule is now, for the report: whether it held at the last check, how often and when it last fired\n *\n * @internal\n */\nexport interface RuleReport {\n\t/** The rule's id */\n\tid: string\n\t/** How important the rule is, which orders the rules */\n\tpriority: number\n\t/** Whether the rule fires at most once */\n\tonce: boolean\n\t/** Whether its condition held at the last check */\n\tholds: boolean\n\t/** How many times it fired */\n\tcount: number\n\t/** The tick it last fired at; nothing if never */\n\tfired?: number\n}\n\nconst isWord = (when: AiRule['when']): when is { word: string } =>\n\ttypeof when === 'object' &&\n\twhen !== null &&\n\t'word' in when &&\n\ttypeof (when as { word: unknown }).word === 'string' &&\n\tObject.keys(when).length === 1\n\n/** Does a rule's action */\nfunction act(ai: Brain, action: AiAction, data?: unknown): void {\n\tif (typeof action === 'function') action(ai, data)\n\telse ai.tell(action.say, action.data, ai.tick)\n}\n\n/**\n * The rules module: checks its rules each think, in their order (by `priority`, then as given), and does each one's\n * action as its condition turns true. Ahead of the modules that act on units, where a brain lists it: what a rule\n * takes is then not given orders by them first. Its id is `rules` (give `id` for a second one)\n *\n * @beta\n */\nexport const rules = (list: AiRule[], options: { id?: string } = {}): AiModuleDef =>\n\tdefineModule({ id: options.id ?? 'rules', make: (ai: Brain): AiModule => {\n\t\tconst named = list.map((rule, i) => ({ ...rule, id: rule.id ?? `rule ${i + 1}` }))\n\t\tconst seen = new Set<string>()\n\t\tfor (const rule of named) {\n\t\t\tif (seen.has(rule.id)) throw new Error(`The brain \"${ai.def.id}\" has two rules called \"${rule.id}\"`)\n\t\t\tseen.add(rule.id)\n\t\t}\n\t\tconst ordered = named.map((rule, i) => ({ rule, i })).sort((a, b) => (b.rule.priority ?? 0) - (a.rule.priority ?? 0) || a.i - b.i)\n\t\tlet memory: Record<string, RuleMemory> = {}\n\t\tconst of = (id: string) => (memory[id] ??= { count: 0 })\n\t\tconst fire = (rule: AiRule & { id: string }, data?: unknown, word?: Told) => {\n\t\t\tconst kept = of(rule.id)\n\t\t\tkept.fired = ai.tick\n\t\t\tkept.count++\n\t\t\tai.decide(`rule \"${rule.id}\" fires${word ? `: told \"${word.word}\"` : ''}`, { kind: 'rule' })\n\t\t\tact(ai, rule.action, data)\n\t\t}\n\t\treturn {\n\t\t\tid: options.id ?? 'rules',\n\t\t\tphase: 'hear',\n\t\t\tversion: 1,\n\t\t\tthink: () => {\n\t\t\t\tfor (const { rule } of ordered) {\n\t\t\t\t\tconst kept = of(rule.id)\n\t\t\t\t\tif (rule.once && kept.count > 0) continue\n\t\t\t\t\tif (isWord(rule.when)) {\n\t\t\t\t\t\t// each time the word was told, once; a `once` rule takes the first and leaves the rest\n\t\t\t\t\t\tconst words = ai.takeTold(rule.when.word, rule.once ? 1 : Infinity)\n\t\t\t\t\t\tfor (const word of words) fire(rule, word.data, word)\n\t\t\t\t\t\tkept.was = words.length > 0\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst holds = evaluate(rule.when, ai)\n\t\t\t\t\tconst turned = holds && !kept.was\n\t\t\t\t\tkept.was = holds\n\t\t\t\t\tif (!holds) continue\n\t\t\t\t\tconst again = rule.every !== undefined && kept.fired !== undefined && ai.tick - kept.fired >= Math.round(rule.every * ai.session.tickRate)\n\t\t\t\t\tif (turned || again) fire(rule)\n\t\t\t\t}\n\t\t\t},\n\t\t\tsave: () => structuredClone(memory),\n\t\t\trestore: (data) => {\n\t\t\t\tmemory = data && typeof data === 'object' ? structuredClone(data as Record<string, RuleMemory>) : {}\n\t\t\t},\n\t\t\tinspect: () => ({\n\t\t\t\trules: ordered.map(({ rule }): RuleReport => {\n\t\t\t\t\tconst kept = of(rule.id)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: rule.id,\n\t\t\t\t\t\tpriority: rule.priority ?? 0,\n\t\t\t\t\t\tonce: !!rule.once,\n\t\t\t\t\t\tholds: !!kept.was,\n\t\t\t\t\t\tcount: kept.count,\n\t\t\t\t\t\t...(kept.fired !== undefined && { fired: kept.fired })\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\t...(Object.keys(ai.goals.taken()).length && {\n\t\t\t\t\ttaken: Object.fromEntries(Object.entries(ai.goals.taken()).map(([id, hold]) => [id, { units: hold.units.length, until: hold.until }]))\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t} })\n\n/**\n * What the words a brain may be told (`words()`) come with: where (`at`, a point, or a name the map or rules gave an\n * entity or region), and for how many seconds the army is the word's, not the goals' (`seconds`)\n *\n * @beta\n */\nexport interface WordData {\n\t/** Where: a point, or the name an entity or region was given by the map or the rules */\n\tat?: Vec2 | string\n\t/** For how many seconds the army is the word's rather than the goals' */\n\tseconds?: number\n}\n\n/** The squad the words put the army in, owned by the word's hold (`word:attack`) */\nconst WORD_SQUAD = 'word'\n\n/** The seconds each word holds the army for, where its data says none */\nconst WORD_SECONDS: Record<string, number> = { attack: 60, defend: 30, retreat: 15, hold: 30 }\n\n/**\n * The words module: answers the words any brain may be told (`world.computers.tell(player, word, data)`), taking them:\n *\n * - `attack` `{ at?, seconds? }`: the army (its fighters) attacks there, fighting what it meets on the way; where no\n * place is given, at the nearest building of a rival's it knows of, else at the first rival's base the seat was told\n * (`AiOptions.enemyBases`).\n * - `defend` `{ at?, seconds? }`: the army goes to fight there, home when left out.\n * - `retreat` `{ seconds? }`: the army comes home, fighting nothing on the way.\n * - `hold` `{ seconds? }`: the army stands where it is, fighting what comes in reach.\n * - `pause`: the brain sits still until told `resume` (or `world.computers.resume`); `resume` the brain answers itself.\n *\n * The army goes as one squad on the kit's task of the word (`attack`, `defend`, `retreat`, `hold`, in the squad\n * `word`), so that where the brain has the `squads()` module it regroups, focuses, kites and falls back on the odds as\n * any squad does. The army is the word's for `seconds` (attack 60, defend 30, retreat 15, hold 30): no goal claims it\n * meanwhile, then the squad goes and the goals have it again. Its id is `words`; put it after `rules`, so that a rule's `{ say }` is answered that think\n *\n * @beta\n */\nexport const words = (): AiModuleDef =>\n\tdefineModule({ id: 'words', make: (ai: Brain): AiModule => {\n\t\tconst army = () => ai.view.mine.fighters().alive()\n\t\tconst point = (at: Vec2 | string | undefined): Vec2 | undefined => {\n\t\t\tif (at === undefined) return undefined\n\t\t\tif (typeof at !== 'string') return at\n\t\t\tconst named = ai.view.named(at)\n\t\t\tif (named) return { x: named.x, z: named.z }\n\t\t\tconst region = ai.view.region(at)\n\t\t\t// a circle or a rectangle, both about their middle\n\t\t\tif (region) return { x: region.shape.x, z: region.shape.z }\n\t\t\treturn undefined\n\t\t}\n\t\t/**\n\t\t * The army on the word's task: `plan` says what it does (`undefined`: nothing to do), and puts the squad on it.\n\t\t * The army is a squad of the word's hold (`word:<word>`), so the squads module regroups, focuses, kites and falls\n\t\t * back for it; when the hold lapses, the squad goes and the goals have the army again\n\t\t */\n\t\tconst order = (word: string, data: WordData, plan: (ids: number[]) => { what: string; give: (squad: Squad) => void } | undefined) => {\n\t\t\tconst units = army()\n\t\t\tif (!units.length) {\n\t\t\t\tai.decide(`told \"${word}\", with no army to do it`, { kind: 'word' })\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst ids = units.map((unit) => unit.id)\n\t\t\tconst planned = plan(ids)\n\t\t\tif (planned === undefined) return\n\t\t\tconst owner = `word:${word}`\n\t\t\tai.goals.take(ids, 'told', { id: owner, seconds: data.seconds ?? WORD_SECONDS[word] })\n\t\t\tfor (const other of Object.keys(WORD_SECONDS)) if (other !== word) ai.goals.release(`word:${other}`)\n\t\t\tplanned.give(ai.squads.make(WORD_SQUAD, ids, { owner }))\n\t\t\tai.decide(`told \"${word}\": ${planned.what}`, { kind: 'word' })\n\t\t}\n\t\treturn {\n\t\t\tid: 'words',\n\t\t\tphase: 'hear',\n\t\t\tafter: ['rules'],\n\t\t\tthink: () => {\n\t\t\t\tfor (const told of [...ai.told()]) {\n\t\t\t\t\tconst data = (told.data && typeof told.data === 'object' ? told.data : {}) as WordData\n\t\t\t\t\tswitch (told.word) {\n\t\t\t\t\t\tcase 'attack':\n\t\t\t\t\t\t\tai.takeTold('attack')\n\t\t\t\t\t\t\torder('attack', data, (ids) => {\n\t\t\t\t\t\t\t\tconst centre = ai.view.mine.where((unit) => ids.includes(unit.id)).centre()\n\t\t\t\t\t\t\t\tconst target = point(data.at) ?? (centre && ai.view.enemies.known().buildings().nearest(centre)) ?? ai.options.enemyBases?.[0]\n\t\t\t\t\t\t\t\tif (!target) {\n\t\t\t\t\t\t\t\t\tai.decide('told \"attack\", and knows of nowhere to attack', { kind: 'word' })\n\t\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst at = { x: target.x, z: target.z }\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\twhat: `the army of ${ids.length} attacks at (${Math.round(target.x)}, ${Math.round(target.z)})`,\n\t\t\t\t\t\t\t\t\tgive: (squad) => squad.attack(at)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'defend':\n\t\t\t\t\t\t\tai.takeTold('defend')\n\t\t\t\t\t\t\torder('defend', data, (ids) => {\n\t\t\t\t\t\t\t\tconst home = ai.view.home()\n\t\t\t\t\t\t\t\tconst target = point(data.at) ?? (home && { x: home.x, z: home.z })\n\t\t\t\t\t\t\t\tif (!target) return undefined\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\twhat: `the army of ${ids.length} goes to fight at (${Math.round(target.x)}, ${Math.round(target.z)})`,\n\t\t\t\t\t\t\t\t\tgive: (squad) => squad.defend(target)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'retreat':\n\t\t\t\t\t\t\tai.takeTold('retreat')\n\t\t\t\t\t\t\torder('retreat', data, (ids) => {\n\t\t\t\t\t\t\t\tconst home = ai.view.home()\n\t\t\t\t\t\t\t\tif (!home) return undefined\n\t\t\t\t\t\t\t\tconst at = { x: home.x, z: home.z }\n\t\t\t\t\t\t\t\treturn { what: `the army of ${ids.length} comes home`, give: (squad) => squad.retreat(at, 'told to') }\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'hold':\n\t\t\t\t\t\t\tai.takeTold('hold')\n\t\t\t\t\t\t\torder('hold', data, (ids) => {\n\t\t\t\t\t\t\t\treturn { what: `the army of ${ids.length} holds where it stands`, give: (squad) => squad.task('hold', {}) }\n\t\t\t\t\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C"}
@@ -30,6 +30,7 @@ export interface ScoutingOptions {
30
30
  * @beta
31
31
  */
32
32
  export interface ScoutingMemory {
33
+ /** The version of the memory's format: 1 so far */
33
34
  v: 1;
34
35
  /** The unit that scouts, while it lives: the same one goes on to the next round */
35
36
  scout?: number;
@@ -52,6 +53,7 @@ export interface ScoutingMemory {
52
53
  * @beta
53
54
  */
54
55
  export interface Look {
56
+ /** Where the place is, in cells */
55
57
  at: Vec2;
56
58
  /** Their start not seen yet, their base, a mine they would expand to, where their army was, or a place the game names */
57
59
  kind: 'start' | 'base' | 'expansion' | 'army' | 'game';
@@ -67,14 +69,18 @@ export interface Look {
67
69
  * @beta
68
70
  */
69
71
  export interface ScoutingReport {
72
+ /** The plan of looks, each with where, its kind, how many seconds ago it was seen and whether it is due */
70
73
  looks: {
71
74
  at: [number, number];
72
75
  kind: Look['kind'];
73
76
  seen?: number;
74
77
  due: boolean;
75
78
  }[];
79
+ /** The entity id of the unit that scouts; nothing when there is none */
76
80
  scout?: number;
81
+ /** The places the scout is going to, in order, in cells */
77
82
  going?: [number, number][];
83
+ /** How many rounds of looks were sent */
78
84
  rounds: number;
79
85
  }
80
86
  /**