@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,81 @@
1
+ import type { GamePack } from '#engine/packs/pack';
2
+ /** @beta */
3
+ export declare const DIRECTOR = "director";
4
+ /**
5
+ * The cinematic playing on each player's screen, by its id, as their screen said (`cinematicPlaying`): whose
6
+ * director's commands are taken
7
+ *
8
+ * @beta
9
+ */
10
+ export declare const directing: import("#engine/components").Component<Record<number, string>, Record<number, string>>;
11
+ /**
12
+ * The units a cinematic made invulnerable (`director` with `invulnerable`): nothing hurts or kills them until it says
13
+ * otherwise
14
+ *
15
+ * @beta
16
+ */
17
+ export declare const directorInvulnerable: import("#engine/components").Component<true, true>;
18
+ /**
19
+ * What a director's command does (`DirectorCommand.action`)
20
+ *
21
+ * @beta
22
+ */
23
+ export declare const DIRECTOR_ACTIONS: readonly ['spawn', 'remove', 'kill', 'teleport', 'scale', 'invulnerable', 'owner', 'order', 'facing'];
24
+ /** @beta */
25
+ export type DirectorAction = (typeof DIRECTOR_ACTIONS)[number];
26
+ /**
27
+ * The orders a director's command gives (`order`): to a spot, or at a unit
28
+ *
29
+ * @beta
30
+ */
31
+ export declare const DIRECTOR_ORDERS: readonly ['move', 'attack', 'attackMove', 'patrol', 'stop', 'hold'];
32
+ /**
33
+ * A player's screen says a cinematic began on it (`playing: true`, its id) or ended: while one plays there, the
34
+ * director's commands it sends are taken
35
+ *
36
+ * @beta
37
+ */
38
+ export declare const cinematicPlayingCommand: import("#engine/commands").DefinedCommand<"cinematicPlaying", {
39
+ cinematic: import("#engine/fields").Check<string>;
40
+ playing: import("#engine/fields").Check<boolean>;
41
+ }>;
42
+ /**
43
+ * What a game's director takes (`withDirector(options)`)
44
+ *
45
+ * @beta
46
+ */
47
+ export interface DirectorOptions {
48
+ /**
49
+ * The cinematics it plays in, by id: a screen that says another began is turned away (and counted), so that on a
50
+ * server a player's own client cannot direct a game with a cinematic made up. Any when left out
51
+ */
52
+ cinematics?: readonly string[];
53
+ }
54
+ /**
55
+ * A cinematic's say over the game (see the top of this file): `action` with what it takes. `unit` is the one it is
56
+ * done to (any player's); `spawn` puts one of `unitType` down for `owner` at `at`, turned to `facing`, named `name` for
57
+ * what comes after it in the cinematic (`world.named`)
58
+ *
59
+ * @beta
60
+ */
61
+ export declare const directorCommand: import("#engine/commands").DefinedCommand<"director", {
62
+ cinematic: import("#engine/fields").Check<string>;
63
+ action: import("#engine/fields").Check<"facing" | "invulnerable" | "kill" | "order" | "owner" | "remove" | "scale" | "spawn" | "teleport">;
64
+ unit: import("#engine/fields").Check<number | undefined>;
65
+ unitType: import("#engine/fields").Check<string | undefined>;
66
+ owner: import("#engine/fields").Check<number | undefined>;
67
+ at: import("#engine/fields").Check<import("../..").Vec2 | undefined>;
68
+ facing: import("#engine/fields").Check<number | undefined>;
69
+ scale: import("#engine/fields").Check<number | undefined>;
70
+ on: import("#engine/fields").Check<boolean | undefined>;
71
+ name: import("#engine/fields").Check<string | undefined>;
72
+ order: import("#engine/fields").Check<"attack" | "attackMove" | "hold" | "move" | "patrol" | "stop" | undefined>;
73
+ target: import("#engine/fields").Check<number | undefined>;
74
+ }>;
75
+ /**
76
+ * The director's pack (see the top of this file): its commands, what it keeps, and what keeps a unit it made
77
+ * invulnerable so. `packs: [withDirector()]`, or `withDirector({ cinematics: ['intro'] })` for those alone
78
+ *
79
+ * @beta
80
+ */
81
+ export declare function withDirector(options?: DirectorOptions): GamePack;
@@ -0,0 +1,137 @@
1
+ import { type HeroItem, type HeroRecord } from './carry';
2
+ import type { Entity, PlayerId } from '#engine/entity';
3
+ import type { Vec2 } from '#engine/math';
4
+ import type { Purse } from '#engine/player';
5
+ import { type VeterancyState } from '#engine/veterancy';
6
+ import type { World } from '#engine/world';
7
+ /**
8
+ * How a mission of a campaign went, the last time it was won
9
+ *
10
+ * @beta
11
+ */
12
+ export interface MissionResult {
13
+ /** How long it took, in seconds of the game */
14
+ seconds: number;
15
+ /** The shortest it ever took */
16
+ best: number;
17
+ /** When it was won, in milliseconds since 1970 */
18
+ finished: number;
19
+ }
20
+ /**
21
+ * How far a campaign has got, as plain data to keep between games: the mission it is at, the missions won and how
22
+ * long each took, the heroes carried out of the last one won, and the game's own state of it (`data`, of the type
23
+ * `D` the campaign says: choices made, gold saved up, the units that go on; what each mission won carries, merged in).
24
+ * It says which format it is in, so that what was kept is read again when the format changes
25
+ *
26
+ * @beta
27
+ */
28
+ export interface CampaignProgress<D extends object = Record<string, unknown>> {
29
+ format: number;
30
+ /** The campaign it is of, by id */
31
+ campaign: string;
32
+ /** The mission to play next */
33
+ at: string;
34
+ /** The difficulty chosen for it (`CampaignDef.difficulties`), by name: its missions' computers play on it */
35
+ difficulty?: string;
36
+ /** Missions won, by id */
37
+ done: Record<string, MissionResult>;
38
+ /** The heroes carried into the next mission */
39
+ heroes: HeroRecord[];
40
+ /** The game's own, plain data: what the missions won carried (`MissionDef.carry`), each mission's keys over the ones before */
41
+ data: Partial<D>;
42
+ }
43
+ /**
44
+ * A campaign as it is before anything is played: at its first mission, with nothing carried
45
+ *
46
+ * @beta
47
+ */
48
+ export declare function newCampaignProgress<D extends object = Record<string, unknown>>(campaign: string, first: string): CampaignProgress<D>;
49
+ /**
50
+ * Progress as it was kept, checked and brought up to date. Throws on what is wrong
51
+ *
52
+ * @beta
53
+ */
54
+ export declare function readCampaignProgress(data: unknown): CampaignProgress;
55
+ /**
56
+ * A mission won: how long it took, the best time kept, the heroes it ends with to carry on, the campaign at the
57
+ * mission after it (`next`), or still at this one when it was the last, and what it carries of the game's own
58
+ * (`data`: its keys over the ones kept, the rest kept as they were). A new progress: the one given is left as it was
59
+ *
60
+ * @beta
61
+ */
62
+ export declare function missionWon<D extends object = Record<string, unknown>>(progress: CampaignProgress<D>, mission: string, seconds: number, heroes: HeroRecord[], next?: string, data?: Partial<D>): CampaignProgress<D>;
63
+ /**
64
+ * A unit as plain data, to take from one mission into the next (`carryUnits`, `placeUnits`): what it is, the name the
65
+ * rules knew it by, how much of its health it has (a share, 0 to 1), its veterancy (`withVeterancy`) and its items
66
+ * slot by slot. Not where it is: the next mission says where they come in. Heroes are carried as heroes (`carryOut`)
67
+ *
68
+ * @beta
69
+ */
70
+ export interface UnitRecord {
71
+ /** Its unit type */
72
+ type: string;
73
+ /** The name it was known by in the rules (`world.named`), when it had one */
74
+ name?: string;
75
+ /** Its health, a share of the most it has: 1 for whole */
76
+ health: number;
77
+ /** Its experience and rank, where it has earned some (`withVeterancy`) */
78
+ veterancy?: VeterancyState;
79
+ /** Its inventory slot by slot, where it has one: null for an empty slot */
80
+ items?: (HeroItem | null)[];
81
+ }
82
+ /**
83
+ * A player's units as records to carry on (`UnitRecord`): those alive, not structures, not heroes (`carryOut` carries
84
+ * those), and of them what `filter` keeps (the footmen, the three nearest the gate). In the order of their ids
85
+ *
86
+ * @beta
87
+ */
88
+ export declare function carryUnits(world: World, player: PlayerId, filter?: (unit: Entity) => boolean): UnitRecord[];
89
+ /**
90
+ * Brings carried units into a mission for a player, round a point (`spread` apart, in rings: 1.5 when left out), each
91
+ * with its name, its share of health, its veterancy and its items. What the game no longer has, a type or an item, is
92
+ * left out. The units made, in the order of the records
93
+ *
94
+ * @beta
95
+ */
96
+ export declare function placeUnits(world: World, player: PlayerId, records: readonly UnitRecord[], at: Vec2, spread?: number): Entity[];
97
+ /**
98
+ * What a player has researched, to carry on (`giveResearch`): each upgrade's level, by its id
99
+ *
100
+ * @beta
101
+ */
102
+ export declare function carryResearch(world: World, player: PlayerId): Record<string, number>;
103
+ /**
104
+ * Gives a player research carried in (`carryResearch`): each upgrade up to its level, never down, no further than it
105
+ * goes, and what it does besides stats (`UpgradeDef.apply`) to the units the player has, as research finishing does.
106
+ * What the game no longer has is left out
107
+ *
108
+ * @beta
109
+ */
110
+ export declare function giveResearch(world: World, player: PlayerId, research: Readonly<Record<string, number>>): void;
111
+ /**
112
+ * What a player has of each resource, to carry on (`giveResources`): a copy, all of it, or of the kinds named
113
+ *
114
+ * @beta
115
+ */
116
+ export declare function carryResources(world: World, player: PlayerId, kinds?: readonly string[]): Purse;
117
+ /**
118
+ * Gives a player resources carried in (`carryResources`), on top of what the mission starts it with. What the game no
119
+ * longer has is left out
120
+ *
121
+ * @beta
122
+ */
123
+ export declare function giveResources(world: World, player: PlayerId, resources: Readonly<Purse>): void;
124
+ /**
125
+ * The heroes of a player as records to carry on (see `heroRecord`): fallen ones too, as a campaign brings them back
126
+ *
127
+ * @beta
128
+ */
129
+ export declare function carryOut(world: World, player: PlayerId): HeroRecord[];
130
+ /**
131
+ * Brings carried heroes into a mission for a player. Each takes the place of the hero the map has for it: the one of
132
+ * that player under the same name, else one of that player of the same type; a hero the map has none for is made at
133
+ * `at`. The heroes, in the order of the records
134
+ *
135
+ * @beta
136
+ */
137
+ export declare function carryIn(world: World, heroes: readonly HeroRecord[], player: PlayerId, at: Vec2): Entity[];
@@ -0,0 +1,59 @@
1
+ import type { Entity, PlayerId } from '#engine/entity';
2
+ import type { Vec2 } from '#engine/math';
3
+ import type { SpawnOptions, World } from '#engine/world';
4
+ /**
5
+ * An item a hero carries, as it is carried over: what it is, its uses left, the game's own state of it
6
+ *
7
+ * @beta
8
+ */
9
+ export interface HeroItem {
10
+ item: string;
11
+ charges: number;
12
+ data?: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * A hero as plain data, to take from one world into another: a campaign's hero going on to the next mission with all
16
+ * it has earned. Its level and experience, the points it has not spent, the abilities it learned and how far, and its
17
+ * items slot by slot. Not where it is or how hurt: the next mission puts it where it starts, whole
18
+ *
19
+ * @beta
20
+ */
21
+ export interface HeroRecord {
22
+ /** Its unit type */
23
+ type: string;
24
+ /** The name it was known by in the rules (`world.named`), when it had one */
25
+ name?: string;
26
+ level: number;
27
+ xp: number;
28
+ points: number;
29
+ /** Learned abilities and their level. Ones not learned are left out */
30
+ abilities: Record<string, number>;
31
+ /** Its inventory slot by slot: null for an empty slot */
32
+ items: (HeroItem | null)[];
33
+ }
34
+ /**
35
+ * A hero of a world as a record, to carry into another (see `applyHeroRecord`). Throws for what is no hero
36
+ *
37
+ * @beta
38
+ */
39
+ export declare function heroRecord(world: World, hero: Entity): HeroRecord;
40
+ /**
41
+ * Makes a hero of a world what a record says it was: its level, experience and points, its abilities as far as they
42
+ * were learned, and its items in their slots. In place of what it had. What the game no longer has, an ability or an
43
+ * item, is left out. Whole: health and mana full, nothing cooling down
44
+ *
45
+ * @beta
46
+ */
47
+ export declare function applyHeroRecord(world: World, hero: Entity, record: HeroRecord): void;
48
+ /**
49
+ * A hero made from a record (see `heroRecord`) for a player at a point, under the name it had unless told another
50
+ *
51
+ * @beta
52
+ */
53
+ export declare function heroFromRecord(world: World, record: HeroRecord, owner: PlayerId, at: Vec2, options?: SpawnOptions): Entity;
54
+ /**
55
+ * A record read back from what was kept (a campaign's progress, a file), checked. Throws on what is wrong
56
+ *
57
+ * @beta
58
+ */
59
+ export declare function readHeroRecord(data: unknown): HeroRecord;
@@ -0,0 +1,6 @@
1
+ declare module '#engine/commands' {
2
+ interface Commands {
3
+ heroes: (typeof heroCommands)[number];
4
+ }
5
+ }
6
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Entity, PlayerId } from '#engine/entity';
2
+ import type { World } from '#engine/world';
3
+ /**
4
+ * Hires a unit at a place that hires for a player: a tavern's hero, a dock's boat. Paid for, and made next to the
5
+ * place, a boat on the water nearest it. The unit, or nothing with the player told why
6
+ *
7
+ * @beta
8
+ */
9
+ export declare function hire(world: World, shop: Entity, unit: string, player: PlayerId): Entity | undefined;
@@ -0,0 +1,12 @@
1
+ import { type HeroesPack, type HeroRules } from '#engine/hero';
2
+ /**
3
+ * The heroes pack: what makes a game a classic hero RTS, opted into (`GameModule.packs: [withHeroes()]`). Heroes, with
4
+ * their experience, levels, points and abilities to learn, brought back at an altar (`revive`); creeps' camps that guard
5
+ * their ground, sleep at night and come back (`Camp.respawn`); shops that sell (`buy`, `sell`) and places that hire
6
+ * (`hire`). `rules` change its numbers (`HeroRules`: how many heroes, the experience a level takes), the classic RTS numbers for
7
+ * those left out. A game without it pays nothing for any of it: no hero is made of a hero's type, no command of these
8
+ * is taken, no camp is looked at
9
+ *
10
+ * @beta
11
+ */
12
+ export declare function withHeroes(rules?: Partial<HeroRules>): HeroesPack;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * What the heroes pack does as heroes are made and as things die: a hero of a hero's type made one, and the
3
+ * experience of a kill shared out (the pack's `made` and `death` handlers)
4
+ */
5
+ import type { Entity } from '#engine/entity';
6
+ import type { World } from '#engine/world';
7
+ /**
8
+ * Makes a unit just made a hero, as its type says (`UnitTypeDef.hero`): level 1, a point to spend, the abilities it can
9
+ * learn (none learned) and the spells it starts with, those it has not got already. What `World.spawn` does for a
10
+ * hero's type, and `morph` for what becomes one
11
+ *
12
+ * @beta
13
+ */
14
+ export declare function makeHero(world: World, entity: Entity): void;
15
+ /** Shares the experience for a kill between the heroes of the killer's side that were around */
16
+ export declare function awardKill(world: World, dead: Entity, killer: Entity | undefined): void;
@@ -0,0 +1,42 @@
1
+ import type { AbilityDef } from '#engine/defs';
2
+ import type { GamePack } from '#engine/packs/pack';
3
+ import type { Entity } from '#engine/entity';
4
+ import type { Vec2 } from '#engine/math';
5
+ import type { World } from '#engine/world';
6
+ /**
7
+ * What a game's heroes do once fallen (`withRespawn`)
8
+ *
9
+ * @beta
10
+ */
11
+ export interface RespawnOptions {
12
+ /** Seconds a fallen hero waits to come back: 4 and 2 more a level when left out (6 at level 1, 24 at level 10) */
13
+ time?: (world: World, hero: Entity) => number;
14
+ /** Where it comes back: its side's home (`homeOf`) when left out, where it fell when there is none */
15
+ at?: (world: World, hero: Entity) => Vec2 | undefined;
16
+ /** Which heroes come back by themselves: all of them when left out */
17
+ heroes?: (world: World, hero: Entity) => boolean;
18
+ }
19
+ /**
20
+ * A game whose heroes come back by themselves after a while, at their side's home (see `RespawnOptions`): a saved timer
21
+ * each, shown on the HUD as a revive is, and waited for by the computer player in place of reviving at an altar.
22
+ * Revived at an altar in the meantime, it is back then, and the timer comes to nothing. For a game with the heroes pack
23
+ * on (`withHeroes()`): one without it is refused
24
+ *
25
+ * @beta
26
+ */
27
+ export declare function withRespawn(options?: RespawnOptions): GamePack;
28
+ /**
29
+ * Recall (features-plan F2): a hero stands and channels for a few seconds, then is at its side's home (`homeOf`),
30
+ * however far; hurt in the meantime, or told to do something else, and it stays where it is. An ability to give heroes
31
+ * (`UnitTypeDef.abilities`), made of the engine's parts: a channel (`AbilityDef.channel`) that `breaksOnDamage`, and the
32
+ * `teleport` effect when it is `finished`. Its id, name, how long it takes, its cooldown and key are the game's to say
33
+ *
34
+ * @beta
35
+ */
36
+ export declare function recallAbility(options?: {
37
+ id?: string;
38
+ name?: string;
39
+ duration?: number;
40
+ cooldown?: number;
41
+ hotkey?: string;
42
+ }): AbilityDef;
@@ -0,0 +1,34 @@
1
+ import type { DamageType, Stats } from '#engine/defs';
2
+ import type { GamePack } from '#engine/packs/pack';
3
+ /**
4
+ * The MOBA stats pack's id
5
+ *
6
+ * @beta
7
+ */
8
+ export declare const MOBA_STATS = "core.mobaStats";
9
+ /**
10
+ * What the MOBA stats pack is made with (`withMobaStats`)
11
+ *
12
+ * @beta
13
+ */
14
+ export interface MobaStatsOptions {
15
+ /** What a critical strike multiplies the damage by, for units that do not say: 1.75 when left out */
16
+ critDamage?: number;
17
+ /** Tenacity no unit goes past: what is left of a stun or a slow at the very least. 0.9 when left out */
18
+ maxTenacity?: number;
19
+ }
20
+ /**
21
+ * What is left of damage once the target's armor or magic resist, less what the source's penetration ignores, had its
22
+ * say: the pack's `rules.combat.mitigation`
23
+ *
24
+ * @beta
25
+ */
26
+ export declare function penetratingMitigation(type: DamageType, target: Readonly<Stats>, source?: Readonly<Stats>): number;
27
+ /**
28
+ * The stats of a MOBA, for a game that has them: ability power (what `scaling: { abilityPower }` reads), critical
29
+ * strikes, armor and magic penetration, life steal and omnivamp, tenacity, slow resistance, heal and shield power,
30
+ * ability haste, with the hero arena games' formulas for each. A game without it has none of these stats
31
+ *
32
+ * @beta
33
+ */
34
+ export declare function withMobaStats(options?: MobaStatsOptions): GamePack;
@@ -0,0 +1,84 @@
1
+ import type { EffectKind } from '#engine/abilities/effects';
2
+ import type { CommandDef } from '#engine/commands';
3
+ import type { Component } from '#engine/components';
4
+ import type { ListenerDef } from '#engine/events';
5
+ import type { HookDef } from '#engine/hooks';
6
+ import type { OrderBehavior, SystemDef } from '#engine/registry';
7
+ import type { StatPart } from '#engine/stats';
8
+ import type { StatDef } from '#engine/defs';
9
+ import type { EventKey } from '#engine/events';
10
+ import type { ReplicatedEvent, SnapshotPart } from '#engine/replication';
11
+ import type { PlayerId } from '#engine/entity';
12
+ import type { GameMap } from '#engine/map';
13
+ import type { MapProblem } from '#engine/mapFields';
14
+ import type { Registry } from '#engine/registry';
15
+ import type { GameRules, RulesInit } from '#engine/rules';
16
+ import type { World } from '#engine/world';
17
+ import type { TimerDef } from '#engine/timers';
18
+ /**
19
+ * A part of the rules a game opts into (`GameModule.packs`): commands, orders, systems, hooks and the state it keeps,
20
+ * which a game without it pays nothing for. The engine's heroes, camps and shops are one (`withHeroes`). A game's
21
+ * own lists come after a pack's, so a command, an order, a hook or a system of the same id or name takes its place;
22
+ * `withoutCommands`, `withoutOrders`, `withoutSystems` and `withoutHooks` take one of a pack's out as they do the
23
+ * engine's
24
+ *
25
+ * @beta
26
+ */
27
+ export interface GamePack {
28
+ /** Unique among a game's packs: how a game, a mod or the editor asks whether it is on (`hasPack`) */
29
+ id: string;
30
+ /** Commands it takes, beside the engine's (`defineCommand`) */
31
+ commands?: CommandDef[];
32
+ /** Orders its units can be given, beside the engine's */
33
+ orders?: OrderBehavior[];
34
+ /** Systems, run with the engine's in the phase each says (see `System`) */
35
+ systems?: SystemDef[];
36
+ /** Its handlers of hooks, after the engine's and before the game's (`defineHook`) */
37
+ hooks?: HookDef[];
38
+ /** Kinds of ability effects it brings (`defineEffect`), beside the engine's: one of the game's of the same type takes its place */
39
+ effects?: EffectKind[];
40
+ /** How it reacts to events (`defineListener`) */
41
+ listeners?: ListenerDef[];
42
+ /** The state it keeps on entities, players and the world (`defineComponent`) */
43
+ components?: Component<any>[];
44
+ /** What it sets to go off later (`defineTimer`): listed, so that a save finds them by id */
45
+ timers?: TimerDef[];
46
+ /** The stats it brings, next to the engine's and the game's own (`StatDef`, as `GameModule.stats`) */
47
+ stats?: StatDef[];
48
+ /** What it adds to a unit's stats, kept up to date as the engine keeps the rest (`StatPart`) */
49
+ statParts?: StatPart[];
50
+ /** The events it tells of (`defineEvent`), listed as a game's are */
51
+ events?: EventKey<any>[];
52
+ /** How events of the world of its own are told to the players (`replicateEvent`), after the engine's */
53
+ replications?: ReplicatedEvent[];
54
+ /** Parts of the players' snapshots of its own (`SnapshotPart`), after the engine's */
55
+ snapshotParts?: SnapshotPart[];
56
+ /** What it adds to the game's report of a player at the end (`GameModule.report`), beside the game's own */
57
+ report?(world: World, player: PlayerId): Record<string, unknown>;
58
+ /** How a game with it is won, where the game says nothing of its own (`GameModule.victory`): the last pack's that says */
59
+ victory?: SystemDef | null;
60
+ /**
61
+ * The rules it changes: handed the game's as they come out (the engine's, the game's over them, the packs' before it),
62
+ * it gives what it lays over them. A function of them, so that what it says can be made of what was there (the lanes'
63
+ * supply: none for a minion, the game's own for the rest)
64
+ */
65
+ rules?(rules: Readonly<GameRules>): RulesInit;
66
+ /** What it finds wrong with a map in the editor, beside what the game finds (`MapEditorDef.check`) */
67
+ check?(map: GameMap, registry: Registry): MapProblem[];
68
+ /** The packs it is made to go with, by id: a game with it and without one of them is refused */
69
+ requires?: string[];
70
+ /**
71
+ * What it was made with, as plain data: what a game's hash names it by, beside its id (`gameHash`), so that one pack
72
+ * made two ways is two games
73
+ */
74
+ options?: unknown;
75
+ }
76
+ /**
77
+ * Whether a game has a pack on, by its id: `hasPack(game, HEROES)`, what the editor asks before it shows a hero's
78
+ * fields
79
+ *
80
+ * @beta
81
+ */
82
+ export declare function hasPack(game: {
83
+ packs?: readonly GamePack[];
84
+ } | null | undefined, id: string): boolean;