@v12-engine/engine 0.0.0-stage → 0.1.1

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,288 @@
1
+ import type { Vec2 } from '#engine/math';
2
+ import type { ObjectiveStatus } from '#engine/objectives';
3
+ import { type Brain } from './brain';
4
+ import { type AiModuleDef } from './module';
5
+ import type { AiRole } from './roles';
6
+ /**
7
+ * At least `min` and at most `max`, each left out for no bound: a count, an amount, a level
8
+ *
9
+ * @beta
10
+ */
11
+ export interface AiRange {
12
+ min?: number;
13
+ max?: number;
14
+ }
15
+ /**
16
+ * Whose units a condition counts: the player’s own (the default), its rivals’ in sight, its allies’
17
+ *
18
+ * @beta
19
+ */
20
+ export type AiWhose = 'mine' | 'enemy' | 'ally';
21
+ /**
22
+ * A condition as plain data: what a map's file, a mission's JSON or the editor holds. Each form is one question; the
23
+ * table in `docs/ai.md` says what each asks
24
+ *
25
+ * @beta
26
+ */
27
+ export type AiConditionData =
28
+ /** Every one of them */
29
+ {
30
+ all: AiCondition[];
31
+ }
32
+ /** One of them at least */
33
+ | {
34
+ any: AiCondition[];
35
+ }
36
+ /** The other way round */
37
+ | {
38
+ not: AiCondition;
39
+ }
40
+ /** How much it has of a resource */
41
+ | {
42
+ resource: {
43
+ id: string;
44
+ } & AiRange;
45
+ }
46
+ /**
47
+ * How many units there are, of a type, a role or a tag, whose (`of`), near a named entity, point or region (`near`,
48
+ * `within`), finished only (`finished`); and for `of: 'enemy'`, those remembered out of sight too (`known`). At
49
+ * least one where neither `min` nor `max` is given
50
+ */
51
+ | {
52
+ units: {
53
+ type?: string;
54
+ role?: AiRole;
55
+ tag?: string;
56
+ of?: AiWhose;
57
+ near?: string | Vec2;
58
+ within?: number;
59
+ finished?: boolean;
60
+ known?: boolean;
61
+ } & AiRange;
62
+ }
63
+ /** Its supply: free (cap less used), used, cap */
64
+ | {
65
+ supply: {
66
+ free?: AiRange;
67
+ used?: AiRange;
68
+ cap?: AiRange;
69
+ };
70
+ }
71
+ /** Seconds into the game: from `after`, before `before` */
72
+ | {
73
+ time: {
74
+ after?: number;
75
+ before?: number;
76
+ };
77
+ }
78
+ /**
79
+ * Whether its own are being hit: damage seen to its entities within so many seconds (5 when left out), anywhere, or
80
+ * near a named entity, a point or a region (`near`, `within` the reach: 16)
81
+ */
82
+ | {
83
+ underAttack: true | {
84
+ seconds?: number;
85
+ near?: string | Vec2;
86
+ reach?: number;
87
+ };
88
+ }
89
+ /** Whether a rival's unit of a type or a role was seen, within so many seconds where given (ever, when left out) */
90
+ | {
91
+ seen: {
92
+ type?: string;
93
+ role?: AiRole;
94
+ within?: number;
95
+ };
96
+ }
97
+ /** The difficulty it plays on (its profile's: `AiOptions.difficulty`, normal when left out), one or any of a list */
98
+ | {
99
+ difficulty: string | string[];
100
+ }
101
+ /** Whether the game told it this word and nothing took it yet */
102
+ | {
103
+ told: string;
104
+ }
105
+ /** Yes so often, by the brain's own numbers (`ai.rng`): `0.3` is three times in ten. The same game says the same */
106
+ | {
107
+ chance: number;
108
+ }
109
+ /** Its heroes: one at least of this type (any where left out), alive where `alive` says, of a level */
110
+ | {
111
+ hero: {
112
+ type?: string;
113
+ alive?: boolean;
114
+ level?: AiRange;
115
+ };
116
+ }
117
+ /** 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`) */
118
+ | {
119
+ wave: AiRange;
120
+ }
121
+ /** One of its own objectives, by id, in this status (or any of these) */
122
+ | {
123
+ objective: {
124
+ id: string;
125
+ status: ObjectiveStatus | ObjectiveStatus[];
126
+ };
127
+ }
128
+ /** A value of the game's report to this player (`GameModule.report`), by its path (`'waves.next'`): equal to, or within */
129
+ | {
130
+ report: {
131
+ path: string;
132
+ equals?: unknown;
133
+ } & AiRange;
134
+ }
135
+ /**
136
+ * A value of a component the game replicates to this player (`Component.replicate`) on an entity: one the map or
137
+ * the rules named (`entity`), or the first of its own of a type (`type`). By path in it, where it is an object
138
+ */
139
+ | {
140
+ component: {
141
+ id: string;
142
+ entity?: string;
143
+ type?: string;
144
+ path?: string;
145
+ equals?: unknown;
146
+ } & AiRange;
147
+ }
148
+ /** How many units are in a region of the map, whose (`of`: its own when left out), of a type or a role */
149
+ | {
150
+ region: {
151
+ name: string;
152
+ of?: AiWhose;
153
+ type?: string;
154
+ role?: AiRole;
155
+ } & AiRange;
156
+ }
157
+ /** 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' } }`) */
158
+ | {
159
+ is: string;
160
+ args?: Record<string, unknown>;
161
+ };
162
+ /**
163
+ * A condition: a question with a yes or no, as a function of the brain, or as plain data (`AiConditionData`)
164
+ *
165
+ * @beta
166
+ */
167
+ export type AiCondition = ((ai: Brain) => boolean) | AiConditionData;
168
+ /**
169
+ * 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
170
+ * (`GameAi.conditions`) or the brain (`BrainDef.conditions`) gives the code, by an id prefixed as components are
171
+ * (`mygame.bridgeDown`)
172
+ *
173
+ * @beta
174
+ */
175
+ export type AiConditionTest = (ai: Brain, args: Record<string, unknown>) => boolean;
176
+ /**
177
+ * Whether a condition holds for the brain now: a function is asked, data is read as its form says. A form the kit
178
+ * does not know (a game's own not defined) is no, and the log says so once
179
+ *
180
+ * @beta
181
+ */
182
+ export declare function evaluate(condition: AiCondition, ai: Brain): boolean;
183
+ /**
184
+ * What a rule does, as plain data: a word the brain tells itself (`{ say: 'attack', data: { at } }`), answered by the
185
+ * `words()` module or a told rule of its own, the same think where they come after the rules
186
+ *
187
+ * @beta
188
+ */
189
+ export interface AiActionData {
190
+ say: string;
191
+ data?: unknown;
192
+ }
193
+ /**
194
+ * What a rule does: a function of the brain and, for a told rule, what came with the word; or plain data
195
+ * (`AiActionData`)
196
+ *
197
+ * @beta
198
+ */
199
+ export type AiAction = ((ai: Brain, data?: unknown) => void) | AiActionData;
200
+ /**
201
+ * A rule of a brain (`when(condition).do(action)`): checked each think by the `rules()` module, its action done as
202
+ * its condition becomes true. Code: given again by the brain's definition, as goals are; what it remembers is data
203
+ *
204
+ * @beta
205
+ */
206
+ export interface AiRule {
207
+ /** 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 */
208
+ readonly id?: string;
209
+ /** When it fires: a condition, or a word told (`when.told`) */
210
+ readonly when: AiCondition | {
211
+ word: string;
212
+ };
213
+ /** What it does */
214
+ readonly action: AiAction;
215
+ /** Whether it fires the first time only, ever */
216
+ readonly once?: boolean;
217
+ /** Seconds: fired again while its condition holds, at most so often. Left out, it fires as it turns true */
218
+ readonly every?: number;
219
+ /** Checked before rules of less: 0 when left out */
220
+ readonly priority?: number;
221
+ }
222
+ /**
223
+ * A rule being written: `when(...)`, then any of `once`, `every`, `priority`, `named`, then `do`
224
+ *
225
+ * @beta
226
+ */
227
+ export interface RuleBuilder {
228
+ /** Fires the first time only, ever */
229
+ once(): RuleBuilder;
230
+ /** Fires again while the condition holds, at most every so many seconds */
231
+ every(seconds: number): RuleBuilder;
232
+ /** Checked before rules of less */
233
+ priority(n: number): RuleBuilder;
234
+ /** Its name, for the memory, the report and the log */
235
+ named(id: string): RuleBuilder;
236
+ /** What it does: the rule */
237
+ do(action: AiAction): AiRule;
238
+ }
239
+ /**
240
+ * A rule: `when(condition).do(action)`, with `once()`, `every(seconds)`, `priority(n)`, `named(id)` between. The
241
+ * condition is a function of the brain or plain data (`AiCondition`). `when.told(word)` fires once for each time the
242
+ * word is told, taking it, its action given the word's data
243
+ *
244
+ * @beta
245
+ */
246
+ export declare const when: ((condition: AiCondition) => RuleBuilder) & {
247
+ /** A rule that fires for each time the game tells the brain this word (`world.computers.tell`), and takes it */
248
+ told: (word: string) => RuleBuilder;
249
+ };
250
+ /**
251
+ * The rules module: checks its rules each think, in their order (by `priority`, then as given), and does each one's
252
+ * action as its condition turns true. Ahead of the modules that act on units, where a brain lists it: what a rule
253
+ * takes is then not given orders by them first. Its id is `rules` (give `id` for a second one)
254
+ *
255
+ * @beta
256
+ */
257
+ export declare const rules: (list: AiRule[], options?: {
258
+ id?: string;
259
+ }) => AiModuleDef;
260
+ /**
261
+ * What the words a brain may be told (`words()`) come with: where (`at`, a point, or a name the map or rules gave an
262
+ * entity or region), and for how many seconds the army is the word's, not the goals' (`seconds`)
263
+ *
264
+ * @beta
265
+ */
266
+ export interface WordData {
267
+ at?: Vec2 | string;
268
+ seconds?: number;
269
+ }
270
+ /**
271
+ * The words module: answers the words any brain may be told (`world.computers.tell(player, word, data)`), taking them:
272
+ *
273
+ * - `attack` `{ at?, seconds? }`: the army (its fighters) attacks there, fighting what it meets on the way; where no
274
+ * 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
275
+ * (`AiOptions.enemyBases`).
276
+ * - `defend` `{ at?, seconds? }`: the army goes to fight there, home when left out.
277
+ * - `retreat` `{ seconds? }`: the army comes home, fighting nothing on the way.
278
+ * - `hold` `{ seconds? }`: the army stands where it is, fighting what comes in reach.
279
+ * - `pause`: the brain sits still until told `resume` (or `world.computers.resume`); `resume` the brain answers itself.
280
+ *
281
+ * The army goes as one squad on the kit's task of the word (`attack`, `defend`, `retreat`, `hold`, in the squad
282
+ * `word`), so that where the brain has the `squads()` module it regroups, focuses, kites and falls back on the odds as
283
+ * any squad does. The army is the word's for `seconds` (attack 60, defend 30, retreat 15, hold 30): no goal claims it
284
+ * 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
285
+ *
286
+ * @beta
287
+ */
288
+ export declare const words: () => AiModuleDef;
@@ -0,0 +1,98 @@
1
+ import { type Vec2 } from '#engine/math';
2
+ import { type Brain } from './brain';
3
+ import { type AiModuleDef } from './module';
4
+ /**
5
+ * How a brain scouts (`BrainDef.scouting`, the seat's `AiOptions.scouting` over it, the `scouting()` module's own under
6
+ * both). Data, but for the function form of `scout`
7
+ *
8
+ * @beta
9
+ */
10
+ export interface ScoutingOptions {
11
+ /** Seconds a place stays out of sight before it is worth a look again: 90 when left out */
12
+ lookEvery?: number;
13
+ /**
14
+ * Where to look: `false` nowhere (the goal is left out), a function for places of the game's own each think (in place
15
+ * of the kit's plan). The kit's plan when left out
16
+ */
17
+ scout?: false | ((ai: Brain) => Vec2[]);
18
+ /** Whether the mines they would expand to are looked at: yes when left out */
19
+ expansions?: boolean;
20
+ /** Whether where their army was last seen is looked at again: yes when left out */
21
+ army?: boolean;
22
+ /** Whether a flying unit with nothing to do goes before the fastest on foot: yes when left out */
23
+ flyers?: boolean;
24
+ /** Seconds into the game before the first look: 15 when left out */
25
+ from?: number;
26
+ }
27
+ /**
28
+ * What the scouting remembers between thinks, as a save keeps it
29
+ *
30
+ * @beta
31
+ */
32
+ export interface ScoutingMemory {
33
+ v: 1;
34
+ /** The unit that scouts, while it lives: the same one goes on to the next round */
35
+ scout?: number;
36
+ /** Rounds sent */
37
+ rounds: number;
38
+ /** The places of the round the scout is on, while it is */
39
+ round?: Vec2[];
40
+ /**
41
+ * Places a scout was lost on the way to, and when: not due again for `lookEvery` seconds, as if looked at (a lost
42
+ * scout says as much: what guards it is there). Never the same unit sent to die at their towers over and over (AI1)
43
+ */
44
+ lost?: {
45
+ at: Vec2;
46
+ tick: number;
47
+ }[];
48
+ }
49
+ /**
50
+ * A place in the plan of looks: where, what kind of place it is, when it was last in sight
51
+ *
52
+ * @beta
53
+ */
54
+ export interface Look {
55
+ at: Vec2;
56
+ /** Their start not seen yet, their base, a mine they would expand to, where their army was, or a place the game names */
57
+ kind: 'start' | 'base' | 'expansion' | 'army' | 'game';
58
+ /** Seconds since it was last in sight: `Infinity` for never */
59
+ since: number;
60
+ /** Whether it is worth a look now */
61
+ due: boolean;
62
+ }
63
+ /**
64
+ * The scouting as the report shows it (`AiReport.scouting`): the plan of looks with how old each is, the scout, where
65
+ * it goes
66
+ *
67
+ * @beta
68
+ */
69
+ export interface ScoutingReport {
70
+ looks: {
71
+ at: [number, number];
72
+ kind: Look['kind'];
73
+ seen?: number;
74
+ due: boolean;
75
+ }[];
76
+ scout?: number;
77
+ going?: [number, number][];
78
+ rounds: number;
79
+ }
80
+ /**
81
+ * The id of the scouting's goal
82
+ *
83
+ * @beta
84
+ */
85
+ export declare const SCOUT = "scout";
86
+ /**
87
+ * The scouting module: puts the `scout` goal on the brain's picker, which sends one unit at a time to look at what is
88
+ * due (`ai.scouting`). With how it scouts where the brain's definition and the seat's options say nothing
89
+ * (`ScoutingOptions`)
90
+ *
91
+ * @beta
92
+ */
93
+ export declare const scouting: (options?: ScoutingOptions) => AiModuleDef;
94
+ declare module './area' {
95
+ interface AreaMemories {
96
+ scouting?: ScoutingMemory;
97
+ }
98
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The settings of a brain (design review B2): every number and switch its areas play by, in one schema keyed by area,
3
+ * each under the area's own names (`{ economy: { workers }, defence: { radius, towers }, micro: { unitsFlee } }`). Every
4
+ * layer speaks it, lowest first:
5
+ *
6
+ * the brain's definition (`BrainDef.settings`) → the game's defaults (`GameAi.defaults`) → the race's
7
+ * (`GameAi.races`) → the difficulty → the personality → the map (`MapAi.settings`, `MapAi.races`) → the seat
8
+ * (`AiOptions.settings`)
9
+ *
10
+ * and `resolveSettings` layers them once: an area's values key by key, the higher layer's over the lower's. What a
11
+ * module was made with (`economy({ workers })`) is under all of them, and what no layer says is the area's own default
12
+ * (`Economy`'s 8 workers). An area reads what it plays by from `ai.settings` and nothing else.
13
+ *
14
+ * The classic flags (`AiFlags`) are a section of their own, for a lobby and the editor's flags list: a flag that says what
15
+ * an area has a name for (Kite: `micro.kite`, Units Flee: `micro.unitsFlee`) is taken into that area in the layer that
16
+ * says it, so that a higher layer's word goes over it either way. A flag may be a function of the brain: worked out each
17
+ * think, as `ai.settings` is
18
+ */
19
+ import type { DefenceOptions } from './defence';
20
+ import type { EconomyOptions } from './economy';
21
+ import type { Brain } from './brain';
22
+ import type { LanesPlayOptions } from './lanes';
23
+ import type { MeleeArmyOptions } from './melee/goals';
24
+ import type { MeleeHeroesOptions } from './melee/heroes';
25
+ import type { MicroOptions } from './micro';
26
+ import type { PlansOptions } from './plans/plans';
27
+ import type { AiFlags } from './profiles';
28
+ import type { ScoutingOptions } from './scouting';
29
+ import type { SquadsOptions } from './squads';
30
+ import type { TeamOptions } from './team';
31
+ import type { WavesOptions } from './waves';
32
+ /**
33
+ * What a brain's areas play by, by area, each under its own names (see the file's comment): what every layer gives, from
34
+ * the brain's definition to the seat. Plain data where a lobby, a map or a save holds it; a function in it is code, not
35
+ * kept in a save
36
+ *
37
+ * @beta
38
+ */
39
+ export interface AiSettings {
40
+ /** The workers and the bases (`Economy`) */
41
+ economy?: EconomyOptions;
42
+ /** What it defends and how (`Defence`) */
43
+ defence?: DefenceOptions;
44
+ /** How often it looks and with whom (`Scouting`) */
45
+ scouting?: ScoutingOptions;
46
+ /** How its units fight (`Micro`) */
47
+ micro?: MicroOptions;
48
+ /** How its squads go, and the tasks they may be given (`Squads`) */
49
+ squads?: SquadsOptions;
50
+ /** How it plays with its team (`Team`) */
51
+ team?: TeamOptions;
52
+ /** The waves it was given (`Waves`) */
53
+ waves?: WavesOptions;
54
+ /** What it builds, trains and researches, and in what order (`Plans`) */
55
+ plans?: PlansOptions;
56
+ /** The melee army: when it attacks, how many go, how a wave goes (`melee.army`) */
57
+ army?: MeleeArmyOptions;
58
+ /** The melee player's heroes: how many, and from when (`melee.heroes`) */
59
+ heroes?: MeleeHeroesOptions;
60
+ /** A lanes brain's play (`lanes`) */
61
+ lanes?: LanesPlayOptions;
62
+ /** How much each goal weighs, by its id (1 when left out): the picker's (`Goals`) */
63
+ weights?: Record<string, number>;
64
+ /** The classic flags (see the file's comment) */
65
+ flags?: AiFlags;
66
+ }
67
+ /**
68
+ * The settings layered, lowest first (see the file's comment): each area's values key by key, a flag taken into the area
69
+ * it names in its own layer. A flag that is a function of the brain is asked of `ai`, and left out where none is given
70
+ *
71
+ * @beta
72
+ */
73
+ export declare function resolveSettings(layers: readonly (AiSettings | undefined)[], ai?: Brain): AiSettings;