@v12-engine/engine 0.1.1 → 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.
- package/dist/abilities/amounts.d.ts +28 -0
- package/dist/abilities/amounts.js +74 -0
- package/dist/abilities/amounts.js.map +1 -0
- package/dist/abilities/buffs.d.ts +106 -6
- package/dist/abilities/buffs.js +443 -0
- package/dist/abilities/buffs.js.map +1 -0
- package/dist/abilities/castTold.d.ts +2 -0
- package/dist/abilities/castTold.js +66 -0
- package/dist/abilities/castTold.js.map +1 -0
- package/dist/abilities/chance.d.ts +38 -0
- package/dist/abilities/chance.js +77 -0
- package/dist/abilities/chance.js.map +1 -0
- package/dist/abilities/charges.d.ts +18 -0
- package/dist/abilities/charges.js +101 -0
- package/dist/abilities/charges.js.map +1 -0
- package/dist/abilities/control.d.ts +28 -0
- package/dist/abilities/control.js +113 -0
- package/dist/abilities/control.js.map +1 -0
- package/dist/abilities/dispel.js +51 -0
- package/dist/abilities/dispel.js.map +1 -0
- package/dist/abilities/effectFields.d.ts +1 -1
- package/dist/abilities/effectFields.js +676 -0
- package/dist/abilities/effectFields.js.map +1 -0
- package/dist/abilities/effectIndex.d.ts +27 -0
- package/dist/abilities/effectIndex.js +64 -0
- package/dist/abilities/effectIndex.js.map +1 -0
- package/dist/abilities/effects/buff.d.ts +9 -3
- package/dist/abilities/effects/buff.js +84 -0
- package/dist/abilities/effects/buff.js.map +1 -0
- package/dist/abilities/effects/conditions.d.ts +2 -0
- package/dist/abilities/effects/conditions.js +41 -0
- package/dist/abilities/effects/conditions.js.map +1 -0
- package/dist/abilities/effects/core.js +54 -0
- package/dist/abilities/effects/core.js.map +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -1
- package/dist/abilities/effects/damage.js +43 -0
- package/dist/abilities/effects/damage.js.map +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -2
- package/dist/abilities/effects/heal.js +51 -0
- package/dist/abilities/effects/heal.js.map +1 -0
- package/dist/abilities/effects/missile.d.ts +13 -1
- package/dist/abilities/effects/missile.js +104 -0
- package/dist/abilities/effects/missile.js.map +1 -0
- package/dist/abilities/effects/morph.d.ts +5 -0
- package/dist/abilities/effects/morph.js +43 -0
- package/dist/abilities/effects/morph.js.map +1 -0
- package/dist/abilities/effects/moves.d.ts +16 -4
- package/dist/abilities/effects/moves.js +212 -0
- package/dist/abilities/effects/moves.js.map +1 -0
- package/dist/abilities/effects/passives.d.ts +19 -9
- package/dist/abilities/effects/passives.js +131 -0
- package/dist/abilities/effects/passives.js.map +1 -0
- package/dist/abilities/effects/proxy.d.ts +5 -0
- package/dist/abilities/effects/proxy.js +60 -0
- package/dist/abilities/effects/proxy.js.map +1 -0
- package/dist/abilities/effects/sight.d.ts +2 -2
- package/dist/abilities/effects/sight.js +39 -0
- package/dist/abilities/effects/sight.js.map +1 -0
- package/dist/abilities/effects/spawn.d.ts +5 -2
- package/dist/abilities/effects/spawn.js +40 -0
- package/dist/abilities/effects/spawn.js.map +1 -0
- package/dist/abilities/effects/timed.d.ts +2 -2
- package/dist/abilities/effects/timed.js +96 -0
- package/dist/abilities/effects/timed.js.map +1 -0
- package/dist/abilities/effects/trade.d.ts +1 -1
- package/dist/abilities/effects/trade.js +25 -0
- package/dist/abilities/effects/trade.js.map +1 -0
- package/dist/abilities/effects.d.ts +97 -23
- package/dist/abilities/effects.js +860 -0
- package/dist/abilities/effects.js.map +1 -0
- package/dist/abilities/land.d.ts +38 -4
- package/dist/abilities/land.js +189 -0
- package/dist/abilities/land.js.map +1 -0
- package/dist/abilities/recast.d.ts +45 -0
- package/dist/abilities/recast.js +118 -0
- package/dist/abilities/recast.js.map +1 -0
- package/dist/abilities/scaled.js +40 -0
- package/dist/abilities/scaled.js.map +1 -0
- package/dist/abilities/screen.d.ts +6 -0
- package/dist/abilities/screen.js +83 -0
- package/dist/abilities/screen.js.map +1 -0
- package/dist/abilities/shapes.d.ts +66 -0
- package/dist/abilities/shapes.js +122 -0
- package/dist/abilities/shapes.js.map +1 -0
- package/dist/abilities/text.d.ts +14 -2
- package/dist/abilities/text.js +204 -0
- package/dist/abilities/text.js.map +1 -0
- package/dist/abilities/triggers.d.ts +98 -0
- package/dist/abilities/triggers.js +351 -0
- package/dist/abilities/triggers.js.map +1 -0
- package/dist/abilityChanges.d.ts +131 -0
- package/dist/abilityChanges.js +345 -0
- package/dist/abilityChanges.js.map +1 -0
- package/dist/ai/area.d.ts +4 -1
- package/dist/ai/brain.d.ts +4 -1
- package/dist/ai/brain.js +844 -0
- package/dist/ai/brain.js.map +1 -0
- package/dist/ai/budget.js +74 -0
- package/dist/ai/budget.js.map +1 -0
- package/dist/ai/checks.d.ts +9 -1
- package/dist/ai/checks.js +242 -0
- package/dist/ai/checks.js.map +1 -0
- package/dist/ai/computer.d.ts +11 -4
- package/dist/ai/computer.js +251 -0
- package/dist/ai/computer.js.map +1 -0
- package/dist/ai/defence.d.ts +4 -0
- package/dist/ai/defence.js +430 -0
- package/dist/ai/defence.js.map +1 -0
- package/dist/ai/define.d.ts +3 -2
- package/dist/ai/define.js +31 -0
- package/dist/ai/define.js.map +1 -0
- package/dist/ai/economy.d.ts +10 -7
- package/dist/ai/economy.js +780 -0
- package/dist/ai/economy.js.map +1 -0
- package/dist/ai/geometry.js +38 -0
- package/dist/ai/geometry.js.map +1 -0
- package/dist/ai/goals.d.ts +1 -0
- package/dist/ai/goals.js +560 -0
- package/dist/ai/goals.js.map +1 -0
- package/dist/ai/knowledge.d.ts +72 -7
- package/dist/ai/knowledge.js +804 -0
- package/dist/ai/knowledge.js.map +1 -0
- package/dist/ai/lanes.d.ts +10 -2
- package/dist/ai/lanes.js +715 -0
- package/dist/ai/lanes.js.map +1 -0
- package/dist/ai/melee/build.js +264 -0
- package/dist/ai/melee/build.js.map +1 -0
- package/dist/ai/melee/goals.d.ts +7 -0
- package/dist/ai/melee/goals.js +720 -0
- package/dist/ai/melee/goals.js.map +1 -0
- package/dist/ai/melee/heroes.js +68 -0
- package/dist/ai/melee/heroes.js.map +1 -0
- package/dist/ai/melee/index.d.ts +1 -1
- package/dist/ai/melee/index.js +51 -0
- package/dist/ai/melee/index.js.map +1 -0
- package/dist/ai/melee/production.js +29 -0
- package/dist/ai/melee/production.js.map +1 -0
- package/dist/ai/melee/surrender.js +64 -0
- package/dist/ai/melee/surrender.js.map +1 -0
- package/dist/ai/micro.d.ts +9 -0
- package/dist/ai/micro.js +1316 -0
- package/dist/ai/micro.js.map +1 -0
- package/dist/ai/mission.d.ts +9 -2
- package/dist/ai/mission.js +538 -0
- package/dist/ai/mission.js.map +1 -0
- package/dist/ai/missionRules.d.ts +1 -1
- package/dist/ai/missionRules.js +26 -0
- package/dist/ai/missionRules.js.map +1 -0
- package/dist/ai/module.d.ts +6 -2
- package/dist/ai/module.js +37 -0
- package/dist/ai/module.js.map +1 -0
- package/dist/ai/options.d.ts +3 -3
- package/dist/ai/plans/build.d.ts +20 -1
- package/dist/ai/plans/build.js +608 -0
- package/dist/ai/plans/build.js.map +1 -0
- package/dist/ai/plans/placement.d.ts +4 -1
- package/dist/ai/plans/placement.js +295 -0
- package/dist/ai/plans/placement.js.map +1 -0
- package/dist/ai/plans/plans.d.ts +9 -0
- package/dist/ai/plans/plans.js +110 -0
- package/dist/ai/plans/plans.js.map +1 -0
- package/dist/ai/plans/production.d.ts +14 -2
- package/dist/ai/plans/production.js +434 -0
- package/dist/ai/plans/production.js.map +1 -0
- package/dist/ai/plans/purse.d.ts +6 -3
- package/dist/ai/plans/purse.js +139 -0
- package/dist/ai/plans/purse.js.map +1 -0
- package/dist/ai/plans/tech.d.ts +6 -0
- package/dist/ai/plans/tech.js +122 -0
- package/dist/ai/plans/tech.js.map +1 -0
- package/dist/ai/profiles.d.ts +4 -4
- package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
- package/dist/ai/profiles.js.map +1 -0
- package/dist/ai/reach.js +54 -0
- package/dist/ai/reach.js.map +1 -0
- package/dist/ai/report.d.ts +8 -0
- package/dist/ai/report.js +87 -0
- package/dist/ai/report.js.map +1 -0
- package/dist/ai/roles.d.ts +4 -0
- package/dist/ai/roles.js +207 -0
- package/dist/ai/roles.js.map +1 -0
- package/dist/ai/rules.d.ts +8 -2
- package/dist/ai/rules.js +416 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/scouting.d.ts +6 -0
- package/dist/ai/scouting.js +324 -0
- package/dist/ai/scouting.js.map +1 -0
- package/dist/ai/settings.js +99 -0
- package/dist/ai/settings.js.map +1 -0
- package/dist/ai/squads.d.ts +21 -2
- package/dist/ai/squads.js +916 -0
- package/dist/ai/squads.js.map +1 -0
- package/dist/ai/strength.js +320 -0
- package/dist/ai/strength.js.map +1 -0
- package/dist/ai/task.d.ts +3 -1
- package/dist/ai/task.js +17 -0
- package/dist/ai/task.js.map +1 -0
- package/dist/ai/tasks/attack.js +24 -0
- package/dist/ai/tasks/attack.js.map +1 -0
- package/dist/ai/tasks/capture.d.ts +3 -3
- package/dist/ai/tasks/capture.js +37 -0
- package/dist/ai/tasks/capture.js.map +1 -0
- package/dist/ai/tasks/creep.js +29 -0
- package/dist/ai/tasks/creep.js.map +1 -0
- package/dist/ai/tasks/defend.js +61 -0
- package/dist/ai/tasks/defend.js.map +1 -0
- package/dist/ai/tasks/drop.js +81 -0
- package/dist/ai/tasks/drop.js.map +1 -0
- package/dist/ai/tasks/escort.js +59 -0
- package/dist/ai/tasks/escort.js.map +1 -0
- package/dist/ai/tasks/gather.js +48 -0
- package/dist/ai/tasks/gather.js.map +1 -0
- package/dist/ai/tasks/harass.js +39 -0
- package/dist/ai/tasks/harass.js.map +1 -0
- package/dist/ai/tasks/hold.js +32 -0
- package/dist/ai/tasks/hold.js.map +1 -0
- package/dist/ai/tasks/index.js +34 -0
- package/dist/ai/tasks/index.js.map +1 -0
- package/dist/ai/tasks/move.js +26 -0
- package/dist/ai/tasks/move.js.map +1 -0
- package/dist/ai/tasks/patrol.js +59 -0
- package/dist/ai/tasks/patrol.js.map +1 -0
- package/dist/ai/tasks/retreat.js +28 -0
- package/dist/ai/tasks/retreat.js.map +1 -0
- package/dist/ai/tasks/scout.js +73 -0
- package/dist/ai/tasks/scout.js.map +1 -0
- package/dist/ai/tasks/shared.d.ts +1 -1
- package/dist/ai/tasks/shared.js +137 -0
- package/dist/ai/tasks/shared.js.map +1 -0
- package/dist/ai/team.d.ts +18 -1
- package/dist/ai/team.js +492 -0
- package/dist/ai/team.js.map +1 -0
- package/dist/ai/threat.d.ts +6 -0
- package/dist/ai/threat.js +206 -0
- package/dist/ai/threat.js.map +1 -0
- package/dist/ai/view.d.ts +21 -7
- package/dist/ai/view.js +677 -0
- package/dist/ai/view.js.map +1 -0
- package/dist/ai/waves.d.ts +6 -0
- package/dist/ai/waves.js +410 -0
- package/dist/ai/waves.js.map +1 -0
- package/dist/ai.js +54 -6239
- package/dist/aiTesting.d.ts +6 -3
- package/dist/aiTesting.js +229 -0
- package/dist/aiTesting.js.map +1 -0
- package/dist/areas.d.ts +4 -1
- package/dist/areas.js +295 -0
- package/dist/areas.js.map +1 -0
- package/dist/attacks.d.ts +3 -3
- package/dist/attacks.js +127 -0
- package/dist/attacks.js.map +1 -0
- package/dist/burning.d.ts +267 -0
- package/dist/burning.js +795 -0
- package/dist/burning.js.map +1 -0
- package/dist/bytes.js +21 -0
- package/dist/bytes.js.map +1 -0
- package/dist/callings.d.ts +71 -0
- package/dist/callings.js +157 -0
- package/dist/callings.js.map +1 -0
- package/dist/cameraOrders.d.ts +78 -0
- package/dist/cameraOrders.js +114 -0
- package/dist/cameraOrders.js.map +1 -0
- package/dist/camps.d.ts +70 -4
- package/dist/camps.js +501 -0
- package/dist/camps.js.map +1 -0
- package/dist/capture.d.ts +15 -3
- package/dist/capture.js +304 -0
- package/dist/capture.js.map +1 -0
- package/dist/cellLayers.d.ts +78 -13
- package/dist/cellLayers.js +275 -0
- package/dist/cellLayers.js.map +1 -0
- package/dist/cellPatches.d.ts +24 -0
- package/dist/cellPatches.js +73 -0
- package/dist/cellPatches.js.map +1 -0
- package/dist/cinematics.d.ts +10 -5
- package/dist/cinematics.js +161 -0
- package/dist/cinematics.js.map +1 -0
- package/dist/clock.d.ts +2 -2
- package/dist/clock.js +78 -0
- package/dist/clock.js.map +1 -0
- package/dist/commands.d.ts +36 -4
- package/dist/commands.js +636 -0
- package/dist/commands.js.map +1 -0
- package/dist/components.d.ts +31 -10
- package/dist/components.js +74 -0
- package/dist/components.js.map +1 -0
- package/dist/computers.d.ts +4 -4
- package/dist/computers.js +194 -0
- package/dist/computers.js.map +1 -0
- package/dist/concealment.d.ts +25 -2
- package/dist/concealment.js +409 -0
- package/dist/concealment.js.map +1 -0
- package/dist/coreComponents.js +130 -0
- package/dist/coreComponents.js.map +1 -0
- package/dist/createGame.d.ts +306 -0
- package/dist/createGame.js +405 -0
- package/dist/createGame.js.map +1 -0
- package/dist/dashing.d.ts +18 -2
- package/dist/dashing.js +41 -0
- package/dist/dashing.js.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +5 -3
- package/dist/debug2.js +76 -0
- package/dist/debug2.js.map +1 -0
- package/dist/debugCommands.d.ts +6 -6
- package/dist/debugCommands.js +537 -0
- package/dist/debugCommands.js.map +1 -0
- package/dist/debugging.d.ts +1 -0
- package/dist/defaultSets.d.ts +183 -0
- package/dist/defaultSets.js +216 -0
- package/dist/defaultSets.js.map +1 -0
- package/dist/definitions.d.ts +6 -0
- package/dist/definitions.js +78 -0
- package/dist/definitions.js.map +1 -0
- package/dist/defs.d.ts +1895 -165
- package/dist/defs.js +380 -0
- package/dist/defs.js.map +1 -0
- package/dist/denying.d.ts +4 -4
- package/dist/denying.js +106 -0
- package/dist/denying.js.map +1 -0
- package/dist/destructibles.d.ts +2 -2
- package/dist/destructibles.js +36 -0
- package/dist/destructibles.js.map +1 -0
- package/dist/determinism.d.ts +4 -4
- package/dist/determinism.js +247 -0
- package/dist/determinism.js.map +1 -0
- package/dist/dialog.d.ts +17 -2
- package/dist/dialog.js +108 -0
- package/dist/dialog.js.map +1 -0
- package/dist/effectRefs.js +28 -0
- package/dist/effectRefs.js.map +1 -0
- package/dist/effects.d.ts +27 -11
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/endings.d.ts +1 -1
- package/dist/endings.js +78 -0
- package/dist/endings.js.map +1 -0
- package/dist/engagement.d.ts +40 -6
- package/dist/engagement.js +530 -0
- package/dist/engagement.js.map +1 -0
- package/dist/engineEvents.d.ts +72 -9
- package/dist/engineEvents.js +520 -0
- package/dist/engineEvents.js.map +1 -0
- package/dist/entity.d.ts +275 -26
- package/dist/entity.js +441 -0
- package/dist/entity.js.map +1 -0
- package/dist/entityIndex.d.ts +10 -3
- package/dist/entityIndex.js +149 -0
- package/dist/entityIndex.js.map +1 -0
- package/dist/errors.d.ts +6 -2
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +11 -5
- package/dist/events.js +158 -0
- package/dist/events.js.map +1 -0
- package/dist/exactMath.js +273 -0
- package/dist/exactMath.js.map +1 -0
- package/dist/features.d.ts +1 -1
- package/dist/features.js +127 -0
- package/dist/features.js.map +1 -0
- package/dist/fields.d.ts +25 -5
- package/dist/fields.js +140 -0
- package/dist/fields.js.map +1 -0
- package/dist/fixture.d.ts +3 -3
- package/dist/fixture.js +512 -0
- package/dist/fixture.js.map +1 -0
- package/dist/fog.d.ts +26 -3
- package/dist/fog.js +333 -0
- package/dist/fog.js.map +1 -0
- package/dist/foliage.d.ts +476 -0
- package/dist/foliage.js +1478 -0
- package/dist/foliage.js.map +1 -0
- package/dist/foliageDebug.d.ts +57 -0
- package/dist/foliageDebug.js +172 -0
- package/dist/foliageDebug.js.map +1 -0
- package/dist/foliageRegrowth.d.ts +20 -0
- package/dist/foliageRegrowth.js +332 -0
- package/dist/foliageRegrowth.js.map +1 -0
- package/dist/formState.d.ts +67 -0
- package/dist/formState.js +65 -0
- package/dist/formState.js.map +1 -0
- package/dist/formation.d.ts +46 -8
- package/dist/formation.js +297 -0
- package/dist/formation.js.map +1 -0
- package/dist/forms.d.ts +58 -0
- package/dist/forms.js +146 -0
- package/dist/forms.js.map +1 -0
- package/dist/friendlyFire.d.ts +2 -2
- package/dist/friendlyFire.js +37 -0
- package/dist/friendlyFire.js.map +1 -0
- package/dist/game.d.ts +141 -48
- package/dist/game.js +834 -0
- package/dist/game.js.map +1 -0
- package/dist/gameData.d.ts +96 -22
- package/dist/gameData.js +1690 -0
- package/dist/gameData.js.map +1 -0
- package/dist/gameFiles.d.ts +3 -3
- package/dist/gameFiles.js +14 -0
- package/dist/gameFiles.js.map +1 -0
- package/dist/gates.js +92 -0
- package/dist/gates.js.map +1 -0
- package/dist/generate.d.ts +28 -1
- package/dist/generate.js +1062 -0
- package/dist/generate.js.map +1 -0
- package/dist/generateWorker.d.ts +7 -3
- package/dist/generateWorker.js +86 -0
- package/dist/generateWorker.js.map +1 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +102 -0
- package/dist/grid.js.map +1 -0
- package/dist/ground.d.ts +17 -1
- package/dist/ground.js +375 -0
- package/dist/ground.js.map +1 -0
- package/dist/groundObjects.d.ts +70 -0
- package/dist/groundObjects.js +371 -0
- package/dist/groundObjects.js.map +1 -0
- package/dist/groundSpeed.d.ts +20 -3
- package/dist/groundSpeed.js +117 -0
- package/dist/groundSpeed.js.map +1 -0
- package/dist/hero.d.ts +126 -10
- package/dist/hero.js +432 -0
- package/dist/hero.js.map +1 -0
- package/dist/holds.d.ts +94 -0
- package/dist/holds.js +305 -0
- package/dist/holds.js.map +1 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +30 -0
- package/dist/home.js.map +1 -0
- package/dist/hooks.d.ts +339 -57
- package/dist/hooks.js +105 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hotReload.d.ts +6 -5
- package/dist/hotReload.js +145 -0
- package/dist/hotReload.js.map +1 -0
- package/dist/ids.d.ts +3 -3
- package/dist/ids.js +30 -0
- package/dist/ids.js.map +1 -0
- package/dist/idsFile.d.ts +36 -0
- package/dist/idsFile.js +134 -0
- package/dist/idsFile.js.map +1 -0
- package/dist/index.d.ts +105 -68
- package/dist/index.js +194 -4701
- package/dist/inspect.d.ts +29 -2
- package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
- package/dist/inspect.js.map +1 -0
- package/dist/inventory.d.ts +14 -1
- package/dist/inventory.js +84 -0
- package/dist/inventory.js.map +1 -0
- package/dist/items.d.ts +136 -8
- package/dist/items.js +585 -0
- package/dist/items.js.map +1 -0
- package/dist/lanes.d.ts +12 -3
- package/dist/lanes.js +496 -0
- package/dist/lanes.js.map +1 -0
- package/dist/life.d.ts +6 -2
- package/dist/life.js +287 -0
- package/dist/life.js.map +1 -0
- package/dist/log.d.ts +26 -3
- package/dist/log.js +192 -0
- package/dist/log.js.map +1 -0
- package/dist/manaBurn.d.ts +2 -2
- package/dist/manaBurn.js +75 -0
- package/dist/manaBurn.js.map +1 -0
- package/dist/map/file.d.ts +56 -3
- package/dist/map/file.js +264 -0
- package/dist/map/file.js.map +1 -0
- package/dist/map/images.js +61 -0
- package/dist/map/images.js.map +1 -0
- package/dist/map/look.d.ts +1 -1
- package/dist/map/look.js +30 -0
- package/dist/map/look.js.map +1 -0
- package/dist/map/pathProfile.js +183 -0
- package/dist/map/pathProfile.js.map +1 -0
- package/dist/map/resize.d.ts +4 -0
- package/dist/map/resize.js +136 -0
- package/dist/map/resize.js.map +1 -0
- package/dist/map/schema.js +257 -0
- package/dist/map/schema.js.map +1 -0
- package/dist/map/terrain.js +214 -0
- package/dist/map/terrain.js.map +1 -0
- package/dist/map/types.d.ts +92 -13
- package/dist/map/types.js +251 -0
- package/dist/map/types.js.map +1 -0
- package/dist/mapCheck/cells.js +94 -0
- package/dist/mapCheck/cells.js.map +1 -0
- package/dist/mapCheck/rules/foliage.d.ts +9 -0
- package/dist/mapCheck/rules/foliage.js +83 -0
- package/dist/mapCheck/rules/foliage.js.map +1 -0
- package/dist/mapCheck/rules/names.js +39 -0
- package/dist/mapCheck/rules/names.js.map +1 -0
- package/dist/mapCheck/rules/objects.d.ts +1 -1
- package/dist/mapCheck/rules/objects.js +56 -0
- package/dist/mapCheck/rules/objects.js.map +1 -0
- package/dist/mapCheck/rules/paths.js +32 -0
- package/dist/mapCheck/rules/paths.js.map +1 -0
- package/dist/mapCheck/rules/players.js +20 -0
- package/dist/mapCheck/rules/players.js.map +1 -0
- package/dist/mapCheck/rules/races.js +56 -0
- package/dist/mapCheck/rules/races.js.map +1 -0
- package/dist/mapCheck/rules/random.js +47 -0
- package/dist/mapCheck/rules/random.js.map +1 -0
- package/dist/mapCheck/rules/regions.js +30 -0
- package/dist/mapCheck/rules/regions.js.map +1 -0
- package/dist/mapCheck/rules/targets.js +31 -0
- package/dist/mapCheck/rules/targets.js.map +1 -0
- package/dist/mapCheck/rules/walking.js +45 -0
- package/dist/mapCheck/rules/walking.js.map +1 -0
- package/dist/mapCheck.d.ts +2 -2
- package/dist/mapCheck.js +63 -0
- package/dist/mapCheck.js.map +1 -0
- package/dist/mapFields.d.ts +25 -2
- package/dist/mapFields.js +134 -0
- package/dist/mapFields.js.map +1 -0
- package/dist/mapFile.js +176 -0
- package/dist/mapFile.js.map +1 -0
- package/dist/mapMeasure.d.ts +8 -0
- package/dist/mapMeasure.js +283 -0
- package/dist/mapMeasure.js.map +1 -0
- package/dist/mapMerge.d.ts +1 -0
- package/dist/mapMerge.js +172 -0
- package/dist/mapMerge.js.map +1 -0
- package/dist/mapObjectives.js +138 -0
- package/dist/mapObjectives.js.map +1 -0
- package/dist/mapObjects.js +80 -0
- package/dist/mapObjects.js.map +1 -0
- package/dist/math.d.ts +37 -7
- package/dist/math.js +155 -0
- package/dist/math.js.map +1 -0
- package/dist/messages.d.ts +71 -4
- package/dist/messages.js +29 -0
- package/dist/messages.js.map +1 -0
- package/dist/missionRules.d.ts +10 -2
- package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
- package/dist/missionRules.js.map +1 -0
- package/dist/mods.d.ts +39 -20
- package/dist/mods.js +271 -0
- package/dist/mods.js.map +1 -0
- package/dist/moves.d.ts +87 -0
- package/dist/moves.js +539 -0
- package/dist/moves.js.map +1 -0
- package/dist/names.d.ts +7 -0
- package/dist/names.js +122 -0
- package/dist/names.js.map +1 -0
- package/dist/navigation/agentParams.js +14 -0
- package/dist/navigation/agentParams.js.map +1 -0
- package/dist/navigation/air.d.ts +7 -3
- package/dist/navigation/air.js +401 -0
- package/dist/navigation/air.js.map +1 -0
- package/dist/navigation/builds.d.ts +34 -2
- package/dist/navigation/builds.js +287 -0
- package/dist/navigation/builds.js.map +1 -0
- package/dist/navigation/groundAreas.d.ts +59 -1
- package/dist/navigation/groundAreas.js +407 -0
- package/dist/navigation/groundAreas.js.map +1 -0
- package/dist/navigation/navigation.d.ts +98 -9
- package/dist/navigation/recast.d.ts +194 -18
- package/dist/navigation/recast.js +1379 -0
- package/dist/navigation/recast.js.map +1 -0
- package/dist/navigation/sidePaths.d.ts +8 -3
- package/dist/navigation/sidePaths.js +241 -0
- package/dist/navigation/sidePaths.js.map +1 -0
- package/dist/navigation/sized.js +243 -0
- package/dist/navigation/sized.js.map +1 -0
- package/dist/nearest.js +32 -0
- package/dist/nearest.js.map +1 -0
- package/dist/noise.js +59 -0
- package/dist/noise.js.map +1 -0
- package/dist/objectives.d.ts +12 -3
- package/dist/objectives.js +144 -0
- package/dist/objectives.js.map +1 -0
- package/dist/orders/basic.d.ts +5 -5
- package/dist/orders/basic.js +417 -0
- package/dist/orders/basic.js.map +1 -0
- package/dist/orders/build.js +278 -0
- package/dist/orders/build.js.map +1 -0
- package/dist/orders/cast.d.ts +13 -3
- package/dist/orders/cast.js +558 -0
- package/dist/orders/cast.js.map +1 -0
- package/dist/orders/facts.js +16 -0
- package/dist/orders/facts.js.map +1 -0
- package/dist/orders/harvest.d.ts +21 -5
- package/dist/orders/harvest.js +540 -0
- package/dist/orders/harvest.js.map +1 -0
- package/dist/orders/idle.d.ts +3 -1
- package/dist/orders/idle.js +234 -0
- package/dist/orders/idle.js.map +1 -0
- package/dist/orders/items.js +92 -0
- package/dist/orders/items.js.map +1 -0
- package/dist/orders/queue.js +108 -0
- package/dist/orders/queue.js.map +1 -0
- package/dist/orders/waiting.d.ts +39 -0
- package/dist/orders/waiting.js +149 -0
- package/dist/orders/waiting.js.map +1 -0
- package/dist/pack.schema.js +13 -0
- package/dist/pack.schema.js.map +1 -0
- package/dist/pack.schema.json +7622 -841
- package/dist/packs/director/index.d.ts +13 -5
- package/dist/packs/director/index.js +204 -0
- package/dist/packs/director/index.js.map +1 -0
- package/dist/packs/heroes/campaign.d.ts +3 -2
- package/dist/packs/heroes/campaign.js +241 -0
- package/dist/packs/heroes/campaign.js.map +1 -0
- package/dist/packs/heroes/carry.d.ts +6 -0
- package/dist/packs/heroes/carry.js +112 -0
- package/dist/packs/heroes/carry.js.map +1 -0
- package/dist/packs/heroes/commands.js +115 -0
- package/dist/packs/heroes/commands.js.map +1 -0
- package/dist/packs/heroes/fallen.d.ts +43 -0
- package/dist/packs/heroes/fallen.js +61 -0
- package/dist/packs/heroes/fallen.js.map +1 -0
- package/dist/packs/heroes/hire.js +60 -0
- package/dist/packs/heroes/hire.js.map +1 -0
- package/dist/packs/heroes/index.d.ts +7 -6
- package/dist/packs/heroes/index.js +130 -0
- package/dist/packs/heroes/index.js.map +1 -0
- package/dist/packs/heroes/loop.d.ts +95 -0
- package/dist/packs/heroes/loop.js +250 -0
- package/dist/packs/heroes/loop.js.map +1 -0
- package/dist/packs/heroes/making.d.ts +6 -3
- package/dist/packs/heroes/making.js +55 -0
- package/dist/packs/heroes/making.js.map +1 -0
- package/dist/packs/heroes/respawn.d.ts +3 -3
- package/dist/packs/heroes/respawn.js +87 -0
- package/dist/packs/heroes/respawn.js.map +1 -0
- package/dist/packs/heroes/sets.d.ts +32 -0
- package/dist/packs/heroes/sets.js +51 -0
- package/dist/packs/heroes/sets.js.map +1 -0
- package/dist/packs/heroes/spells.d.ts +16 -0
- package/dist/packs/heroes/spells.js +269 -0
- package/dist/packs/heroes/spells.js.map +1 -0
- package/dist/packs/items/defaults.d.ts +43 -0
- package/dist/packs/items/defaults.js +1504 -0
- package/dist/packs/items/defaults.js.map +1 -0
- package/dist/packs/items/index.d.ts +27 -0
- package/dist/packs/items/index.js +214 -0
- package/dist/packs/items/index.js.map +1 -0
- package/dist/packs/moba/index.d.ts +3 -3
- package/dist/packs/moba/index.js +174 -0
- package/dist/packs/moba/index.js.map +1 -0
- package/dist/packs/pack.d.ts +15 -15
- package/dist/packs/pack.js +14 -0
- package/dist/packs/pack.js.map +1 -0
- package/dist/packs.d.ts +15 -7
- package/dist/packs.js +222 -0
- package/dist/packs.js.map +1 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +109 -0
- package/dist/paths.js.map +1 -0
- package/dist/plain.js +57 -0
- package/dist/plain.js.map +1 -0
- package/dist/player.d.ts +33 -10
- package/dist/player.js +159 -0
- package/dist/player.js.map +1 -0
- package/dist/portals.d.ts +1 -1
- package/dist/portals.js +194 -0
- package/dist/portals.js.map +1 -0
- package/dist/prefabs.d.ts +25 -2
- package/dist/prefabs.js +239 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/presetBuildings.js +58 -0
- package/dist/presetBuildings.js.map +1 -0
- package/dist/presetFoliage.d.ts +27 -0
- package/dist/presetFoliage.js +98 -0
- package/dist/presetFoliage.js.map +1 -0
- package/dist/presetGround.js +65 -0
- package/dist/presetGround.js.map +1 -0
- package/dist/proxies.d.ts +12 -0
- package/dist/proxies.js +79 -0
- package/dist/proxies.js.map +1 -0
- package/dist/query.d.ts +56 -0
- package/dist/query.js +88 -0
- package/dist/query.js.map +1 -0
- package/dist/races.d.ts +15 -14
- package/dist/races.js +172 -0
- package/dist/races.js.map +1 -0
- package/dist/randomGroups.js +91 -0
- package/dist/randomGroups.js.map +1 -0
- package/dist/registry.d.ts +117 -53
- package/dist/registry.js +323 -0
- package/dist/registry.js.map +1 -0
- package/dist/remains.d.ts +11 -9
- package/dist/remains.js +188 -0
- package/dist/remains.js.map +1 -0
- package/dist/replication.d.ts +12 -7
- package/dist/replication.js +100 -0
- package/dist/replication.js.map +1 -0
- package/dist/rng.d.ts +2 -0
- package/dist/rng.js +40 -0
- package/dist/rng.js.map +1 -0
- package/dist/rules.d.ts +186 -99
- package/dist/rules.js +179 -0
- package/dist/rules.js.map +1 -0
- package/dist/rulesCheck.d.ts +5 -4
- package/dist/rulesCheck.js +693 -0
- package/dist/rulesCheck.js.map +1 -0
- package/dist/runes.d.ts +2 -2
- package/dist/runes.js +80 -0
- package/dist/runes.js.map +1 -0
- package/dist/save.d.ts +37 -12
- package/dist/save.js +532 -0
- package/dist/save.js.map +1 -0
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +99 -0
- package/dist/scenario.js.map +1 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/scheduler.js +156 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/score.d.ts +19 -19
- package/dist/score.js +709 -0
- package/dist/score.js.map +1 -0
- package/dist/sequences.d.ts +10 -6
- package/dist/sequences.js +206 -0
- package/dist/sequences.js.map +1 -0
- package/dist/server/doorman.js +154 -0
- package/dist/server/doorman.js.map +1 -0
- package/dist/server/gameServer.d.ts +16 -1
- package/dist/server/gameServer.js +643 -0
- package/dist/server/gameServer.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/lobby.js +199 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/log.js +18 -0
- package/dist/server/log.js.map +1 -0
- package/dist/server/match.js +267 -0
- package/dist/server/match.js.map +1 -0
- package/dist/server/mode.d.ts +18 -9
- package/dist/server/mode.js +220 -0
- package/dist/server/mode.js.map +1 -0
- package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
- package/dist/server/navigation-worker.js.map +1 -0
- package/dist/server/navigation.js +39 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/ops.d.ts +4 -0
- package/dist/server/ops.js +137 -0
- package/dist/server/ops.js.map +1 -0
- package/dist/server/packs.d.ts +3 -3
- package/dist/server/packs.js +32 -0
- package/dist/server/packs.js.map +1 -0
- package/dist/server/ratings.d.ts +5 -0
- package/dist/server/ratings.js +104 -0
- package/dist/server/ratings.js.map +1 -0
- package/dist/server/relay.d.ts +12 -2
- package/dist/server/relay.js +144 -0
- package/dist/server/relay.js.map +1 -0
- package/dist/server/rooms.d.ts +9 -2
- package/dist/server/rooms.js +442 -0
- package/dist/server/rooms.js.map +1 -0
- package/dist/server/seat.js +116 -0
- package/dist/server/seat.js.map +1 -0
- package/dist/server/seatSettings.d.ts +3 -3
- package/dist/server/seatSettings.js +63 -0
- package/dist/server/seatSettings.js.map +1 -0
- package/dist/server/secret.js +13 -0
- package/dist/server/secret.js.map +1 -0
- package/dist/server/start.d.ts +13 -6
- package/dist/server/start.js +76 -0
- package/dist/server/start.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -1
- package/dist/server/websocket.js +306 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server.js +15 -2861
- package/dist/session/can.js +26 -0
- package/dist/session/can.js.map +1 -0
- package/dist/session/commandReplay.d.ts +8 -2
- package/dist/session/commandReplay.js +293 -0
- package/dist/session/commandReplay.js.map +1 -0
- package/dist/session/debug.js +151 -0
- package/dist/session/debug.js.map +1 -0
- package/dist/session/delay.js +62 -0
- package/dist/session/delay.js.map +1 -0
- package/dist/session/delta.d.ts +14 -1
- package/dist/session/delta.js +407 -0
- package/dist/session/delta.js.map +1 -0
- package/dist/session/entityState.js +415 -0
- package/dist/session/entityState.js.map +1 -0
- package/dist/session/local.d.ts +47 -5
- package/dist/session/local.js +670 -0
- package/dist/session/local.js.map +1 -0
- package/dist/session/memory.d.ts +20 -2
- package/dist/session/memory.js +131 -0
- package/dist/session/memory.js.map +1 -0
- package/dist/session/protocol.d.ts +325 -31
- package/dist/session/protocol.js +55 -0
- package/dist/session/protocol.js.map +1 -0
- package/dist/session/remote.d.ts +74 -12
- package/dist/session/remote.js +1394 -0
- package/dist/session/remote.js.map +1 -0
- package/dist/session/replay.d.ts +11 -2
- package/dist/session/replay.js +160 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/seed.js +12 -0
- package/dist/session/seed.js.map +1 -0
- package/dist/session/share.d.ts +5 -1
- package/dist/session/share.js +94 -0
- package/dist/session/share.js.map +1 -0
- package/dist/session/socket.d.ts +1 -1
- package/dist/session/socket.js +29 -0
- package/dist/session/socket.js.map +1 -0
- package/dist/session/wire.d.ts +5 -0
- package/dist/session/wire.js +84 -0
- package/dist/session/wire.js.map +1 -0
- package/dist/session/worker.d.ts +77 -12
- package/dist/session/worker.js +499 -0
- package/dist/session/worker.js.map +1 -0
- package/dist/shared.d.ts +31 -5
- package/dist/shared.js +166 -0
- package/dist/shared.js.map +1 -0
- package/dist/sides.d.ts +9 -3
- package/dist/sides.js +149 -0
- package/dist/sides.js.map +1 -0
- package/dist/sight.js +85 -0
- package/dist/sight.js.map +1 -0
- package/dist/simulate-worker.js +1 -1
- package/dist/simulate.d.ts +12 -8
- package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
- package/dist/simulate.js.map +1 -0
- package/dist/smart.js +77 -0
- package/dist/smart.js.map +1 -0
- package/dist/spatial.d.ts +32 -16
- package/dist/spatial.js +234 -0
- package/dist/spatial.js.map +1 -0
- package/dist/spawning.d.ts +1 -0
- package/dist/spawning.js +224 -0
- package/dist/spawning.js.map +1 -0
- package/dist/stances.d.ts +6 -3
- package/dist/stances.js +169 -0
- package/dist/stances.js.map +1 -0
- package/dist/start.d.ts +10 -10
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/stats.d.ts +42 -16
- package/dist/stats.js +290 -0
- package/dist/stats.js.map +1 -0
- package/dist/summoned.d.ts +52 -0
- package/dist/summoned.js +38 -0
- package/dist/summoned.js.map +1 -0
- package/dist/summons.d.ts +10 -13
- package/dist/summons.js +271 -0
- package/dist/summons.js.map +1 -0
- package/dist/systems/abilities.js +224 -0
- package/dist/systems/abilities.js.map +1 -0
- package/dist/systems/combat.d.ts +35 -1
- package/dist/systems/combat.js +677 -0
- package/dist/systems/combat.js.map +1 -0
- package/dist/systems/combatTold.d.ts +3 -1
- package/dist/systems/combatTold.js +85 -0
- package/dist/systems/combatTold.js.map +1 -0
- package/dist/systems/construction.js +80 -0
- package/dist/systems/construction.js.map +1 -0
- package/dist/systems/economy.d.ts +0 -6
- package/dist/systems/economy.js +128 -0
- package/dist/systems/economy.js.map +1 -0
- package/dist/systems/fog.d.ts +1 -1
- package/dist/systems/fog.js +120 -0
- package/dist/systems/fog.js.map +1 -0
- package/dist/systems/life.js +32 -0
- package/dist/systems/life.js.map +1 -0
- package/dist/systems/movement.d.ts +24 -12
- package/dist/systems/movement.js +1247 -0
- package/dist/systems/movement.js.map +1 -0
- package/dist/systems/orders.js +64 -0
- package/dist/systems/orders.js.map +1 -0
- package/dist/systems/production.js +322 -0
- package/dist/systems/production.js.map +1 -0
- package/dist/systems/productionQueue.js +120 -0
- package/dist/systems/productionQueue.js.map +1 -0
- package/dist/systems/victory.d.ts +1 -1
- package/dist/systems/victory.js +56 -0
- package/dist/systems/victory.js.map +1 -0
- package/dist/talk.d.ts +6 -6
- package/dist/talk.js +153 -0
- package/dist/talk.js.map +1 -0
- package/dist/targeting.d.ts +142 -0
- package/dist/targeting.js +49 -0
- package/dist/targeting.js.map +1 -0
- package/dist/tech.d.ts +20 -3
- package/dist/tech.js +239 -0
- package/dist/tech.js.map +1 -0
- package/dist/techTree.d.ts +7 -0
- package/dist/techTree.js +90 -0
- package/dist/techTree.js.map +1 -0
- package/dist/terrain.d.ts +59 -7
- package/dist/terrain.js +389 -0
- package/dist/terrain.js.map +1 -0
- package/dist/terrainSave.d.ts +6 -0
- package/dist/terrainSave.js +74 -0
- package/dist/terrainSave.js.map +1 -0
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +13 -739
- package/dist/testing.js.map +1 -1
- package/dist/tiles.d.ts +1 -1
- package/dist/tiles.js +43 -0
- package/dist/tiles.js.map +1 -0
- package/dist/timers.d.ts +29 -4
- package/dist/timers.js +242 -0
- package/dist/timers.js.map +1 -0
- package/dist/tomes.d.ts +4 -4
- package/dist/tomes.js +94 -0
- package/dist/tomes.js.map +1 -0
- package/dist/trade.js +103 -0
- package/dist/trade.js.map +1 -0
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +281 -0
- package/dist/transport.js.map +1 -0
- package/dist/tunables.d.ts +10 -3
- package/dist/tunables.js +56 -0
- package/dist/tunables.js.map +1 -0
- package/dist/unitResources.d.ts +67 -0
- package/dist/unitResources.js +266 -0
- package/dist/unitResources.js.map +1 -0
- package/dist/upkeep.d.ts +6 -1
- package/dist/upkeep.js +26 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/veterancy.d.ts +8 -3
- package/dist/veterancy.js +131 -0
- package/dist/veterancy.js.map +1 -0
- package/dist/vision.d.ts +36 -0
- package/dist/vision.js +133 -0
- package/dist/vision.js.map +1 -0
- package/dist/walls.d.ts +1 -1
- package/dist/walls.js +278 -0
- package/dist/walls.js.map +1 -0
- package/dist/world.d.ts +606 -88
- package/dist/world.js +1263 -0
- package/dist/world.js.map +1 -0
- package/package.json +2 -2
- package/dist/ai.js.map +0 -1
- package/dist/attributes.d.ts +0 -66
- package/dist/brain-BvVdUhX8.js +0 -7659
- package/dist/brain-BvVdUhX8.js.map +0 -1
- package/dist/builds-C6LfgvEU.js +0 -460
- package/dist/builds-C6LfgvEU.js.map +0 -1
- package/dist/coreComponents-syuh2fPG.js +0 -5149
- package/dist/coreComponents-syuh2fPG.js.map +0 -1
- package/dist/debugCommands-CzjrSm66.js +0 -14739
- package/dist/debugCommands-CzjrSm66.js.map +0 -1
- package/dist/determinism-BCymQwiE.js +0 -518
- package/dist/determinism-BCymQwiE.js.map +0 -1
- package/dist/game-DiJEN-Ks.js +0 -5800
- package/dist/game-DiJEN-Ks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inspect-D9dWHmZ0.js.map +0 -1
- package/dist/local-Dkovq42k.js +0 -1379
- package/dist/local-Dkovq42k.js.map +0 -1
- package/dist/missionRules-C-bGxm0Q.js.map +0 -1
- package/dist/navigation-worker.js.map +0 -1
- package/dist/packs-g5thvmGn.js +0 -3199
- package/dist/packs-g5thvmGn.js.map +0 -1
- package/dist/profiles-B3NS9jwk.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/simulate-oXBiw1Ff.js.map +0 -1
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import { distSq } from "../math.js";
|
|
2
|
+
import { heroOfState } from "../hero.js";
|
|
3
|
+
import "./reach.js";
|
|
4
|
+
//#region src/ai/knowledge.ts
|
|
5
|
+
var LIMITS = {
|
|
6
|
+
sightings: 12,
|
|
7
|
+
workers: 40,
|
|
8
|
+
heroes: 16,
|
|
9
|
+
structures: 400,
|
|
10
|
+
lost: 64,
|
|
11
|
+
events: 48,
|
|
12
|
+
attacks: 20,
|
|
13
|
+
history: 36
|
|
14
|
+
};
|
|
15
|
+
var empty = () => ({
|
|
16
|
+
v: 1,
|
|
17
|
+
tick: 0,
|
|
18
|
+
structures: [],
|
|
19
|
+
army: [],
|
|
20
|
+
workers: [],
|
|
21
|
+
heroes: [],
|
|
22
|
+
types: {},
|
|
23
|
+
looked: {
|
|
24
|
+
cols: 0,
|
|
25
|
+
rows: 0,
|
|
26
|
+
ticks: []
|
|
27
|
+
},
|
|
28
|
+
lost: [],
|
|
29
|
+
attacks: [],
|
|
30
|
+
gathered: {},
|
|
31
|
+
history: [],
|
|
32
|
+
pings: [],
|
|
33
|
+
damage: [],
|
|
34
|
+
deaths: []
|
|
35
|
+
});
|
|
36
|
+
var at = (point) => ({
|
|
37
|
+
x: point.x,
|
|
38
|
+
z: point.z
|
|
39
|
+
});
|
|
40
|
+
/** Keeps the last `limit` of a list (the newest, for lists kept oldest first) */
|
|
41
|
+
function trimOldest(list, limit) {
|
|
42
|
+
if (list.length > limit) list.splice(0, list.length - limit);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a computer player remembers of the enemy, the map and itself, with when (`Brain.knowledge`). Brought up to date
|
|
46
|
+
* once a think from the view; asked through its parts: `enemy` (structures, bases, army seen, workers, heroes, tech),
|
|
47
|
+
* `map` (when a place was last looked at), `own` (losses, attacks sent, income), `events` (pings, damage, deaths heard).
|
|
48
|
+
* Plain data underneath (`data`), saved with the brain
|
|
49
|
+
*
|
|
50
|
+
* @beta
|
|
51
|
+
*/
|
|
52
|
+
var Knowledge = class {
|
|
53
|
+
kept;
|
|
54
|
+
/** Its id among the brain's areas: what its memory and its report are kept under */
|
|
55
|
+
id = "knowledge";
|
|
56
|
+
/** What the log says where a save's memory of it is of a shape it does not read */
|
|
57
|
+
afresh = "the save remembers what the computer player knew in a shape this brain does not read: it starts afresh";
|
|
58
|
+
/** What it remembers, as plain data. Replaced as a whole by `restore` */
|
|
59
|
+
data = empty();
|
|
60
|
+
/** The enemy: structures, bases, army, workers, heroes, tech */
|
|
61
|
+
enemy;
|
|
62
|
+
/** The map: when each place was last in sight */
|
|
63
|
+
map;
|
|
64
|
+
/** One's own: losses, attacks sent, income */
|
|
65
|
+
own;
|
|
66
|
+
/** What was heard: pings, damage to friends, deaths */
|
|
67
|
+
events;
|
|
68
|
+
/** @internal The view of the last update: for what is asked of the map now */
|
|
69
|
+
view;
|
|
70
|
+
/** @internal The seat's fog as of the last update */
|
|
71
|
+
fog;
|
|
72
|
+
/** Where in the fog each cell of the map is read: found again when the fog or the map is of another size */
|
|
73
|
+
sample;
|
|
74
|
+
/** The options it runs with: those given over the defaults, the limits being the built-in ones */
|
|
75
|
+
options;
|
|
76
|
+
constructor(options = {}, size, kept = true) {
|
|
77
|
+
this.kept = kept;
|
|
78
|
+
this.options = {
|
|
79
|
+
armyFor: options.armyFor ?? 180,
|
|
80
|
+
keepFor: options.keepFor ?? 300,
|
|
81
|
+
mergeRadius: options.mergeRadius ?? 16,
|
|
82
|
+
historyEvery: options.historyEvery ?? 5,
|
|
83
|
+
army: options.army,
|
|
84
|
+
limits: {
|
|
85
|
+
...LIMITS,
|
|
86
|
+
...options.limits
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
this.enemy = new EnemyKnowledge(this);
|
|
90
|
+
this.map = new MapKnowledge(this);
|
|
91
|
+
this.own = new OwnKnowledge(this);
|
|
92
|
+
this.events = new HeardEvents(this);
|
|
93
|
+
if (size) this.size(size.width, size.depth);
|
|
94
|
+
}
|
|
95
|
+
/** Makes what is remembered of the map the size of a map of this many units: forgotten where it was another size */
|
|
96
|
+
size(width, depth) {
|
|
97
|
+
const cols = Math.max(1, Math.ceil(width / 8));
|
|
98
|
+
const rows = Math.max(1, Math.ceil(depth / 8));
|
|
99
|
+
const looked = this.data.looked;
|
|
100
|
+
if (looked.cols !== cols || looked.rows !== rows) this.data.looked = {
|
|
101
|
+
cols,
|
|
102
|
+
rows,
|
|
103
|
+
ticks: new Array(cols * rows).fill(-1)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** The tick it was last brought up to date */
|
|
107
|
+
get tick() {
|
|
108
|
+
return this.data.tick;
|
|
109
|
+
}
|
|
110
|
+
/** @internal Seconds into the game of a tick, at the seat's rate */
|
|
111
|
+
seconds(ticks) {
|
|
112
|
+
return ticks / (this.view?.session.tickRate ?? 1);
|
|
113
|
+
}
|
|
114
|
+
/** @internal The tick so many seconds before the last update */
|
|
115
|
+
since(seconds) {
|
|
116
|
+
if (seconds === void 0) return -Infinity;
|
|
117
|
+
return this.data.tick - seconds * (this.view?.session.tickRate ?? 1);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Brings it up to date from a think's view. `before` is the view of the think before: what the dead of this think
|
|
121
|
+
* were (a death says only an id). What the brain calls as each think begins, after the view is made
|
|
122
|
+
*/
|
|
123
|
+
update(view, before) {
|
|
124
|
+
const { data, options } = this;
|
|
125
|
+
const tick = view.tick;
|
|
126
|
+
const rate = view.session.tickRate;
|
|
127
|
+
this.view = view;
|
|
128
|
+
this.enemy.reset();
|
|
129
|
+
data.tick = tick;
|
|
130
|
+
const sees = this.lookAround(view);
|
|
131
|
+
const known = /* @__PURE__ */ new Set();
|
|
132
|
+
const byId = new Map(data.structures.map((each) => [each.id, each]));
|
|
133
|
+
for (const building of view.enemies.known().buildings()) {
|
|
134
|
+
known.add(building.id);
|
|
135
|
+
let seen = byId.get(building.id);
|
|
136
|
+
if (!seen) {
|
|
137
|
+
seen = {
|
|
138
|
+
id: building.id,
|
|
139
|
+
type: building.type,
|
|
140
|
+
owner: building.owner,
|
|
141
|
+
at: at(building),
|
|
142
|
+
first: tick,
|
|
143
|
+
last: tick
|
|
144
|
+
};
|
|
145
|
+
data.structures.push(seen);
|
|
146
|
+
byId.set(building.id, seen);
|
|
147
|
+
}
|
|
148
|
+
seen.type = building.type;
|
|
149
|
+
seen.at = at(building);
|
|
150
|
+
if (building.visible) seen.last = tick;
|
|
151
|
+
delete seen.gone;
|
|
152
|
+
}
|
|
153
|
+
const goneFor = options.keepFor * rate;
|
|
154
|
+
data.structures = data.structures.filter((each) => {
|
|
155
|
+
if (!known.has(each.id) && each.gone === void 0) each.gone = tick;
|
|
156
|
+
return each.gone === void 0 || tick - each.gone <= goneFor;
|
|
157
|
+
});
|
|
158
|
+
trimOldest(data.structures, options.limits.structures);
|
|
159
|
+
const now = {};
|
|
160
|
+
for (const entity of view.enemies) now[entity.type] = (now[entity.type] ?? 0) + 1;
|
|
161
|
+
for (const [type, count] of Object.entries(now)) {
|
|
162
|
+
const seen = data.types[type] ??= {
|
|
163
|
+
first: tick,
|
|
164
|
+
last: tick,
|
|
165
|
+
most: 0
|
|
166
|
+
};
|
|
167
|
+
seen.last = tick;
|
|
168
|
+
seen.most = Math.max(seen.most, count);
|
|
169
|
+
}
|
|
170
|
+
this.seeArmy(view, sees);
|
|
171
|
+
this.seeUnits(view, sees);
|
|
172
|
+
this.hear(view, before);
|
|
173
|
+
this.count(view);
|
|
174
|
+
}
|
|
175
|
+
/** Brings what was last looked at up to date from the seat's fog: what is in sight now, by cell (1 for in sight) */
|
|
176
|
+
/**
|
|
177
|
+
* Reads the think's picture through this view without remembering anything of it: for a think a game loaded from a
|
|
178
|
+
* save goes on with (`BrainMemory.thinking`), whose picture the saved game remembered already, so that what is restored
|
|
179
|
+
* is as it was after that; only what is asked of the map now needs the view it is asked through
|
|
180
|
+
*/
|
|
181
|
+
resume(view) {
|
|
182
|
+
this.view = view;
|
|
183
|
+
this.fog = view.session.fog();
|
|
184
|
+
this.size(view.session.terrain.width, view.session.terrain.depth);
|
|
185
|
+
this.enemy.reset();
|
|
186
|
+
}
|
|
187
|
+
lookAround(view) {
|
|
188
|
+
const { width, depth } = view.session.terrain;
|
|
189
|
+
this.size(width, depth);
|
|
190
|
+
const { cols, rows } = this.data.looked;
|
|
191
|
+
const ticks = this.data.looked.ticks;
|
|
192
|
+
const fog = view.session.fog();
|
|
193
|
+
this.fog = fog;
|
|
194
|
+
const sees = new Uint8Array(cols * rows);
|
|
195
|
+
const tick = view.tick;
|
|
196
|
+
if (fog.revealed || !fog.visible.length) {
|
|
197
|
+
sees.fill(1);
|
|
198
|
+
ticks.fill(tick);
|
|
199
|
+
return sees;
|
|
200
|
+
}
|
|
201
|
+
let sample = this.sample;
|
|
202
|
+
if (!sample || sample.fog !== fog.width * 65536 + fog.depth || sample.cells.length !== cols * rows) {
|
|
203
|
+
const cells = new Int32Array(cols * rows);
|
|
204
|
+
for (let r = 0; r < rows; r++) {
|
|
205
|
+
const fz = Math.min(fog.depth - 1, Math.floor((r + .5) * 8 / depth * fog.depth));
|
|
206
|
+
for (let c = 0; c < cols; c++) cells[r * cols + c] = fz * fog.width + Math.min(fog.width - 1, Math.floor((c + .5) * 8 / width * fog.width));
|
|
207
|
+
}
|
|
208
|
+
sample = this.sample = {
|
|
209
|
+
fog: fog.width * 65536 + fog.depth,
|
|
210
|
+
cells
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const { visible } = fog;
|
|
214
|
+
const { cells } = sample;
|
|
215
|
+
for (let i = 0; i < cells.length; i++) {
|
|
216
|
+
if (!visible[cells[i]]) continue;
|
|
217
|
+
sees[i] = 1;
|
|
218
|
+
ticks[i] = tick;
|
|
219
|
+
}
|
|
220
|
+
return sees;
|
|
221
|
+
}
|
|
222
|
+
/** @internal The cell of a point, in what is remembered of the map: -1 off it */
|
|
223
|
+
cell(point) {
|
|
224
|
+
const { cols, rows } = this.data.looked;
|
|
225
|
+
const c = Math.floor(point.x / 8);
|
|
226
|
+
const r = Math.floor(point.z / 8);
|
|
227
|
+
if (c < 0 || r < 0 || c >= cols || r >= rows) return -1;
|
|
228
|
+
return r * cols + c;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The enemy's fighters in sight, grouped by nearness into sightings. A newer sighting replaces the older ones near
|
|
232
|
+
* it (the army moved); an older one whose place is in sight with no sighting near is dropped (no one is there now)
|
|
233
|
+
*/
|
|
234
|
+
seeArmy(view, sees) {
|
|
235
|
+
const { data, options } = this;
|
|
236
|
+
const tick = view.tick;
|
|
237
|
+
const merge = options.mergeRadius * options.mergeRadius;
|
|
238
|
+
const fighters = options.army ? view.enemies.units().where((entity) => options.army(entity, view)) : view.enemies.units().fighters();
|
|
239
|
+
const groups = [];
|
|
240
|
+
for (const unit of fighters) {
|
|
241
|
+
if (unit.health <= 0) continue;
|
|
242
|
+
const group = groups.find((each) => distSq(each[0], unit) <= merge);
|
|
243
|
+
if (group) group.push(unit);
|
|
244
|
+
else groups.push([unit]);
|
|
245
|
+
}
|
|
246
|
+
const fresh = groups.map((group) => {
|
|
247
|
+
let x = 0;
|
|
248
|
+
let z = 0;
|
|
249
|
+
let health = 0;
|
|
250
|
+
let strength = 0;
|
|
251
|
+
let heroes = 0;
|
|
252
|
+
const types = {};
|
|
253
|
+
const owners = /* @__PURE__ */ new Map();
|
|
254
|
+
for (const unit of group) {
|
|
255
|
+
x += unit.x;
|
|
256
|
+
z += unit.z;
|
|
257
|
+
health += unit.health;
|
|
258
|
+
strength += view.strength.of(unit);
|
|
259
|
+
if (view.hasRole(unit, "hero")) heroes++;
|
|
260
|
+
types[unit.type] = (types[unit.type] ?? 0) + 1;
|
|
261
|
+
owners.set(unit.owner, (owners.get(unit.owner) ?? 0) + 1);
|
|
262
|
+
}
|
|
263
|
+
let owner = group[0].owner;
|
|
264
|
+
for (const [player, count] of owners) if (count > owners.get(owner)) owner = player;
|
|
265
|
+
return {
|
|
266
|
+
at: {
|
|
267
|
+
x: x / group.length,
|
|
268
|
+
z: z / group.length
|
|
269
|
+
},
|
|
270
|
+
tick,
|
|
271
|
+
owner,
|
|
272
|
+
count: group.length,
|
|
273
|
+
health,
|
|
274
|
+
strength,
|
|
275
|
+
types,
|
|
276
|
+
heroes
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
const oldest = tick - options.armyFor * view.session.tickRate;
|
|
280
|
+
const kept = data.army.filter((old) => {
|
|
281
|
+
if (old.tick < oldest) return false;
|
|
282
|
+
if (fresh.some((each) => distSq(each.at, old.at) <= merge)) return false;
|
|
283
|
+
const cell = this.cell(old.at);
|
|
284
|
+
return cell < 0 || !sees[cell];
|
|
285
|
+
});
|
|
286
|
+
data.army = [...fresh, ...kept].slice(0, options.limits.sightings);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The enemy's workers and heroes in sight, by id, where they were. A worker whose place is in sight and who is not
|
|
290
|
+
* there is forgotten; a hero is kept where last seen (there are few, and where they went matters)
|
|
291
|
+
*/
|
|
292
|
+
seeUnits(view, sees) {
|
|
293
|
+
const { data, options } = this;
|
|
294
|
+
const tick = view.tick;
|
|
295
|
+
const workers = new Map(data.workers.map((each) => [each.id, each]));
|
|
296
|
+
for (const unit of view.enemies.units()) {
|
|
297
|
+
if (!(view.hasRole(unit, "worker") || view.hasRole(unit, "gatherer") && !view.hasRole(unit, "soldier"))) continue;
|
|
298
|
+
const seen = workers.get(unit.id);
|
|
299
|
+
if (seen) {
|
|
300
|
+
seen.at = at(unit);
|
|
301
|
+
seen.tick = tick;
|
|
302
|
+
} else workers.set(unit.id, {
|
|
303
|
+
id: unit.id,
|
|
304
|
+
type: unit.type,
|
|
305
|
+
owner: unit.owner,
|
|
306
|
+
at: at(unit),
|
|
307
|
+
tick
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
const oldest = tick - options.armyFor * view.session.tickRate;
|
|
311
|
+
data.workers = [...workers.values()].filter((each) => {
|
|
312
|
+
if (each.tick === tick) return true;
|
|
313
|
+
const cell = this.cell(each.at);
|
|
314
|
+
return each.tick >= oldest && (cell < 0 || !sees[cell]);
|
|
315
|
+
});
|
|
316
|
+
data.workers.sort((a, b) => b.tick - a.tick || a.id - b.id);
|
|
317
|
+
data.workers.length = Math.min(data.workers.length, options.limits.workers);
|
|
318
|
+
const heroes = new Map(data.heroes.map((each) => [each.id, each]));
|
|
319
|
+
for (const hero of view.enemies.heroes()) {
|
|
320
|
+
const seen = heroes.get(hero.id) ?? {
|
|
321
|
+
id: hero.id,
|
|
322
|
+
type: hero.type,
|
|
323
|
+
owner: hero.owner,
|
|
324
|
+
at: at(hero),
|
|
325
|
+
tick
|
|
326
|
+
};
|
|
327
|
+
seen.type = hero.type;
|
|
328
|
+
seen.at = at(hero);
|
|
329
|
+
seen.tick = tick;
|
|
330
|
+
const level = heroOfState(hero)?.level;
|
|
331
|
+
if (level !== void 0) seen.level = level;
|
|
332
|
+
delete seen.died;
|
|
333
|
+
heroes.set(hero.id, seen);
|
|
334
|
+
}
|
|
335
|
+
data.heroes = [...heroes.values()];
|
|
336
|
+
data.heroes.sort((a, b) => b.tick - a.tick || a.id - b.id);
|
|
337
|
+
data.heroes.length = Math.min(data.heroes.length, options.limits.heroes);
|
|
338
|
+
}
|
|
339
|
+
/** What the think's events say: deaths (one's own among them, as losses), pings, damage to one's own and allies' */
|
|
340
|
+
hear(view, before) {
|
|
341
|
+
const { data, options } = this;
|
|
342
|
+
const tick = view.tick;
|
|
343
|
+
const limit = options.limits.events;
|
|
344
|
+
for (const death of view.events.of("death")) {
|
|
345
|
+
const was = before?.byId(death.id) ?? view.byId(death.id);
|
|
346
|
+
if (!was) continue;
|
|
347
|
+
const by = death.killerType;
|
|
348
|
+
const seen = {
|
|
349
|
+
tick,
|
|
350
|
+
id: was.id,
|
|
351
|
+
type: was.type,
|
|
352
|
+
owner: was.owner,
|
|
353
|
+
at: at(was),
|
|
354
|
+
...by && { by }
|
|
355
|
+
};
|
|
356
|
+
data.deaths.push(seen);
|
|
357
|
+
if (was.owner === view.playerId) data.lost.push({
|
|
358
|
+
id: was.id,
|
|
359
|
+
type: was.type,
|
|
360
|
+
at: seen.at,
|
|
361
|
+
tick,
|
|
362
|
+
...by && { by }
|
|
363
|
+
});
|
|
364
|
+
const worker = data.workers.findIndex((each) => each.id === was.id);
|
|
365
|
+
if (worker >= 0) data.workers.splice(worker, 1);
|
|
366
|
+
const hero = data.heroes.find((each) => each.id === was.id);
|
|
367
|
+
if (hero) hero.died = tick;
|
|
368
|
+
}
|
|
369
|
+
trimOldest(data.deaths, limit);
|
|
370
|
+
trimOldest(data.lost, options.limits.lost);
|
|
371
|
+
for (const ping of view.events.of("ping")) data.pings.push({
|
|
372
|
+
tick,
|
|
373
|
+
player: ping.player,
|
|
374
|
+
at: {
|
|
375
|
+
x: ping.x,
|
|
376
|
+
z: ping.z
|
|
377
|
+
},
|
|
378
|
+
kind: ping.kind
|
|
379
|
+
});
|
|
380
|
+
trimOldest(data.pings, limit);
|
|
381
|
+
const damage = view.events.of("damage");
|
|
382
|
+
if (damage.length) {
|
|
383
|
+
const byEntity = /* @__PURE__ */ new Map();
|
|
384
|
+
for (const hit of damage) {
|
|
385
|
+
const target = view.byId(hit.id) ?? before?.byId(hit.id);
|
|
386
|
+
if (!target || !view.isFriendly(target)) continue;
|
|
387
|
+
const line = byEntity.get(hit.id);
|
|
388
|
+
if (line) line.amount += hit.amount;
|
|
389
|
+
else byEntity.set(hit.id, {
|
|
390
|
+
tick,
|
|
391
|
+
id: hit.id,
|
|
392
|
+
type: target.type,
|
|
393
|
+
owner: target.owner,
|
|
394
|
+
at: at(target),
|
|
395
|
+
amount: hit.amount,
|
|
396
|
+
...hit.sourceType && { by: hit.sourceType }
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
for (const line of byEntity.values()) data.damage.push(line);
|
|
400
|
+
trimOldest(data.damage, limit);
|
|
401
|
+
}
|
|
402
|
+
this.forgetOlder(this.since(options.keepFor), false);
|
|
403
|
+
}
|
|
404
|
+
/** What was gathered: every rise in what the player has, added up; sampled every `historyEvery` seconds */
|
|
405
|
+
count(view) {
|
|
406
|
+
const { data, options } = this;
|
|
407
|
+
const resources = view.me.resources;
|
|
408
|
+
if (data.had) for (const [kind, amount] of Object.entries(resources)) {
|
|
409
|
+
const rise = amount - (data.had[kind] ?? 0);
|
|
410
|
+
if (rise > 0) data.gathered[kind] = (data.gathered[kind] ?? 0) + rise;
|
|
411
|
+
}
|
|
412
|
+
data.had = { ...resources };
|
|
413
|
+
const last = data.history[data.history.length - 1];
|
|
414
|
+
if (!last || view.tick - last.tick >= options.historyEvery * view.session.tickRate) {
|
|
415
|
+
data.history.push({
|
|
416
|
+
tick: view.tick,
|
|
417
|
+
gathered: { ...data.gathered }
|
|
418
|
+
});
|
|
419
|
+
trimOldest(data.history, options.limits.history);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/** Forgets what is older than so many seconds: sightings, workers, losses, attacks, what was heard, structures long gone */
|
|
423
|
+
forget(olderThan) {
|
|
424
|
+
this.forgetOlder(this.since(olderThan), true);
|
|
425
|
+
}
|
|
426
|
+
forgetOlder(oldest, all) {
|
|
427
|
+
const { data } = this;
|
|
428
|
+
const keep = (list) => list.filter((each) => each.tick >= oldest);
|
|
429
|
+
data.lost = keep(data.lost);
|
|
430
|
+
data.attacks = keep(data.attacks);
|
|
431
|
+
data.pings = keep(data.pings);
|
|
432
|
+
data.damage = keep(data.damage);
|
|
433
|
+
data.deaths = keep(data.deaths);
|
|
434
|
+
if (!all) return;
|
|
435
|
+
data.army = keep(data.army);
|
|
436
|
+
data.workers = keep(data.workers);
|
|
437
|
+
data.heroes = keep(data.heroes);
|
|
438
|
+
data.structures = data.structures.filter((each) => each.gone === void 0 || each.gone >= oldest);
|
|
439
|
+
this.enemy.reset();
|
|
440
|
+
}
|
|
441
|
+
/** What it remembers, as plain data for a save: a copy */
|
|
442
|
+
/** Whether it has anything to remember now: one that does not is left out of a save */
|
|
443
|
+
remembers() {
|
|
444
|
+
return this.kept;
|
|
445
|
+
}
|
|
446
|
+
/** Gives a copy of what is known, as plain data for a save of the brain */
|
|
447
|
+
save() {
|
|
448
|
+
const { looked } = this.data;
|
|
449
|
+
const copy = structuredClone({
|
|
450
|
+
...this.data,
|
|
451
|
+
looked: void 0
|
|
452
|
+
});
|
|
453
|
+
copy.looked = {
|
|
454
|
+
cols: looked.cols,
|
|
455
|
+
rows: looked.rows,
|
|
456
|
+
ticks: looked.ticks.slice()
|
|
457
|
+
};
|
|
458
|
+
return copy;
|
|
459
|
+
}
|
|
460
|
+
/** Takes back what `save` gave. Memory of another shape is dropped: it starts afresh */
|
|
461
|
+
restore(memory) {
|
|
462
|
+
const data = memory;
|
|
463
|
+
if (!data || typeof data !== "object" || data.v !== 1) return false;
|
|
464
|
+
this.data = {
|
|
465
|
+
...empty(),
|
|
466
|
+
...structuredClone(data)
|
|
467
|
+
};
|
|
468
|
+
this.data.army = this.data.army.filter((sighting) => typeof sighting.strength === "number");
|
|
469
|
+
this.enemy.reset();
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
/** What it knows, in short, for the debug tools: bases, the army seen with its age, the tech seen */
|
|
473
|
+
inspect() {
|
|
474
|
+
const age = (tick) => Math.round(this.seconds(this.data.tick - tick));
|
|
475
|
+
return {
|
|
476
|
+
bases: this.enemy.bases().map((base) => ({
|
|
477
|
+
owner: base.owner,
|
|
478
|
+
at: [Math.round(base.at.x), Math.round(base.at.z)],
|
|
479
|
+
structures: base.structures.length,
|
|
480
|
+
seen: age(base.last),
|
|
481
|
+
...base.gone && { gone: true }
|
|
482
|
+
})),
|
|
483
|
+
army: this.data.army.map((each) => ({
|
|
484
|
+
at: [Math.round(each.at.x), Math.round(each.at.z)],
|
|
485
|
+
count: each.count,
|
|
486
|
+
seen: age(each.tick)
|
|
487
|
+
})),
|
|
488
|
+
tech: this.enemy.techSeen(),
|
|
489
|
+
lost: this.data.lost.length
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* What a computer player remembers of its enemies (`knowledge.enemy`): their structures and bases, their army as last
|
|
495
|
+
* seen, their workers and heroes, the types and tech seen. Creeps are no one's enemy here
|
|
496
|
+
*
|
|
497
|
+
* @beta
|
|
498
|
+
*/
|
|
499
|
+
var EnemyKnowledge = class {
|
|
500
|
+
knowledge;
|
|
501
|
+
basesFound;
|
|
502
|
+
trainedBy;
|
|
503
|
+
constructor(knowledge) {
|
|
504
|
+
this.knowledge = knowledge;
|
|
505
|
+
}
|
|
506
|
+
/** @internal Forgets what was worked out of the data: it changed */
|
|
507
|
+
reset() {
|
|
508
|
+
this.basesFound = void 0;
|
|
509
|
+
}
|
|
510
|
+
/** Their structures remembered and not known gone (`gone: true` for those too), of one owner where given */
|
|
511
|
+
structures(options = {}) {
|
|
512
|
+
return this.knowledge.data.structures.filter((each) => (options.gone || each.gone === void 0) && (options.owner === void 0 || each.owner === options.owner));
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Their bases: the structures remembered, gone ones too, clustered by owner around what takes deposits (a hall), or
|
|
516
|
+
* around any structure where none does. The first seen of each owner's first; `gone` where all of it is known gone
|
|
517
|
+
*/
|
|
518
|
+
bases(owner) {
|
|
519
|
+
const all = this.basesFound ??= this.cluster();
|
|
520
|
+
return owner === void 0 ? all : all.filter((base) => base.owner === owner);
|
|
521
|
+
}
|
|
522
|
+
cluster() {
|
|
523
|
+
const { knowledge } = this;
|
|
524
|
+
const registry = knowledge.view?.registry;
|
|
525
|
+
const reach = 576;
|
|
526
|
+
const takesDeposits = (each) => !!registry?.units.has(each.type) && !!registry.unit(each.type).dropOff;
|
|
527
|
+
const structures = [...knowledge.data.structures].sort((a, b) => a.first - b.first || a.id - b.id);
|
|
528
|
+
const bases = [];
|
|
529
|
+
const centreOf = (each) => bases.find((base) => base.owner === each.owner && distSq(base.at, each.at) < reach);
|
|
530
|
+
for (const each of structures) {
|
|
531
|
+
if (!takesDeposits(each) || centreOf(each)) continue;
|
|
532
|
+
bases.push({
|
|
533
|
+
owner: each.owner,
|
|
534
|
+
at: at(each.at),
|
|
535
|
+
first: each.first,
|
|
536
|
+
last: each.last,
|
|
537
|
+
structures: [],
|
|
538
|
+
hall: true,
|
|
539
|
+
gone: false,
|
|
540
|
+
expansion: false
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
for (const each of structures) {
|
|
544
|
+
let base = centreOf(each);
|
|
545
|
+
if (!base) {
|
|
546
|
+
base = {
|
|
547
|
+
owner: each.owner,
|
|
548
|
+
at: at(each.at),
|
|
549
|
+
first: each.first,
|
|
550
|
+
last: each.last,
|
|
551
|
+
structures: [],
|
|
552
|
+
hall: false,
|
|
553
|
+
gone: false,
|
|
554
|
+
expansion: false
|
|
555
|
+
};
|
|
556
|
+
bases.push(base);
|
|
557
|
+
}
|
|
558
|
+
base.structures.push(each);
|
|
559
|
+
base.first = Math.min(base.first, each.first);
|
|
560
|
+
base.last = Math.max(base.last, each.last);
|
|
561
|
+
}
|
|
562
|
+
const firstOf = /* @__PURE__ */ new Set();
|
|
563
|
+
bases.sort((a, b) => a.first - b.first || a.owner - b.owner);
|
|
564
|
+
for (const base of bases) {
|
|
565
|
+
base.gone = base.structures.every((each) => each.gone !== void 0);
|
|
566
|
+
if (!base.hall) continue;
|
|
567
|
+
if (firstOf.has(base.owner)) base.expansion = true;
|
|
568
|
+
else firstOf.add(base.owner);
|
|
569
|
+
}
|
|
570
|
+
return bases;
|
|
571
|
+
}
|
|
572
|
+
/** Their bases beyond the first of each owner's, with a hall: where they expanded to, as far as seen */
|
|
573
|
+
expansionsSeen() {
|
|
574
|
+
return this.bases().filter((base) => base.expansion && !base.gone);
|
|
575
|
+
}
|
|
576
|
+
/** Their army as last seen, in groups, newest first; only those seen within so many seconds where given */
|
|
577
|
+
armySeen(withinSeconds) {
|
|
578
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
579
|
+
return this.knowledge.data.army.filter((each) => each.tick >= oldest);
|
|
580
|
+
}
|
|
581
|
+
/** Their workers as last seen, newest first; only those seen within so many seconds where given */
|
|
582
|
+
workersSeen(withinSeconds) {
|
|
583
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
584
|
+
return this.knowledge.data.workers.filter((each) => each.tick >= oldest);
|
|
585
|
+
}
|
|
586
|
+
/** Their heroes as last seen, newest first: type, level, where, and `died` when seen to die */
|
|
587
|
+
heroesSeen() {
|
|
588
|
+
return this.knowledge.data.heroes;
|
|
589
|
+
}
|
|
590
|
+
/** The unit and structure types of theirs seen, with when and the most seen at once */
|
|
591
|
+
typesSeen() {
|
|
592
|
+
return this.knowledge.data.types;
|
|
593
|
+
}
|
|
594
|
+
/** The most of a type of theirs seen at once: 0 for one never seen */
|
|
595
|
+
mostSeen(type) {
|
|
596
|
+
return this.knowledge.data.types[type]?.most ?? 0;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* What they have, as far as what was seen tells: the types seen; what those require, named as `UnitTypeDef.requires`
|
|
600
|
+
* names them; and the building that trains a type, where only one does (a gryphon means an aviary, and what an aviary
|
|
601
|
+
* requires). Sorted, for the same answer every time
|
|
602
|
+
*/
|
|
603
|
+
techSeen() {
|
|
604
|
+
const registry = this.knowledge.view?.registry;
|
|
605
|
+
const tech = /* @__PURE__ */ new Set();
|
|
606
|
+
const add = (id) => {
|
|
607
|
+
if (tech.has(id)) return;
|
|
608
|
+
tech.add(id);
|
|
609
|
+
if (!registry?.units.has(id)) return;
|
|
610
|
+
for (const need of registry.unit(id).requires ?? []) add(need);
|
|
611
|
+
const trainers = this.trainersOf(id);
|
|
612
|
+
if (trainers.length === 1) add(trainers[0]);
|
|
613
|
+
};
|
|
614
|
+
for (const type of Object.keys(this.knowledge.data.types)) add(type);
|
|
615
|
+
return [...tech].sort();
|
|
616
|
+
}
|
|
617
|
+
/** The building types that train a unit type, found once for the game's definitions */
|
|
618
|
+
trainersOf(type) {
|
|
619
|
+
const registry = this.knowledge.view?.registry;
|
|
620
|
+
if (!registry) return [];
|
|
621
|
+
if (this.trainedBy?.registry !== registry) {
|
|
622
|
+
const by = /* @__PURE__ */ new Map();
|
|
623
|
+
for (const def of registry.units.all()) for (const trained of def.trains ?? []) (by.get(trained) ?? by.set(trained, []).get(trained)).push(def.id);
|
|
624
|
+
this.trainedBy = {
|
|
625
|
+
registry,
|
|
626
|
+
by
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
return this.trainedBy.by.get(type) ?? [];
|
|
630
|
+
}
|
|
631
|
+
/** Takes in what a type seen was, where the game or an older save tells: as if seen, `count` at once, at a tick */
|
|
632
|
+
sawType(type, count, tick = this.knowledge.tick) {
|
|
633
|
+
const seen = this.knowledge.data.types[type] ??= {
|
|
634
|
+
first: tick,
|
|
635
|
+
last: tick,
|
|
636
|
+
most: 0
|
|
637
|
+
};
|
|
638
|
+
seen.last = Math.max(seen.last, tick);
|
|
639
|
+
seen.most = Math.max(seen.most, count);
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* What a computer player remembers of the map (`knowledge.map`): when each place was last in sight. The cells are of
|
|
644
|
+
* the view's grid (8 units)
|
|
645
|
+
*
|
|
646
|
+
* @beta
|
|
647
|
+
*/
|
|
648
|
+
var MapKnowledge = class {
|
|
649
|
+
knowledge;
|
|
650
|
+
constructor(knowledge) {
|
|
651
|
+
this.knowledge = knowledge;
|
|
652
|
+
}
|
|
653
|
+
/** The tick a place was last in sight of the seat's team: none for a place never seen */
|
|
654
|
+
lastLooked(point) {
|
|
655
|
+
const cell = this.knowledge.cell(point);
|
|
656
|
+
const tick = cell < 0 ? -1 : this.knowledge.data.looked.ticks[cell] ?? -1;
|
|
657
|
+
return tick < 0 ? void 0 : tick;
|
|
658
|
+
}
|
|
659
|
+
/** Seconds since a place was last in sight: `Infinity` for one never seen */
|
|
660
|
+
sinceLooked(point) {
|
|
661
|
+
const tick = this.lastLooked(point);
|
|
662
|
+
return tick === void 0 ? Infinity : this.knowledge.seconds(this.knowledge.tick - tick);
|
|
663
|
+
}
|
|
664
|
+
/** Whether a place is in sight now, as of the last update */
|
|
665
|
+
inSight(point) {
|
|
666
|
+
return this.lastLooked(point) === this.knowledge.tick && this.knowledge.view !== void 0;
|
|
667
|
+
}
|
|
668
|
+
/** Whether the seat's team has explored a place: seen it once, as the fog says */
|
|
669
|
+
explored(point) {
|
|
670
|
+
const { fog, view } = this.knowledge;
|
|
671
|
+
if (!fog || !view) return this.lastLooked(point) !== void 0;
|
|
672
|
+
if (fog.revealed || !fog.explored.length) return true;
|
|
673
|
+
const { width, depth } = view.session.terrain;
|
|
674
|
+
const fx = Math.floor(point.x / width * fog.width);
|
|
675
|
+
const fz = Math.floor(point.z / depth * fog.depth);
|
|
676
|
+
if (fx < 0 || fz < 0 || fx >= fog.width || fz >= fog.depth) return false;
|
|
677
|
+
return !!fog.explored[fz * fog.width + fx];
|
|
678
|
+
}
|
|
679
|
+
/** Takes in that a place was looked at, at a tick: where the game or an older save tells */
|
|
680
|
+
look(point, tick = this.knowledge.tick) {
|
|
681
|
+
const cell = this.knowledge.cell(point);
|
|
682
|
+
const ticks = this.knowledge.data.looked.ticks;
|
|
683
|
+
if (cell >= 0) ticks[cell] = Math.max(ticks[cell] ?? -1, tick);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* The map's mines (`view.mines`), each with when its place was last looked at and whose base is by it, as far as
|
|
687
|
+
* known: where to expand, where to look for theirs
|
|
688
|
+
*/
|
|
689
|
+
mines() {
|
|
690
|
+
const view = this.knowledge.view;
|
|
691
|
+
if (!view) return [];
|
|
692
|
+
const mine = view.bases();
|
|
693
|
+
const theirs = this.knowledge.enemy.bases().filter((base) => base.hall && !base.gone);
|
|
694
|
+
const reach = 576;
|
|
695
|
+
return view.mines().map((each) => {
|
|
696
|
+
const looked = this.lastLooked(each);
|
|
697
|
+
const taken = mine.some((base) => distSq(base.at, each) < reach) ? view.playerId : theirs.find((base) => distSq(base.at, each) < reach)?.owner;
|
|
698
|
+
return {
|
|
699
|
+
...each,
|
|
700
|
+
...looked !== void 0 && { looked },
|
|
701
|
+
...taken !== void 0 && { taken }
|
|
702
|
+
};
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
/** The map's creep camps, as the seat knows them (`view.camps`) */
|
|
706
|
+
camps() {
|
|
707
|
+
return this.knowledge.view?.camps() ?? [];
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
/**
|
|
711
|
+
* What a computer player remembers of itself (`knowledge.own`): what it lost, the attacks it sent, what it gathered
|
|
712
|
+
*
|
|
713
|
+
* @beta
|
|
714
|
+
*/
|
|
715
|
+
var OwnKnowledge = class {
|
|
716
|
+
knowledge;
|
|
717
|
+
constructor(knowledge) {
|
|
718
|
+
this.knowledge = knowledge;
|
|
719
|
+
}
|
|
720
|
+
/** What of its own died, oldest first; only within so many seconds where given */
|
|
721
|
+
lost(withinSeconds) {
|
|
722
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
723
|
+
return this.knowledge.data.lost.filter((each) => each.tick >= oldest);
|
|
724
|
+
}
|
|
725
|
+
/** What of its own died within a distance of a place: "we are being raided here" */
|
|
726
|
+
lostNear(point, radius, withinSeconds) {
|
|
727
|
+
const reach = radius * radius;
|
|
728
|
+
return this.lost(withinSeconds).filter((each) => distSq(each.at, point) <= reach);
|
|
729
|
+
}
|
|
730
|
+
/** Notes an attack sent, for whoever asks later (`attacks`): what a module that sends an army calls */
|
|
731
|
+
attackSent(point, count) {
|
|
732
|
+
const { data, options } = this.knowledge;
|
|
733
|
+
data.attacks.push({
|
|
734
|
+
tick: data.tick,
|
|
735
|
+
at: at(point),
|
|
736
|
+
count
|
|
737
|
+
});
|
|
738
|
+
trimOldest(data.attacks, options.limits.attacks);
|
|
739
|
+
}
|
|
740
|
+
/** The attacks sent, oldest first; only within so many seconds where given */
|
|
741
|
+
attacks(withinSeconds) {
|
|
742
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
743
|
+
return this.knowledge.data.attacks.filter((each) => each.tick >= oldest);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* What it gathers of a resource a minute, over the last so many seconds (60): from the rises in what it has, so it
|
|
747
|
+
* is at least this (what was gathered and spent between two thinks does not show). Bounty counts as gathered
|
|
748
|
+
*/
|
|
749
|
+
income(kind, seconds = 60) {
|
|
750
|
+
const { data } = this.knowledge;
|
|
751
|
+
const rate = this.knowledge.view?.session.tickRate ?? 1;
|
|
752
|
+
const from = data.tick - seconds * rate;
|
|
753
|
+
const sample = data.history.find((each) => each.tick >= from) ?? data.history[0];
|
|
754
|
+
if (!sample) return 0;
|
|
755
|
+
const elapsed = (data.tick - sample.tick) / rate;
|
|
756
|
+
if (elapsed <= 0) return 0;
|
|
757
|
+
return ((data.gathered[kind] ?? 0) - (sample.gathered[kind] ?? 0)) / elapsed * 60;
|
|
758
|
+
}
|
|
759
|
+
/** The income of every resource gathered so far, a minute (`income`) */
|
|
760
|
+
incomes(seconds = 60) {
|
|
761
|
+
const result = {};
|
|
762
|
+
for (const kind of Object.keys(this.knowledge.data.gathered)) result[kind] = this.income(kind, seconds);
|
|
763
|
+
return result;
|
|
764
|
+
}
|
|
765
|
+
/** What was gathered of each resource since the game began, as far as the rises tell */
|
|
766
|
+
get gathered() {
|
|
767
|
+
return this.knowledge.data.gathered;
|
|
768
|
+
}
|
|
769
|
+
/** The samples of what was gathered, oldest first */
|
|
770
|
+
get history() {
|
|
771
|
+
return this.knowledge.data.history;
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* What a computer player heard (`knowledge.events`): pings, damage to its own and its allies', deaths, each with its
|
|
776
|
+
* tick, the oldest first
|
|
777
|
+
*
|
|
778
|
+
* @beta
|
|
779
|
+
*/
|
|
780
|
+
var HeardEvents = class {
|
|
781
|
+
knowledge;
|
|
782
|
+
constructor(knowledge) {
|
|
783
|
+
this.knowledge = knowledge;
|
|
784
|
+
}
|
|
785
|
+
/** Pings heard; only within so many seconds where given */
|
|
786
|
+
pings(withinSeconds) {
|
|
787
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
788
|
+
return this.knowledge.data.pings.filter((each) => each.tick >= oldest);
|
|
789
|
+
}
|
|
790
|
+
/** Damage seen done to its own and its allies' entities, a line an entity a think; only within so many seconds where given */
|
|
791
|
+
damage(withinSeconds) {
|
|
792
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
793
|
+
return this.knowledge.data.damage.filter((each) => each.tick >= oldest);
|
|
794
|
+
}
|
|
795
|
+
/** Deaths seen, anyone's; only within so many seconds where given */
|
|
796
|
+
deaths(withinSeconds) {
|
|
797
|
+
const oldest = this.knowledge.since(withinSeconds);
|
|
798
|
+
return this.knowledge.data.deaths.filter((each) => each.tick >= oldest);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
//#endregion
|
|
802
|
+
export { EnemyKnowledge, HeardEvents, Knowledge, MapKnowledge, OwnKnowledge };
|
|
803
|
+
|
|
804
|
+
//# sourceMappingURL=knowledge.js.map
|