@v12-engine/engine 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (951) hide show
  1. package/dist/abilities/amounts.d.ts +28 -0
  2. package/dist/abilities/amounts.js +74 -0
  3. package/dist/abilities/amounts.js.map +1 -0
  4. package/dist/abilities/buffs.d.ts +106 -6
  5. package/dist/abilities/buffs.js +443 -0
  6. package/dist/abilities/buffs.js.map +1 -0
  7. package/dist/abilities/castTold.d.ts +2 -0
  8. package/dist/abilities/castTold.js +66 -0
  9. package/dist/abilities/castTold.js.map +1 -0
  10. package/dist/abilities/chance.d.ts +38 -0
  11. package/dist/abilities/chance.js +77 -0
  12. package/dist/abilities/chance.js.map +1 -0
  13. package/dist/abilities/charges.d.ts +18 -0
  14. package/dist/abilities/charges.js +101 -0
  15. package/dist/abilities/charges.js.map +1 -0
  16. package/dist/abilities/control.d.ts +28 -0
  17. package/dist/abilities/control.js +113 -0
  18. package/dist/abilities/control.js.map +1 -0
  19. package/dist/abilities/dispel.js +51 -0
  20. package/dist/abilities/dispel.js.map +1 -0
  21. package/dist/abilities/effectFields.d.ts +1 -1
  22. package/dist/abilities/effectFields.js +676 -0
  23. package/dist/abilities/effectFields.js.map +1 -0
  24. package/dist/abilities/effectIndex.d.ts +27 -0
  25. package/dist/abilities/effectIndex.js +64 -0
  26. package/dist/abilities/effectIndex.js.map +1 -0
  27. package/dist/abilities/effects/buff.d.ts +9 -3
  28. package/dist/abilities/effects/buff.js +84 -0
  29. package/dist/abilities/effects/buff.js.map +1 -0
  30. package/dist/abilities/effects/conditions.d.ts +2 -0
  31. package/dist/abilities/effects/conditions.js +41 -0
  32. package/dist/abilities/effects/conditions.js.map +1 -0
  33. package/dist/abilities/effects/core.js +54 -0
  34. package/dist/abilities/effects/core.js.map +1 -0
  35. package/dist/abilities/effects/damage.d.ts +1 -1
  36. package/dist/abilities/effects/damage.js +43 -0
  37. package/dist/abilities/effects/damage.js.map +1 -0
  38. package/dist/abilities/effects/heal.d.ts +2 -2
  39. package/dist/abilities/effects/heal.js +51 -0
  40. package/dist/abilities/effects/heal.js.map +1 -0
  41. package/dist/abilities/effects/missile.d.ts +13 -1
  42. package/dist/abilities/effects/missile.js +104 -0
  43. package/dist/abilities/effects/missile.js.map +1 -0
  44. package/dist/abilities/effects/morph.d.ts +5 -0
  45. package/dist/abilities/effects/morph.js +43 -0
  46. package/dist/abilities/effects/morph.js.map +1 -0
  47. package/dist/abilities/effects/moves.d.ts +16 -4
  48. package/dist/abilities/effects/moves.js +212 -0
  49. package/dist/abilities/effects/moves.js.map +1 -0
  50. package/dist/abilities/effects/passives.d.ts +19 -9
  51. package/dist/abilities/effects/passives.js +131 -0
  52. package/dist/abilities/effects/passives.js.map +1 -0
  53. package/dist/abilities/effects/proxy.d.ts +5 -0
  54. package/dist/abilities/effects/proxy.js +60 -0
  55. package/dist/abilities/effects/proxy.js.map +1 -0
  56. package/dist/abilities/effects/sight.d.ts +2 -2
  57. package/dist/abilities/effects/sight.js +39 -0
  58. package/dist/abilities/effects/sight.js.map +1 -0
  59. package/dist/abilities/effects/spawn.d.ts +5 -2
  60. package/dist/abilities/effects/spawn.js +40 -0
  61. package/dist/abilities/effects/spawn.js.map +1 -0
  62. package/dist/abilities/effects/timed.d.ts +2 -2
  63. package/dist/abilities/effects/timed.js +96 -0
  64. package/dist/abilities/effects/timed.js.map +1 -0
  65. package/dist/abilities/effects/trade.d.ts +1 -1
  66. package/dist/abilities/effects/trade.js +25 -0
  67. package/dist/abilities/effects/trade.js.map +1 -0
  68. package/dist/abilities/effects.d.ts +97 -23
  69. package/dist/abilities/effects.js +860 -0
  70. package/dist/abilities/effects.js.map +1 -0
  71. package/dist/abilities/land.d.ts +38 -4
  72. package/dist/abilities/land.js +189 -0
  73. package/dist/abilities/land.js.map +1 -0
  74. package/dist/abilities/recast.d.ts +45 -0
  75. package/dist/abilities/recast.js +118 -0
  76. package/dist/abilities/recast.js.map +1 -0
  77. package/dist/abilities/scaled.js +40 -0
  78. package/dist/abilities/scaled.js.map +1 -0
  79. package/dist/abilities/screen.d.ts +6 -0
  80. package/dist/abilities/screen.js +83 -0
  81. package/dist/abilities/screen.js.map +1 -0
  82. package/dist/abilities/shapes.d.ts +66 -0
  83. package/dist/abilities/shapes.js +122 -0
  84. package/dist/abilities/shapes.js.map +1 -0
  85. package/dist/abilities/text.d.ts +14 -2
  86. package/dist/abilities/text.js +204 -0
  87. package/dist/abilities/text.js.map +1 -0
  88. package/dist/abilities/triggers.d.ts +98 -0
  89. package/dist/abilities/triggers.js +351 -0
  90. package/dist/abilities/triggers.js.map +1 -0
  91. package/dist/abilityChanges.d.ts +131 -0
  92. package/dist/abilityChanges.js +345 -0
  93. package/dist/abilityChanges.js.map +1 -0
  94. package/dist/ai/area.d.ts +4 -1
  95. package/dist/ai/brain.d.ts +4 -1
  96. package/dist/ai/brain.js +844 -0
  97. package/dist/ai/brain.js.map +1 -0
  98. package/dist/ai/budget.js +74 -0
  99. package/dist/ai/budget.js.map +1 -0
  100. package/dist/ai/checks.d.ts +9 -1
  101. package/dist/ai/checks.js +242 -0
  102. package/dist/ai/checks.js.map +1 -0
  103. package/dist/ai/computer.d.ts +11 -4
  104. package/dist/ai/computer.js +251 -0
  105. package/dist/ai/computer.js.map +1 -0
  106. package/dist/ai/defence.d.ts +4 -0
  107. package/dist/ai/defence.js +430 -0
  108. package/dist/ai/defence.js.map +1 -0
  109. package/dist/ai/define.d.ts +3 -2
  110. package/dist/ai/define.js +31 -0
  111. package/dist/ai/define.js.map +1 -0
  112. package/dist/ai/economy.d.ts +10 -7
  113. package/dist/ai/economy.js +780 -0
  114. package/dist/ai/economy.js.map +1 -0
  115. package/dist/ai/geometry.js +38 -0
  116. package/dist/ai/geometry.js.map +1 -0
  117. package/dist/ai/goals.d.ts +1 -0
  118. package/dist/ai/goals.js +560 -0
  119. package/dist/ai/goals.js.map +1 -0
  120. package/dist/ai/knowledge.d.ts +72 -7
  121. package/dist/ai/knowledge.js +804 -0
  122. package/dist/ai/knowledge.js.map +1 -0
  123. package/dist/ai/lanes.d.ts +10 -2
  124. package/dist/ai/lanes.js +715 -0
  125. package/dist/ai/lanes.js.map +1 -0
  126. package/dist/ai/melee/build.js +264 -0
  127. package/dist/ai/melee/build.js.map +1 -0
  128. package/dist/ai/melee/goals.d.ts +7 -0
  129. package/dist/ai/melee/goals.js +720 -0
  130. package/dist/ai/melee/goals.js.map +1 -0
  131. package/dist/ai/melee/heroes.js +68 -0
  132. package/dist/ai/melee/heroes.js.map +1 -0
  133. package/dist/ai/melee/index.d.ts +1 -1
  134. package/dist/ai/melee/index.js +51 -0
  135. package/dist/ai/melee/index.js.map +1 -0
  136. package/dist/ai/melee/production.js +29 -0
  137. package/dist/ai/melee/production.js.map +1 -0
  138. package/dist/ai/melee/surrender.js +64 -0
  139. package/dist/ai/melee/surrender.js.map +1 -0
  140. package/dist/ai/micro.d.ts +9 -0
  141. package/dist/ai/micro.js +1316 -0
  142. package/dist/ai/micro.js.map +1 -0
  143. package/dist/ai/mission.d.ts +9 -2
  144. package/dist/ai/mission.js +538 -0
  145. package/dist/ai/mission.js.map +1 -0
  146. package/dist/ai/missionRules.d.ts +1 -1
  147. package/dist/ai/missionRules.js +26 -0
  148. package/dist/ai/missionRules.js.map +1 -0
  149. package/dist/ai/module.d.ts +6 -2
  150. package/dist/ai/module.js +37 -0
  151. package/dist/ai/module.js.map +1 -0
  152. package/dist/ai/options.d.ts +3 -3
  153. package/dist/ai/plans/build.d.ts +20 -1
  154. package/dist/ai/plans/build.js +608 -0
  155. package/dist/ai/plans/build.js.map +1 -0
  156. package/dist/ai/plans/placement.d.ts +4 -1
  157. package/dist/ai/plans/placement.js +295 -0
  158. package/dist/ai/plans/placement.js.map +1 -0
  159. package/dist/ai/plans/plans.d.ts +9 -0
  160. package/dist/ai/plans/plans.js +110 -0
  161. package/dist/ai/plans/plans.js.map +1 -0
  162. package/dist/ai/plans/production.d.ts +14 -2
  163. package/dist/ai/plans/production.js +434 -0
  164. package/dist/ai/plans/production.js.map +1 -0
  165. package/dist/ai/plans/purse.d.ts +6 -3
  166. package/dist/ai/plans/purse.js +139 -0
  167. package/dist/ai/plans/purse.js.map +1 -0
  168. package/dist/ai/plans/tech.d.ts +6 -0
  169. package/dist/ai/plans/tech.js +122 -0
  170. package/dist/ai/plans/tech.js.map +1 -0
  171. package/dist/ai/profiles.d.ts +4 -4
  172. package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
  173. package/dist/ai/profiles.js.map +1 -0
  174. package/dist/ai/reach.js +54 -0
  175. package/dist/ai/reach.js.map +1 -0
  176. package/dist/ai/report.d.ts +8 -0
  177. package/dist/ai/report.js +87 -0
  178. package/dist/ai/report.js.map +1 -0
  179. package/dist/ai/roles.d.ts +4 -0
  180. package/dist/ai/roles.js +207 -0
  181. package/dist/ai/roles.js.map +1 -0
  182. package/dist/ai/rules.d.ts +8 -2
  183. package/dist/ai/rules.js +416 -0
  184. package/dist/ai/rules.js.map +1 -0
  185. package/dist/ai/scouting.d.ts +6 -0
  186. package/dist/ai/scouting.js +324 -0
  187. package/dist/ai/scouting.js.map +1 -0
  188. package/dist/ai/settings.js +99 -0
  189. package/dist/ai/settings.js.map +1 -0
  190. package/dist/ai/squads.d.ts +21 -2
  191. package/dist/ai/squads.js +916 -0
  192. package/dist/ai/squads.js.map +1 -0
  193. package/dist/ai/strength.js +320 -0
  194. package/dist/ai/strength.js.map +1 -0
  195. package/dist/ai/task.d.ts +3 -1
  196. package/dist/ai/task.js +17 -0
  197. package/dist/ai/task.js.map +1 -0
  198. package/dist/ai/tasks/attack.js +24 -0
  199. package/dist/ai/tasks/attack.js.map +1 -0
  200. package/dist/ai/tasks/capture.d.ts +3 -3
  201. package/dist/ai/tasks/capture.js +37 -0
  202. package/dist/ai/tasks/capture.js.map +1 -0
  203. package/dist/ai/tasks/creep.js +29 -0
  204. package/dist/ai/tasks/creep.js.map +1 -0
  205. package/dist/ai/tasks/defend.js +61 -0
  206. package/dist/ai/tasks/defend.js.map +1 -0
  207. package/dist/ai/tasks/drop.js +81 -0
  208. package/dist/ai/tasks/drop.js.map +1 -0
  209. package/dist/ai/tasks/escort.js +59 -0
  210. package/dist/ai/tasks/escort.js.map +1 -0
  211. package/dist/ai/tasks/gather.js +48 -0
  212. package/dist/ai/tasks/gather.js.map +1 -0
  213. package/dist/ai/tasks/harass.js +39 -0
  214. package/dist/ai/tasks/harass.js.map +1 -0
  215. package/dist/ai/tasks/hold.js +32 -0
  216. package/dist/ai/tasks/hold.js.map +1 -0
  217. package/dist/ai/tasks/index.js +34 -0
  218. package/dist/ai/tasks/index.js.map +1 -0
  219. package/dist/ai/tasks/move.js +26 -0
  220. package/dist/ai/tasks/move.js.map +1 -0
  221. package/dist/ai/tasks/patrol.js +59 -0
  222. package/dist/ai/tasks/patrol.js.map +1 -0
  223. package/dist/ai/tasks/retreat.js +28 -0
  224. package/dist/ai/tasks/retreat.js.map +1 -0
  225. package/dist/ai/tasks/scout.js +73 -0
  226. package/dist/ai/tasks/scout.js.map +1 -0
  227. package/dist/ai/tasks/shared.d.ts +1 -1
  228. package/dist/ai/tasks/shared.js +137 -0
  229. package/dist/ai/tasks/shared.js.map +1 -0
  230. package/dist/ai/team.d.ts +18 -1
  231. package/dist/ai/team.js +492 -0
  232. package/dist/ai/team.js.map +1 -0
  233. package/dist/ai/threat.d.ts +6 -0
  234. package/dist/ai/threat.js +206 -0
  235. package/dist/ai/threat.js.map +1 -0
  236. package/dist/ai/view.d.ts +21 -7
  237. package/dist/ai/view.js +677 -0
  238. package/dist/ai/view.js.map +1 -0
  239. package/dist/ai/waves.d.ts +6 -0
  240. package/dist/ai/waves.js +410 -0
  241. package/dist/ai/waves.js.map +1 -0
  242. package/dist/ai.js +54 -6239
  243. package/dist/aiTesting.d.ts +6 -3
  244. package/dist/aiTesting.js +229 -0
  245. package/dist/aiTesting.js.map +1 -0
  246. package/dist/areas.d.ts +4 -1
  247. package/dist/areas.js +295 -0
  248. package/dist/areas.js.map +1 -0
  249. package/dist/attacks.d.ts +3 -3
  250. package/dist/attacks.js +127 -0
  251. package/dist/attacks.js.map +1 -0
  252. package/dist/burning.d.ts +267 -0
  253. package/dist/burning.js +795 -0
  254. package/dist/burning.js.map +1 -0
  255. package/dist/bytes.js +21 -0
  256. package/dist/bytes.js.map +1 -0
  257. package/dist/callings.d.ts +71 -0
  258. package/dist/callings.js +157 -0
  259. package/dist/callings.js.map +1 -0
  260. package/dist/cameraOrders.d.ts +78 -0
  261. package/dist/cameraOrders.js +114 -0
  262. package/dist/cameraOrders.js.map +1 -0
  263. package/dist/camps.d.ts +70 -4
  264. package/dist/camps.js +501 -0
  265. package/dist/camps.js.map +1 -0
  266. package/dist/capture.d.ts +15 -3
  267. package/dist/capture.js +304 -0
  268. package/dist/capture.js.map +1 -0
  269. package/dist/cellLayers.d.ts +78 -13
  270. package/dist/cellLayers.js +275 -0
  271. package/dist/cellLayers.js.map +1 -0
  272. package/dist/cellPatches.d.ts +24 -0
  273. package/dist/cellPatches.js +73 -0
  274. package/dist/cellPatches.js.map +1 -0
  275. package/dist/cinematics.d.ts +10 -5
  276. package/dist/cinematics.js +161 -0
  277. package/dist/cinematics.js.map +1 -0
  278. package/dist/clock.d.ts +2 -2
  279. package/dist/clock.js +78 -0
  280. package/dist/clock.js.map +1 -0
  281. package/dist/commands.d.ts +36 -4
  282. package/dist/commands.js +636 -0
  283. package/dist/commands.js.map +1 -0
  284. package/dist/components.d.ts +31 -10
  285. package/dist/components.js +74 -0
  286. package/dist/components.js.map +1 -0
  287. package/dist/computers.d.ts +4 -4
  288. package/dist/computers.js +194 -0
  289. package/dist/computers.js.map +1 -0
  290. package/dist/concealment.d.ts +25 -2
  291. package/dist/concealment.js +409 -0
  292. package/dist/concealment.js.map +1 -0
  293. package/dist/coreComponents.js +130 -0
  294. package/dist/coreComponents.js.map +1 -0
  295. package/dist/createGame.d.ts +306 -0
  296. package/dist/createGame.js +405 -0
  297. package/dist/createGame.js.map +1 -0
  298. package/dist/dashing.d.ts +18 -2
  299. package/dist/dashing.js +41 -0
  300. package/dist/dashing.js.map +1 -0
  301. package/dist/debug.d.ts +8 -0
  302. package/dist/debug.js +5 -3
  303. package/dist/debug2.js +76 -0
  304. package/dist/debug2.js.map +1 -0
  305. package/dist/debugCommands.d.ts +6 -6
  306. package/dist/debugCommands.js +537 -0
  307. package/dist/debugCommands.js.map +1 -0
  308. package/dist/debugging.d.ts +1 -0
  309. package/dist/defaultSets.d.ts +183 -0
  310. package/dist/defaultSets.js +216 -0
  311. package/dist/defaultSets.js.map +1 -0
  312. package/dist/definitions.d.ts +6 -0
  313. package/dist/definitions.js +78 -0
  314. package/dist/definitions.js.map +1 -0
  315. package/dist/defs.d.ts +1895 -165
  316. package/dist/defs.js +380 -0
  317. package/dist/defs.js.map +1 -0
  318. package/dist/denying.d.ts +4 -4
  319. package/dist/denying.js +106 -0
  320. package/dist/denying.js.map +1 -0
  321. package/dist/destructibles.d.ts +2 -2
  322. package/dist/destructibles.js +36 -0
  323. package/dist/destructibles.js.map +1 -0
  324. package/dist/determinism.d.ts +4 -4
  325. package/dist/determinism.js +247 -0
  326. package/dist/determinism.js.map +1 -0
  327. package/dist/dialog.d.ts +17 -2
  328. package/dist/dialog.js +108 -0
  329. package/dist/dialog.js.map +1 -0
  330. package/dist/effectRefs.js +28 -0
  331. package/dist/effectRefs.js.map +1 -0
  332. package/dist/effects.d.ts +27 -11
  333. package/dist/effects.js +110 -0
  334. package/dist/effects.js.map +1 -0
  335. package/dist/endings.d.ts +1 -1
  336. package/dist/endings.js +78 -0
  337. package/dist/endings.js.map +1 -0
  338. package/dist/engagement.d.ts +40 -6
  339. package/dist/engagement.js +530 -0
  340. package/dist/engagement.js.map +1 -0
  341. package/dist/engineEvents.d.ts +72 -9
  342. package/dist/engineEvents.js +520 -0
  343. package/dist/engineEvents.js.map +1 -0
  344. package/dist/entity.d.ts +275 -26
  345. package/dist/entity.js +441 -0
  346. package/dist/entity.js.map +1 -0
  347. package/dist/entityIndex.d.ts +10 -3
  348. package/dist/entityIndex.js +149 -0
  349. package/dist/entityIndex.js.map +1 -0
  350. package/dist/errors.d.ts +6 -2
  351. package/dist/errors.js +59 -0
  352. package/dist/errors.js.map +1 -0
  353. package/dist/events.d.ts +11 -5
  354. package/dist/events.js +158 -0
  355. package/dist/events.js.map +1 -0
  356. package/dist/exactMath.js +273 -0
  357. package/dist/exactMath.js.map +1 -0
  358. package/dist/features.d.ts +1 -1
  359. package/dist/features.js +127 -0
  360. package/dist/features.js.map +1 -0
  361. package/dist/fields.d.ts +25 -5
  362. package/dist/fields.js +140 -0
  363. package/dist/fields.js.map +1 -0
  364. package/dist/fixture.d.ts +3 -3
  365. package/dist/fixture.js +512 -0
  366. package/dist/fixture.js.map +1 -0
  367. package/dist/fog.d.ts +26 -3
  368. package/dist/fog.js +333 -0
  369. package/dist/fog.js.map +1 -0
  370. package/dist/foliage.d.ts +476 -0
  371. package/dist/foliage.js +1478 -0
  372. package/dist/foliage.js.map +1 -0
  373. package/dist/foliageDebug.d.ts +57 -0
  374. package/dist/foliageDebug.js +172 -0
  375. package/dist/foliageDebug.js.map +1 -0
  376. package/dist/foliageRegrowth.d.ts +20 -0
  377. package/dist/foliageRegrowth.js +332 -0
  378. package/dist/foliageRegrowth.js.map +1 -0
  379. package/dist/formState.d.ts +67 -0
  380. package/dist/formState.js +65 -0
  381. package/dist/formState.js.map +1 -0
  382. package/dist/formation.d.ts +46 -8
  383. package/dist/formation.js +297 -0
  384. package/dist/formation.js.map +1 -0
  385. package/dist/forms.d.ts +58 -0
  386. package/dist/forms.js +146 -0
  387. package/dist/forms.js.map +1 -0
  388. package/dist/friendlyFire.d.ts +2 -2
  389. package/dist/friendlyFire.js +37 -0
  390. package/dist/friendlyFire.js.map +1 -0
  391. package/dist/game.d.ts +141 -48
  392. package/dist/game.js +834 -0
  393. package/dist/game.js.map +1 -0
  394. package/dist/gameData.d.ts +96 -22
  395. package/dist/gameData.js +1690 -0
  396. package/dist/gameData.js.map +1 -0
  397. package/dist/gameFiles.d.ts +3 -3
  398. package/dist/gameFiles.js +14 -0
  399. package/dist/gameFiles.js.map +1 -0
  400. package/dist/gates.js +92 -0
  401. package/dist/gates.js.map +1 -0
  402. package/dist/generate.d.ts +28 -1
  403. package/dist/generate.js +1062 -0
  404. package/dist/generate.js.map +1 -0
  405. package/dist/generateWorker.d.ts +7 -3
  406. package/dist/generateWorker.js +86 -0
  407. package/dist/generateWorker.js.map +1 -0
  408. package/dist/grid.d.ts +9 -0
  409. package/dist/grid.js +102 -0
  410. package/dist/grid.js.map +1 -0
  411. package/dist/ground.d.ts +17 -1
  412. package/dist/ground.js +375 -0
  413. package/dist/ground.js.map +1 -0
  414. package/dist/groundObjects.d.ts +70 -0
  415. package/dist/groundObjects.js +371 -0
  416. package/dist/groundObjects.js.map +1 -0
  417. package/dist/groundSpeed.d.ts +20 -3
  418. package/dist/groundSpeed.js +117 -0
  419. package/dist/groundSpeed.js.map +1 -0
  420. package/dist/hero.d.ts +126 -10
  421. package/dist/hero.js +432 -0
  422. package/dist/hero.js.map +1 -0
  423. package/dist/holds.d.ts +94 -0
  424. package/dist/holds.js +305 -0
  425. package/dist/holds.js.map +1 -0
  426. package/dist/home.d.ts +1 -1
  427. package/dist/home.js +30 -0
  428. package/dist/home.js.map +1 -0
  429. package/dist/hooks.d.ts +339 -57
  430. package/dist/hooks.js +105 -0
  431. package/dist/hooks.js.map +1 -0
  432. package/dist/hotReload.d.ts +6 -5
  433. package/dist/hotReload.js +145 -0
  434. package/dist/hotReload.js.map +1 -0
  435. package/dist/ids.d.ts +3 -3
  436. package/dist/ids.js +30 -0
  437. package/dist/ids.js.map +1 -0
  438. package/dist/idsFile.d.ts +36 -0
  439. package/dist/idsFile.js +134 -0
  440. package/dist/idsFile.js.map +1 -0
  441. package/dist/index.d.ts +105 -68
  442. package/dist/index.js +194 -4701
  443. package/dist/inspect.d.ts +29 -2
  444. package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
  445. package/dist/inspect.js.map +1 -0
  446. package/dist/inventory.d.ts +14 -1
  447. package/dist/inventory.js +84 -0
  448. package/dist/inventory.js.map +1 -0
  449. package/dist/items.d.ts +136 -8
  450. package/dist/items.js +585 -0
  451. package/dist/items.js.map +1 -0
  452. package/dist/lanes.d.ts +12 -3
  453. package/dist/lanes.js +496 -0
  454. package/dist/lanes.js.map +1 -0
  455. package/dist/life.d.ts +6 -2
  456. package/dist/life.js +287 -0
  457. package/dist/life.js.map +1 -0
  458. package/dist/log.d.ts +26 -3
  459. package/dist/log.js +192 -0
  460. package/dist/log.js.map +1 -0
  461. package/dist/manaBurn.d.ts +2 -2
  462. package/dist/manaBurn.js +75 -0
  463. package/dist/manaBurn.js.map +1 -0
  464. package/dist/map/file.d.ts +56 -3
  465. package/dist/map/file.js +264 -0
  466. package/dist/map/file.js.map +1 -0
  467. package/dist/map/images.js +61 -0
  468. package/dist/map/images.js.map +1 -0
  469. package/dist/map/look.d.ts +1 -1
  470. package/dist/map/look.js +30 -0
  471. package/dist/map/look.js.map +1 -0
  472. package/dist/map/pathProfile.js +183 -0
  473. package/dist/map/pathProfile.js.map +1 -0
  474. package/dist/map/resize.d.ts +4 -0
  475. package/dist/map/resize.js +136 -0
  476. package/dist/map/resize.js.map +1 -0
  477. package/dist/map/schema.js +257 -0
  478. package/dist/map/schema.js.map +1 -0
  479. package/dist/map/terrain.js +214 -0
  480. package/dist/map/terrain.js.map +1 -0
  481. package/dist/map/types.d.ts +92 -13
  482. package/dist/map/types.js +251 -0
  483. package/dist/map/types.js.map +1 -0
  484. package/dist/mapCheck/cells.js +94 -0
  485. package/dist/mapCheck/cells.js.map +1 -0
  486. package/dist/mapCheck/rules/foliage.d.ts +9 -0
  487. package/dist/mapCheck/rules/foliage.js +83 -0
  488. package/dist/mapCheck/rules/foliage.js.map +1 -0
  489. package/dist/mapCheck/rules/names.js +39 -0
  490. package/dist/mapCheck/rules/names.js.map +1 -0
  491. package/dist/mapCheck/rules/objects.d.ts +1 -1
  492. package/dist/mapCheck/rules/objects.js +56 -0
  493. package/dist/mapCheck/rules/objects.js.map +1 -0
  494. package/dist/mapCheck/rules/paths.js +32 -0
  495. package/dist/mapCheck/rules/paths.js.map +1 -0
  496. package/dist/mapCheck/rules/players.js +20 -0
  497. package/dist/mapCheck/rules/players.js.map +1 -0
  498. package/dist/mapCheck/rules/races.js +56 -0
  499. package/dist/mapCheck/rules/races.js.map +1 -0
  500. package/dist/mapCheck/rules/random.js +47 -0
  501. package/dist/mapCheck/rules/random.js.map +1 -0
  502. package/dist/mapCheck/rules/regions.js +30 -0
  503. package/dist/mapCheck/rules/regions.js.map +1 -0
  504. package/dist/mapCheck/rules/targets.js +31 -0
  505. package/dist/mapCheck/rules/targets.js.map +1 -0
  506. package/dist/mapCheck/rules/walking.js +45 -0
  507. package/dist/mapCheck/rules/walking.js.map +1 -0
  508. package/dist/mapCheck.d.ts +2 -2
  509. package/dist/mapCheck.js +63 -0
  510. package/dist/mapCheck.js.map +1 -0
  511. package/dist/mapFields.d.ts +25 -2
  512. package/dist/mapFields.js +134 -0
  513. package/dist/mapFields.js.map +1 -0
  514. package/dist/mapFile.js +176 -0
  515. package/dist/mapFile.js.map +1 -0
  516. package/dist/mapMeasure.d.ts +8 -0
  517. package/dist/mapMeasure.js +283 -0
  518. package/dist/mapMeasure.js.map +1 -0
  519. package/dist/mapMerge.d.ts +1 -0
  520. package/dist/mapMerge.js +172 -0
  521. package/dist/mapMerge.js.map +1 -0
  522. package/dist/mapObjectives.js +138 -0
  523. package/dist/mapObjectives.js.map +1 -0
  524. package/dist/mapObjects.js +80 -0
  525. package/dist/mapObjects.js.map +1 -0
  526. package/dist/math.d.ts +37 -7
  527. package/dist/math.js +155 -0
  528. package/dist/math.js.map +1 -0
  529. package/dist/messages.d.ts +71 -4
  530. package/dist/messages.js +29 -0
  531. package/dist/messages.js.map +1 -0
  532. package/dist/missionRules.d.ts +10 -2
  533. package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
  534. package/dist/missionRules.js.map +1 -0
  535. package/dist/mods.d.ts +39 -20
  536. package/dist/mods.js +271 -0
  537. package/dist/mods.js.map +1 -0
  538. package/dist/moves.d.ts +87 -0
  539. package/dist/moves.js +539 -0
  540. package/dist/moves.js.map +1 -0
  541. package/dist/names.d.ts +7 -0
  542. package/dist/names.js +122 -0
  543. package/dist/names.js.map +1 -0
  544. package/dist/navigation/agentParams.js +14 -0
  545. package/dist/navigation/agentParams.js.map +1 -0
  546. package/dist/navigation/air.d.ts +7 -3
  547. package/dist/navigation/air.js +401 -0
  548. package/dist/navigation/air.js.map +1 -0
  549. package/dist/navigation/builds.d.ts +34 -2
  550. package/dist/navigation/builds.js +287 -0
  551. package/dist/navigation/builds.js.map +1 -0
  552. package/dist/navigation/groundAreas.d.ts +59 -1
  553. package/dist/navigation/groundAreas.js +407 -0
  554. package/dist/navigation/groundAreas.js.map +1 -0
  555. package/dist/navigation/navigation.d.ts +98 -9
  556. package/dist/navigation/recast.d.ts +194 -18
  557. package/dist/navigation/recast.js +1379 -0
  558. package/dist/navigation/recast.js.map +1 -0
  559. package/dist/navigation/sidePaths.d.ts +8 -3
  560. package/dist/navigation/sidePaths.js +241 -0
  561. package/dist/navigation/sidePaths.js.map +1 -0
  562. package/dist/navigation/sized.js +243 -0
  563. package/dist/navigation/sized.js.map +1 -0
  564. package/dist/nearest.js +32 -0
  565. package/dist/nearest.js.map +1 -0
  566. package/dist/noise.js +59 -0
  567. package/dist/noise.js.map +1 -0
  568. package/dist/objectives.d.ts +12 -3
  569. package/dist/objectives.js +144 -0
  570. package/dist/objectives.js.map +1 -0
  571. package/dist/orders/basic.d.ts +5 -5
  572. package/dist/orders/basic.js +417 -0
  573. package/dist/orders/basic.js.map +1 -0
  574. package/dist/orders/build.js +278 -0
  575. package/dist/orders/build.js.map +1 -0
  576. package/dist/orders/cast.d.ts +13 -3
  577. package/dist/orders/cast.js +558 -0
  578. package/dist/orders/cast.js.map +1 -0
  579. package/dist/orders/facts.js +16 -0
  580. package/dist/orders/facts.js.map +1 -0
  581. package/dist/orders/harvest.d.ts +21 -5
  582. package/dist/orders/harvest.js +540 -0
  583. package/dist/orders/harvest.js.map +1 -0
  584. package/dist/orders/idle.d.ts +3 -1
  585. package/dist/orders/idle.js +234 -0
  586. package/dist/orders/idle.js.map +1 -0
  587. package/dist/orders/items.js +92 -0
  588. package/dist/orders/items.js.map +1 -0
  589. package/dist/orders/queue.js +108 -0
  590. package/dist/orders/queue.js.map +1 -0
  591. package/dist/orders/waiting.d.ts +39 -0
  592. package/dist/orders/waiting.js +149 -0
  593. package/dist/orders/waiting.js.map +1 -0
  594. package/dist/pack.schema.js +13 -0
  595. package/dist/pack.schema.js.map +1 -0
  596. package/dist/pack.schema.json +7622 -841
  597. package/dist/packs/director/index.d.ts +13 -5
  598. package/dist/packs/director/index.js +204 -0
  599. package/dist/packs/director/index.js.map +1 -0
  600. package/dist/packs/heroes/campaign.d.ts +3 -2
  601. package/dist/packs/heroes/campaign.js +241 -0
  602. package/dist/packs/heroes/campaign.js.map +1 -0
  603. package/dist/packs/heroes/carry.d.ts +6 -0
  604. package/dist/packs/heroes/carry.js +112 -0
  605. package/dist/packs/heroes/carry.js.map +1 -0
  606. package/dist/packs/heroes/commands.js +115 -0
  607. package/dist/packs/heroes/commands.js.map +1 -0
  608. package/dist/packs/heroes/fallen.d.ts +43 -0
  609. package/dist/packs/heroes/fallen.js +61 -0
  610. package/dist/packs/heroes/fallen.js.map +1 -0
  611. package/dist/packs/heroes/hire.js +60 -0
  612. package/dist/packs/heroes/hire.js.map +1 -0
  613. package/dist/packs/heroes/index.d.ts +7 -6
  614. package/dist/packs/heroes/index.js +130 -0
  615. package/dist/packs/heroes/index.js.map +1 -0
  616. package/dist/packs/heroes/loop.d.ts +95 -0
  617. package/dist/packs/heroes/loop.js +250 -0
  618. package/dist/packs/heroes/loop.js.map +1 -0
  619. package/dist/packs/heroes/making.d.ts +6 -3
  620. package/dist/packs/heroes/making.js +55 -0
  621. package/dist/packs/heroes/making.js.map +1 -0
  622. package/dist/packs/heroes/respawn.d.ts +3 -3
  623. package/dist/packs/heroes/respawn.js +87 -0
  624. package/dist/packs/heroes/respawn.js.map +1 -0
  625. package/dist/packs/heroes/sets.d.ts +32 -0
  626. package/dist/packs/heroes/sets.js +51 -0
  627. package/dist/packs/heroes/sets.js.map +1 -0
  628. package/dist/packs/heroes/spells.d.ts +16 -0
  629. package/dist/packs/heroes/spells.js +269 -0
  630. package/dist/packs/heroes/spells.js.map +1 -0
  631. package/dist/packs/items/defaults.d.ts +43 -0
  632. package/dist/packs/items/defaults.js +1504 -0
  633. package/dist/packs/items/defaults.js.map +1 -0
  634. package/dist/packs/items/index.d.ts +27 -0
  635. package/dist/packs/items/index.js +214 -0
  636. package/dist/packs/items/index.js.map +1 -0
  637. package/dist/packs/moba/index.d.ts +3 -3
  638. package/dist/packs/moba/index.js +174 -0
  639. package/dist/packs/moba/index.js.map +1 -0
  640. package/dist/packs/pack.d.ts +15 -15
  641. package/dist/packs/pack.js +14 -0
  642. package/dist/packs/pack.js.map +1 -0
  643. package/dist/packs.d.ts +15 -7
  644. package/dist/packs.js +222 -0
  645. package/dist/packs.js.map +1 -0
  646. package/dist/paths.d.ts +2 -0
  647. package/dist/paths.js +109 -0
  648. package/dist/paths.js.map +1 -0
  649. package/dist/plain.js +57 -0
  650. package/dist/plain.js.map +1 -0
  651. package/dist/player.d.ts +33 -10
  652. package/dist/player.js +159 -0
  653. package/dist/player.js.map +1 -0
  654. package/dist/portals.d.ts +1 -1
  655. package/dist/portals.js +194 -0
  656. package/dist/portals.js.map +1 -0
  657. package/dist/prefabs.d.ts +25 -2
  658. package/dist/prefabs.js +239 -0
  659. package/dist/prefabs.js.map +1 -0
  660. package/dist/presetBuildings.js +58 -0
  661. package/dist/presetBuildings.js.map +1 -0
  662. package/dist/presetFoliage.d.ts +27 -0
  663. package/dist/presetFoliage.js +98 -0
  664. package/dist/presetFoliage.js.map +1 -0
  665. package/dist/presetGround.js +65 -0
  666. package/dist/presetGround.js.map +1 -0
  667. package/dist/proxies.d.ts +12 -0
  668. package/dist/proxies.js +79 -0
  669. package/dist/proxies.js.map +1 -0
  670. package/dist/query.d.ts +56 -0
  671. package/dist/query.js +88 -0
  672. package/dist/query.js.map +1 -0
  673. package/dist/races.d.ts +15 -14
  674. package/dist/races.js +172 -0
  675. package/dist/races.js.map +1 -0
  676. package/dist/randomGroups.js +91 -0
  677. package/dist/randomGroups.js.map +1 -0
  678. package/dist/registry.d.ts +117 -53
  679. package/dist/registry.js +323 -0
  680. package/dist/registry.js.map +1 -0
  681. package/dist/remains.d.ts +11 -9
  682. package/dist/remains.js +188 -0
  683. package/dist/remains.js.map +1 -0
  684. package/dist/replication.d.ts +12 -7
  685. package/dist/replication.js +100 -0
  686. package/dist/replication.js.map +1 -0
  687. package/dist/rng.d.ts +2 -0
  688. package/dist/rng.js +40 -0
  689. package/dist/rng.js.map +1 -0
  690. package/dist/rules.d.ts +186 -99
  691. package/dist/rules.js +179 -0
  692. package/dist/rules.js.map +1 -0
  693. package/dist/rulesCheck.d.ts +5 -4
  694. package/dist/rulesCheck.js +693 -0
  695. package/dist/rulesCheck.js.map +1 -0
  696. package/dist/runes.d.ts +2 -2
  697. package/dist/runes.js +80 -0
  698. package/dist/runes.js.map +1 -0
  699. package/dist/save.d.ts +37 -12
  700. package/dist/save.js +532 -0
  701. package/dist/save.js.map +1 -0
  702. package/dist/scenario.d.ts +2 -2
  703. package/dist/scenario.js +99 -0
  704. package/dist/scenario.js.map +1 -0
  705. package/dist/scheduler.d.ts +3 -0
  706. package/dist/scheduler.js +156 -0
  707. package/dist/scheduler.js.map +1 -0
  708. package/dist/score.d.ts +19 -19
  709. package/dist/score.js +709 -0
  710. package/dist/score.js.map +1 -0
  711. package/dist/sequences.d.ts +10 -6
  712. package/dist/sequences.js +206 -0
  713. package/dist/sequences.js.map +1 -0
  714. package/dist/server/doorman.js +154 -0
  715. package/dist/server/doorman.js.map +1 -0
  716. package/dist/server/gameServer.d.ts +16 -1
  717. package/dist/server/gameServer.js +643 -0
  718. package/dist/server/gameServer.js.map +1 -0
  719. package/dist/server/index.d.ts +1 -1
  720. package/dist/server/lobby.js +199 -0
  721. package/dist/server/lobby.js.map +1 -0
  722. package/dist/server/log.js +18 -0
  723. package/dist/server/log.js.map +1 -0
  724. package/dist/server/match.js +267 -0
  725. package/dist/server/match.js.map +1 -0
  726. package/dist/server/mode.d.ts +18 -9
  727. package/dist/server/mode.js +220 -0
  728. package/dist/server/mode.js.map +1 -0
  729. package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
  730. package/dist/server/navigation-worker.js.map +1 -0
  731. package/dist/server/navigation.js +39 -0
  732. package/dist/server/navigation.js.map +1 -0
  733. package/dist/server/ops.d.ts +4 -0
  734. package/dist/server/ops.js +137 -0
  735. package/dist/server/ops.js.map +1 -0
  736. package/dist/server/packs.d.ts +3 -3
  737. package/dist/server/packs.js +32 -0
  738. package/dist/server/packs.js.map +1 -0
  739. package/dist/server/ratings.d.ts +5 -0
  740. package/dist/server/ratings.js +104 -0
  741. package/dist/server/ratings.js.map +1 -0
  742. package/dist/server/relay.d.ts +12 -2
  743. package/dist/server/relay.js +144 -0
  744. package/dist/server/relay.js.map +1 -0
  745. package/dist/server/rooms.d.ts +9 -2
  746. package/dist/server/rooms.js +442 -0
  747. package/dist/server/rooms.js.map +1 -0
  748. package/dist/server/seat.js +116 -0
  749. package/dist/server/seat.js.map +1 -0
  750. package/dist/server/seatSettings.d.ts +3 -3
  751. package/dist/server/seatSettings.js +63 -0
  752. package/dist/server/seatSettings.js.map +1 -0
  753. package/dist/server/secret.js +13 -0
  754. package/dist/server/secret.js.map +1 -0
  755. package/dist/server/start.d.ts +13 -6
  756. package/dist/server/start.js +76 -0
  757. package/dist/server/start.js.map +1 -0
  758. package/dist/server/websocket.d.ts +9 -1
  759. package/dist/server/websocket.js +306 -0
  760. package/dist/server/websocket.js.map +1 -0
  761. package/dist/server.js +15 -2861
  762. package/dist/session/can.js +26 -0
  763. package/dist/session/can.js.map +1 -0
  764. package/dist/session/commandReplay.d.ts +8 -2
  765. package/dist/session/commandReplay.js +293 -0
  766. package/dist/session/commandReplay.js.map +1 -0
  767. package/dist/session/debug.js +151 -0
  768. package/dist/session/debug.js.map +1 -0
  769. package/dist/session/delay.js +62 -0
  770. package/dist/session/delay.js.map +1 -0
  771. package/dist/session/delta.d.ts +14 -1
  772. package/dist/session/delta.js +407 -0
  773. package/dist/session/delta.js.map +1 -0
  774. package/dist/session/entityState.js +415 -0
  775. package/dist/session/entityState.js.map +1 -0
  776. package/dist/session/local.d.ts +47 -5
  777. package/dist/session/local.js +670 -0
  778. package/dist/session/local.js.map +1 -0
  779. package/dist/session/memory.d.ts +20 -2
  780. package/dist/session/memory.js +131 -0
  781. package/dist/session/memory.js.map +1 -0
  782. package/dist/session/protocol.d.ts +325 -31
  783. package/dist/session/protocol.js +55 -0
  784. package/dist/session/protocol.js.map +1 -0
  785. package/dist/session/remote.d.ts +74 -12
  786. package/dist/session/remote.js +1394 -0
  787. package/dist/session/remote.js.map +1 -0
  788. package/dist/session/replay.d.ts +11 -2
  789. package/dist/session/replay.js +160 -0
  790. package/dist/session/replay.js.map +1 -0
  791. package/dist/session/seed.js +12 -0
  792. package/dist/session/seed.js.map +1 -0
  793. package/dist/session/share.d.ts +5 -1
  794. package/dist/session/share.js +94 -0
  795. package/dist/session/share.js.map +1 -0
  796. package/dist/session/socket.d.ts +1 -1
  797. package/dist/session/socket.js +29 -0
  798. package/dist/session/socket.js.map +1 -0
  799. package/dist/session/wire.d.ts +5 -0
  800. package/dist/session/wire.js +84 -0
  801. package/dist/session/wire.js.map +1 -0
  802. package/dist/session/worker.d.ts +77 -12
  803. package/dist/session/worker.js +499 -0
  804. package/dist/session/worker.js.map +1 -0
  805. package/dist/shared.d.ts +31 -5
  806. package/dist/shared.js +166 -0
  807. package/dist/shared.js.map +1 -0
  808. package/dist/sides.d.ts +9 -3
  809. package/dist/sides.js +149 -0
  810. package/dist/sides.js.map +1 -0
  811. package/dist/sight.js +85 -0
  812. package/dist/sight.js.map +1 -0
  813. package/dist/simulate-worker.js +1 -1
  814. package/dist/simulate.d.ts +12 -8
  815. package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
  816. package/dist/simulate.js.map +1 -0
  817. package/dist/smart.js +77 -0
  818. package/dist/smart.js.map +1 -0
  819. package/dist/spatial.d.ts +32 -16
  820. package/dist/spatial.js +234 -0
  821. package/dist/spatial.js.map +1 -0
  822. package/dist/spawning.d.ts +1 -0
  823. package/dist/spawning.js +224 -0
  824. package/dist/spawning.js.map +1 -0
  825. package/dist/stances.d.ts +6 -3
  826. package/dist/stances.js +169 -0
  827. package/dist/stances.js.map +1 -0
  828. package/dist/start.d.ts +10 -10
  829. package/dist/start.js +75 -0
  830. package/dist/start.js.map +1 -0
  831. package/dist/stats.d.ts +42 -16
  832. package/dist/stats.js +290 -0
  833. package/dist/stats.js.map +1 -0
  834. package/dist/summoned.d.ts +52 -0
  835. package/dist/summoned.js +38 -0
  836. package/dist/summoned.js.map +1 -0
  837. package/dist/summons.d.ts +10 -13
  838. package/dist/summons.js +271 -0
  839. package/dist/summons.js.map +1 -0
  840. package/dist/systems/abilities.js +224 -0
  841. package/dist/systems/abilities.js.map +1 -0
  842. package/dist/systems/combat.d.ts +35 -1
  843. package/dist/systems/combat.js +677 -0
  844. package/dist/systems/combat.js.map +1 -0
  845. package/dist/systems/combatTold.d.ts +3 -1
  846. package/dist/systems/combatTold.js +85 -0
  847. package/dist/systems/combatTold.js.map +1 -0
  848. package/dist/systems/construction.js +80 -0
  849. package/dist/systems/construction.js.map +1 -0
  850. package/dist/systems/economy.d.ts +0 -6
  851. package/dist/systems/economy.js +128 -0
  852. package/dist/systems/economy.js.map +1 -0
  853. package/dist/systems/fog.d.ts +1 -1
  854. package/dist/systems/fog.js +120 -0
  855. package/dist/systems/fog.js.map +1 -0
  856. package/dist/systems/life.js +32 -0
  857. package/dist/systems/life.js.map +1 -0
  858. package/dist/systems/movement.d.ts +24 -12
  859. package/dist/systems/movement.js +1247 -0
  860. package/dist/systems/movement.js.map +1 -0
  861. package/dist/systems/orders.js +64 -0
  862. package/dist/systems/orders.js.map +1 -0
  863. package/dist/systems/production.js +322 -0
  864. package/dist/systems/production.js.map +1 -0
  865. package/dist/systems/productionQueue.js +120 -0
  866. package/dist/systems/productionQueue.js.map +1 -0
  867. package/dist/systems/victory.d.ts +1 -1
  868. package/dist/systems/victory.js +56 -0
  869. package/dist/systems/victory.js.map +1 -0
  870. package/dist/talk.d.ts +6 -6
  871. package/dist/talk.js +153 -0
  872. package/dist/talk.js.map +1 -0
  873. package/dist/targeting.d.ts +142 -0
  874. package/dist/targeting.js +49 -0
  875. package/dist/targeting.js.map +1 -0
  876. package/dist/tech.d.ts +20 -3
  877. package/dist/tech.js +239 -0
  878. package/dist/tech.js.map +1 -0
  879. package/dist/techTree.d.ts +7 -0
  880. package/dist/techTree.js +90 -0
  881. package/dist/techTree.js.map +1 -0
  882. package/dist/terrain.d.ts +59 -7
  883. package/dist/terrain.js +389 -0
  884. package/dist/terrain.js.map +1 -0
  885. package/dist/terrainSave.d.ts +6 -0
  886. package/dist/terrainSave.js +74 -0
  887. package/dist/terrainSave.js.map +1 -0
  888. package/dist/testing.d.ts +8 -7
  889. package/dist/testing.js +13 -739
  890. package/dist/testing.js.map +1 -1
  891. package/dist/tiles.d.ts +1 -1
  892. package/dist/tiles.js +43 -0
  893. package/dist/tiles.js.map +1 -0
  894. package/dist/timers.d.ts +29 -4
  895. package/dist/timers.js +242 -0
  896. package/dist/timers.js.map +1 -0
  897. package/dist/tomes.d.ts +4 -4
  898. package/dist/tomes.js +94 -0
  899. package/dist/tomes.js.map +1 -0
  900. package/dist/trade.js +103 -0
  901. package/dist/trade.js.map +1 -0
  902. package/dist/transport.d.ts +6 -1
  903. package/dist/transport.js +281 -0
  904. package/dist/transport.js.map +1 -0
  905. package/dist/tunables.d.ts +10 -3
  906. package/dist/tunables.js +56 -0
  907. package/dist/tunables.js.map +1 -0
  908. package/dist/unitResources.d.ts +67 -0
  909. package/dist/unitResources.js +266 -0
  910. package/dist/unitResources.js.map +1 -0
  911. package/dist/upkeep.d.ts +6 -1
  912. package/dist/upkeep.js +26 -0
  913. package/dist/upkeep.js.map +1 -0
  914. package/dist/veterancy.d.ts +8 -3
  915. package/dist/veterancy.js +131 -0
  916. package/dist/veterancy.js.map +1 -0
  917. package/dist/vision.d.ts +36 -0
  918. package/dist/vision.js +133 -0
  919. package/dist/vision.js.map +1 -0
  920. package/dist/walls.d.ts +1 -1
  921. package/dist/walls.js +278 -0
  922. package/dist/walls.js.map +1 -0
  923. package/dist/world.d.ts +606 -88
  924. package/dist/world.js +1263 -0
  925. package/dist/world.js.map +1 -0
  926. package/package.json +2 -2
  927. package/dist/ai.js.map +0 -1
  928. package/dist/attributes.d.ts +0 -66
  929. package/dist/brain-BvVdUhX8.js +0 -7659
  930. package/dist/brain-BvVdUhX8.js.map +0 -1
  931. package/dist/builds-C6LfgvEU.js +0 -460
  932. package/dist/builds-C6LfgvEU.js.map +0 -1
  933. package/dist/coreComponents-syuh2fPG.js +0 -5149
  934. package/dist/coreComponents-syuh2fPG.js.map +0 -1
  935. package/dist/debugCommands-CzjrSm66.js +0 -14739
  936. package/dist/debugCommands-CzjrSm66.js.map +0 -1
  937. package/dist/determinism-BCymQwiE.js +0 -518
  938. package/dist/determinism-BCymQwiE.js.map +0 -1
  939. package/dist/game-DiJEN-Ks.js +0 -5800
  940. package/dist/game-DiJEN-Ks.js.map +0 -1
  941. package/dist/index.js.map +0 -1
  942. package/dist/inspect-D9dWHmZ0.js.map +0 -1
  943. package/dist/local-Dkovq42k.js +0 -1379
  944. package/dist/local-Dkovq42k.js.map +0 -1
  945. package/dist/missionRules-C-bGxm0Q.js.map +0 -1
  946. package/dist/navigation-worker.js.map +0 -1
  947. package/dist/packs-g5thvmGn.js +0 -3199
  948. package/dist/packs-g5thvmGn.js.map +0 -1
  949. package/dist/profiles-B3NS9jwk.js.map +0 -1
  950. package/dist/server.js.map +0 -1
  951. package/dist/simulate-oXBiw1Ff.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.js","names":[],"sources":["../../src/abilities/effects.ts"],"sourcesContent":["import { manaChanged, missileHit, missileRemoved } from '#engine/engineEvents'\nimport { dashing } from '../dashing'\nimport {\n\ttype AbilityDef,\n\tat,\n\ttype EffectCommon,\n\ttype EffectDef,\n\ttype EffectFields,\n\ttype EffectOf,\n\ttype EffectTypes\n} from '#engine/defs'\nimport type { EditableField } from '#engine/gameData'\nimport { EFFECT_FIELDS } from './effectFields'\nimport { type Dash, distanceToEdge, type Entity } from '#engine/entity'\nimport { dist, type Vec2 } from '#engine/math'\nimport type { EntityId } from '#engine/entity'\nimport { halt, setGhost } from '#engine/systems/movement'\nimport type { Missile, World, Zone } from '#engine/world'\nimport { agentParamsOf } from '#engine/navigation/agentParams'\nimport { avoids, hasBuff, isUntargetable, layerOf, removeBuff } from './buffs'\nimport { conditionHolds, hasTag } from './chance'\nimport { sortTargets } from '#engine/query'\nimport { land, reached, run } from './land'\nimport { areaReach, edgeRadius, effectArea, inArea } from './shapes'\nimport { atan2, cos, hypot, sin } from '#engine/exactMath'\nimport { heroState } from '#engine/hero'\nimport { moving } from '../entity'\nimport { replicateEvent, snapshotField } from '../replication'\nimport type { MissileState } from '../session/protocol'\nimport { effectIndex } from './effectIndex'\n\n/** Where an effect is in an ability of the registry, for the screen (`effectIndex`) */\nconst effectIndexOf = (world: World, ability: string, effect: EffectDef): number | undefined =>\n\tworld.registry.abilities.has(ability) ? effectIndex(world.registry.ability(ability), effect) : undefined\n\n/**\n * What an effect is run with: the world, the caster, the ability and its level, the target and where it landed\n *\n * @beta\n */\nexport interface EffectContext {\n\t/** The world the ability is cast in */\n\tworld: World\n\t/** The unit that cast the ability */\n\tcaster: Entity\n\t/** The definition of the ability being cast */\n\tability: AbilityDef\n\t/** Level the ability was cast at */\n\tlevel: number\n\t/** The unit the ability was cast on, if any */\n\ttarget?: Entity\n\t/** Where the ability landed: the target, the chosen spot, or the caster */\n\tpoint: Vec2\n\t/**\n\t * What the effects go off from, when not the caster: a unit of its (a ball, a shadow, a soldier) or a place. A\n\t * missile starts there and aims from there, an area of the effects never takes it in, and the strike the screens\n\t * hear says it came from there; the caster stays who does it (whose the damage and the kills are, whose stats scale\n\t * it). The caster when left out (`effectOrigin`)\n\t *\n\t * @beta\n\t */\n\torigin?: Entity | Vec2\n\t/**\n\t * The way the effects face, for those with a shape (`EffectCommon.shape`): radians, as a unit's `facing`. From where\n\t * they go off from to where they landed when left out (`effectHeading`): a zone keeps the way it was cast, or the way\n\t * the unit it follows faces\n\t *\n\t * @beta\n\t */\n\theading?: number\n\t/** How far what carried the effect here has come, for what a missile does */\n\tdistance?: number\n\t/**\n\t * What part of their amounts the effects come to (`damage`, `heal`, `mana`): less on every spring of a missile that\n\t * bounces (`EffectFields.bounce`). All of it when left out; a game's own effect with an amount multiplies by it too\n\t */\n\tshare?: number\n\t/** How many of the buff that ran out there were, for what happens when it does */\n\tstacks?: number\n\t/** The ability went off charged, see `charge` on the ability */\n\tcharged?: boolean\n\t/**\n\t * For an ability held to charge and let go (`AbilityDef.hold`): how full it was, 0 let go at once to 1 full. Its\n\t * amounts are grown by it (`HoldDef.scale`); a game's own amounts read it. Carried by its missiles\n\t *\n\t * @beta\n\t */\n\theld?: number\n\t/**\n\t * For the effects of a trigger set off by damage (`onDamaged`, `onAbilityHit`, an `onHit`): the damage that did,\n\t * after armor and shields, for the formula `byDamage` and a game's own amounts\n\t *\n\t * @beta\n\t */\n\tdamage?: number\n\t/**\n\t * For an effect that is kept up all the time (a passive asked every round): the seconds since it was last asked.\n\t * Something that works per second multiplies by this, rather than counting on how often it is asked\n\t */\n\tinterval?: number\n}\n\n/**\n * Carries out an effect, whatever its type: what the registry hands for a type (`registry.effect`), to call with an\n * effect of that type\n *\n * @beta\n */\nexport type EffectHandler = (context: EffectContext, effect: EffectDef) => void\n\n/**\n * A kind of effect: its type and what it does (`defineEffect`). The engine's are the game's from the start; a game\n * lists its own in `Rules.effects`, and one of a type the engine has takes its place\n *\n * @beta\n */\nexport interface EffectType<K extends keyof EffectTypes = keyof EffectTypes> {\n\t/** The effect type this is the definition of: the `type` an effect of it carries in an ability's list */\n\treadonly type: K\n\t/** Carries out an effect of the type, for a cast (or a passive asked, a missile's hit...) */\n\trun(context: EffectContext, effect: EffectOf<K>): void\n\t/** An effect of the type, for an ability's list: `pull.of({ distance: 3 })` is `{ type: 'pull', distance: 3 }` */\n\tof(fields: EffectCommon & EffectTypes[K]): EffectOf<K>\n\t/**\n\t * The fields an effect of the type reads, besides those every effect has (`EffectCommon`): what the editor's Data\n\t * panel offers on a row of the type (campaign plan RC2). None said, it offers those a row has\n\t */\n\treadonly fields?: readonly EditableField[]\n}\n\n/**\n * What a kind of effect says besides what it does (`defineEffect`): the fields it reads, each the name of one of the\n * engine's (`EffectFields`) or said in full, its path the field's name in the effect (`{ path: 'pull', kind: 'number' }`)\n *\n * @beta\n */\nexport interface EffectTypeOptions {\n\t/** The fields an effect of the type reads, each the name of an engine field (`EffectFields`) or a full `EditableField` */\n\tfields?: readonly (keyof EffectFields | EditableField)[]\n}\n\n/**\n * A kind of effect, its type and what it does together: `defineEffect({ type: 'pull', run: (context, effect) => ... })`, listed in\n * `Rules.effects`. Its fields are said by declaring the type in `EffectTypes`\n * (`declare module '@v12-engine/engine' { interface EffectTypes { pull: { distance: number } } }`), so that a handler\n * reads them typed, and an ability's effect of the type is checked for them\n *\n * @public\n */\nexport function defineEffect<K extends keyof EffectTypes>(\n\tdef: { type: K; run: (context: EffectContext, effect: EffectOf<K>) => void } & EffectTypeOptions\n): EffectType<K> {\n\tconst { type, run, ...options } = def\n\tconst fields = options.fields?.flatMap((field) => (typeof field === 'string' ? (EFFECT_FIELDS[field] ?? []) : [field]))\n\treturn { type, run, of: (fields) => ({ ...fields, type }) as EffectOf<K>, ...(fields && { fields }) }\n}\n\n/** The unit effects go off from, where that is one and not the caster */\nconst originUnit = (context: EffectContext): Entity | undefined =>\n\tcontext.origin && 'pos' in context.origin && context.origin !== context.caster ? (context.origin as Entity) : undefined\n\nconst found: Entity[] = []\n\n/**\n * Whether an effect may reach a target, as the game says (the `beforeEffect` hook): what a game's own effect asks of\n * each unit it does something to without `effectTargets` (which asks it of every one it gives). True where no handler is\n * there. `missile`: the missile that reached it, for a missile's hit\n *\n * @beta\n */\nexport function mayReach(context: EffectContext, effect: EffectDef, target: Entity, missile?: Missile): boolean {\n\tconst { world, caster, ability, level, origin, point } = context\n\tif (!world.hooks.has('beforeEffect')) return true\n\tconst event = { caster, ability, level, effect, target, origin, point, missile, cancelled: false }\n\treturn !world.hooks.run('beforeEffect', event).cancelled\n}\n\n/**\n * Who an effect applies to: the caster (`on: 'caster'`), the target or the caster (no `radius`), or who is within its\n * `radius` of where it landed, as `affects` (`fallback` when it says nothing), `layers`, `kinds`, `tags`, `ifBuff`, `only` and\n * what keeps out of the ability's way (`avoids`) say, the unit it went off from aside (`EffectContext.origin`); and of\n * those, who the game lets it reach (`beforeEffect`, `mayReach`). A handler of a game's own effect calls it as the\n * engine's do: who it gives is told to `effectLanded` once the handler is done\n *\n * @beta\n */\nexport function effectTargets(context: EffectContext, effect: EffectDef, fallback: 'enemies' | 'allies'): Entity[] {\n\tconst given = chosen(context, effect, candidates(context, effect, fallback))\n\tconst result = context.world.hooks.has('beforeEffect') ? given.filter((target) => mayReach(context, effect, target)) : given\n\treached(result)\n\treturn result\n}\n\n/**\n * Of who an effect's area reaches, those it goes to: in its `sort` (the nearest to the middle of its area, where it\n * landed, or the caster for a cone, a line and an arc, where it has a `limit` alone), as many as its `limit`, before\n * the game has its say\n */\nfunction chosen(context: EffectContext, effect: EffectDef, given: Entity[]): Entity[] {\n\tconst { sort, limit } = effect\n\tif ((sort === undefined && limit === undefined) || effect.on === 'caster' || given.length === 0) return given\n\tconst area = effectArea(context, effect)\n\tif (!area) return given\n\tsortTargets(context.world, given, sort ?? 'nearest', { x: area.x, z: area.z })\n\tif (limit !== undefined) given.length = Math.min(given.length, Math.max(0, Math.floor(at(limit, context.level))))\n\treturn given\n}\n\n/** Whether an entity is one an effect applies to by its `ifBuff`, `only`, `kinds`, `tags` and `where` */\nconst fitsCommon = (context: EffectContext, effect: EffectDef, entity: Entity): boolean =>\n\t(!effect.ifBuff || hasBuff(entity, effect.ifBuff)) &&\n\t(effect.only !== 'heroes' || entity.has(heroState)) &&\n\t(!effect.kinds || effect.kinds.includes(entity.def.kind)) &&\n\t(!effect.tags || hasTag(entity, effect.tags)) &&\n\t(!effect.where || conditionHolds(context, effect.where, entity))\n\n/**\n * Of what an effect found to act on by itself (the `burn` effect: what burns where it lands, trees among it, which\n * `effectTargets` leaves out as resources), those it applies to as its fields of whom say (`EffectCommon`): `layers`,\n * `affects` (`fallback` when it says nothing), `ifBuff`, `only`, `kinds` (everything, resources too, when left out),\n * `tags`, `where`, and what keeps out of the ability's way (`avoids`); in its `sort`, as many as its `limit`; and of\n * those, who the game lets it reach (`beforeEffect`). Told to `effectLanded` as `effectTargets`'s are\n *\n * @internal\n */\nexport function effectFilter(context: EffectContext, effect: EffectDef, things: readonly Entity[], fallback: 'enemies' | 'allies' | 'all'): Entity[] {\n\tconst { world, caster } = context\n\tconst { layers } = effect\n\tconst affects = effect.affects ?? fallback\n\tconst given = things.filter(\n\t\t(entity) =>\n\t\t\t(!layers || layers.includes(layerOf(world, entity))) &&\n\t\t\t(affects !== 'enemies' || world.areEnemies(caster.owner, entity.owner)) &&\n\t\t\t(affects !== 'allies' || world.areAllies(caster.owner, entity.owner)) &&\n\t\t\t(entity === caster || !avoids(world, entity, context.ability)) &&\n\t\t\t(entity === caster || !entity.buffs.length || !isUntargetable(world, entity)) &&\n\t\t\tfitsCommon(context, effect, entity)\n\t)\n\tconst picked = chosen(context, effect, given)\n\tconst result = world.hooks.has('beforeEffect') ? picked.filter((target) => mayReach(context, effect, target)) : picked\n\treached(result)\n\treturn result\n}\n\n/** Who an effect applies to, by what it says (`effectTargets`), before the game has its say */\nfunction candidates(context: EffectContext, effect: EffectDef, fallback: 'enemies' | 'allies'): Entity[] {\n\tconst { world, caster, target, point } = context\n\tif (effect.on === 'caster') return [caster]\n\tconst { layers } = effect\n\tconst area = effectArea(context, effect)\n\tconst fits = (entity: Entity) => fitsCommon(context, effect, entity)\n\tif (!area) {\n\t\tconst one = target ?? caster\n\t\tif (one !== caster && avoids(world, one, context.ability)) return []\n\t\t// out of everyone else's reach (AB9)\n\t\tif (one !== caster && one.buffs.length && isUntargetable(world, one)) return []\n\t\treturn (!layers || layers.includes(layerOf(world, one))) && fits(one) ? [one] : []\n\t}\n\n\tconst affects = effect.affects ?? fallback\n\tconst result: Entity[] = []\n\tconst origin = originUnit(context)\n\t// a circle as it always was, to the edge of what it reaches; another shape by `inArea`\n\tconst circle = area.shape === 'circle'\n\tconst radius = area.radius\n\tfor (const entity of world.spatial.query(area.x, area.z, circle ? radius : areaReach(area), found)) {\n\t\tif (!entity.alive || entity.hidden || entity.isResource || entity === origin) continue\n\t\tif (circle ? distanceToEdge(point, entity) > radius : !inArea(area, entity.pos, edgeRadius(entity))) continue\n\t\tif (layers && !layers.includes(layerOf(world, entity))) continue\n\t\tif (affects === 'enemies' && !world.areEnemies(caster.owner, entity.owner)) continue\n\t\tif (affects === 'allies' && !world.areAllies(caster.owner, entity.owner)) continue\n\t\tif (entity !== caster && avoids(world, entity, context.ability)) continue\n\t\tif (entity !== caster && entity.buffs.length && isUntargetable(world, entity)) continue\n\t\tif (fits(entity)) result.push(entity)\n\t}\n\treturn result\n}\n\n/** Whether an ability of the caster is charged: its `charge` buff is on it with as many stacks as it can have */\nexport function isCharged(world: World, caster: Entity, ability: AbilityDef): boolean {\n\tif (!ability.charge) return false\n\tconst instance = caster.buffs.find((carried) => carried.id === ability.charge)\n\treturn !!instance && (instance.stacks ?? 0) >= (world.registry.buff(ability.charge).maxStacks ?? 1)\n}\n\n/**\n * Takes someone off the ground for a leap or a throw. Up there it is nobody's obstacle: it pushes no one\n * on its way over them, and goes straight over what cannot be walked\n */\n/**\n * Sends an entity rushing to a spot (`dash.x`, `dash.z`): nothing stops it on the way, its orders wait, and what\n * `dash.effects` do happens where it ends. A leap (`dash.height`) takes it off the ground until it comes down\n *\n * @beta\n */\nexport function startDash(world: World, entity: Entity, dash: Omit<Dash, 'from'>): void {\n\tif (entity.isStructure) throw new Error(`${entity.def.id}#${entity.id} is a structure: it cannot rush anywhere`)\n\tworld.wake(entity)\n\tentity.set(dashing, { ...dash, from: { x: entity.pos.x, z: entity.pos.z } })\n\tif (dash.height) takeOff(world, entity)\n}\n\nfunction takeOff(world: World, entity: Entity): void {\n\tif (!entity.get(moving)) return\n\thalt(world, entity)\n\tworld.nav.removeAgent(entity.id)\n}\n\n/** Back on the ground, where it came down */\nfunction touchDown(world: World, entity: Entity): void {\n\tconst m = entity.get(moving)\n\tif (!m) return\n\tworld.nav.addAgent(entity.id, entity.pos, agentParamsOf(entity, m.speed))\n\t// the agent is new, so it lost its flags\n\tconst { ghost } = m\n\tm.ghost = false\n\t// phasing is seen to again on the next tick (`BuffDef.phasing`)\n\tdelete m.phased\n\tm.anchored = false\n\tm.status = 'idle'\n\tsetGhost(world, entity, ghost)\n\t// what it was doing starts over from here: on its way again, after whom it was after\n\tconst order = entity.orders[0]\n\tif (order) order.started = false\n}\n\nconst crossed: Entity[] = []\n/** Seconds between two rounds of a zone seeing to what is inside */\nconst ZONE_INTERVAL = 0.25\n\n/** Missiles taken out of the world while the missiles were being moved along: the round passes them by */\nconst gone = new WeakSet<Missile>()\n\n/** Takes a missile out of the world, and tells it: false for one that was not in it */\nfunction drop(world: World, missile: Missile): boolean {\n\tconst index = world.missiles.indexOf(missile)\n\tif (index < 0) return false\n\tworld.missiles.splice(index, 1)\n\tgone.add(missile)\n\tworld.events.emit(missileRemoved, missile)\n\treturn true\n}\n\n/**\n * Takes a missile of an ability out of the world before it is done: blocked by a wall of wind, caught, swallowed. It\n * hits nothing more, and every screen is told (`missileRemoved`). With `end`, what happens where it ends\n * (`EffectFields.onEnd`) happens where it is, as if it had come to the end of its way. False for one that is not in the\n * world (`world.missiles`) any more\n *\n * @beta\n */\nexport function removeMissile(world: World, missile: Missile, options: { end?: boolean } = {}): boolean {\n\tif (!drop(world, missile)) return false\n\tconst caster = world.get(missile.source)\n\tconst ability = world.registry.abilities.has(missile.ability) ? world.registry.ability(missile.ability) : undefined\n\tif (options.end && caster && ability && missile.effect.onEnd) {\n\t\tconst point = { x: missile.x, z: missile.z }\n\t\tland({ world, caster, ability, level: missile.level, point, distance: missile.travelled, share: shareOf(missile), held: missile.held }, missile.effect.onEnd)\n\t}\n\treturn true\n}\n\n/**\n * Ends a zone of an ability (`world.zones`) before its time: what happens at its end (`onEnd`) happens now, unless\n * `onEnd` is false (a zone called off, not finished). False for one that is not in the world any more\n *\n * @beta\n */\nexport function endZone(world: World, zone: Zone, options: { onEnd?: boolean } = {}): boolean {\n\tconst index = world.zones.indexOf(zone)\n\tif (index < 0) return false\n\tworld.zones.splice(index, 1)\n\tif (options.onEnd !== false) land(zoneContext(world, zone), zone.effect.onEnd)\n\treturn true\n}\n\n/**\n * What a zone's effects run with: its caster, its place, the way it was cast (AB10)\n *\n * @internal\n */\nexport const zoneContext = (world: World, zone: Zone): EffectContext => ({\n\tworld,\n\tcaster: zone.caster,\n\tability: zone.ability,\n\tlevel: zone.level,\n\tpoint: { x: zone.x, z: zone.z },\n\t// the way it was cast, for what it holds with a shape (AB10)\n\t...(zone.from && { origin: { x: zone.from.x, z: zone.from.z } }),\n\t...(zone.heading !== undefined && { heading: zone.heading })\n})\n\n/** Whether a missile may hit an entity, as its effect says: who it is for, of what kind, where, and once */\nfunction mayHit(world: World, missile: Missile, caster: Entity, ability: AbilityDef, entity: Entity): boolean {\n\tconst { effect } = missile\n\tif (!entity.alive || entity.hidden || entity.isResource || entity === caster || missile.hit.has(entity.id)) return false\n\tif (effect.layers && !effect.layers.includes(layerOf(world, entity))) return false\n\tif (effect.kinds && !effect.kinds.includes(entity.def.kind)) return false\n\tif (effect.tags && !hasTag(entity, effect.tags)) return false\n\tif (avoids(world, entity, ability)) return false\n\tif (entity.buffs.length && isUntargetable(world, entity)) return false\n\tconst affects = effect.affects ?? 'enemies'\n\tif (affects === 'enemies' && !world.areEnemies(missile.owner, entity.owner)) return false\n\tif (affects === 'allies' && !world.areAllies(missile.owner, entity.owner)) return false\n\treturn true\n}\n\n/**\n * What a missile's effects come to after it sprang on as many times as it has (`bounce.falloff` less each time), and went\n * through as many as it has (`falloff` less for each)\n */\nfunction shareOf(missile: Missile): number | undefined {\n\tconst falloff = missile.effect.bounce?.falloff\n\tlet share: number | undefined\n\tif (missile.bounces && falloff) {\n\t\tshare = 1\n\t\tfor (let i = 0; i < missile.bounces; i++) share *= Math.max(1 - falloff, 0)\n\t}\n\tconst through = missile.effect.falloff\n\tif (missile.struck && through) {\n\t\tshare ??= 1\n\t\tfor (let i = 0; i < missile.struck; i++) share *= Math.max(1 - through, 0)\n\t}\n\treturn share\n}\n\n/** Whether a missile that goes through so many (`pierce`) is used up by what it hit last */\nfunction usedUp(missile: Missile): boolean {\n\tconst { pierce } = missile.effect\n\treturn pierce === false || (typeof pierce === 'number' && (missile.struck ?? 0) > pierce)\n}\n\n/** Whether counting what a missile went through matters to it (`pierce` a number, `falloff`) */\nconst counts = (missile: Missile): boolean => typeof missile.effect.pierce === 'number' || !!missile.effect.falloff\n\n/**\n * What a missile does to one it hits: its effects, as much of them as is left after its springs. False where the game\n * would not let it reach that one (`beforeEffect`)\n */\nfunction strike(world: World, missile: Missile, caster: Entity, ability: AbilityDef, target: Entity): boolean {\n\tmissile.hit.add(target.id)\n\tconst point = { x: target.pos.x, z: target.pos.z }\n\tconst context = { world, caster, ability, level: missile.level, target, point, distance: missile.travelled, share: shareOf(missile), held: missile.held }\n\t// the game's say (`beforeEffect`): a spell shield, a parry. It passes that one by, and is not asked of it again\n\tif (!mayReach(context, missile.effect, target, missile)) return false\n\tif (counts(missile)) missile.struck = (missile.struck ?? 0) + 1\n\tif (missile.effect.onWall) missile.last = target.id\n\tland(context, missile.effect.effects)\n\tworld.events.emit(missileHit, { missile, target })\n\treturn true\n}\n\n/** The nearest a missile may hit within `range` of where it is, the lowest id among those as near */\nfunction nearestFor(world: World, missile: Missile, caster: Entity, ability: AbilityDef, range: number): Entity | undefined {\n\tlet next: Entity | undefined\n\tlet nearest = Infinity\n\tfor (const entity of world.spatial.query(missile.x, missile.z, range, crossed)) {\n\t\tif (!mayHit(world, missile, caster, ability, entity)) continue\n\t\tconst gap = distanceToEdge(missile, entity)\n\t\tif (gap > range || gap > nearest || (gap === nearest && next && entity.id > next.id)) continue\n\t\tnearest = gap\n\t\tnext = entity\n\t}\n\treturn next\n}\n\n/**\n * What a missile passes through where it is now: each it may hit, once. True when one used it up (`pierce`) or it is\n * gone; `back`: on its way back (`hitsOnReturn`), when nothing uses it up\n */\nfunction passThrough(world: World, missile: Missile, caster: Entity, ability: AbilityDef, back = false): boolean {\n\tfor (const entity of [...world.spatial.query(missile.x, missile.z, missile.radius, crossed)]) {\n\t\tif (!mayHit(world, missile, caster, ability, entity) || distanceToEdge(missile, entity) > missile.radius) continue\n\t\tconst struck = strike(world, missile, caster, ability, entity)\n\t\tif (gone.has(missile)) return true\n\t\tif (!back && struck && usedUp(missile)) return true\n\t}\n\treturn false\n}\n\n/** What a missile's split sends off from where it is, the way it flew (`split`) */\nfunction splitOff(world: World, missile: Missile, caster: Entity, ability: AbilityDef): void {\n\tconst { split } = missile.effect\n\tif (!split) return\n\tconst origin = { x: missile.x, z: missile.z }\n\tconst point = { x: missile.x + missile.dx, z: missile.z + missile.dz }\n\trun({ world, caster, ability, level: missile.level, point, origin, heading: atan2(missile.dx, missile.dz), distance: missile.travelled }, split)\n}\n\n/**\n * Splits a missile where it is now (`EffectFields.split`), as it would once done: what a game's own recast does (Vel'Koz's\n * Plasma Fission). It is gone, its `onEnd` not happening; false for one not in the world, or with no caster or ability left\n *\n * @beta\n */\nexport function splitMissile(world: World, missile: Missile): boolean {\n\tconst caster = world.get(missile.source)\n\tconst ability = world.registry.abilities.has(missile.ability) ? world.registry.ability(missile.ability) : undefined\n\tif (!caster || !ability || !drop(world, missile)) return false\n\tsplitOff(world, missile, caster, ability)\n\treturn true\n}\n\n/**\n * Turns a missile that is steered (`EffectFields.steer`) towards a point, as its owner's `steer` command does: it turns\n * that way as it flies, as fast as its `rate` lets it. False for one that is not steered, or not in the world\n *\n * @beta\n */\nexport function steerMissile(world: World, missile: Missile, point: Vec2): boolean {\n\tif (!missile.effect.steer || !world.missiles.includes(missile)) return false\n\tmissile.steerTo = { x: point.x, z: point.z }\n\treturn true\n}\n\n/** Turns a steered missile towards where it is steered, at most its rate this round */\nfunction steer(missile: Missile, dt: number): void {\n\tconst to = missile.steerTo\n\tif (!to) return\n\tconst dx = to.x - missile.x\n\tconst dz = to.z - missile.z\n\tif (hypot(dx, dz) < 0.05) return\n\tconst now = atan2(missile.dx, missile.dz)\n\tlet turn = atan2(dx, dz) - now\n\twhile (turn > Math.PI) turn -= Math.PI * 2\n\twhile (turn < -Math.PI) turn += Math.PI * 2\n\tconst most = (missile.effect.steer?.rate ?? Math.PI) * dt\n\tconst heading = now + Math.max(-most, Math.min(most, turn))\n\tmissile.dx = sin(heading)\n\tmissile.dz = cos(heading)\n}\n\n/**\n * Whether a missile is at a wall (`onWall`): off the play area, on ground nothing walks, on a cliff above where it set\n * off, or at a building or a tree\n */\nfunction atWall(world: World, missile: Missile): boolean {\n\tconst { terrain } = world\n\tconst { x, z } = missile\n\tif (x < 0 || z < 0 || x >= terrain.width || z >= terrain.depth) return true\n\tconst cx = Math.floor(x)\n\tconst cz = Math.floor(z)\n\tif (!terrain.inPlay(cx, cz)) return true\n\tconst cell = cz * terrain.width + cx\n\tif (terrain.blocked[cell] === 2 || terrain.levels[cell] > (missile.floor ?? 0)) return true\n\tfor (const entity of world.spatial.query(x, z, missile.radius, crossed))\n\t\tif (entity.alive && !entity.hidden && entity.def.kind !== 'unit' && distanceToEdge(missile, entity) <= missile.radius) return true\n\treturn false\n}\n\n/**\n * Where a missile that bounces would be done, it springs on (`EffectFields.bounce`): after the nearest one within its\n * range of where it is that it may hit and has not, the lowest id among those as near. False when it has sprung as many\n * times as it may, or there is nobody to spring on to\n */\nfunction springOn(world: World, missile: Missile, caster: Entity, ability: AbilityDef): boolean {\n\tconst { bounce, arc } = missile.effect\n\tif (!bounce || missile.bounces >= Math.round(at(bounce.count, missile.level))) return false\n\tconst next = nearestFor(world, missile, caster, ability, bounce.range)\n\tif (!next) return false\n\tmissile.target = next.id\n\tmissile.bounces++\n\tmissile.leg = 0\n\tmissile.left = Infinity\n\tmissile.stopped = false\n\t// thrown again in the same time, however far the next one is\n\tif (arc?.time && arc.time > 0) missile.speed = dist(missile, next.pos) / arc.time\n\treturn true\n}\n\n/** A missile that comes back (`EffectFields.returns`) turns for the caster where it would be done */\nfunction turnBack(missile: Missile): void {\n\t// to hit each again on the way back, a list of its own of whom it hit (`hitsOnReturn`)\n\tif (missile.effect.hitsOnReturn) missile.hit = new Set()\n\tmissile.returning = true\n\tmissile.target = 0\n\tmissile.left = Infinity\n\tmissile.leg = 0\n\tmissile.height = 0\n}\n\n/** How high a missile's arc carries it, `leg` along a way that has `left` to go: highest halfway */\nconst arcHeight = (arc: EffectFields['arc'], leg: number, left: number): number => {\n\tif (!arc || !(leg + left > 0) || !Number.isFinite(left)) return 0\n\tconst way = leg / (leg + left)\n\treturn 4 * arc.height * way * (1 - way)\n}\n\n/** Moves the missiles of abilities along, and lets them do what they do to what they pass through and where they come down */\nexport function updateMissiles(world: World, dt: number): void {\n\tif (!world.missiles.length) return\n\t// as they were when the round began: what a hit sets off may take one out (`removeMissile`) or send more\n\tconst missiles = world.missiles.slice()\n\tfor (let i = missiles.length - 1; i >= 0; i--) {\n\t\tconst missile = missiles[i]\n\t\tif (gone.has(missile)) continue\n\t\tif (missile.delay > 0) {\n\t\t\t// taking shape: it goes nowhere and touches nobody yet\n\t\t\tmissile.delay -= dt\n\t\t\tmissile.prevX = missile.x\n\t\t\tmissile.prevZ = missile.z\n\t\t\tcontinue\n\t\t}\n\t\tconst caster = world.entities.get(missile.source)\n\t\tconst { effect } = missile\n\t\tconst ability = world.registry.abilities.has(missile.ability) ? world.registry.ability(missile.ability) : undefined\n\t\tmissile.prevX = missile.x\n\t\tmissile.prevZ = missile.z\n\n\t\tif (missile.returning) {\n\t\t\t// back to the caster, wherever it went, past everyone: what happens at its end happens there\n\t\t\tif (!caster?.alive || caster.hidden || !ability) {\n\t\t\t\tdrop(world, missile)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst gap = dist(missile, caster.pos)\n\t\t\tconst step = missile.speed * dt\n\t\t\tif (gap > 0.01) {\n\t\t\t\tmissile.dx = (caster.pos.x - missile.x) / gap\n\t\t\t\tmissile.dz = (caster.pos.z - missile.z) / gap\n\t\t\t}\n\t\t\tif (gap > step + caster.def.radius * 0.5) {\n\t\t\t\tmissile.x += missile.dx * step\n\t\t\t\tmissile.z += missile.dz * step\n\t\t\t\tmissile.travelled += step\n\t\t\t\t// and through everyone again, for one that hits on its way back\n\t\t\t\tif (effect.hitsOnReturn && effect.effects?.length) passThrough(world, missile, caster, ability, true)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmissile.x = caster.pos.x\n\t\t\tmissile.z = caster.pos.z\n\t\t\tmissile.travelled += gap\n\t\t\tif (effect.onEnd) {\n\t\t\t\tconst point = { x: caster.pos.x, z: caster.pos.z }\n\t\t\t\tland({ world, caster, ability, level: missile.level, point, distance: missile.travelled, share: shareOf(missile), held: missile.held }, effect.onEnd)\n\t\t\t}\n\t\t\tdrop(world, missile)\n\t\t\tcontinue\n\t\t}\n\n\t\t// one that finds its own: after the nearest it may hit, while it has nobody; another, if that one is gone first\n\t\tif (effect.seek && caster && ability) {\n\t\t\tconst sought = missile.target ? world.get(missile.target) : undefined\n\t\t\tif (missile.target && (!sought?.alive || sought.hidden || missile.hit.has(missile.target))) missile.target = 0\n\t\t\tif (!missile.target) missile.target = nearestFor(world, missile, caster, ability, effect.seek)?.id ?? 0\n\t\t}\n\n\t\tif (missile.target) {\n\t\t\t// after its target, wherever that goes, until it has it\n\t\t\tconst target = world.get(missile.target)\n\t\t\tif (!target || target.hidden || !caster || !ability) {\n\t\t\t\tif (effect.returns && caster && ability) turnBack(missile)\n\t\t\t\telse drop(world, missile)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst gap = dist(missile, target.pos)\n\t\t\tconst step = missile.speed * dt\n\t\t\tif (gap > 0.01) {\n\t\t\t\tmissile.dx = (target.pos.x - missile.x) / gap\n\t\t\t\tmissile.dz = (target.pos.z - missile.z) / gap\n\t\t\t}\n\t\t\tif (gap <= step + target.def.radius * 0.5) {\n\t\t\t\tmissile.x = target.pos.x\n\t\t\t\tmissile.z = target.pos.z\n\t\t\t\tmissile.travelled += gap\n\t\t\t\tmissile.leg += gap\n\t\t\t\tmissile.height = 0\n\t\t\t\tstrike(world, missile, caster, ability, target)\n\t\t\t\tif (gone.has(missile) || springOn(world, missile, caster, ability)) continue\n\t\t\t\tif (effect.returns) turnBack(missile)\n\t\t\t\telse {\n\t\t\t\t\tdrop(world, missile)\n\t\t\t\t\tsplitOff(world, missile, caster, ability)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmissile.x += missile.dx * step\n\t\t\tmissile.z += missile.dz * step\n\t\t\tmissile.travelled += step\n\t\t\tmissile.leg += step\n\t\t\tmissile.height = arcHeight(effect.arc, missile.leg, gap - step)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (effect.steer) steer(missile, dt)\n\t\tconst step = Math.min(missile.speed * dt, missile.left)\n\t\tmissile.x += missile.dx * step\n\t\tmissile.z += missile.dz * step\n\t\tmissile.left -= step\n\t\tmissile.travelled += step\n\t\tmissile.leg += step\n\t\tmissile.height = arcHeight(effect.arc, missile.leg, missile.left)\n\n\t\t// what is thrown flies over everyone and everything, and comes down on what is where it lands\n\t\tif (!effect.arc) {\n\t\t\t// what has nothing to do to anyone passes everyone by\n\t\t\tif (caster && ability && effect.effects?.length && passThrough(world, missile, caster, ability) && !gone.has(missile)) {\n\t\t\t\t// used up by what it hit last, unless it springs on from it; split where it is\n\t\t\t\tif (!springOn(world, missile, caster, ability)) {\n\t\t\t\t\tmissile.left = 0\n\t\t\t\t\tmissile.stopped = true\n\t\t\t\t\tsplitOff(world, missile, caster, ability)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (missile.target || gone.has(missile)) continue\n\t\t\t// at a wall: it stops there, and what it does there happens (`onWall`), to the last one it hit\n\t\t\tif (effect.onWall && !missile.stopped && caster && ability && atWall(world, missile)) {\n\t\t\t\tmissile.left = 0\n\t\t\t\tmissile.stopped = true\n\t\t\t\tconst last = missile.last ? world.get(missile.last) : undefined\n\t\t\t\tconst point = { x: missile.x, z: missile.z }\n\t\t\t\tconst target = last?.alive && !last.hidden ? last : undefined\n\t\t\t\tland({ world, caster, ability, level: missile.level, point, target, heading: atan2(missile.dx, missile.dz), distance: missile.travelled }, effect.onWall)\n\t\t\t\tif (gone.has(missile)) continue\n\t\t\t}\n\t\t\t// buildings and trees stand in its way, whoever's they are, and nothing happens to them\n\t\t\tif (effect.blocked && !missile.stopped) {\n\t\t\t\tfor (const entity of world.spatial.query(missile.x, missile.z, missile.radius, crossed)) {\n\t\t\t\t\tif (!entity.alive || entity.hidden || entity.def.kind === 'unit' || distanceToEdge(missile, entity) > missile.radius) continue\n\t\t\t\t\tmissile.left = 0\n\t\t\t\t\tmissile.stopped = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (missile.left <= 0) {\n\t\t\tif (effect.arc && caster && ability && effect.effects?.length) {\n\t\t\t\tfor (const entity of [...world.spatial.query(missile.x, missile.z, missile.radius, crossed)]) {\n\t\t\t\t\tif (mayHit(world, missile, caster, ability, entity) && distanceToEdge(missile, entity) <= missile.radius)\n\t\t\t\t\t\tstrike(world, missile, caster, ability, entity)\n\t\t\t\t\tif (gone.has(missile)) break\n\t\t\t\t}\n\t\t\t\tif (gone.has(missile)) continue\n\t\t\t}\n\t\t\tif (!missile.stopped && caster && ability && springOn(world, missile, caster, ability)) continue\n\t\t\tif (effect.returns && caster && ability) {\n\t\t\t\tturnBack(missile)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (caster && ability && !missile.stopped) splitOff(world, missile, caster, ability)\n\t\t\tif (caster && ability && effect.onEnd && !missile.stopped) {\n\t\t\t\tconst point = { x: missile.x, z: missile.z }\n\t\t\t\tland({ world, caster, ability, level: missile.level, point, distance: missile.travelled, share: shareOf(missile), held: missile.held }, effect.onEnd)\n\t\t\t}\n\t\t\tdrop(world, missile)\n\t\t}\n\t}\n}\n\n/** What abilities left behind to happen later, and the ground they go on working on */\nexport function updateLingering(world: World, dt: number): void {\n\tconst { delayed } = world\n\tfor (let i = delayed.length - 1; i >= 0; i--) {\n\t\tconst entry = delayed[i]\n\t\tentry.left -= dt\n\t\tif (entry.left > 0) continue\n\t\tdelayed.splice(i, 1)\n\t\tconst { caster, ability, level, point, from, heading } = entry\n\t\tland({ world, caster, ability, level, point, ...(from && { origin: from }), ...(heading !== undefined && { heading }) }, entry.effects, entry.impact)\n\t}\n\tif (!world.zones.length) return\n\t// as they were when the round began: what one does may end another (`endZone`) or make more\n\tconst zones = world.zones.slice()\n\tfor (let i = zones.length - 1; i >= 0; i--) {\n\t\tconst zone = zones[i]\n\t\tif (!world.zones.includes(zone)) continue\n\t\t// one that goes with a unit: where it is, the way it faces; done with it\n\t\tif (zone.follows) {\n\t\t\tconst followed = world.get(zone.follows)\n\t\t\tif (!followed?.alive || followed.hidden) {\n\t\t\t\tendZone(world, zone)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tzone.x = followed.pos.x\n\t\t\tzone.z = followed.pos.z\n\t\t\tzone.from = { x: zone.x, z: zone.z }\n\t\t\tzone.heading = followed.facing\n\t\t}\n\t\tconst { onEnter, onLeave, edge } = zone.effect\n\t\tif (onEnter || onLeave || edge) comesAndGoes(world, zone)\n\t\tif (!world.zones.includes(zone)) continue\n\t\tconst context = zoneContext(world, zone)\n\t\tzone.left -= dt\n\t\tzone.next -= dt\n\t\tif (zone.left <= 0) {\n\t\t\tworld.zones.splice(world.zones.indexOf(zone), 1)\n\t\t\tland(context, zone.effect.onEnd)\n\t\t} else if (zone.next <= 0) {\n\t\t\tzone.next = ZONE_INTERVAL\n\t\t\trun(context, zone.effect.effects)\n\t\t}\n\t}\n}\n\n/**\n * Who comes into a zone and goes out of it (`onEnter`, `onLeave`, `edge`): its own area (`radius`, `shape`) as `affects`\n * says, seen to every round. Those inside as it is laid come in, and have not crossed its edge\n */\nfunction comesAndGoes(world: World, zone: Zone): void {\n\tconst context = zoneContext(world, zone)\n\tconst { effect } = zone\n\tconst now = effectArea(context, effect) ? candidates(context, effect, 'enemies').map((entity) => entity.id) : []\n\tnow.sort((a, b) => a - b)\n\tconst before = zone.inside\n\tzone.inside = now\n\tconst was = new Set(before ?? [])\n\tconst is = new Set(now)\n\tconst to = (id: EntityId, effects: readonly EffectDef[] | undefined) => {\n\t\tconst entity = world.get(id)\n\t\tif (!effects || !entity?.alive || entity.hidden || !world.zones.includes(zone)) return\n\t\trun({ ...context, target: entity, point: { x: entity.pos.x, z: entity.pos.z } }, effects)\n\t}\n\tfor (const id of now) {\n\t\tif (was.has(id)) continue\n\t\tto(id, effect.onEnter)\n\t\tif (before) to(id, effect.edge)\n\t}\n\tfor (const id of before ?? []) {\n\t\tif (is.has(id)) continue\n\t\tto(id, effect.onLeave)\n\t\tto(id, effect.edge)\n\t}\n}\n\n/** What was waiting for a pull to end (its order) starts over from where the unit was dragged to */\nfunction letGo(entity: Entity): void {\n\tconst order = entity.orders[0]\n\tif (order) order.started = false\n}\n\n/** Carries those who rush somewhere towards where they are going. Nothing holds them up, and what it does happens when they arrive */\nexport function updateDashes(world: World, dt: number): void {\n\tfor (const entity of world.index.with(dashing)) {\n\t\tconst dash = entity.get(dashing)\n\t\tif (!dash || !entity.alive) continue\n\t\tconst { pulled } = dash\n\t\t// dragged: after whoever drags it, up to its edge; let go where it is when they are gone\n\t\tconst by = pulled && world.get(pulled.by)\n\t\tlet edge = 0\n\t\tif (pulled?.follows) {\n\t\t\tif (!by?.alive || by.hidden) {\n\t\t\t\tentity.remove(dashing)\n\t\t\t\tletGo(entity)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdash.x = by.pos.x\n\t\t\tdash.z = by.pos.z\n\t\t\tedge = by.def.radius + entity.def.radius\n\t\t}\n\t\tconst gap = dist(entity.pos, dash)\n\t\tconst step = dash.speed * dt\n\t\tif (gap - edge > step) {\n\t\t\tworld.place(entity, { x: entity.pos.x + ((dash.x - entity.pos.x) / gap) * step, z: entity.pos.z + ((dash.z - entity.pos.z) / gap) * step })\n\t\t\tcontinue\n\t\t}\n\t\tif (!edge) world.place(entity, dash)\n\t\telse if (gap > edge)\n\t\t\tworld.place(entity, { x: dash.x + ((entity.pos.x - dash.x) / gap) * edge, z: dash.z + ((entity.pos.z - dash.z) / gap) * edge })\n\t\tentity.remove(dashing)\n\t\tif (dash.buff) removeBuff(world, entity, dash.buff)\n\t\tif (dash.height) touchDown(world, entity)\n\t\tif (pulled) letGo(entity)\n\t\tif (!world.registry.abilities.has(dash.ability)) continue\n\t\tconst ability = world.registry.ability(dash.ability)\n\t\tconst point = { x: entity.pos.x, z: entity.pos.z }\n\t\t// a pull's effects happen to who was pulled, in the name of who pulled it, while they are there\n\t\t// a rush to a unit lands on it, while it is there\n\t\tconst to = dash.target ? world.get(dash.target) : undefined\n\t\tif (!pulled) land({ world, caster: entity, ability, level: dash.level, point, target: to?.alive && !to.hidden ? to : undefined }, dash.effects)\n\t\telse if (by?.alive) land({ world, caster: by, ability, level: dash.level, target: entity, point }, dash.effects)\n\t}\n}\n\n/** A missile reaching what it hits, to those who see what it hits */\nexport const toldMissileHit = replicateEvent(missileHit, 'missileHit', ({ missile, target }, view) =>\n\tview.knows(target) ? { type: 'missileHit', missile: missile.id, target: target.id } : undefined\n)\n\n/** Mana given or taken: its side's alone */\nexport const toldMana = replicateEvent(manaChanged, 'mana', ({ entity, amount, ability }, view) =>\n\tview.isAlly(entity.owner) ? { type: 'mana', id: entity.id, amount, ability } : undefined\n)\n\n/** The missiles of abilities in flight the player is told of: their side's, and those where they see (`Snapshot.missiles`); none to a computer */\nexport const missilesPart = snapshotField('missiles', (view) => {\n\tconst missiles: MissileState[] = []\n\tif (view.forComputer) return missiles\n\tconst { world } = view\n\tfor (const m of world.missiles) {\n\t\tif (!view.isAlly(m.owner) && !view.sees(m.x, m.z)) continue\n\t\tconst source = world.get(m.source)\n\t\tmissiles.push({\n\t\t\tid: m.id,\n\t\t\tability: m.ability,\n\t\t\tlevel: m.level,\n\t\t\tsource: source && view.knows(source) ? source.id : undefined,\n\t\t\tx: m.x,\n\t\t\tz: m.z,\n\t\t\tradius: m.radius,\n\t\t\theading: atan2(m.dx, m.dz),\n\t\t\tforming: m.delay > 0 ? 1 - m.delay / m.forms : undefined,\n\t\t\tprogress: Number.isFinite(m.left) ? m.travelled / (m.travelled + m.left || 1) : undefined,\n\t\t\tarc: m.height || undefined,\n\t\t\treturning: m.returning || undefined,\n\t\t\teffect: effectIndexOf(world, m.ability, m.effect),\n\t\t\t// one its owner turns as it flies: told to its side, whose screen steers it\n\t\t\tsteered: (m.effect.steer && view.isAlly(m.owner)) || undefined\n\t\t})\n\t}\n\treturn missiles\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,IAAM,iBAAiB,OAAc,SAAiB,WACrD,MAAM,SAAS,UAAU,IAAI,OAAO,IAAI,YAAY,MAAM,SAAS,QAAQ,OAAO,GAAG,MAAM,IAAI,KAAA;;;;;;;;;AAoHhG,SAAgB,aACf,KACgB;CAChB,MAAM,EAAE,MAAM,KAAK,GAAG,YAAY;CAClC,MAAM,SAAS,QAAQ,QAAQ,SAAS,UAAW,OAAO,UAAU,WAAY,cAAc,UAAU,CA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;GACX,OAAO,EAAE;GACT,QAAQ,UAAU,KAAK,MAAM,MAAM,IAAI,OAAO,KAAK,KAAA;GACnD,GAAG,EAAE;GACL,GAAG,EAAE;GACL,QAAQ,EAAE;GACV,SAAS,MAAM,EAAE,IAAI,EAAE,EAAE;GACzB,SAAS,EAAE,QAAQ,IAAI,IAAI,EAAE,QAAQ,EAAE,QAAQ,KAAA;GAC/C,UAAU,OAAO,SAAS,EAAE,IAAI,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,KAAK,KAAA;GAChF,KAAK,EAAE,UAAU,KAAA;GACjB,WAAW,EAAE,aAAa,KAAA;GAC1B,QAAQ,cAAc,OAAO,EAAE,SAAS,EAAE,MAAM;GAEhD,SAAU,EAAE,OAAO,SAAS,KAAK,OAAO,EAAE,KAAK,KAAM,KAAA;EACtD,CAAC;CACF;CACA,OAAO;AACR,CAAC"}
@@ -2,10 +2,44 @@ import { type EffectDef } from '#engine/defs';
2
2
  import type { BuffInstance, Entity } from '#engine/entity';
3
3
  import type { World } from '#engine/world';
4
4
  import type { EffectContext } from './effects';
5
- /** Runs each effect of a list by its handler (`registry.effect`) */
6
- export declare function run(context: EffectContext, effects: EffectDef[] | undefined): void;
7
- /** What something an ability set off does where it arrives, and the word to everyone that it did */
8
- export declare function land(context: EffectContext, effects: EffectDef[] | undefined, impact?: string): void;
5
+ import type { Vec2 } from '#engine/math';
6
+ /**
7
+ * Where the effects of a context go off from: its `origin` (an entity's place, or the place given), or the caster's
8
+ *
9
+ * @beta
10
+ */
11
+ export declare function effectOrigin(context: Pick<EffectContext, 'caster' | 'origin'>): Vec2;
12
+ /**
13
+ * Runs each effect of a list by its handler (`registry.effect`), as the list runs (`lowerChain`): what waits for a
14
+ * moment (`EffectCommon.when`) put into what it waits on, what happens by `chance` when the draw says. Every list of effects the engine runs comes through here.
15
+ * A game's own effect with effects of its own runs them with this (`runEffects`), as the engine's do
16
+ */
17
+ export declare function run(context: EffectContext, effects: readonly EffectDef[] | undefined): void;
18
+ /** What `effectTargets` gave the effect being run, to be told once its handler is done (`effectLanded`) */
19
+ export declare function reached(targets: readonly Entity[]): void;
20
+ /**
21
+ * What something an ability set off does where it arrives, and the word to everyone that it did (the strike every
22
+ * screen that sees it hears, `abilityImpact`). From the context's `origin`, where it has one
23
+ */
24
+ export declare function land(context: EffectContext, effects: readonly EffectDef[] | undefined, impact?: string): void;
25
+ /**
26
+ * Runs a list of effects as the engine runs every list (`EffectDef[]`): each by its handler, in the order of its
27
+ * chain (`EffectCommon.when` lowered into what it waits on). What a game's own effect does with the effects it holds
28
+ * (`defineEffect({ type: 'orb', run: (context, effect) => runEffects(context, effect.effects) })`), and a hook or a
29
+ * system with a context it puts together (`EffectContext`: the caster whose they are, the ability, the place, an
30
+ * `origin` they go off from). Nothing is told: `landEffects` is for where something arrives
31
+ *
32
+ * @beta
33
+ */
34
+ export declare const runEffects: (context: EffectContext, effects: readonly EffectDef[] | undefined) => void;
35
+ /**
36
+ * Runs a list of effects where something arrived (`runEffects`), and tells everyone who sees it that it struck there
37
+ * (`abilityImpact`, the `strike` a screen's spell styles draw): what a game's own missile, wave or ball does where it
38
+ * hits. `impact`: the name the strike goes by, when not the ability's (`EffectFields.impact`)
39
+ *
40
+ * @beta
41
+ */
42
+ export declare const landEffects: (context: EffectContext, effects: readonly EffectDef[] | undefined, impact?: string) => void;
9
43
  /**
10
44
  * Effects of a buff on its carrier (`onApply`, `onTick`), in the name of who put it there, while they live: from the
11
45
  * ability it came from, or from the buff itself for one put on otherwise
@@ -0,0 +1,189 @@
1
+ import { declaredAt, lowerChain } from "../defs.js";
2
+ import { abilityImpact } from "../engineEvents.js";
3
+ import { replicateEvent } from "../replication.js";
4
+ import { fromProxies } from "../proxies.js";
5
+ import { byChance } from "./chance.js";
6
+ import { effectIndex, effectOfList } from "./effectIndex.js";
7
+ //#region src/abilities/land.ts
8
+ /**
9
+ * Effects landing: each of a list run by its handler (`registry.effect`), and the word to everyone that they did; and a
10
+ * buff's own effects (`onApply`, `onTick`, `onEnd`) in the name of who put it there. What the effects (`effects.ts`)
11
+ * and the buffs (`buffs.ts`) both do, each of them importing this and not the other: an effect puts a buff on, and a
12
+ * buff runs effects
13
+ */
14
+ /**
15
+ * Where the effects of a context go off from: its `origin` (an entity's place, or the place given), or the caster's
16
+ *
17
+ * @beta
18
+ */
19
+ function effectOrigin(context) {
20
+ const { origin, caster } = context;
21
+ if (!origin) return caster.pos;
22
+ return "pos" in origin ? origin.pos : origin;
23
+ }
24
+ /** The widest of what a list of effects covers, for whoever draws it */
25
+ var reach = (effects, level) => (effects ?? []).reduce((max, effect) => Math.max(max, declaredAt(effect.radius, level)), 0);
26
+ /**
27
+ * Runs each effect of a list by its handler (`registry.effect`), as the list runs (`lowerChain`): what waits for a
28
+ * moment (`EffectCommon.when`) put into what it waits on, what happens by `chance` when the draw says. Every list of effects the engine runs comes through here.
29
+ * A game's own effect with effects of its own runs them with this (`runEffects`), as the engine's do
30
+ */
31
+ function run(context, effects) {
32
+ if (!effects) return;
33
+ for (const effect of lowerChain(effects)) {
34
+ if (effect.chance !== void 0 && effect.type !== "if" && !byChance(context, effect.chance, context.target)) continue;
35
+ if (effect.origin) fromProxies(context, effect, (from) => runOne(from, effect));
36
+ else runOne(context, effect);
37
+ }
38
+ }
39
+ /** One effect run by its handler, and whom it reached told (`effectLanded`) where a game listens */
40
+ function runOne(context, effect) {
41
+ const { world } = context;
42
+ if (!world.hooks.has("effectLanded")) {
43
+ world.registry.effect(effect.type)(context, effect);
44
+ return;
45
+ }
46
+ const frame = [];
47
+ reaching.push(frame);
48
+ try {
49
+ world.registry.effect(effect.type)(context, effect);
50
+ } finally {
51
+ reaching.pop();
52
+ }
53
+ const { caster, ability, level, origin, point } = context;
54
+ for (const target of frame) world.hooks.run("effectLanded", {
55
+ caster,
56
+ ability,
57
+ level,
58
+ effect,
59
+ target,
60
+ origin,
61
+ point
62
+ });
63
+ }
64
+ /** Who the effects being run reach, one list for each running while `effectLanded` has handlers: the innermost last */
65
+ var reaching = [];
66
+ /** What `effectTargets` gave the effect being run, to be told once its handler is done (`effectLanded`) */
67
+ function reached(targets) {
68
+ const frame = reaching[reaching.length - 1];
69
+ if (frame) for (const target of targets) frame.push(target);
70
+ }
71
+ /**
72
+ * What something an ability set off does where it arrives, and the word to everyone that it did (the strike every
73
+ * screen that sees it hears, `abilityImpact`). From the context's `origin`, where it has one
74
+ */
75
+ function land(context, effects, impact) {
76
+ const { world, caster, ability, level, target, point, origin } = context;
77
+ const now = effects && lowerChain(effects);
78
+ run(context, now);
79
+ const from = origin && effectOrigin(context);
80
+ const by = effectOfList(ability, effects);
81
+ world.events.emit(abilityImpact, {
82
+ caster,
83
+ ability,
84
+ level,
85
+ target,
86
+ point,
87
+ radius: reach(now, level),
88
+ impact,
89
+ ...from && { from: {
90
+ x: from.x,
91
+ z: from.z
92
+ } },
93
+ ...by && { effect: by }
94
+ });
95
+ }
96
+ /**
97
+ * Runs a list of effects as the engine runs every list (`EffectDef[]`): each by its handler, in the order of its
98
+ * chain (`EffectCommon.when` lowered into what it waits on). What a game's own effect does with the effects it holds
99
+ * (`defineEffect({ type: 'orb', run: (context, effect) => runEffects(context, effect.effects) })`), and a hook or a
100
+ * system with a context it puts together (`EffectContext`: the caster whose they are, the ability, the place, an
101
+ * `origin` they go off from). Nothing is told: `landEffects` is for where something arrives
102
+ *
103
+ * @beta
104
+ */
105
+ var runEffects = run;
106
+ /**
107
+ * Runs a list of effects where something arrived (`runEffects`), and tells everyone who sees it that it struck there
108
+ * (`abilityImpact`, the `strike` a screen's spell styles draw): what a game's own missile, wave or ball does where it
109
+ * hits. `impact`: the name the strike goes by, when not the ability's (`EffectFields.impact`)
110
+ *
111
+ * @beta
112
+ */
113
+ var landEffects = land;
114
+ /**
115
+ * Effects of a buff on its carrier (`onApply`, `onTick`), in the name of who put it there, while they live: from the
116
+ * ability it came from, or from the buff itself for one put on otherwise
117
+ */
118
+ function buffEffects(world, carrier, instance, effects) {
119
+ const source = world.get(instance.source);
120
+ if (!source?.alive) return;
121
+ const def = world.registry.buff(instance.id);
122
+ const ability = instance.ability && world.registry.abilities.has(instance.ability) ? world.registry.ability(instance.ability) : {
123
+ id: instance.id,
124
+ name: def.name,
125
+ target: "unit"
126
+ };
127
+ const point = {
128
+ x: carrier.pos.x,
129
+ z: carrier.pos.z
130
+ };
131
+ land({
132
+ world,
133
+ caster: source,
134
+ ability,
135
+ level: instance.level,
136
+ target: carrier,
137
+ point,
138
+ stacks: instance.stacks ?? 0
139
+ }, effects);
140
+ }
141
+ /**
142
+ * What a buff that ran out leaves behind: its `onEnd`, in the name of who put it there
143
+ *
144
+ * @beta
145
+ */
146
+ function buffEnded(world, carrier, instance) {
147
+ const def = world.registry.buff(instance.id);
148
+ const source = world.get(instance.source);
149
+ if (!def.onEnd || !source?.alive || !instance.ability || !world.registry.abilities.has(instance.ability)) return;
150
+ const ability = world.registry.ability(instance.ability);
151
+ const point = {
152
+ x: carrier.pos.x,
153
+ z: carrier.pos.z
154
+ };
155
+ land({
156
+ world,
157
+ caster: source,
158
+ ability,
159
+ level: instance.level,
160
+ target: carrier,
161
+ point,
162
+ stacks: instance.stacks ?? 0
163
+ }, def.onEnd);
164
+ }
165
+ /** Where a spell lands, to those who see the caster or the spot */
166
+ var toldStrike = replicateEvent(abilityImpact, "strike", ({ caster, ability, level, target, point, radius, impact, from, effect }, view) => {
167
+ if (!view.knows(caster) && !view.sees(point.x, point.z)) return void 0;
168
+ const index = effect && effectIndex(ability, effect);
169
+ return {
170
+ type: "strike",
171
+ id: view.knows(caster) ? caster.id : void 0,
172
+ ability: ability.id,
173
+ level,
174
+ x: point.x,
175
+ z: point.z,
176
+ target: target && view.knows(target) ? target.id : void 0,
177
+ radius: radius || void 0,
178
+ impact,
179
+ ...from && { from: {
180
+ x: from.x,
181
+ z: from.z
182
+ } },
183
+ ...index !== void 0 && { effect: index }
184
+ };
185
+ });
186
+ //#endregion
187
+ export { buffEffects, buffEnded, effectOrigin, land, landEffects, reached, run, runEffects, toldStrike };
188
+
189
+ //# sourceMappingURL=land.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.js","names":[],"sources":["../../src/abilities/land.ts"],"sourcesContent":["/**\n * Effects landing: each of a list run by its handler (`registry.effect`), and the word to everyone that they did; and a\n * buff's own effects (`onApply`, `onTick`, `onEnd`) in the name of who put it there. What the effects (`effects.ts`)\n * and the buffs (`buffs.ts`) both do, each of them importing this and not the other: an effect puts a buff on, and a\n * buff runs effects\n */\nimport { abilityImpact } from '#engine/engineEvents'\nimport { type AbilityDef, declaredAt, type EffectDef, lowerChain } from '#engine/defs'\nimport type { BuffInstance, Entity } from '#engine/entity'\nimport type { World } from '#engine/world'\nimport type { EffectContext } from './effects'\nimport type { Vec2 } from '#engine/math'\nimport { replicateEvent } from '../replication'\nimport { fromProxies } from '../proxies'\nimport { byChance } from './chance'\nimport { effectIndex, effectOfList } from './effectIndex'\n\n/**\n * Where the effects of a context go off from: its `origin` (an entity's place, or the place given), or the caster's\n *\n * @beta\n */\nexport function effectOrigin(context: Pick<EffectContext, 'caster' | 'origin'>): Vec2 {\n\tconst { origin, caster } = context\n\tif (!origin) return caster.pos\n\treturn 'pos' in origin ? (origin as Entity).pos : origin\n}\n\n/** The widest of what a list of effects covers, for whoever draws it */\nconst reach = (effects: readonly EffectDef[] | undefined, level: number) =>\n\t(effects ?? []).reduce((max, effect) => Math.max(max, declaredAt(effect.radius, level)), 0)\n\n/**\n * Runs each effect of a list by its handler (`registry.effect`), as the list runs (`lowerChain`): what waits for a\n * moment (`EffectCommon.when`) put into what it waits on, what happens by `chance` when the draw says. Every list of effects the engine runs comes through here.\n * A game's own effect with effects of its own runs them with this (`runEffects`), as the engine's do\n */\nexport function run(context: EffectContext, effects: readonly EffectDef[] | undefined): void {\n\tif (!effects) return\n\tfor (const effect of lowerChain(effects)) {\n\t\t// one that happens by chance, drawn once as its list runs (an `if` draws its own, for each it asks of)\n\t\tif (effect.chance !== undefined && effect.type !== 'if' && !byChance(context, effect.chance, context.target)) continue\n\t\t// from units of the caster's (AB17): once from each it picks\n\t\tif (effect.origin) fromProxies(context, effect, (from) => runOne(from, effect))\n\t\telse runOne(context, effect)\n\t}\n}\n\n/** One effect run by its handler, and whom it reached told (`effectLanded`) where a game listens */\nfunction runOne(context: EffectContext, effect: EffectDef): void {\n\tconst { world } = context\n\tif (!world.hooks.has('effectLanded')) {\n\t\tworld.registry.effect(effect.type)(context, effect)\n\t\treturn\n\t}\n\t// whom its handler reaches (`effectTargets`), each told once it is done\n\tconst frame: Entity[] = []\n\treaching.push(frame)\n\ttry {\n\t\tworld.registry.effect(effect.type)(context, effect)\n\t} finally {\n\t\treaching.pop()\n\t}\n\tconst { caster, ability, level, origin, point } = context\n\tfor (const target of frame) world.hooks.run('effectLanded', { caster, ability, level, effect, target, origin, point })\n}\n\n/** Who the effects being run reach, one list for each running while `effectLanded` has handlers: the innermost last */\nconst reaching: Entity[][] = []\n\n/** What `effectTargets` gave the effect being run, to be told once its handler is done (`effectLanded`) */\nexport function reached(targets: readonly Entity[]): void {\n\tconst frame = reaching[reaching.length - 1]\n\tif (frame) for (const target of targets) frame.push(target)\n}\n\n/**\n * What something an ability set off does where it arrives, and the word to everyone that it did (the strike every\n * screen that sees it hears, `abilityImpact`). From the context's `origin`, where it has one\n */\nexport function land(context: EffectContext, effects: readonly EffectDef[] | undefined, impact?: string): void {\n\tconst { world, caster, ability, level, target, point, origin } = context\n\tconst now = effects && lowerChain(effects)\n\trun(context, now)\n\tconst from = origin && effectOrigin(context)\n\tconst by = effectOfList(ability, effects)\n\tworld.events.emit(abilityImpact, {\n\t\tcaster,\n\t\tability,\n\t\tlevel,\n\t\ttarget,\n\t\tpoint,\n\t\tradius: reach(now, level),\n\t\timpact,\n\t\t...(from && { from: { x: from.x, z: from.z } }),\n\t\t...(by && { effect: by })\n\t})\n}\n\n/**\n * Runs a list of effects as the engine runs every list (`EffectDef[]`): each by its handler, in the order of its\n * chain (`EffectCommon.when` lowered into what it waits on). What a game's own effect does with the effects it holds\n * (`defineEffect({ type: 'orb', run: (context, effect) => runEffects(context, effect.effects) })`), and a hook or a\n * system with a context it puts together (`EffectContext`: the caster whose they are, the ability, the place, an\n * `origin` they go off from). Nothing is told: `landEffects` is for where something arrives\n *\n * @beta\n */\nexport const runEffects: (context: EffectContext, effects: readonly EffectDef[] | undefined) => void = run\n\n/**\n * Runs a list of effects where something arrived (`runEffects`), and tells everyone who sees it that it struck there\n * (`abilityImpact`, the `strike` a screen's spell styles draw): what a game's own missile, wave or ball does where it\n * hits. `impact`: the name the strike goes by, when not the ability's (`EffectFields.impact`)\n *\n * @beta\n */\nexport const landEffects: (context: EffectContext, effects: readonly EffectDef[] | undefined, impact?: string) => void = land\n\n/**\n * Effects of a buff on its carrier (`onApply`, `onTick`), in the name of who put it there, while they live: from the\n * ability it came from, or from the buff itself for one put on otherwise\n */\nexport function buffEffects(world: World, carrier: Entity, instance: BuffInstance, effects: EffectDef[]): void {\n\tconst source = world.get(instance.source)\n\tif (!source?.alive) return\n\tconst def = world.registry.buff(instance.id)\n\tconst ability =\n\t\tinstance.ability && world.registry.abilities.has(instance.ability)\n\t\t\t? world.registry.ability(instance.ability)\n\t\t\t: ({ id: instance.id, name: def.name, target: 'unit' } as AbilityDef)\n\tconst point = { x: carrier.pos.x, z: carrier.pos.z }\n\tland({ world, caster: source, ability, level: instance.level, target: carrier, point, stacks: instance.stacks ?? 0 }, effects)\n}\n\n/**\n * What a buff that ran out leaves behind: its `onEnd`, in the name of who put it there\n *\n * @beta\n */\nexport function buffEnded(world: World, carrier: Entity, instance: BuffInstance): void {\n\tconst def = world.registry.buff(instance.id)\n\tconst source = world.get(instance.source)\n\tif (!def.onEnd || !source?.alive || !instance.ability || !world.registry.abilities.has(instance.ability)) return\n\tconst ability = world.registry.ability(instance.ability)\n\tconst point = { x: carrier.pos.x, z: carrier.pos.z }\n\tland({ world, caster: source, ability, level: instance.level, target: carrier, point, stacks: instance.stacks ?? 0 }, def.onEnd)\n}\n\n/** Where a spell lands, to those who see the caster or the spot */\nexport const toldStrike = replicateEvent(abilityImpact, 'strike', ({ caster, ability, level, target, point, radius, impact, from, effect }, view) => {\n\tif (!view.knows(caster) && !view.sees(point.x, point.z)) return undefined\n\tconst index = effect && effectIndex(ability, effect)\n\treturn {\n\t\ttype: 'strike',\n\t\tid: view.knows(caster) ? caster.id : undefined,\n\t\tability: ability.id,\n\t\tlevel,\n\t\tx: point.x,\n\t\tz: point.z,\n\t\ttarget: target && view.knows(target) ? target.id : undefined,\n\t\tradius: radius || undefined,\n\t\timpact,\n\t\t...(from && { from: { x: from.x, z: from.z } }),\n\t\t...(index !== undefined && { effect: index })\n\t}\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,SAAgB,aAAa,SAAyD;CACrF,MAAM,EAAE,QAAQ,WAAW;CAC3B,IAAI,CAAC,QAAQ,OAAO,OAAO;CAC3B,OAAO,SAAS,SAAU,OAAkB,MAAM;AACnD;;AAGA,IAAM,SAAS,SAA2C,WACxD,WAAW,CAAC,EAAA,CAAG,QAAQ,KAAK,WAAW,KAAK,IAAI,KAAK,WAAW,OAAO,QAAQ,KAAK,CAAC,GAAG,CAAC;;;;;;AAO3F,SAAgB,IAAI,SAAwB,SAAiD;CAC5F,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,UAAU,WAAW,OAAO,GAAG;EAEzC,IAAI,OAAO,WAAW,KAAA,KAAa,OAAO,SAAS,QAAQ,CAAC,SAAS,SAAS,OAAO,QAAQ,QAAQ,MAAM,GAAG;EAE9G,IAAI,OAAO,QAAQ,YAAY,SAAS,SAAS,SAAS,OAAO,MAAM,MAAM,CAAC;OACzE,OAAO,SAAS,MAAM;CAC5B;AACD;;AAGA,SAAS,OAAO,SAAwB,QAAyB;CAChE,MAAM,EAAE,UAAU;CAClB,IAAI,CAAC,MAAM,MAAM,IAAI,cAAc,GAAG;EACrC,MAAM,SAAS,OAAO,OAAO,IAAI,CAAC,CAAC,SAAS,MAAM;EAClD;CACD;CAEA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AAU,KAAK,MAAM,MAAM,IAAI,OAAO,KAAK,KAAA;EACnD,QAAQ,UAAU,KAAA;EAClB;EACA,GAAI,QAAQ,EAAE,MAAM;GAAE,GAAG,KAAK;GAAG,GAAG,KAAK;EAAE,EAAE;EAC7C,GAAI,UAAU,KAAA,KAAa,EAAE,QAAQ,MAAM;CAC5C;AACD,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Recast windows (E2E-PLAN AB8): an ability that may be cast again for a while after it is cast (`AbilityDef.recast`),
3
+ * the window kept on its state (`AbilityState.recast`), the cooldown waiting for its end or not, a recast that goes to
4
+ * the unit the cast marked
5
+ */
6
+ import { type AbilityDef } from '#engine/defs';
7
+ import type { AbilityState, Entity, RecastWindow } from '#engine/entity';
8
+ import type { World } from '#engine/world';
9
+ /**
10
+ * The ability as the next cast of it is: itself, or with its window open (`state.recast`) its recast (`AbilityDef.recast`):
11
+ * aimed as the recast is (`none` for one that goes to a mark), its range, its effects, its mana cost, no health cost, no
12
+ * charges, no wind-up and no channel. The same object every time for an ability. What the order, the button and the
13
+ * aim go by; `state` is an ability's state or what its owner's screen is told of it (`AbilityInfo`)
14
+ *
15
+ * @beta
16
+ */
17
+ export declare function abilityAsCast(ability: AbilityDef, state: {
18
+ readonly recast?: unknown;
19
+ } | undefined): AbilityDef;
20
+ /**
21
+ * The unit a recast goes to (`AbilityRecast.mark`): of those alive and in the world that carry the buff from the caster,
22
+ * the nearest to it, the lowest id among those as near. None when none does
23
+ *
24
+ * @beta
25
+ */
26
+ export declare function markedBy(world: World, caster: Entity, buff: string): Entity | undefined;
27
+ /**
28
+ * Opens an ability's window to be cast again as it is cast (`AbilityDef.recast`): its cooldown, with one that waits for
29
+ * the window (`after`), kept for its end and none meanwhile
30
+ */
31
+ export declare function openRecast(ability: AbilityDef, state: AbilityState): void;
32
+ /** A recast was made: the window closes with the last it holds */
33
+ export declare function recastMade(ability: AbilityDef, state: AbilityState): void;
34
+ /**
35
+ * Closes an ability's window to be cast again before its time, as its last recast or its end does: the cooldown that
36
+ * waited for it starts. What a game's own rule does (the marked one died, a recast the game says was the last). False
37
+ * where the window was not open
38
+ *
39
+ * @beta
40
+ */
41
+ export declare function endRecast(state: AbilityState): boolean;
42
+ /** The window's time passes: closed at its end */
43
+ export declare function tickRecast(state: AbilityState, dt: number): void;
44
+ /** How many recasts are left in an ability's open window, for its owner's button */
45
+ export declare const recastsLeft: (ability: AbilityDef, held: RecastWindow) => number;
@@ -0,0 +1,118 @@
1
+ import { distSq } from "../math.js";
2
+ import { at } from "../defs.js";
3
+ //#region src/abilities/recast.ts
4
+ /**
5
+ * Recast windows (E2E-PLAN AB8): an ability that may be cast again for a while after it is cast (`AbilityDef.recast`),
6
+ * the window kept on its state (`AbilityState.recast`), the cooldown waiting for its end or not, a recast that goes to
7
+ * the unit the cast marked
8
+ */
9
+ /** What each ability is as its recast, made once */
10
+ var asRecast = /* @__PURE__ */ new WeakMap();
11
+ /** The recasts made: one asked again is itself */
12
+ var recasts = /* @__PURE__ */ new WeakSet();
13
+ /**
14
+ * The ability as the next cast of it is: itself, or with its window open (`state.recast`) its recast (`AbilityDef.recast`):
15
+ * aimed as the recast is (`none` for one that goes to a mark), its range, its effects, its mana cost, no health cost, no
16
+ * charges, no wind-up and no channel. The same object every time for an ability. What the order, the button and the
17
+ * aim go by; `state` is an ability's state or what its owner's screen is told of it (`AbilityInfo`)
18
+ *
19
+ * @beta
20
+ */
21
+ function abilityAsCast(ability, state) {
22
+ const { recast } = ability;
23
+ if (!recast || !state?.recast || recasts.has(ability)) return ability;
24
+ let made = asRecast.get(ability);
25
+ if (!made) {
26
+ made = {
27
+ ...ability,
28
+ target: recast.mark ? "none" : recast.target ?? ability.target,
29
+ range: recast.range ?? ability.range,
30
+ effects: recast.effects ?? ability.effects,
31
+ manaCost: recast.manaCost,
32
+ healthCost: void 0,
33
+ charges: void 0,
34
+ charge: void 0,
35
+ castTime: void 0,
36
+ castTimeOf: void 0,
37
+ channel: void 0,
38
+ hold: void 0
39
+ };
40
+ asRecast.set(ability, made);
41
+ recasts.add(made);
42
+ }
43
+ return made;
44
+ }
45
+ /**
46
+ * The unit a recast goes to (`AbilityRecast.mark`): of those alive and in the world that carry the buff from the caster,
47
+ * the nearest to it, the lowest id among those as near. None when none does
48
+ *
49
+ * @beta
50
+ */
51
+ function markedBy(world, caster, buff) {
52
+ let found;
53
+ let nearest = Infinity;
54
+ for (const entity of world.units.values()) {
55
+ if (!entity.alive || entity.hidden || !entity.buffs.some((instance) => instance.id === buff && instance.source === caster.id)) continue;
56
+ const far = distSq(entity.pos, caster.pos);
57
+ if (far > nearest || far === nearest && found && entity.id > found.id) continue;
58
+ nearest = far;
59
+ found = entity;
60
+ }
61
+ return found;
62
+ }
63
+ /**
64
+ * Opens an ability's window to be cast again as it is cast (`AbilityDef.recast`): its cooldown, with one that waits for
65
+ * the window (`after`), kept for its end and none meanwhile
66
+ */
67
+ function openRecast(ability, state) {
68
+ const { recast } = ability;
69
+ if (!recast) return;
70
+ const seconds = at(recast.window, state.level);
71
+ const opened = {
72
+ left: seconds,
73
+ total: seconds,
74
+ used: 0
75
+ };
76
+ if ((recast.cooldown ?? "after") === "after") {
77
+ opened.cooldown = state.cooldown;
78
+ state.cooldown = 0;
79
+ }
80
+ state.recast = opened;
81
+ }
82
+ /** A recast was made: the window closes with the last it holds */
83
+ function recastMade(ability, state) {
84
+ const held = state.recast;
85
+ if (!held) return;
86
+ held.used++;
87
+ if (held.used >= (ability.recast?.count ?? 1)) closeRecast(state);
88
+ }
89
+ /**
90
+ * Closes an ability's window to be cast again before its time, as its last recast or its end does: the cooldown that
91
+ * waited for it starts. What a game's own rule does (the marked one died, a recast the game says was the last). False
92
+ * where the window was not open
93
+ *
94
+ * @beta
95
+ */
96
+ function endRecast(state) {
97
+ if (!state.recast) return false;
98
+ closeRecast(state);
99
+ return true;
100
+ }
101
+ function closeRecast(state) {
102
+ const { cooldown } = state.recast;
103
+ delete state.recast;
104
+ if (cooldown !== void 0) state.cooldown = Math.max(state.cooldown, cooldown);
105
+ }
106
+ /** The window's time passes: closed at its end */
107
+ function tickRecast(state, dt) {
108
+ const held = state.recast;
109
+ if (!held) return;
110
+ held.left -= dt;
111
+ if (held.left <= 0) closeRecast(state);
112
+ }
113
+ /** How many recasts are left in an ability's open window, for its owner's button */
114
+ var recastsLeft = (ability, held) => Math.max((ability.recast?.count ?? 1) - held.used, 0);
115
+ //#endregion
116
+ export { abilityAsCast, endRecast, markedBy, openRecast, recastMade, recastsLeft, tickRecast };
117
+
118
+ //# sourceMappingURL=recast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recast.js","names":[],"sources":["../../src/abilities/recast.ts"],"sourcesContent":["/**\n * Recast windows (E2E-PLAN AB8): an ability that may be cast again for a while after it is cast (`AbilityDef.recast`),\n * the window kept on its state (`AbilityState.recast`), the cooldown waiting for its end or not, a recast that goes to\n * the unit the cast marked\n */\nimport { type AbilityDef, at } from '#engine/defs'\nimport type { AbilityState, Entity, RecastWindow } from '#engine/entity'\nimport { distSq } from '#engine/math'\nimport type { World } from '#engine/world'\n\n/** What each ability is as its recast, made once */\nconst asRecast = new WeakMap<AbilityDef, AbilityDef>()\n/** The recasts made: one asked again is itself */\nconst recasts = new WeakSet<AbilityDef>()\n\n/**\n * The ability as the next cast of it is: itself, or with its window open (`state.recast`) its recast (`AbilityDef.recast`):\n * aimed as the recast is (`none` for one that goes to a mark), its range, its effects, its mana cost, no health cost, no\n * charges, no wind-up and no channel. The same object every time for an ability. What the order, the button and the\n * aim go by; `state` is an ability's state or what its owner's screen is told of it (`AbilityInfo`)\n *\n * @beta\n */\nexport function abilityAsCast(ability: AbilityDef, state: { readonly recast?: unknown } | undefined): AbilityDef {\n\tconst { recast } = ability\n\tif (!recast || !state?.recast || recasts.has(ability)) return ability\n\tlet made = asRecast.get(ability)\n\tif (!made) {\n\t\tmade = {\n\t\t\t...ability,\n\t\t\ttarget: recast.mark ? 'none' : (recast.target ?? ability.target),\n\t\t\trange: recast.range ?? ability.range,\n\t\t\teffects: recast.effects ?? ability.effects,\n\t\t\tmanaCost: recast.manaCost,\n\t\t\thealthCost: undefined,\n\t\t\tcharges: undefined,\n\t\t\tcharge: undefined,\n\t\t\tcastTime: undefined,\n\t\t\tcastTimeOf: undefined,\n\t\t\tchannel: undefined,\n\t\t\thold: undefined\n\t\t}\n\t\tasRecast.set(ability, made)\n\t\trecasts.add(made)\n\t}\n\treturn made\n}\n\n/**\n * The unit a recast goes to (`AbilityRecast.mark`): of those alive and in the world that carry the buff from the caster,\n * the nearest to it, the lowest id among those as near. None when none does\n *\n * @beta\n */\nexport function markedBy(world: World, caster: Entity, buff: string): Entity | undefined {\n\tlet found: Entity | undefined\n\tlet nearest = Infinity\n\tfor (const entity of world.units.values()) {\n\t\tif (!entity.alive || entity.hidden || !entity.buffs.some((instance) => instance.id === buff && instance.source === caster.id)) continue\n\t\tconst far = distSq(entity.pos, caster.pos)\n\t\tif (far > nearest || (far === nearest && found && entity.id > found.id)) continue\n\t\tnearest = far\n\t\tfound = entity\n\t}\n\treturn found\n}\n\n/**\n * Opens an ability's window to be cast again as it is cast (`AbilityDef.recast`): its cooldown, with one that waits for\n * the window (`after`), kept for its end and none meanwhile\n */\nexport function openRecast(ability: AbilityDef, state: AbilityState): void {\n\tconst { recast } = ability\n\tif (!recast) return\n\tconst seconds = at(recast.window, state.level)\n\tconst opened: RecastWindow = { left: seconds, total: seconds, used: 0 }\n\tif ((recast.cooldown ?? 'after') === 'after') {\n\t\topened.cooldown = state.cooldown\n\t\tstate.cooldown = 0\n\t}\n\tstate.recast = opened\n}\n\n/** A recast was made: the window closes with the last it holds */\nexport function recastMade(ability: AbilityDef, state: AbilityState): void {\n\tconst held = state.recast\n\tif (!held) return\n\theld.used++\n\tif (held.used >= (ability.recast?.count ?? 1)) closeRecast(state)\n}\n\n/**\n * Closes an ability's window to be cast again before its time, as its last recast or its end does: the cooldown that\n * waited for it starts. What a game's own rule does (the marked one died, a recast the game says was the last). False\n * where the window was not open\n *\n * @beta\n */\nexport function endRecast(state: AbilityState): boolean {\n\tif (!state.recast) return false\n\tcloseRecast(state)\n\treturn true\n}\n\nfunction closeRecast(state: AbilityState): void {\n\tconst { cooldown } = state.recast!\n\tdelete state.recast\n\tif (cooldown !== undefined) state.cooldown = Math.max(state.cooldown, cooldown)\n}\n\n/** The window's time passes: closed at its end */\nexport function tickRecast(state: AbilityState, dt: number): void {\n\tconst held = state.recast\n\tif (!held) return\n\theld.left -= dt\n\tif (held.left <= 0) closeRecast(state)\n}\n\n/** How many recasts are left in an ability's open window, for its owner's button */\nexport const recastsLeft = (ability: AbilityDef, held: RecastWindow): number => Math.max((ability.recast?.count ?? 1) - held.used, 0)\n"],"mappings":";;;;;;;;;AAWA,IAAM,2BAAW,IAAI,QAAgC;;AAErD,IAAM,0BAAU,IAAI,QAAoB;;;;;;;;;AAUxC,SAAgB,cAAc,SAAqB,OAA8D;CAChH,MAAM,EAAE,WAAW;CACnB,IAAI,CAAC,UAAU,CAAC,OAAO,UAAU,QAAQ,IAAI,OAAO,GAAG,OAAO;CAC9D,IAAI,OAAO,SAAS,IAAI,OAAO;CAC/B,IAAI,CAAC,MAAM;EACV,OAAO;GACN,GAAG;GACH,QAAQ,OAAO,OAAO,SAAU,OAAO,UAAU,QAAQ;GACzD,OAAO,OAAO,SAAS,QAAQ;GAC/B,SAAS,OAAO,WAAW,QAAQ;GACnC,UAAU,OAAO;GACjB,YAAY,KAAA;GACZ,SAAS,KAAA;GACT,QAAQ,KAAA;GACR,UAAU,KAAA;GACV,YAAY,KAAA;GACZ,SAAS,KAAA;GACT,MAAM,KAAA;EACP;EACA,SAAS,IAAI,SAAS,IAAI;EAC1B,QAAQ,IAAI,IAAI;CACjB;CACA,OAAO;AACR;;;;;;;AAQA,SAAgB,SAAS,OAAc,QAAgB,MAAkC;CACxF,IAAI;CACJ,IAAI,UAAU;CACd,KAAK,MAAM,UAAU,MAAM,MAAM,OAAO,GAAG;EAC1C,IAAI,CAAC,OAAO,SAA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 -0,0 +1,40 @@
1
+ import { baseStats } from "../defs.js";
2
+ import { statsOf } from "../stats.js";
3
+ import { heroOf } from "../hero.js";
4
+ import { scaledParts } from "./text.js";
5
+ //#region src/abilities/scaled.ts
6
+ /**
7
+ * What an ability's numbers come to for the unit that casts it: the parts that grow with its stats, its level as a hero,
8
+ * its own attack (`Scaling`). Above the stats (`stats.ts`), which know nothing of heroes: a hero's level is the heroes
9
+ * pack's
10
+ */
11
+ /**
12
+ * An amount with what the stats of the caster, and the levels of a hero, add to it
13
+ *
14
+ * @beta
15
+ */
16
+ function scaled(world, caster, amount, scaling, level) {
17
+ if (!scaling) return amount;
18
+ return scaledParts(amount, scaling, level, casterFacts(world, caster)).total;
19
+ }
20
+ /**
21
+ * What an entity brings to the numbers of its abilities, now (see `CasterFacts`)
22
+ *
23
+ * @beta
24
+ */
25
+ function casterFacts(world, caster) {
26
+ return {
27
+ stats: statsOf(world, caster),
28
+ heroLevel: heroOf(caster)?.level ?? 1,
29
+ ownAttackDamage: ownAttackDamage(world, caster)
30
+ };
31
+ }
32
+ /** The attack damage an entity has from its type and its levels, with nothing it carries or that is on it */
33
+ function ownAttackDamage(world, entity) {
34
+ const grown = ((heroOf(entity)?.level ?? 1) - 1) * (entity.def.hero?.growth.stats?.attackDamage ?? 0);
35
+ return baseStats(entity.def, world.registry).attackDamage + grown;
36
+ }
37
+ //#endregion
38
+ export { casterFacts, scaled };
39
+
40
+ //# sourceMappingURL=scaled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaled.js","names":[],"sources":["../../src/abilities/scaled.ts"],"sourcesContent":["/**\n * What an ability's numbers come to for the unit that casts it: the parts that grow with its stats, its level as a hero,\n * its own attack (`Scaling`). Above the stats (`stats.ts`), which know nothing of heroes: a hero's level is the heroes\n * pack's\n */\nimport { type CasterFacts, scaledParts } from './text'\nimport { baseStats, type Scaling } from '#engine/defs'\nimport type { Entity } from '#engine/entity'\nimport { heroOf } from '#engine/hero'\nimport { statsOf } from '#engine/stats'\nimport type { World } from '#engine/world'\n\n/**\n * An amount with what the stats of the caster, and the levels of a hero, add to it\n *\n * @beta\n */\nexport function scaled(world: World, caster: Entity, amount: number, scaling: Scaling | undefined, level: number): number {\n\tif (!scaling) return amount\n\t// the same arithmetic as what an ability says it does (`describeAbility`): the two never disagree\n\treturn scaledParts(amount, scaling, level, casterFacts(world, caster)).total\n}\n\n/**\n * What an entity brings to the numbers of its abilities, now (see `CasterFacts`)\n *\n * @beta\n */\nexport function casterFacts(world: World, caster: Entity): CasterFacts {\n\treturn { stats: statsOf(world, caster), heroLevel: heroOf(caster)?.level ?? 1, ownAttackDamage: ownAttackDamage(world, caster) }\n}\n\n/** The attack damage an entity has from its type and its levels, with nothing it carries or that is on it */\nfunction ownAttackDamage(world: World, entity: Entity): number {\n\tconst grown = ((heroOf(entity)?.level ?? 1) - 1) * (entity.def.hero?.growth.stats?.attackDamage ?? 0)\n\treturn baseStats(entity.def, world.registry).attackDamage + grown\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAgB,OAAO,OAAc,QAAgB,QAAgB,SAA8B,OAAuB;CACzH,IAAI,CAAC,SAAS,OAAO;CAErB,OAAO,YAAY,QAAQ,SAAS,OAAO,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC;AACxE;;;;;;AAOA,SAAgB,YAAY,OAAc,QAA6B;CACtE,OAAO;EAAE,OAAO,QAAQ,OAAO,MAAM;EAAG,WAAW,OAAO,MAAM,CAAC,EAAE,SAAS;EAAG,iBAAiB,gBAAgB,OAAO,MAAM;CAAE;AAChI;;AAGA,SAAS,gBAAgB,OAAc,QAAwB;CAC9D,MAAM,UAAU,OAAO,MAAM,CAAC,EAAE,SAAS,KAAK,MAAM,OAAO,IAAI,MAAM,OAAO,OAAO,gBAAgB;CACnG,OAAO,UAAU,OAAO,KAAK,MAAM,QAAQ,CAAC,CAAC,eAAe;AAC7D"}