@v12-engine/engine 0.0.0-stage → 0.1.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 (341) hide show
  1. package/LICENSE +21 -0
  2. package/dist/abilities/buffs.d.ts +83 -0
  3. package/dist/abilities/castTold.d.ts +12 -0
  4. package/dist/abilities/charges.d.ts +28 -0
  5. package/dist/abilities/dispel.d.ts +9 -0
  6. package/dist/abilities/effectFields.d.ts +10 -0
  7. package/dist/abilities/effects/buff.d.ts +8 -0
  8. package/dist/abilities/effects/core.d.ts +1 -0
  9. package/dist/abilities/effects/damage.d.ts +1 -0
  10. package/dist/abilities/effects/heal.d.ts +2 -0
  11. package/dist/abilities/effects/missile.d.ts +1 -0
  12. package/dist/abilities/effects/moves.d.ts +11 -0
  13. package/dist/abilities/effects/passives.d.ts +15 -0
  14. package/dist/abilities/effects/sight.d.ts +4 -0
  15. package/dist/abilities/effects/spawn.d.ts +2 -0
  16. package/dist/abilities/effects/timed.d.ts +4 -0
  17. package/dist/abilities/effects/trade.d.ts +1 -0
  18. package/dist/abilities/effects.d.ts +122 -0
  19. package/dist/abilities/land.d.ts +21 -0
  20. package/dist/abilities/scaled.d.ts +21 -0
  21. package/dist/abilities/text.d.ts +113 -0
  22. package/dist/ai/area.d.ts +53 -0
  23. package/dist/ai/brain.d.ts +528 -0
  24. package/dist/ai/budget.d.ts +67 -0
  25. package/dist/ai/checks.d.ts +115 -0
  26. package/dist/ai/computer.d.ts +166 -0
  27. package/dist/ai/defence.d.ts +108 -0
  28. package/dist/ai/define.d.ts +21 -0
  29. package/dist/ai/economy.d.ts +129 -0
  30. package/dist/ai/geometry.d.ts +35 -0
  31. package/dist/ai/goals.d.ts +360 -0
  32. package/dist/ai/index.d.ts +38 -0
  33. package/dist/ai/knowledge.d.ts +418 -0
  34. package/dist/ai/lanes.d.ts +232 -0
  35. package/dist/ai/melee/build.d.ts +61 -0
  36. package/dist/ai/melee/goals.d.ts +299 -0
  37. package/dist/ai/melee/heroes.d.ts +27 -0
  38. package/dist/ai/melee/index.d.ts +14 -0
  39. package/dist/ai/melee/production.d.ts +8 -0
  40. package/dist/ai/melee/surrender.d.ts +24 -0
  41. package/dist/ai/micro.d.ts +278 -0
  42. package/dist/ai/mission.d.ts +195 -0
  43. package/dist/ai/missionRules.d.ts +18 -0
  44. package/dist/ai/module.d.ts +116 -0
  45. package/dist/ai/options.d.ts +61 -0
  46. package/dist/ai/plans/build.d.ts +280 -0
  47. package/dist/ai/plans/placement.d.ts +82 -0
  48. package/dist/ai/plans/plans.d.ts +105 -0
  49. package/dist/ai/plans/production.d.ts +210 -0
  50. package/dist/ai/plans/purse.d.ts +73 -0
  51. package/dist/ai/plans/tech.d.ts +37 -0
  52. package/dist/ai/profiles.d.ts +204 -0
  53. package/dist/ai/reach.d.ts +4 -0
  54. package/dist/ai/report.d.ts +203 -0
  55. package/dist/ai/roles.d.ts +133 -0
  56. package/dist/ai/rules.d.ts +288 -0
  57. package/dist/ai/scouting.d.ts +98 -0
  58. package/dist/ai/settings.d.ts +73 -0
  59. package/dist/ai/squads.d.ts +429 -0
  60. package/dist/ai/strength.d.ts +167 -0
  61. package/dist/ai/task.d.ts +118 -0
  62. package/dist/ai/tasks/attack.d.ts +7 -0
  63. package/dist/ai/tasks/capture.d.ts +21 -0
  64. package/dist/ai/tasks/creep.d.ts +16 -0
  65. package/dist/ai/tasks/defend.d.ts +29 -0
  66. package/dist/ai/tasks/drop.d.ts +34 -0
  67. package/dist/ai/tasks/escort.d.ts +16 -0
  68. package/dist/ai/tasks/gather.d.ts +23 -0
  69. package/dist/ai/tasks/harass.d.ts +7 -0
  70. package/dist/ai/tasks/hold.d.ts +20 -0
  71. package/dist/ai/tasks/index.d.ts +32 -0
  72. package/dist/ai/tasks/move.d.ts +19 -0
  73. package/dist/ai/tasks/patrol.d.ts +8 -0
  74. package/dist/ai/tasks/retreat.d.ts +20 -0
  75. package/dist/ai/tasks/scout.d.ts +29 -0
  76. package/dist/ai/tasks/shared.d.ts +74 -0
  77. package/dist/ai/team.d.ts +155 -0
  78. package/dist/ai/threat.d.ts +91 -0
  79. package/dist/ai/view.d.ts +366 -0
  80. package/dist/ai/waves.d.ts +126 -0
  81. package/dist/ai.js +6239 -0
  82. package/dist/ai.js.map +1 -0
  83. package/dist/aiTesting.d.ts +179 -0
  84. package/dist/areas.d.ts +149 -0
  85. package/dist/attacks.d.ts +66 -0
  86. package/dist/attributes.d.ts +66 -0
  87. package/dist/brain-BvVdUhX8.js +7659 -0
  88. package/dist/brain-BvVdUhX8.js.map +1 -0
  89. package/dist/builds-C6LfgvEU.js +460 -0
  90. package/dist/builds-C6LfgvEU.js.map +1 -0
  91. package/dist/bytes.d.ts +6 -0
  92. package/dist/camps.d.ts +95 -0
  93. package/dist/capture.d.ts +131 -0
  94. package/dist/cellLayers.d.ts +75 -0
  95. package/dist/cinematics.d.ts +194 -0
  96. package/dist/clock.d.ts +32 -0
  97. package/dist/commands.d.ts +235 -0
  98. package/dist/components.d.ts +184 -0
  99. package/dist/computers.d.ts +108 -0
  100. package/dist/concealment.d.ts +61 -0
  101. package/dist/coreComponents-syuh2fPG.js +5149 -0
  102. package/dist/coreComponents-syuh2fPG.js.map +1 -0
  103. package/dist/coreComponents.d.ts +1 -0
  104. package/dist/dashing.d.ts +8 -0
  105. package/dist/debug.d.ts +36 -0
  106. package/dist/debug.js +3 -0
  107. package/dist/debugCommands-CzjrSm66.js +14739 -0
  108. package/dist/debugCommands-CzjrSm66.js.map +1 -0
  109. package/dist/debugCommands.d.ts +213 -0
  110. package/dist/debugging.d.ts +10 -0
  111. package/dist/definitions.d.ts +43 -0
  112. package/dist/defs.d.ts +1162 -0
  113. package/dist/denying.d.ts +81 -0
  114. package/dist/destructibles.d.ts +27 -0
  115. package/dist/determinism-BCymQwiE.js +518 -0
  116. package/dist/determinism-BCymQwiE.js.map +1 -0
  117. package/dist/determinism.d.ts +121 -0
  118. package/dist/dialog.d.ts +94 -0
  119. package/dist/effectRefs.d.ts +16 -0
  120. package/dist/effects.d.ts +80 -0
  121. package/dist/endings.d.ts +22 -0
  122. package/dist/engagement.d.ts +108 -0
  123. package/dist/engineEvents.d.ts +710 -0
  124. package/dist/entity.d.ts +409 -0
  125. package/dist/entityIndex.d.ts +50 -0
  126. package/dist/errors.d.ts +85 -0
  127. package/dist/events.d.ts +97 -0
  128. package/dist/exactMath.d.ts +63 -0
  129. package/dist/features.d.ts +10 -0
  130. package/dist/fields.d.ts +114 -0
  131. package/dist/fixture.d.ts +17 -0
  132. package/dist/fog.d.ts +110 -0
  133. package/dist/formation.d.ts +111 -0
  134. package/dist/friendlyFire.d.ts +26 -0
  135. package/dist/game-DiJEN-Ks.js +5800 -0
  136. package/dist/game-DiJEN-Ks.js.map +1 -0
  137. package/dist/game.d.ts +501 -0
  138. package/dist/gameData.d.ts +325 -0
  139. package/dist/gameFiles.d.ts +26 -0
  140. package/dist/gates.d.ts +28 -0
  141. package/dist/generate.d.ts +403 -0
  142. package/dist/generateWorker.d.ts +39 -0
  143. package/dist/grid.d.ts +53 -0
  144. package/dist/ground.d.ts +127 -0
  145. package/dist/groundSpeed.d.ts +22 -0
  146. package/dist/hero.d.ts +177 -0
  147. package/dist/home.d.ts +14 -0
  148. package/dist/hooks.d.ts +780 -0
  149. package/dist/hotReload.d.ts +76 -0
  150. package/dist/ids.d.ts +26 -0
  151. package/dist/index.d.ts +227 -0
  152. package/dist/index.js +4701 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/inspect-D9dWHmZ0.js +491 -0
  155. package/dist/inspect-D9dWHmZ0.js.map +1 -0
  156. package/dist/inspect.d.ts +176 -0
  157. package/dist/inventory.d.ts +18 -0
  158. package/dist/items.d.ts +91 -0
  159. package/dist/lanes.d.ts +213 -0
  160. package/dist/life.d.ts +53 -0
  161. package/dist/local-Dkovq42k.js +1379 -0
  162. package/dist/local-Dkovq42k.js.map +1 -0
  163. package/dist/log.d.ts +140 -0
  164. package/dist/manaBurn.d.ts +39 -0
  165. package/dist/map/file.d.ts +114 -0
  166. package/dist/map/images.d.ts +18 -0
  167. package/dist/map/look.d.ts +47 -0
  168. package/dist/map/pathProfile.d.ts +13 -0
  169. package/dist/map/resize.d.ts +54 -0
  170. package/dist/map/schema.d.ts +10 -0
  171. package/dist/map/terrain.d.ts +32 -0
  172. package/dist/map/types.d.ts +613 -0
  173. package/dist/map.d.ts +7 -0
  174. package/dist/mapCheck/cells.d.ts +19 -0
  175. package/dist/mapCheck/rule.d.ts +30 -0
  176. package/dist/mapCheck/rules/names.d.ts +3 -0
  177. package/dist/mapCheck/rules/objects.d.ts +3 -0
  178. package/dist/mapCheck/rules/paths.d.ts +3 -0
  179. package/dist/mapCheck/rules/players.d.ts +3 -0
  180. package/dist/mapCheck/rules/races.d.ts +3 -0
  181. package/dist/mapCheck/rules/random.d.ts +3 -0
  182. package/dist/mapCheck/rules/regions.d.ts +3 -0
  183. package/dist/mapCheck/rules/targets.d.ts +3 -0
  184. package/dist/mapCheck/rules/walking.d.ts +3 -0
  185. package/dist/mapCheck.d.ts +23 -0
  186. package/dist/mapFields.d.ts +364 -0
  187. package/dist/mapFile.d.ts +23 -0
  188. package/dist/mapMeasure.d.ts +95 -0
  189. package/dist/mapMerge.d.ts +19 -0
  190. package/dist/mapObjectives.d.ts +82 -0
  191. package/dist/mapObjects.d.ts +1 -0
  192. package/dist/math.d.ts +44 -0
  193. package/dist/messages.d.ts +150 -0
  194. package/dist/missionRules-C-bGxm0Q.js +523 -0
  195. package/dist/missionRules-C-bGxm0Q.js.map +1 -0
  196. package/dist/missionRules.d.ts +179 -0
  197. package/dist/mods.d.ts +146 -0
  198. package/dist/names.d.ts +93 -0
  199. package/dist/navigation/agentParams.d.ts +4 -0
  200. package/dist/navigation/air.d.ts +89 -0
  201. package/dist/navigation/builds.d.ts +140 -0
  202. package/dist/navigation/groundAreas.d.ts +23 -0
  203. package/dist/navigation/navigation.d.ts +127 -0
  204. package/dist/navigation/recast.d.ts +214 -0
  205. package/dist/navigation/sidePaths.d.ts +69 -0
  206. package/dist/navigation/sized.d.ts +1 -0
  207. package/dist/navigation-worker.js +11 -0
  208. package/dist/navigation-worker.js.map +1 -0
  209. package/dist/nearest.d.ts +8 -0
  210. package/dist/noise.d.ts +12 -0
  211. package/dist/objectives.d.ts +93 -0
  212. package/dist/orders/basic.d.ts +96 -0
  213. package/dist/orders/build.d.ts +91 -0
  214. package/dist/orders/cast.d.ts +105 -0
  215. package/dist/orders/facts.d.ts +14 -0
  216. package/dist/orders/harvest.d.ts +94 -0
  217. package/dist/orders/idle.d.ts +7 -0
  218. package/dist/orders/items.d.ts +14 -0
  219. package/dist/orders/queue.d.ts +24 -0
  220. package/dist/pack.schema.json +6621 -0
  221. package/dist/packs/director/index.d.ts +81 -0
  222. package/dist/packs/heroes/campaign.d.ts +137 -0
  223. package/dist/packs/heroes/carry.d.ts +59 -0
  224. package/dist/packs/heroes/commands.d.ts +6 -0
  225. package/dist/packs/heroes/hire.d.ts +9 -0
  226. package/dist/packs/heroes/index.d.ts +12 -0
  227. package/dist/packs/heroes/making.d.ts +16 -0
  228. package/dist/packs/heroes/respawn.d.ts +42 -0
  229. package/dist/packs/moba/index.d.ts +34 -0
  230. package/dist/packs/pack.d.ts +84 -0
  231. package/dist/packs-g5thvmGn.js +3199 -0
  232. package/dist/packs-g5thvmGn.js.map +1 -0
  233. package/dist/packs.d.ts +84 -0
  234. package/dist/paths.d.ts +51 -0
  235. package/dist/plain.d.ts +17 -0
  236. package/dist/player.d.ts +117 -0
  237. package/dist/portals.d.ts +66 -0
  238. package/dist/prefabs.d.ts +139 -0
  239. package/dist/presetBuildings.d.ts +52 -0
  240. package/dist/presetGround.d.ts +22 -0
  241. package/dist/profiles-B3NS9jwk.js +335 -0
  242. package/dist/profiles-B3NS9jwk.js.map +1 -0
  243. package/dist/races.d.ts +136 -0
  244. package/dist/randomGroups.d.ts +2 -0
  245. package/dist/registry.d.ts +464 -0
  246. package/dist/remains.d.ts +119 -0
  247. package/dist/replication.d.ts +103 -0
  248. package/dist/rng.d.ts +17 -0
  249. package/dist/rules.d.ts +395 -0
  250. package/dist/rulesCheck.d.ts +37 -0
  251. package/dist/runes.d.ts +41 -0
  252. package/dist/save.d.ts +277 -0
  253. package/dist/scenario.d.ts +56 -0
  254. package/dist/scheduler.d.ts +67 -0
  255. package/dist/score.d.ts +306 -0
  256. package/dist/sequences.d.ts +132 -0
  257. package/dist/server/doorman.d.ts +21 -0
  258. package/dist/server/gameServer.d.ts +346 -0
  259. package/dist/server/index.d.ts +24 -0
  260. package/dist/server/lobby.d.ts +1 -0
  261. package/dist/server/log.d.ts +13 -0
  262. package/dist/server/match.d.ts +24 -0
  263. package/dist/server/mode.d.ts +168 -0
  264. package/dist/server/navigation-worker.d.ts +1 -0
  265. package/dist/server/navigation.d.ts +11 -0
  266. package/dist/server/ops.d.ts +78 -0
  267. package/dist/server/packs.d.ts +15 -0
  268. package/dist/server/ratings.d.ts +62 -0
  269. package/dist/server/relay.d.ts +34 -0
  270. package/dist/server/rooms.d.ts +162 -0
  271. package/dist/server/seat.d.ts +2 -0
  272. package/dist/server/seatSettings.d.ts +15 -0
  273. package/dist/server/secret.d.ts +5 -0
  274. package/dist/server/start.d.ts +54 -0
  275. package/dist/server/websocket.d.ts +74 -0
  276. package/dist/server.js +2861 -0
  277. package/dist/server.js.map +1 -0
  278. package/dist/session/can.d.ts +20 -0
  279. package/dist/session/commandReplay.d.ts +92 -0
  280. package/dist/session/debug.d.ts +65 -0
  281. package/dist/session/delay.d.ts +15 -0
  282. package/dist/session/delta.d.ts +98 -0
  283. package/dist/session/entityState.d.ts +1 -0
  284. package/dist/session/local.d.ts +214 -0
  285. package/dist/session/memory.d.ts +27 -0
  286. package/dist/session/protocol.d.ts +1155 -0
  287. package/dist/session/remote.d.ts +530 -0
  288. package/dist/session/replay.d.ts +114 -0
  289. package/dist/session/seed.d.ts +7 -0
  290. package/dist/session/share.d.ts +78 -0
  291. package/dist/session/socket.d.ts +8 -0
  292. package/dist/session/wire.d.ts +153 -0
  293. package/dist/session/worker.d.ts +227 -0
  294. package/dist/shared.d.ts +171 -0
  295. package/dist/sides.d.ts +75 -0
  296. package/dist/sight.d.ts +27 -0
  297. package/dist/simulate-oXBiw1Ff.js +167 -0
  298. package/dist/simulate-oXBiw1Ff.js.map +1 -0
  299. package/dist/simulate-worker.d.ts +1 -0
  300. package/dist/simulate-worker.js +28 -0
  301. package/dist/simulate-worker.js.map +1 -0
  302. package/dist/simulate.d.ts +154 -0
  303. package/dist/smart.d.ts +9 -0
  304. package/dist/spatial.d.ts +62 -0
  305. package/dist/spawning.d.ts +33 -0
  306. package/dist/stances.d.ts +76 -0
  307. package/dist/start.d.ts +71 -0
  308. package/dist/stats.d.ts +122 -0
  309. package/dist/summons.d.ts +63 -0
  310. package/dist/systems/abilities.d.ts +3 -0
  311. package/dist/systems/combat.d.ts +71 -0
  312. package/dist/systems/combatTold.d.ts +14 -0
  313. package/dist/systems/construction.d.ts +34 -0
  314. package/dist/systems/economy.d.ts +21 -0
  315. package/dist/systems/fog.d.ts +19 -0
  316. package/dist/systems/life.d.ts +3 -0
  317. package/dist/systems/movement.d.ts +105 -0
  318. package/dist/systems/orders.d.ts +7 -0
  319. package/dist/systems/production.d.ts +49 -0
  320. package/dist/systems/productionQueue.d.ts +40 -0
  321. package/dist/systems/victory.d.ts +14 -0
  322. package/dist/talk.d.ts +65 -0
  323. package/dist/tech.d.ts +62 -0
  324. package/dist/techTree.d.ts +38 -0
  325. package/dist/terrain.d.ts +173 -0
  326. package/dist/terrainSave.d.ts +29 -0
  327. package/dist/testing.d.ts +58 -0
  328. package/dist/testing.js +822 -0
  329. package/dist/testing.js.map +1 -0
  330. package/dist/tiles.d.ts +34 -0
  331. package/dist/timers.d.ts +146 -0
  332. package/dist/tomes.d.ts +48 -0
  333. package/dist/trade.d.ts +28 -0
  334. package/dist/transport.d.ts +76 -0
  335. package/dist/tunables.d.ts +45 -0
  336. package/dist/upkeep.d.ts +16 -0
  337. package/dist/veterancy.d.ts +80 -0
  338. package/dist/walls.d.ts +86 -0
  339. package/dist/world.d.ts +1118 -0
  340. package/package.json +80 -5
  341. package/README.md +0 -3
@@ -0,0 +1,118 @@
1
+ /**
2
+ * A kind of task a squad is on (design review B10): its definition (`TaskDef`, `defineTask`), typed by what it is given
3
+ * (`TaskData`) and what it remembers (`TaskMemory`), and its state as the brain keeps it (`TaskState`). Apart from the
4
+ * squads (`squads.ts`), so that the kit's tasks (`tasks/`) and a game's define theirs without loading the squads
5
+ */
6
+ import type { Vec2 } from '#engine/math';
7
+ import type { Brain } from './brain';
8
+ import type { Squad } from './squads';
9
+ /**
10
+ * How a task ended (`TaskState.done`): `arrived` where it was sent, `cleared` with nothing left to fight where it went,
11
+ * `lost` its target (gone from sight: killed, or out of it), `retreated` home after a fight it was losing, `wiped`
12
+ * with none of its units left; or a game's own word
13
+ *
14
+ * @beta
15
+ */
16
+ export type TaskDone = 'arrived' | 'cleared' | 'lost' | 'retreated' | 'wiped' | (string & {});
17
+ /**
18
+ * A task to give next (`then`): its kind (the kit's `attack`, a game's `defineTask` id) and what it is given
19
+ *
20
+ * @beta
21
+ */
22
+ export interface TaskOrder {
23
+ kind: string;
24
+ data?: TaskData;
25
+ }
26
+ /**
27
+ * What any task may be given beside its own (`TaskState.data`): the task after it (`then`), and `regroup: false` for one
28
+ * not stopped for its stragglers
29
+ *
30
+ * @beta
31
+ */
32
+ export type TaskCommon = {
33
+ then?: TaskOrder;
34
+ regroup?: boolean;
35
+ };
36
+ /**
37
+ * What a task is given, as plain data (`TaskState.data`): each task says its own shape (`defineTask<Data>`)
38
+ *
39
+ * @beta
40
+ */
41
+ export type TaskData = Record<string, unknown>;
42
+ /**
43
+ * What a task remembers of its own, as plain data (`TaskState.memory`): each task says its own shape
44
+ * (`defineTask<Data, Memory>`)
45
+ *
46
+ * @beta
47
+ */
48
+ export type TaskMemory = Record<string, unknown>;
49
+ /**
50
+ * What a squad is doing, as plain data kept in the brain's memory: the kind of task, what it was given, where it is in
51
+ * it (`phase`: `going`, `regrouping`, `fighting`, `gathering`, `holding`, the task's own words), since when, the last
52
+ * order it sent, and how it ended
53
+ *
54
+ * @beta
55
+ */
56
+ export interface TaskState<D extends object = TaskData, M extends object = TaskMemory> {
57
+ /** The kind of task: the kit's (`attack`) or a game's (`defineTask`) */
58
+ kind: string;
59
+ /** What it was given: a point (`at`), a target, a radius, what to do next (`then`). Plain data, of the task's shape */
60
+ data: D & TaskCommon;
61
+ /** The tick it began at */
62
+ since: number;
63
+ /** Where it is in it, in a word */
64
+ phase: string;
65
+ /** The tick its phase began at */
66
+ phaseSince: number;
67
+ /** The tick it last sent an order */
68
+ sent?: number;
69
+ /** How it ended: none while it goes on */
70
+ done?: TaskDone;
71
+ /** The tick it ended at */
72
+ doneAt?: number;
73
+ /** What the task remembers of its own, plain data of the task's shape: the point of a scout's round it is at */
74
+ memory: M;
75
+ }
76
+ /**
77
+ * A kind of task (`defineTask`): what it sends as it begins (`start`), what it looks at each think (`think`), and the
78
+ * place it is about (`where`, for the squads module's regroup and reinforcements and for the report). The squads
79
+ * module runs it with its own regroup, reinforce and retreat around it, but for what it `handles` itself
80
+ *
81
+ * @beta
82
+ */
83
+ export interface TaskDef<D extends object = TaskData, M extends object = TaskMemory> {
84
+ /** Unique among the brain's tasks: what a save names it by. The kit's are words (`attack`); a game's prefixed (`ctf.capture`) */
85
+ id: string;
86
+ /**
87
+ * Sends what puts the squad on its way: called as the task is given, and again as the squad goes on after a regroup.
88
+ * Sets `state.phase`
89
+ */
90
+ start(ai: Brain, squad: Squad, state: TaskState<D, M>): void;
91
+ /** Each think, after the squads module looked at the squad: watches how it goes, sends what was lost, `squad.finish(done)` when it is over */
92
+ think(ai: Brain, squad: Squad, state: TaskState<D, M>): void;
93
+ /** Whether it is over, asked each think before `think`: how it ended, or nothing while it goes on */
94
+ done?(ai: Brain, squad: Squad, state: TaskState<D, M>): TaskDone | undefined | false;
95
+ /** The place it is about: where reinforcements are sent, what the report shows. None for a task about no place */
96
+ where?(ai: Brain, squad: Squad, state: TaskState<D, M>): Vec2 | undefined;
97
+ /** What the squads module leaves to it: a task that regroups in its own way, or retreats never */
98
+ handles?: readonly ('retreat' | 'regroup' | 'reinforce')[];
99
+ /**
100
+ * Whether it is a standing duty, going on as long as its squad has it (a hero walking a lane with its waves): never
101
+ * stuck, whatever its phase, for the `ends` invariant (`checkBrain`). No when left out
102
+ */
103
+ standing?: boolean;
104
+ /**
105
+ * Whether a squad on it is in a fight it means to win, which the micro fights for (`ai.area(Micro)`): yes when left
106
+ * out. No for a task that goes somewhere, looks, stands, gathers or falls back (the kit's `move`, `scout`, `hold`,
107
+ * `gather`, `retreat`, and the micro's own `flee`)
108
+ */
109
+ fighting?: boolean;
110
+ }
111
+ /**
112
+ * Defines a task: a kind of thing a squad can be told to do (`squad.task(def, data)`, its data typed by the task), the
113
+ * kit's and a game's own. List a game's in the brain's `settings.squads.tasks`, so that a squad on it goes on after a
114
+ * load
115
+ *
116
+ * @beta
117
+ */
118
+ export declare function defineTask<D extends object = TaskData, M extends object = TaskMemory>(id: string, def: Omit<TaskDef<D, M>, 'id'>): TaskDef<D, M>;
@@ -0,0 +1,7 @@
1
+ import { type FightData, type FightMemory } from './shared';
2
+ /**
3
+ * Attacks a place or a target, by a way round where told: done `cleared` with nothing left to fight there, `lost` with its target gone
4
+ *
5
+ * @beta
6
+ */
7
+ export declare const ATTACK: import("..").TaskDef<FightData, FightMemory>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The kit's `capture` task (design review B10): takes a capture point of the game (`withCapture`): done `captured`, or `lost` where it is gone
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ import { type TaskMemory } from '../task';
6
+ /**
7
+ * What the `capture` task is given
8
+ *
9
+ * @beta
10
+ */
11
+ export type CaptureData = {
12
+ /** The capture point, by id (`withCapture`) */
13
+ point: string;
14
+ at?: Vec2;
15
+ };
16
+ /**
17
+ * Takes a capture point of the game (`withCapture`): done `captured`, or `lost` where it is gone
18
+ *
19
+ * @beta
20
+ */
21
+ export declare const CAPTURE: import("..").TaskDef<CaptureData, TaskMemory>;
@@ -0,0 +1,16 @@
1
+ import type { Vec2 } from '#engine/math';
2
+ import { type FightMemory } from './shared';
3
+ /**
4
+ * What the `creep` task is given: the camp
5
+ *
6
+ * @beta
7
+ */
8
+ export type CreepData = {
9
+ at: Vec2;
10
+ };
11
+ /**
12
+ * Takes a camp of creeps: done `cleared` once the map says the camp is
13
+ *
14
+ * @beta
15
+ */
16
+ export declare const CREEP: import("..").TaskDef<CreepData, FightMemory>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The kit's `defend` task (design review B10): holds a place against what comes within its radius, one foe at a time
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ /**
6
+ * What the `defend` task is given
7
+ *
8
+ * @beta
9
+ */
10
+ export type DefendData = {
11
+ at: Vec2;
12
+ /** How far round the place it fights: 16 when left out */
13
+ radius?: number;
14
+ };
15
+ /**
16
+ * What the `defend` task remembers
17
+ *
18
+ * @beta
19
+ */
20
+ export type DefendMemory = {
21
+ /** The foe the whole squad is on */
22
+ foe?: number;
23
+ };
24
+ /**
25
+ * Holds a place against what comes within its radius, one foe at a time
26
+ *
27
+ * @beta
28
+ */
29
+ export declare const DEFEND_TASK: import("..").TaskDef<DefendData, DefendMemory>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The kit's `drop` task: a squad carried by transports to a place it cannot walk to (an island, across a river, behind
3
+ * the enemy's walls), let out on the land nearest it: done `landed`, its `then` after (an attack where it landed)
4
+ */
5
+ import { type Vec2 } from '#engine/math';
6
+ /**
7
+ * What the `drop` task is given: where it lands, and the transports that carry it (the brain's units, not of the
8
+ * squad: they are let go of once they have let it out)
9
+ *
10
+ * @beta
11
+ */
12
+ export type DropData = {
13
+ at: Vec2;
14
+ transports: number[];
15
+ };
16
+ /**
17
+ * What the `drop` task remembers: since when it waits for its units to get in
18
+ *
19
+ * @beta
20
+ */
21
+ export type DropMemory = {
22
+ /** When it began to wait for its units to get in, in seconds of the game */
23
+ waiting?: number;
24
+ /** When the transports were sent off, in seconds of the game */
25
+ sailed?: number;
26
+ };
27
+ /**
28
+ * Carries the squad to a place by its transports: each unit told to get into one (shared out as they have room), the
29
+ * transports sent off once all are in (or after `BOARDING_WAIT` seconds, with those that are), and told to let them out
30
+ * on the land nearest the place. Done `landed` once they are all out; `lost` with no transport left to carry them
31
+ *
32
+ * @beta
33
+ */
34
+ export declare const DROP: import("..").TaskDef<DropData, DropMemory>;
@@ -0,0 +1,16 @@
1
+ import { type TaskMemory } from '../task';
2
+ /**
3
+ * What the `escort` task is given
4
+ *
5
+ * @beta
6
+ */
7
+ export type EscortData = {
8
+ /** Whom it follows */
9
+ target: number;
10
+ };
11
+ /**
12
+ * Follows a unit and fights what comes near it: done `lost` with it gone
13
+ *
14
+ * @beta
15
+ */
16
+ export declare const ESCORT: import("..").TaskDef<EscortData, TaskMemory>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The kit's `gather` task (design review B10): gathers at a rally: done `arrived` once enough are there, or the time is up
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ import { type TaskMemory } from '../task';
6
+ /**
7
+ * What the `gather` task is given
8
+ *
9
+ * @beta
10
+ */
11
+ export type GatherData = {
12
+ at: Vec2;
13
+ /** The share of the squad there that is enough: all when left out */
14
+ minForces?: number;
15
+ /** Seconds it waits at most */
16
+ seconds?: number;
17
+ };
18
+ /**
19
+ * Gathers at a rally: done `arrived` once enough are there, or the time is up
20
+ *
21
+ * @beta
22
+ */
23
+ export declare const GATHER: import("..").TaskDef<GatherData, TaskMemory>;
@@ -0,0 +1,7 @@
1
+ import { type FightData, type FightMemory } from './shared';
2
+ /**
3
+ * Goes for the workers at a place, one at a time, round their army where told
4
+ *
5
+ * @beta
6
+ */
7
+ export declare const HARASS: import("..").TaskDef<FightData, FightMemory>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The kit's `hold` task (design review B10): stands its ground (defensive where the game has stances), where it is or at a place
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ import { type TaskMemory } from '../task';
6
+ /**
7
+ * What the `hold` task is given
8
+ *
9
+ * @beta
10
+ */
11
+ export type HoldData = {
12
+ /** Where it holds: where it stands when left out */
13
+ at?: Vec2;
14
+ };
15
+ /**
16
+ * Stands its ground (defensive where the game has stances), where it is or at a place
17
+ *
18
+ * @beta
19
+ */
20
+ export declare const HOLD: import("..").TaskDef<HoldData, TaskMemory>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The kit's tasks (design review B10), one file each, listed for every brain's squads (`Squads`)
3
+ */
4
+ import type { TaskDef } from '../task';
5
+ /** The kit's tasks, by their word */
6
+ export declare const TASKS: readonly TaskDef[];
7
+ export { ATTACK } from './attack';
8
+ export { HARASS } from './harass';
9
+ export { CREEP } from './creep';
10
+ export { DEFEND_TASK } from './defend';
11
+ export { HOLD } from './hold';
12
+ export { MOVE } from './move';
13
+ export { CAPTURE } from './capture';
14
+ export { RETREAT } from './retreat';
15
+ export { ESCORT } from './escort';
16
+ export { SCOUT_TASK } from './scout';
17
+ export { PATROL } from './patrol';
18
+ export { GATHER } from './gather';
19
+ export { DROP } from './drop';
20
+ export type { DropData, DropMemory } from './drop';
21
+ export { type FightData, type FightMemory } from './shared';
22
+ export type { DefendData } from './defend';
23
+ export type { DefendMemory } from './defend';
24
+ export type { HoldData } from './hold';
25
+ export type { MoveData } from './move';
26
+ export type { CaptureData } from './capture';
27
+ export type { EscortData } from './escort';
28
+ export type { RoundData } from './scout';
29
+ export type { RoundMemory } from './scout';
30
+ export type { GatherData } from './gather';
31
+ export type { CreepData } from './creep';
32
+ export type { RetreatData } from './retreat';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The kit's `move` task (design review B10): walks to a place: done `arrived`
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ import { type TaskMemory } from '../task';
6
+ /**
7
+ * What the `move` task is given
8
+ *
9
+ * @beta
10
+ */
11
+ export type MoveData = {
12
+ at: Vec2;
13
+ };
14
+ /**
15
+ * Walks to a place: done `arrived`
16
+ *
17
+ * @beta
18
+ */
19
+ export declare const MOVE: import("..").TaskDef<MoveData, TaskMemory>;
@@ -0,0 +1,8 @@
1
+ import type { RoundData } from './scout';
2
+ import type { RoundMemory } from './scout';
3
+ /**
4
+ * Walks a round of places for ever, fighting what it meets
5
+ *
6
+ * @beta
7
+ */
8
+ export declare const PATROL: import("..").TaskDef<RoundData, RoundMemory>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The kit's `retreat` task (design review B10): falls back to a place: done `retreated`
3
+ */
4
+ import type { Vec2 } from '#engine/math';
5
+ import { type TaskMemory } from '../task';
6
+ /**
7
+ * What the `retreat` task is given: where to (home when left out), and why, for the report
8
+ *
9
+ * @beta
10
+ */
11
+ export type RetreatData = {
12
+ at?: Vec2;
13
+ why?: string;
14
+ };
15
+ /**
16
+ * Falls back to a place: done `retreated`
17
+ *
18
+ * @beta
19
+ */
20
+ export declare const RETREAT: import("..").TaskDef<RetreatData, TaskMemory>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The kit's `scout` task (design review B10): looks at places in turn: done `arrived` after the last
3
+ */
4
+ import { type Vec2 } from '#engine/math';
5
+ /**
6
+ * What the `scout` task is given
7
+ *
8
+ * @beta
9
+ */
10
+ export type RoundData = {
11
+ points: Vec2[];
12
+ };
13
+ /**
14
+ * What the `scout` task remembers
15
+ *
16
+ * @beta
17
+ */
18
+ export type RoundMemory = {
19
+ /** The place of the round it is on */
20
+ next?: number;
21
+ /** Times it was sent again to a place it stopped short of */
22
+ tries?: number;
23
+ };
24
+ /**
25
+ * Looks at places in turn: done `arrived` after the last
26
+ *
27
+ * @beta
28
+ */
29
+ export declare const SCOUT_TASK: import("..").TaskDef<RoundData, RoundMemory>;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * What the kit's tasks share (design review B10): where a task's data says it goes, what is fighting near a place, how a
3
+ * fight is gone to and watched, a way round, a walk's end
4
+ */
5
+ import { type Vec2 } from '#engine/math';
6
+ import type { Brain } from '../brain';
7
+ import type { Squad } from '../squads';
8
+ import type { TaskDone, TaskState } from '../task';
9
+ import type { UnitSet } from '../view';
10
+ /** How near the place it was sent to a squad is there */
11
+ export declare const ARRIVE = 8;
12
+ /** How near a place of its round a patrol is there, and a little more for each of its units (they stand round it) */
13
+ export declare const PATROL_ARRIVE = 4;
14
+ /** How near the place it was sent to look at a scout that stopped short is as near as the ground lets it: further is stuck */
15
+ export declare const SCOUT_NEAR = 16;
16
+ /**
17
+ * What a task that fights somewhere is given (`attack`, `harass`, `creep`): a place, or a target (an entity, as it
18
+ * goes), a way round their army (`avoid: 'army'`) or by a place (`via`)
19
+ *
20
+ * @beta
21
+ */
22
+ export type FightData = {
23
+ at?: Vec2;
24
+ target?: number;
25
+ avoid?: 'army' | false;
26
+ via?: Vec2;
27
+ };
28
+ /**
29
+ * What a task that fights remembers: its way round, and the worker it hunts (`harass`)
30
+ *
31
+ * @beta
32
+ */
33
+ export type FightMemory = {
34
+ routed?: boolean;
35
+ waypoints?: Vec2[];
36
+ prey?: number;
37
+ };
38
+ /** Where a task's data says it goes: its target where it is in sight, else its place */
39
+ export declare function placeOf(ai: Brain, state: TaskState<FightData, FightMemory>): Vec2 | undefined;
40
+ /** Whether a place is on the map */
41
+ export declare function onMap(ai: Brain, at: Vec2): boolean;
42
+ /** What is hostile and alive near a place: what a squad there fights */
43
+ export declare function foesNear(ai: Brain, at: Vec2, radius?: number): UnitSet;
44
+ /**
45
+ * Sets a task on its way to fight at its place: by the waypoints of a way round (`avoid`) where there are any, walking
46
+ * them, then attack-moving there; else attack-moving, or attacking its target
47
+ */
48
+ export declare function goFight(ai: Brain, squad: Squad, state: TaskState<FightData, FightMemory>): void;
49
+ /**
50
+ * Watches a squad on its way to fight or fighting: done once there with nothing left to fight, or once its target is
51
+ * gone; the units that stand idle short of it sent again
52
+ */
53
+ export declare function watchFight(ai: Brain, squad: Squad, state: TaskState<FightData, FightMemory>): void;
54
+ /**
55
+ * A task's target where it is in sight, to attack it by name: a building remembered out of sight (`visible: false`)
56
+ * cannot be told to be attacked, and is attack-moved to instead
57
+ */
58
+ export declare function inSight(ai: Brain, state: TaskState<FightData, FightMemory>): number | undefined;
59
+ /** Works out the way round for a task that avoids, as it begins: kept in its memory, said in the decision log */
60
+ export declare function planRoute(ai: Brain, squad: Squad, state: TaskState<FightData, FightMemory>): void;
61
+ /** The capture points of the game (`withCapture`), as the report tells the brain: none for a game without them */
62
+ export declare function capturePointsOf(ai: Brain): {
63
+ id: string;
64
+ owner: number | null;
65
+ x: number;
66
+ z: number;
67
+ }[];
68
+ /**
69
+ * A walk's think: done (as `done` says) once its middle is near the place, or once all of it stands idle as near as the
70
+ * ground let it go; what stands idle short of it, while others walk on, is sent again
71
+ */
72
+ export declare function arrive(done: TaskDone): (ai: Brain, squad: Squad, state: TaskState<{
73
+ at?: Vec2;
74
+ }>) => void;
@@ -0,0 +1,155 @@
1
+ import type { PlayerId } from '#engine/entity';
2
+ import { type Vec2 } from '#engine/math';
3
+ import { type AiModuleDef } from './module';
4
+ /**
5
+ * Something one computer of a team asks of the others, on the team's board: help at a place
6
+ *
7
+ * @beta
8
+ */
9
+ export interface TeamRequest {
10
+ /** Its number on the board */
11
+ id: number;
12
+ kind: 'help' | 'attack' | 'defend' | 'rally';
13
+ /** Who asks: a computer of the team, or a person whose ping or plight it is */
14
+ from: PlayerId;
15
+ at: Vec2;
16
+ /** The enemy strength seen there as it was asked (0 for none seen: a ping on a place) */
17
+ strength: number;
18
+ /** The tick it is asked until */
19
+ until: number;
20
+ /** What it came of: a raid on a computer, a person's ping, damage seen done to an ally, a word of the game's */
21
+ by: 'raid' | 'ping' | 'damage' | 'word';
22
+ /** The computers that answered it */
23
+ answered: PlayerId[];
24
+ }
25
+ /**
26
+ * An attack the computers of a team agree on (`together`): where, when, who proposed it, who joined and who did not
27
+ *
28
+ * @beta
29
+ */
30
+ export interface AttackPlan {
31
+ target: Vec2;
32
+ /** The tick the waves go at */
33
+ at: number;
34
+ by: PlayerId;
35
+ joined: PlayerId[];
36
+ declined: PlayerId[];
37
+ /** The tick it was proposed at */
38
+ since: number;
39
+ }
40
+ /**
41
+ * A team's board as the world keeps it (`core.ai.teams`, by team): plain data, kept in a save, never replicated
42
+ *
43
+ * @beta
44
+ */
45
+ export interface TeamBoard {
46
+ v: 1;
47
+ requests: TeamRequest[];
48
+ plan?: AttackPlan;
49
+ /** What each computer of the team remembers of the enemy's bases, and when it last thought */
50
+ known: Record<string, {
51
+ tick: number;
52
+ bases: {
53
+ owner: PlayerId;
54
+ at: Vec2;
55
+ last: number;
56
+ }[];
57
+ }>;
58
+ /** The next request's number */
59
+ next: number;
60
+ }
61
+ /**
62
+ * How a brain plays with its team (`BrainDef.team`, the seat's `AiOptions.team` over it, the `team()` module's own
63
+ * under both). Data
64
+ *
65
+ * @beta
66
+ */
67
+ export interface TeamOptions {
68
+ /** Whether it helps its allies, people and computers, where asked (the classic Defend Users): yes when left out */
69
+ defendUsers?: boolean;
70
+ /**
71
+ * Whether it does what an ally's ping asks besides help (`GameRules.talk.pings.meanings`): a squad sent to fight at
72
+ * an `attack` (a push), one to hold a place at a `defend` (a hold), its squads out brought home at a `rally` (a
73
+ * retreat). Yes when left out
74
+ */
75
+ answerPings?: boolean;
76
+ /** The odds of the fight (`Strength.odds`) what it sends to help is to have: one in two when left out */
77
+ helpOdds?: number;
78
+ /** Whether it asks its team for help with a raid more than it can meet: yes when left out */
79
+ askForHelp?: boolean;
80
+ /** Whether its waves wait for the team's plan and go together: no when left out */
81
+ together?: boolean;
82
+ /** Seconds ahead of the proposal the waves of a plan go: 20 when left out */
83
+ gatherFor?: number;
84
+ /** Seconds a request stands: 30 when left out */
85
+ requestFor?: number;
86
+ /** Whether it says a line to its side as it sends a wave, comes to help, falls back: no when left out */
87
+ say?: boolean;
88
+ /** Its lines, the game's words: `{ attacking, helping, retreating }`. Nothing is said for a line not given */
89
+ lines?: Partial<Record<'attacking' | 'helping' | 'retreating', string>>;
90
+ }
91
+ /**
92
+ * What a brain remembers of its team play between thinks (`BrainMemory.team`): up to when it heard, when it last said
93
+ * each line
94
+ *
95
+ * @beta
96
+ */
97
+ export interface TeamPlayMemory {
98
+ v: 1;
99
+ heard: number;
100
+ said: Record<string, number>;
101
+ }
102
+ /**
103
+ * Team play as the report shows it (`AiReport.team`): the team, its computers, the requests on its board, the plan of
104
+ * an attack together, how many enemy bases the team knows
105
+ *
106
+ * @beta
107
+ */
108
+ export interface TeamReport {
109
+ team: number;
110
+ computers: PlayerId[];
111
+ requests: {
112
+ id: number;
113
+ kind: TeamRequest['kind'];
114
+ from: PlayerId;
115
+ at: [number, number];
116
+ strength: number;
117
+ by: TeamRequest['by'];
118
+ answered: PlayerId[];
119
+ left: number;
120
+ }[];
121
+ plan?: {
122
+ target: [number, number];
123
+ in: number;
124
+ by: PlayerId;
125
+ joined: PlayerId[];
126
+ declined: PlayerId[];
127
+ };
128
+ enemyBases: number;
129
+ }
130
+ /**
131
+ * The id of the help goal
132
+ *
133
+ * @beta
134
+ */
135
+ export declare const HELP = "help";
136
+ /**
137
+ * The id of the goal that does what an ally's ping asks (`push`, `hold`): `pinged`
138
+ *
139
+ * @beta
140
+ */
141
+ export declare const PINGED = "pinged";
142
+ /**
143
+ * The team module: the team's board brought up to date each think (`ai.team.think`: itself and what it knows written,
144
+ * pings and an ally's damage heard as calls for help, its own raids asked help for, the plan of an attack together
145
+ * answered), and the `help` goal on the picker. With how it plays where the brain's definition and the seat's options
146
+ * say nothing (`TeamOptions`)
147
+ *
148
+ * @beta
149
+ */
150
+ export declare const team: (options?: TeamOptions) => AiModuleDef;
151
+ declare module './area' {
152
+ interface AreaMemories {
153
+ team?: TeamPlayMemory;
154
+ }
155
+ }