@v12-engine/engine 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/abilities/buffs.d.ts +83 -0
- package/dist/abilities/castTold.d.ts +12 -0
- package/dist/abilities/charges.d.ts +28 -0
- package/dist/abilities/dispel.d.ts +9 -0
- package/dist/abilities/effectFields.d.ts +10 -0
- package/dist/abilities/effects/buff.d.ts +8 -0
- package/dist/abilities/effects/core.d.ts +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -0
- package/dist/abilities/effects/missile.d.ts +1 -0
- package/dist/abilities/effects/moves.d.ts +11 -0
- package/dist/abilities/effects/passives.d.ts +15 -0
- package/dist/abilities/effects/sight.d.ts +4 -0
- package/dist/abilities/effects/spawn.d.ts +2 -0
- package/dist/abilities/effects/timed.d.ts +4 -0
- package/dist/abilities/effects/trade.d.ts +1 -0
- package/dist/abilities/effects.d.ts +122 -0
- package/dist/abilities/land.d.ts +21 -0
- package/dist/abilities/scaled.d.ts +21 -0
- package/dist/abilities/text.d.ts +113 -0
- package/dist/ai/area.d.ts +53 -0
- package/dist/ai/brain.d.ts +528 -0
- package/dist/ai/budget.d.ts +67 -0
- package/dist/ai/checks.d.ts +115 -0
- package/dist/ai/computer.d.ts +166 -0
- package/dist/ai/defence.d.ts +108 -0
- package/dist/ai/define.d.ts +21 -0
- package/dist/ai/economy.d.ts +129 -0
- package/dist/ai/geometry.d.ts +35 -0
- package/dist/ai/goals.d.ts +360 -0
- package/dist/ai/index.d.ts +38 -0
- package/dist/ai/knowledge.d.ts +418 -0
- package/dist/ai/lanes.d.ts +232 -0
- package/dist/ai/melee/build.d.ts +61 -0
- package/dist/ai/melee/goals.d.ts +299 -0
- package/dist/ai/melee/heroes.d.ts +27 -0
- package/dist/ai/melee/index.d.ts +14 -0
- package/dist/ai/melee/production.d.ts +8 -0
- package/dist/ai/melee/surrender.d.ts +24 -0
- package/dist/ai/micro.d.ts +278 -0
- package/dist/ai/mission.d.ts +195 -0
- package/dist/ai/missionRules.d.ts +18 -0
- package/dist/ai/module.d.ts +116 -0
- package/dist/ai/options.d.ts +61 -0
- package/dist/ai/plans/build.d.ts +280 -0
- package/dist/ai/plans/placement.d.ts +82 -0
- package/dist/ai/plans/plans.d.ts +105 -0
- package/dist/ai/plans/production.d.ts +210 -0
- package/dist/ai/plans/purse.d.ts +73 -0
- package/dist/ai/plans/tech.d.ts +37 -0
- package/dist/ai/profiles.d.ts +204 -0
- package/dist/ai/reach.d.ts +4 -0
- package/dist/ai/report.d.ts +203 -0
- package/dist/ai/roles.d.ts +133 -0
- package/dist/ai/rules.d.ts +288 -0
- package/dist/ai/scouting.d.ts +98 -0
- package/dist/ai/settings.d.ts +73 -0
- package/dist/ai/squads.d.ts +429 -0
- package/dist/ai/strength.d.ts +167 -0
- package/dist/ai/task.d.ts +118 -0
- package/dist/ai/tasks/attack.d.ts +7 -0
- package/dist/ai/tasks/capture.d.ts +21 -0
- package/dist/ai/tasks/creep.d.ts +16 -0
- package/dist/ai/tasks/defend.d.ts +29 -0
- package/dist/ai/tasks/drop.d.ts +34 -0
- package/dist/ai/tasks/escort.d.ts +16 -0
- package/dist/ai/tasks/gather.d.ts +23 -0
- package/dist/ai/tasks/harass.d.ts +7 -0
- package/dist/ai/tasks/hold.d.ts +20 -0
- package/dist/ai/tasks/index.d.ts +32 -0
- package/dist/ai/tasks/move.d.ts +19 -0
- package/dist/ai/tasks/patrol.d.ts +8 -0
- package/dist/ai/tasks/retreat.d.ts +20 -0
- package/dist/ai/tasks/scout.d.ts +29 -0
- package/dist/ai/tasks/shared.d.ts +74 -0
- package/dist/ai/team.d.ts +155 -0
- package/dist/ai/threat.d.ts +91 -0
- package/dist/ai/view.d.ts +366 -0
- package/dist/ai/waves.d.ts +126 -0
- package/dist/ai.js +6239 -0
- package/dist/ai.js.map +1 -0
- package/dist/aiTesting.d.ts +179 -0
- package/dist/areas.d.ts +149 -0
- package/dist/attacks.d.ts +66 -0
- package/dist/attributes.d.ts +66 -0
- package/dist/brain-BvVdUhX8.js +7659 -0
- package/dist/brain-BvVdUhX8.js.map +1 -0
- package/dist/builds-C6LfgvEU.js +460 -0
- package/dist/builds-C6LfgvEU.js.map +1 -0
- package/dist/bytes.d.ts +6 -0
- package/dist/camps.d.ts +95 -0
- package/dist/capture.d.ts +131 -0
- package/dist/cellLayers.d.ts +75 -0
- package/dist/cinematics.d.ts +194 -0
- package/dist/clock.d.ts +32 -0
- package/dist/commands.d.ts +235 -0
- package/dist/components.d.ts +184 -0
- package/dist/computers.d.ts +108 -0
- package/dist/concealment.d.ts +61 -0
- package/dist/coreComponents-syuh2fPG.js +5149 -0
- package/dist/coreComponents-syuh2fPG.js.map +1 -0
- package/dist/coreComponents.d.ts +1 -0
- package/dist/dashing.d.ts +8 -0
- package/dist/debug.d.ts +36 -0
- package/dist/debug.js +3 -0
- package/dist/debugCommands-CzjrSm66.js +14739 -0
- package/dist/debugCommands-CzjrSm66.js.map +1 -0
- package/dist/debugCommands.d.ts +213 -0
- package/dist/debugging.d.ts +10 -0
- package/dist/definitions.d.ts +43 -0
- package/dist/defs.d.ts +1162 -0
- package/dist/denying.d.ts +81 -0
- package/dist/destructibles.d.ts +27 -0
- package/dist/determinism-BCymQwiE.js +518 -0
- package/dist/determinism-BCymQwiE.js.map +1 -0
- package/dist/determinism.d.ts +121 -0
- package/dist/dialog.d.ts +94 -0
- package/dist/effectRefs.d.ts +16 -0
- package/dist/effects.d.ts +80 -0
- package/dist/endings.d.ts +22 -0
- package/dist/engagement.d.ts +108 -0
- package/dist/engineEvents.d.ts +710 -0
- package/dist/entity.d.ts +409 -0
- package/dist/entityIndex.d.ts +50 -0
- package/dist/errors.d.ts +85 -0
- package/dist/events.d.ts +97 -0
- package/dist/exactMath.d.ts +63 -0
- package/dist/features.d.ts +10 -0
- package/dist/fields.d.ts +114 -0
- package/dist/fixture.d.ts +17 -0
- package/dist/fog.d.ts +110 -0
- package/dist/formation.d.ts +111 -0
- package/dist/friendlyFire.d.ts +26 -0
- package/dist/game-DiJEN-Ks.js +5800 -0
- package/dist/game-DiJEN-Ks.js.map +1 -0
- package/dist/game.d.ts +501 -0
- package/dist/gameData.d.ts +325 -0
- package/dist/gameFiles.d.ts +26 -0
- package/dist/gates.d.ts +28 -0
- package/dist/generate.d.ts +403 -0
- package/dist/generateWorker.d.ts +39 -0
- package/dist/grid.d.ts +53 -0
- package/dist/ground.d.ts +127 -0
- package/dist/groundSpeed.d.ts +22 -0
- package/dist/hero.d.ts +177 -0
- package/dist/home.d.ts +14 -0
- package/dist/hooks.d.ts +780 -0
- package/dist/hotReload.d.ts +76 -0
- package/dist/ids.d.ts +26 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +4701 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-D9dWHmZ0.js +491 -0
- package/dist/inspect-D9dWHmZ0.js.map +1 -0
- package/dist/inspect.d.ts +176 -0
- package/dist/inventory.d.ts +18 -0
- package/dist/items.d.ts +91 -0
- package/dist/lanes.d.ts +213 -0
- package/dist/life.d.ts +53 -0
- package/dist/local-Dkovq42k.js +1379 -0
- package/dist/local-Dkovq42k.js.map +1 -0
- package/dist/log.d.ts +140 -0
- package/dist/manaBurn.d.ts +39 -0
- package/dist/map/file.d.ts +114 -0
- package/dist/map/images.d.ts +18 -0
- package/dist/map/look.d.ts +47 -0
- package/dist/map/pathProfile.d.ts +13 -0
- package/dist/map/resize.d.ts +54 -0
- package/dist/map/schema.d.ts +10 -0
- package/dist/map/terrain.d.ts +32 -0
- package/dist/map/types.d.ts +613 -0
- package/dist/map.d.ts +7 -0
- package/dist/mapCheck/cells.d.ts +19 -0
- package/dist/mapCheck/rule.d.ts +30 -0
- package/dist/mapCheck/rules/names.d.ts +3 -0
- package/dist/mapCheck/rules/objects.d.ts +3 -0
- package/dist/mapCheck/rules/paths.d.ts +3 -0
- package/dist/mapCheck/rules/players.d.ts +3 -0
- package/dist/mapCheck/rules/races.d.ts +3 -0
- package/dist/mapCheck/rules/random.d.ts +3 -0
- package/dist/mapCheck/rules/regions.d.ts +3 -0
- package/dist/mapCheck/rules/targets.d.ts +3 -0
- package/dist/mapCheck/rules/walking.d.ts +3 -0
- package/dist/mapCheck.d.ts +23 -0
- package/dist/mapFields.d.ts +364 -0
- package/dist/mapFile.d.ts +23 -0
- package/dist/mapMeasure.d.ts +95 -0
- package/dist/mapMerge.d.ts +19 -0
- package/dist/mapObjectives.d.ts +82 -0
- package/dist/mapObjects.d.ts +1 -0
- package/dist/math.d.ts +44 -0
- package/dist/messages.d.ts +150 -0
- package/dist/missionRules-C-bGxm0Q.js +523 -0
- package/dist/missionRules-C-bGxm0Q.js.map +1 -0
- package/dist/missionRules.d.ts +179 -0
- package/dist/mods.d.ts +146 -0
- package/dist/names.d.ts +93 -0
- package/dist/navigation/agentParams.d.ts +4 -0
- package/dist/navigation/air.d.ts +89 -0
- package/dist/navigation/builds.d.ts +140 -0
- package/dist/navigation/groundAreas.d.ts +23 -0
- package/dist/navigation/navigation.d.ts +127 -0
- package/dist/navigation/recast.d.ts +214 -0
- package/dist/navigation/sidePaths.d.ts +69 -0
- package/dist/navigation/sized.d.ts +1 -0
- package/dist/navigation-worker.js +11 -0
- package/dist/navigation-worker.js.map +1 -0
- package/dist/nearest.d.ts +8 -0
- package/dist/noise.d.ts +12 -0
- package/dist/objectives.d.ts +93 -0
- package/dist/orders/basic.d.ts +96 -0
- package/dist/orders/build.d.ts +91 -0
- package/dist/orders/cast.d.ts +105 -0
- package/dist/orders/facts.d.ts +14 -0
- package/dist/orders/harvest.d.ts +94 -0
- package/dist/orders/idle.d.ts +7 -0
- package/dist/orders/items.d.ts +14 -0
- package/dist/orders/queue.d.ts +24 -0
- package/dist/pack.schema.json +6621 -0
- package/dist/packs/director/index.d.ts +81 -0
- package/dist/packs/heroes/campaign.d.ts +137 -0
- package/dist/packs/heroes/carry.d.ts +59 -0
- package/dist/packs/heroes/commands.d.ts +6 -0
- package/dist/packs/heroes/hire.d.ts +9 -0
- package/dist/packs/heroes/index.d.ts +12 -0
- package/dist/packs/heroes/making.d.ts +16 -0
- package/dist/packs/heroes/respawn.d.ts +42 -0
- package/dist/packs/moba/index.d.ts +34 -0
- package/dist/packs/pack.d.ts +84 -0
- package/dist/packs-g5thvmGn.js +3199 -0
- package/dist/packs-g5thvmGn.js.map +1 -0
- package/dist/packs.d.ts +84 -0
- package/dist/paths.d.ts +51 -0
- package/dist/plain.d.ts +17 -0
- package/dist/player.d.ts +117 -0
- package/dist/portals.d.ts +66 -0
- package/dist/prefabs.d.ts +139 -0
- package/dist/presetBuildings.d.ts +52 -0
- package/dist/presetGround.d.ts +22 -0
- package/dist/profiles-B3NS9jwk.js +335 -0
- package/dist/profiles-B3NS9jwk.js.map +1 -0
- package/dist/races.d.ts +136 -0
- package/dist/randomGroups.d.ts +2 -0
- package/dist/registry.d.ts +464 -0
- package/dist/remains.d.ts +119 -0
- package/dist/replication.d.ts +103 -0
- package/dist/rng.d.ts +17 -0
- package/dist/rules.d.ts +395 -0
- package/dist/rulesCheck.d.ts +37 -0
- package/dist/runes.d.ts +41 -0
- package/dist/save.d.ts +277 -0
- package/dist/scenario.d.ts +56 -0
- package/dist/scheduler.d.ts +67 -0
- package/dist/score.d.ts +306 -0
- package/dist/sequences.d.ts +132 -0
- package/dist/server/doorman.d.ts +21 -0
- package/dist/server/gameServer.d.ts +346 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/lobby.d.ts +1 -0
- package/dist/server/log.d.ts +13 -0
- package/dist/server/match.d.ts +24 -0
- package/dist/server/mode.d.ts +168 -0
- package/dist/server/navigation-worker.d.ts +1 -0
- package/dist/server/navigation.d.ts +11 -0
- package/dist/server/ops.d.ts +78 -0
- package/dist/server/packs.d.ts +15 -0
- package/dist/server/ratings.d.ts +62 -0
- package/dist/server/relay.d.ts +34 -0
- package/dist/server/rooms.d.ts +162 -0
- package/dist/server/seat.d.ts +2 -0
- package/dist/server/seatSettings.d.ts +15 -0
- package/dist/server/secret.d.ts +5 -0
- package/dist/server/start.d.ts +54 -0
- package/dist/server/websocket.d.ts +74 -0
- package/dist/server.js +2861 -0
- package/dist/server.js.map +1 -0
- package/dist/session/can.d.ts +20 -0
- package/dist/session/commandReplay.d.ts +92 -0
- package/dist/session/debug.d.ts +65 -0
- package/dist/session/delay.d.ts +15 -0
- package/dist/session/delta.d.ts +98 -0
- package/dist/session/entityState.d.ts +1 -0
- package/dist/session/local.d.ts +214 -0
- package/dist/session/memory.d.ts +27 -0
- package/dist/session/protocol.d.ts +1155 -0
- package/dist/session/remote.d.ts +530 -0
- package/dist/session/replay.d.ts +114 -0
- package/dist/session/seed.d.ts +7 -0
- package/dist/session/share.d.ts +78 -0
- package/dist/session/socket.d.ts +8 -0
- package/dist/session/wire.d.ts +153 -0
- package/dist/session/worker.d.ts +227 -0
- package/dist/shared.d.ts +171 -0
- package/dist/sides.d.ts +75 -0
- package/dist/sight.d.ts +27 -0
- package/dist/simulate-oXBiw1Ff.js +167 -0
- package/dist/simulate-oXBiw1Ff.js.map +1 -0
- package/dist/simulate-worker.d.ts +1 -0
- package/dist/simulate-worker.js +28 -0
- package/dist/simulate-worker.js.map +1 -0
- package/dist/simulate.d.ts +154 -0
- package/dist/smart.d.ts +9 -0
- package/dist/spatial.d.ts +62 -0
- package/dist/spawning.d.ts +33 -0
- package/dist/stances.d.ts +76 -0
- package/dist/start.d.ts +71 -0
- package/dist/stats.d.ts +122 -0
- package/dist/summons.d.ts +63 -0
- package/dist/systems/abilities.d.ts +3 -0
- package/dist/systems/combat.d.ts +71 -0
- package/dist/systems/combatTold.d.ts +14 -0
- package/dist/systems/construction.d.ts +34 -0
- package/dist/systems/economy.d.ts +21 -0
- package/dist/systems/fog.d.ts +19 -0
- package/dist/systems/life.d.ts +3 -0
- package/dist/systems/movement.d.ts +105 -0
- package/dist/systems/orders.d.ts +7 -0
- package/dist/systems/production.d.ts +49 -0
- package/dist/systems/productionQueue.d.ts +40 -0
- package/dist/systems/victory.d.ts +14 -0
- package/dist/talk.d.ts +65 -0
- package/dist/tech.d.ts +62 -0
- package/dist/techTree.d.ts +38 -0
- package/dist/terrain.d.ts +173 -0
- package/dist/terrainSave.d.ts +29 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +822 -0
- package/dist/testing.js.map +1 -0
- package/dist/tiles.d.ts +34 -0
- package/dist/timers.d.ts +146 -0
- package/dist/tomes.d.ts +48 -0
- package/dist/trade.d.ts +28 -0
- package/dist/transport.d.ts +76 -0
- package/dist/tunables.d.ts +45 -0
- package/dist/upkeep.d.ts +16 -0
- package/dist/veterancy.d.ts +80 -0
- package/dist/walls.d.ts +86 -0
- package/dist/world.d.ts +1118 -0
- package/package.json +80 -5
- package/README.md +0 -3
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import type { ResourceKind } from '#engine/defs';
|
|
2
|
+
import type { AiArea } from './area';
|
|
3
|
+
import type { PlayerId } from '#engine/entity';
|
|
4
|
+
import { type Vec2 } from '#engine/math';
|
|
5
|
+
import type { CampInfo, EntityState, MineInfo } from '#engine/session/protocol';
|
|
6
|
+
import type { AiView } from './view';
|
|
7
|
+
/**
|
|
8
|
+
* How a brain's knowledge remembers (`BrainDef.knowledge`): how long, how much, what counts as the army. Every field
|
|
9
|
+
* has its default; numbers are seconds where they say so
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface KnowledgeOptions {
|
|
14
|
+
/** Seconds a sighting of the enemy's army, or of a worker, is kept: 180 */
|
|
15
|
+
armyFor?: number;
|
|
16
|
+
/** Seconds a structure seen gone is still remembered as gone, and an event, a loss or an attack sent is kept: 300 */
|
|
17
|
+
keepFor?: number;
|
|
18
|
+
/** How near two groups of enemy fighters are to be one sighting, and a newer sighting to replace an older: 16 */
|
|
19
|
+
mergeRadius?: number;
|
|
20
|
+
/** Seconds between samples of what was gathered, for `own.income`: 5 */
|
|
21
|
+
historyEvery?: number;
|
|
22
|
+
/** At most so many of each: sightings 12, workers 40, heroes 16, structures 400, losses 64, events 48, attacks 20, samples 36 */
|
|
23
|
+
limits?: Partial<Record<'sightings' | 'workers' | 'heroes' | 'structures' | 'lost' | 'events' | 'attacks' | 'history', number>>;
|
|
24
|
+
/** What of the enemy's units in sight counts as their army: their soldiers and heroes (`UnitSet.fighters`) when left out */
|
|
25
|
+
army?: (entity: EntityState, view: AiView) => boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* An enemy structure as remembered: where, what, whose, and when it was first and last in sight (ticks). `gone` is the
|
|
29
|
+
* tick it was known to be gone: seen destroyed, or its spot seen empty
|
|
30
|
+
*
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export interface StructureSeen {
|
|
34
|
+
id: number;
|
|
35
|
+
type: string;
|
|
36
|
+
owner: PlayerId;
|
|
37
|
+
at: Vec2;
|
|
38
|
+
first: number;
|
|
39
|
+
last: number;
|
|
40
|
+
gone?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A group of the enemy's fighters, seen together (`enemy.armySeen`): where its middle was, the tick, how many, of
|
|
44
|
+
* what types, with how much health and strength, whose (the owner of most of them)
|
|
45
|
+
*
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
export interface ArmySighting {
|
|
49
|
+
at: Vec2;
|
|
50
|
+
tick: number;
|
|
51
|
+
owner: PlayerId;
|
|
52
|
+
count: number;
|
|
53
|
+
/** Their health together, as seen */
|
|
54
|
+
health: number;
|
|
55
|
+
/** Their strength together, as seen (`Strength.of`, with the health each had left) */
|
|
56
|
+
strength: number;
|
|
57
|
+
types: Record<string, number>;
|
|
58
|
+
heroes: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* An enemy unit as last seen (`enemy.workersSeen`, `enemy.heroesSeen`): `level` for a hero, `died` the tick it was
|
|
62
|
+
* seen to die (a hero may come back)
|
|
63
|
+
*
|
|
64
|
+
* @beta
|
|
65
|
+
*/
|
|
66
|
+
export interface UnitSeen {
|
|
67
|
+
id: number;
|
|
68
|
+
type: string;
|
|
69
|
+
owner: PlayerId;
|
|
70
|
+
at: Vec2;
|
|
71
|
+
tick: number;
|
|
72
|
+
level?: number;
|
|
73
|
+
died?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A unit type of the enemy's as seen (`enemy.typesSeen`): first and last tick, and the most seen at once
|
|
77
|
+
*
|
|
78
|
+
* @beta
|
|
79
|
+
*/
|
|
80
|
+
export interface TypeSeen {
|
|
81
|
+
first: number;
|
|
82
|
+
last: number;
|
|
83
|
+
most: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* An enemy's base, as its structures remembered cluster (`enemy.bases`): around what takes deposits (a hall), or
|
|
87
|
+
* around any structure where none does. `gone` when every structure of it is known gone; `expansion` for every base of
|
|
88
|
+
* an owner but the first seen of theirs
|
|
89
|
+
*
|
|
90
|
+
* @beta
|
|
91
|
+
*/
|
|
92
|
+
export interface EnemyBase {
|
|
93
|
+
owner: PlayerId;
|
|
94
|
+
at: Vec2;
|
|
95
|
+
/** When the first of it was seen */
|
|
96
|
+
first: number;
|
|
97
|
+
/** When any of it was last in sight */
|
|
98
|
+
last: number;
|
|
99
|
+
structures: StructureSeen[];
|
|
100
|
+
/** Whether it is around what takes deposits: a hall, not a lone tower */
|
|
101
|
+
hall: boolean;
|
|
102
|
+
gone: boolean;
|
|
103
|
+
expansion: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Something of one's own that died (`own.lost`): what, where, when, to what type of killer where it was seen
|
|
107
|
+
*
|
|
108
|
+
* @beta
|
|
109
|
+
*/
|
|
110
|
+
export interface Loss {
|
|
111
|
+
id: number;
|
|
112
|
+
type: string;
|
|
113
|
+
at: Vec2;
|
|
114
|
+
tick: number;
|
|
115
|
+
by?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* An attack a module sent (`own.attackSent`): when, where to, with how many
|
|
119
|
+
*
|
|
120
|
+
* @beta
|
|
121
|
+
*/
|
|
122
|
+
export interface AttackSent {
|
|
123
|
+
tick: number;
|
|
124
|
+
at: Vec2;
|
|
125
|
+
count: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A ping heard (`events.pings`): who marked where, of what kind
|
|
129
|
+
*
|
|
130
|
+
* @beta
|
|
131
|
+
*/
|
|
132
|
+
export interface PingHeard {
|
|
133
|
+
tick: number;
|
|
134
|
+
player: PlayerId;
|
|
135
|
+
at: Vec2;
|
|
136
|
+
kind: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Damage seen done to one's own or an ally's entity in a think (`events.damage`): added up over the think, one line
|
|
140
|
+
* an entity
|
|
141
|
+
*
|
|
142
|
+
* @beta
|
|
143
|
+
*/
|
|
144
|
+
export interface DamageSeen {
|
|
145
|
+
tick: number;
|
|
146
|
+
id: number;
|
|
147
|
+
type: string;
|
|
148
|
+
owner: PlayerId;
|
|
149
|
+
at: Vec2;
|
|
150
|
+
amount: number;
|
|
151
|
+
by?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A death seen (`events.deaths`): of anyone known to the seat in the think before
|
|
155
|
+
*
|
|
156
|
+
* @beta
|
|
157
|
+
*/
|
|
158
|
+
export interface DeathSeen {
|
|
159
|
+
tick: number;
|
|
160
|
+
id: number;
|
|
161
|
+
type: string;
|
|
162
|
+
owner: PlayerId;
|
|
163
|
+
at: Vec2;
|
|
164
|
+
by?: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* What a brain's knowledge is, as plain data: what a save keeps (`Brain.save`, under `knowledge`), what a game's module
|
|
168
|
+
* may read or add to through `Knowledge`
|
|
169
|
+
*
|
|
170
|
+
* @beta
|
|
171
|
+
*/
|
|
172
|
+
export interface KnowledgeMemory {
|
|
173
|
+
v: 1;
|
|
174
|
+
/** The tick it was last brought up to date */
|
|
175
|
+
tick: number;
|
|
176
|
+
structures: StructureSeen[];
|
|
177
|
+
/** Newest first */
|
|
178
|
+
army: ArmySighting[];
|
|
179
|
+
workers: UnitSeen[];
|
|
180
|
+
heroes: UnitSeen[];
|
|
181
|
+
types: Record<string, TypeSeen>;
|
|
182
|
+
/** The tick each cell of the map was last in sight, row by row (-1: never); `cols` cells a row */
|
|
183
|
+
looked: {
|
|
184
|
+
cols: number;
|
|
185
|
+
rows: number;
|
|
186
|
+
ticks: number[];
|
|
187
|
+
};
|
|
188
|
+
lost: Loss[];
|
|
189
|
+
attacks: AttackSent[];
|
|
190
|
+
/** What was gathered of each resource since the game began, as far as rises in what the player has tell */
|
|
191
|
+
gathered: Record<ResourceKind, number>;
|
|
192
|
+
/** What the player had at the last update, to see the next rise against */
|
|
193
|
+
had?: Record<ResourceKind, number>;
|
|
194
|
+
/** Samples of `gathered`, oldest first */
|
|
195
|
+
history: {
|
|
196
|
+
tick: number;
|
|
197
|
+
gathered: Record<ResourceKind, number>;
|
|
198
|
+
}[];
|
|
199
|
+
pings: PingHeard[];
|
|
200
|
+
damage: DamageSeen[];
|
|
201
|
+
deaths: DeathSeen[];
|
|
202
|
+
}
|
|
203
|
+
declare const LIMITS: {
|
|
204
|
+
sightings: number;
|
|
205
|
+
workers: number;
|
|
206
|
+
heroes: number;
|
|
207
|
+
structures: number;
|
|
208
|
+
lost: number;
|
|
209
|
+
events: number;
|
|
210
|
+
attacks: number;
|
|
211
|
+
history: number;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* What a computer player remembers of the enemy, the map and itself, with when (`Brain.knowledge`). Brought up to date
|
|
215
|
+
* once a think from the view; asked through its parts: `enemy` (structures, bases, army seen, workers, heroes, tech),
|
|
216
|
+
* `map` (when a place was last looked at), `own` (losses, attacks sent, income), `events` (pings, damage, deaths heard).
|
|
217
|
+
* Plain data underneath (`data`), saved with the brain
|
|
218
|
+
*
|
|
219
|
+
* @beta
|
|
220
|
+
*/
|
|
221
|
+
export declare class Knowledge implements AiArea {
|
|
222
|
+
/** Whether a save keeps it: not for a brain that remembers nothing between thinks (`BrainDef.knowledge: false`) */
|
|
223
|
+
private readonly kept;
|
|
224
|
+
/** Its id among the brain's areas: what its memory and its report are kept under */
|
|
225
|
+
readonly id = "knowledge";
|
|
226
|
+
/** What the log says where a save's memory of it is of a shape it does not read */
|
|
227
|
+
readonly afresh = "the save remembers what the computer player knew in a shape this brain does not read: it starts afresh";
|
|
228
|
+
/** What it remembers, as plain data. Replaced as a whole by `restore` */
|
|
229
|
+
data: KnowledgeMemory;
|
|
230
|
+
/** The enemy: structures, bases, army, workers, heroes, tech */
|
|
231
|
+
readonly enemy: EnemyKnowledge;
|
|
232
|
+
/** The map: when each place was last in sight */
|
|
233
|
+
readonly map: MapKnowledge;
|
|
234
|
+
/** One's own: losses, attacks sent, income */
|
|
235
|
+
readonly own: OwnKnowledge;
|
|
236
|
+
/** What was heard: pings, damage to friends, deaths */
|
|
237
|
+
readonly events: HeardEvents;
|
|
238
|
+
/** Where in the fog each cell of the map is read: found again when the fog or the map is of another size */
|
|
239
|
+
private sample;
|
|
240
|
+
readonly options: Required<Omit<KnowledgeOptions, 'army' | 'limits'>> & Pick<KnowledgeOptions, 'army'> & {
|
|
241
|
+
limits: typeof LIMITS;
|
|
242
|
+
};
|
|
243
|
+
constructor(options?: KnowledgeOptions,
|
|
244
|
+
/** The map's size, where known before the first update: what is looked at can be told before it (an older save) */
|
|
245
|
+
size?: {
|
|
246
|
+
width: number;
|
|
247
|
+
depth: number;
|
|
248
|
+
},
|
|
249
|
+
/** Whether a save keeps it: not for a brain that remembers nothing between thinks (`BrainDef.knowledge: false`) */
|
|
250
|
+
kept?: boolean);
|
|
251
|
+
/** Makes what is remembered of the map the size of a map of this many units: forgotten where it was another size */
|
|
252
|
+
private size;
|
|
253
|
+
/** The tick it was last brought up to date */
|
|
254
|
+
get tick(): number;
|
|
255
|
+
/**
|
|
256
|
+
* Brings it up to date from a think's view. `before` is the view of the think before: what the dead of this think
|
|
257
|
+
* were (a death says only an id). What the brain calls as each think begins, after the view is made
|
|
258
|
+
*/
|
|
259
|
+
update(view: AiView, before?: AiView): void;
|
|
260
|
+
/** 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) */
|
|
261
|
+
/**
|
|
262
|
+
* Reads the think's picture through this view without remembering anything of it: for a think a game loaded from a
|
|
263
|
+
* save goes on with (`BrainMemory.thinking`), whose picture the saved game remembered already, so that what is restored
|
|
264
|
+
* is as it was after that; only what is asked of the map now needs the view it is asked through
|
|
265
|
+
*/
|
|
266
|
+
resume(view: AiView): void;
|
|
267
|
+
private lookAround;
|
|
268
|
+
/**
|
|
269
|
+
* The enemy's fighters in sight, grouped by nearness into sightings. A newer sighting replaces the older ones near
|
|
270
|
+
* it (the army moved); an older one whose place is in sight with no sighting near is dropped (no one is there now)
|
|
271
|
+
*/
|
|
272
|
+
private seeArmy;
|
|
273
|
+
/**
|
|
274
|
+
* The enemy's workers and heroes in sight, by id, where they were. A worker whose place is in sight and who is not
|
|
275
|
+
* there is forgotten; a hero is kept where last seen (there are few, and where they went matters)
|
|
276
|
+
*/
|
|
277
|
+
private seeUnits;
|
|
278
|
+
/** What the think's events say: deaths (one's own among them, as losses), pings, damage to one's own and allies' */
|
|
279
|
+
private hear;
|
|
280
|
+
/** What was gathered: every rise in what the player has, added up; sampled every `historyEvery` seconds */
|
|
281
|
+
private count;
|
|
282
|
+
/** Forgets what is older than so many seconds: sightings, workers, losses, attacks, what was heard, structures long gone */
|
|
283
|
+
forget(olderThan: number): void;
|
|
284
|
+
private forgetOlder;
|
|
285
|
+
/** What it remembers, as plain data for a save: a copy */
|
|
286
|
+
/** Whether it has anything to remember now: one that does not is left out of a save */
|
|
287
|
+
remembers(): boolean;
|
|
288
|
+
save(): KnowledgeMemory;
|
|
289
|
+
/** Takes back what `save` gave. Memory of another shape is dropped: it starts afresh */
|
|
290
|
+
restore(memory: unknown): boolean;
|
|
291
|
+
/** What it knows, in short, for the debug tools: bases, the army seen with its age, the tech seen */
|
|
292
|
+
inspect(): Record<string, unknown>;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* What a computer player remembers of its enemies (`knowledge.enemy`): their structures and bases, their army as last
|
|
296
|
+
* seen, their workers and heroes, the types and tech seen. Creeps are no one's enemy here
|
|
297
|
+
*
|
|
298
|
+
* @beta
|
|
299
|
+
*/
|
|
300
|
+
export declare class EnemyKnowledge {
|
|
301
|
+
private readonly knowledge;
|
|
302
|
+
private basesFound;
|
|
303
|
+
private trainedBy;
|
|
304
|
+
constructor(knowledge: Knowledge);
|
|
305
|
+
/** Their structures remembered and not known gone (`gone: true` for those too), of one owner where given */
|
|
306
|
+
structures(options?: {
|
|
307
|
+
owner?: PlayerId;
|
|
308
|
+
gone?: boolean;
|
|
309
|
+
}): StructureSeen[];
|
|
310
|
+
/**
|
|
311
|
+
* Their bases: the structures remembered, gone ones too, clustered by owner around what takes deposits (a hall), or
|
|
312
|
+
* around any structure where none does. The first seen of each owner's first; `gone` where all of it is known gone
|
|
313
|
+
*/
|
|
314
|
+
bases(owner?: PlayerId): EnemyBase[];
|
|
315
|
+
private cluster;
|
|
316
|
+
/** Their bases beyond the first of each owner's, with a hall: where they expanded to, as far as seen */
|
|
317
|
+
expansionsSeen(): EnemyBase[];
|
|
318
|
+
/** Their army as last seen, in groups, newest first; only those seen within so many seconds where given */
|
|
319
|
+
armySeen(withinSeconds?: number): ArmySighting[];
|
|
320
|
+
/** Their workers as last seen, newest first; only those seen within so many seconds where given */
|
|
321
|
+
workersSeen(withinSeconds?: number): UnitSeen[];
|
|
322
|
+
/** Their heroes as last seen, newest first: type, level, where, and `died` when seen to die */
|
|
323
|
+
heroesSeen(): UnitSeen[];
|
|
324
|
+
/** The unit and structure types of theirs seen, with when and the most seen at once */
|
|
325
|
+
typesSeen(): Readonly<Record<string, TypeSeen>>;
|
|
326
|
+
/** The most of a type of theirs seen at once: 0 for one never seen */
|
|
327
|
+
mostSeen(type: string): number;
|
|
328
|
+
/**
|
|
329
|
+
* What they have, as far as what was seen tells: the types seen; what those require, named as `UnitTypeDef.requires`
|
|
330
|
+
* names them; and the building that trains a type, where only one does (a gryphon means an aviary, and what an aviary
|
|
331
|
+
* requires). Sorted, for the same answer every time
|
|
332
|
+
*/
|
|
333
|
+
techSeen(): string[];
|
|
334
|
+
/** The building types that train a unit type, found once for the game's definitions */
|
|
335
|
+
private trainersOf;
|
|
336
|
+
/** Takes in what a type seen was, where the game or an older save tells: as if seen, `count` at once, at a tick */
|
|
337
|
+
sawType(type: string, count: number, tick?: number): void;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* What a computer player remembers of the map (`knowledge.map`): when each place was last in sight. The cells are of
|
|
341
|
+
* the view's grid (8 units)
|
|
342
|
+
*
|
|
343
|
+
* @beta
|
|
344
|
+
*/
|
|
345
|
+
export declare class MapKnowledge {
|
|
346
|
+
private readonly knowledge;
|
|
347
|
+
constructor(knowledge: Knowledge);
|
|
348
|
+
/** The tick a place was last in sight of the seat's team: none for a place never seen */
|
|
349
|
+
lastLooked(point: Vec2): number | undefined;
|
|
350
|
+
/** Seconds since a place was last in sight: `Infinity` for one never seen */
|
|
351
|
+
sinceLooked(point: Vec2): number;
|
|
352
|
+
/** Whether a place is in sight now, as of the last update */
|
|
353
|
+
inSight(point: Vec2): boolean;
|
|
354
|
+
/** Whether the seat's team has explored a place: seen it once, as the fog says */
|
|
355
|
+
explored(point: Vec2): boolean;
|
|
356
|
+
/** Takes in that a place was looked at, at a tick: where the game or an older save tells */
|
|
357
|
+
look(point: Vec2, tick?: number): void;
|
|
358
|
+
/**
|
|
359
|
+
* The map's mines (`view.mines`), each with when its place was last looked at and whose base is by it, as far as
|
|
360
|
+
* known: where to expand, where to look for theirs
|
|
361
|
+
*/
|
|
362
|
+
mines(): (MineInfo & {
|
|
363
|
+
looked?: number;
|
|
364
|
+
taken?: PlayerId;
|
|
365
|
+
})[];
|
|
366
|
+
/** The map's creep camps, as the seat knows them (`view.camps`) */
|
|
367
|
+
camps(): readonly CampInfo[];
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* What a computer player remembers of itself (`knowledge.own`): what it lost, the attacks it sent, what it gathered
|
|
371
|
+
*
|
|
372
|
+
* @beta
|
|
373
|
+
*/
|
|
374
|
+
export declare class OwnKnowledge {
|
|
375
|
+
private readonly knowledge;
|
|
376
|
+
constructor(knowledge: Knowledge);
|
|
377
|
+
/** What of its own died, oldest first; only within so many seconds where given */
|
|
378
|
+
lost(withinSeconds?: number): Loss[];
|
|
379
|
+
/** What of its own died within a distance of a place: "we are being raided here" */
|
|
380
|
+
lostNear(point: Vec2, radius: number, withinSeconds?: number): Loss[];
|
|
381
|
+
/** Notes an attack sent, for whoever asks later (`attacks`): what a module that sends an army calls */
|
|
382
|
+
attackSent(point: Vec2, count: number): void;
|
|
383
|
+
/** The attacks sent, oldest first; only within so many seconds where given */
|
|
384
|
+
attacks(withinSeconds?: number): AttackSent[];
|
|
385
|
+
/**
|
|
386
|
+
* What it gathers of a resource a minute, over the last so many seconds (60): from the rises in what it has, so it
|
|
387
|
+
* is at least this (what was gathered and spent between two thinks does not show). Bounty counts as gathered
|
|
388
|
+
*/
|
|
389
|
+
income(kind: ResourceKind, seconds?: number): number;
|
|
390
|
+
/** The income of every resource gathered so far, a minute (`income`) */
|
|
391
|
+
incomes(seconds?: number): Record<ResourceKind, number>;
|
|
392
|
+
/** What was gathered of each resource since the game began, as far as the rises tell */
|
|
393
|
+
get gathered(): Readonly<Record<ResourceKind, number>>;
|
|
394
|
+
/** The samples of what was gathered, oldest first */
|
|
395
|
+
get history(): KnowledgeMemory['history'];
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* What a computer player heard (`knowledge.events`): pings, damage to its own and its allies', deaths, each with its
|
|
399
|
+
* tick, the oldest first
|
|
400
|
+
*
|
|
401
|
+
* @beta
|
|
402
|
+
*/
|
|
403
|
+
export declare class HeardEvents {
|
|
404
|
+
private readonly knowledge;
|
|
405
|
+
constructor(knowledge: Knowledge);
|
|
406
|
+
/** Pings heard; only within so many seconds where given */
|
|
407
|
+
pings(withinSeconds?: number): PingHeard[];
|
|
408
|
+
/** Damage seen done to its own and its allies' entities, a line an entity a think; only within so many seconds where given */
|
|
409
|
+
damage(withinSeconds?: number): DamageSeen[];
|
|
410
|
+
/** Deaths seen, anyone's; only within so many seconds where given */
|
|
411
|
+
deaths(withinSeconds?: number): DeathSeen[];
|
|
412
|
+
}
|
|
413
|
+
declare module './area' {
|
|
414
|
+
interface AreaMemories {
|
|
415
|
+
knowledge?: KnowledgeMemory;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
export {};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { type Vec2 } from '#engine/math';
|
|
2
|
+
import type { EntityState } from '#engine/session/protocol';
|
|
3
|
+
import { type Brain, type BrainDef, type BrainExtension } from './brain';
|
|
4
|
+
import { type AiModule, type AiModuleDef } from './module';
|
|
5
|
+
import { type TargetPicker } from './micro';
|
|
6
|
+
import type { UnitSet } from './view';
|
|
7
|
+
/**
|
|
8
|
+
* How a lanes brain plays (`lanesPlay(options)`, the seat's `AiOptions.lanes` over it): its heroes' rest, how far it
|
|
9
|
+
* goes for an ally or a camp, how near its wave it walks. Data, but for `units` and `home` as functions
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface LanesPlayOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Which of its units it commands: its heroes when left out. The rest (the minions) are the lanes', and walk as they
|
|
16
|
+
* were sent
|
|
17
|
+
*/
|
|
18
|
+
units?: (ai: Brain, unit: EntityState) => boolean;
|
|
19
|
+
/** Where its heroes go to rest: a point, or a function. Its side's building by its side's ends of the lanes when left out (a core) */
|
|
20
|
+
home?: Vec2 | ((ai: Brain) => Vec2 | undefined);
|
|
21
|
+
/** Only these lanes, by their path's name: every lane of the map when left out */
|
|
22
|
+
lanes?: string[];
|
|
23
|
+
/** The share of its health under which a hero goes home to rest: 0.35 */
|
|
24
|
+
backAt?: number;
|
|
25
|
+
/** The share at which a resting hero goes back out: 0.85 */
|
|
26
|
+
returnAt?: number;
|
|
27
|
+
/** Seconds a hero rests at home at most, healed or not: 40 */
|
|
28
|
+
restFor?: number;
|
|
29
|
+
/** Whether a hero going home uses an ability that takes it there (a recall), where nothing hostile is near: yes when left out */
|
|
30
|
+
recall?: boolean;
|
|
31
|
+
/** The odds where a hero stands on its lane under which it falls back along it: 0.3 */
|
|
32
|
+
backOdds?: number;
|
|
33
|
+
/** How many cells behind its side's wave a hero walks: 3 */
|
|
34
|
+
behind?: number;
|
|
35
|
+
/** An ally's hero in a fight it goes to: within `reach` cells of it (30), where the odds with it are at least `odds` (0.4). `false` never */
|
|
36
|
+
help?: false | {
|
|
37
|
+
reach?: number;
|
|
38
|
+
odds?: number;
|
|
39
|
+
};
|
|
40
|
+
/** A camp it takes with no wave to walk with: within `reach` cells (50), where the odds against it are at least `odds` (0.6). `false` never */
|
|
41
|
+
camps?: false | {
|
|
42
|
+
reach?: number;
|
|
43
|
+
odds?: number;
|
|
44
|
+
};
|
|
45
|
+
/** Whether a hero hits the minion its next hit kills before anything else (a last hit): yes when left out */
|
|
46
|
+
lastHits?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What the lanes module remembers between thinks, as a save keeps it: the heroes resting, since when; when each last
|
|
50
|
+
* used an ability that takes it home
|
|
51
|
+
*
|
|
52
|
+
* @beta
|
|
53
|
+
*/
|
|
54
|
+
export interface LanesPlayMemory {
|
|
55
|
+
v: 1;
|
|
56
|
+
/** The heroes resting, by id: the tick they turned for home */
|
|
57
|
+
resting: Record<string, number>;
|
|
58
|
+
/** When each hero last set off home by its recall, by id */
|
|
59
|
+
recalled: Record<string, number>;
|
|
60
|
+
/** When each resting hero was last sent home on foot, by id */
|
|
61
|
+
sent: Record<string, number>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A lane as one side reads it (`LanesPlay.lanes`): the path, measured from that side's end (`from`: the end its own
|
|
65
|
+
* spawner stands at), its length
|
|
66
|
+
*
|
|
67
|
+
* @beta
|
|
68
|
+
*/
|
|
69
|
+
export interface LaneSide {
|
|
70
|
+
/** The name of its path: what the goal and squad of the lane are named by (`lanes.push:mid`) */
|
|
71
|
+
path: string;
|
|
72
|
+
points: readonly Vec2[];
|
|
73
|
+
/** The end of the lane that is its side's: 0 the first point's, 1 the last's */
|
|
74
|
+
from: 0 | 1;
|
|
75
|
+
/** Cells from end to end, along it */
|
|
76
|
+
length: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A lane as it stands this think, for one side: its waves' fronts (in cells along it from its side's end), who is on
|
|
80
|
+
* it, the towers by it
|
|
81
|
+
*
|
|
82
|
+
* @beta
|
|
83
|
+
*/
|
|
84
|
+
export interface LaneState {
|
|
85
|
+
lane: LaneSide;
|
|
86
|
+
/** How far along its side's furthest minion is: none with no minion of its side on the lane */
|
|
87
|
+
front?: number;
|
|
88
|
+
/** How far along their nearest minion is: none with none of theirs on it */
|
|
89
|
+
theirFront?: number;
|
|
90
|
+
/** Its side's minions on it (the player's own and its allies'), and theirs */
|
|
91
|
+
ours: EntityState[];
|
|
92
|
+
theirs: EntityState[];
|
|
93
|
+
/** The heroes on it: its allies' (the player's own left out), and theirs */
|
|
94
|
+
allies: EntityState[];
|
|
95
|
+
enemies: EntityState[];
|
|
96
|
+
/** The towers by it, its side's and theirs (theirs as remembered), with how far along each stands */
|
|
97
|
+
ourTowers: {
|
|
98
|
+
tower: EntityState;
|
|
99
|
+
at: number;
|
|
100
|
+
}[];
|
|
101
|
+
theirTowers: {
|
|
102
|
+
tower: EntityState;
|
|
103
|
+
at: number;
|
|
104
|
+
}[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Where a place is on a side's lane: how far along from the side's end, how far off the line
|
|
108
|
+
*
|
|
109
|
+
* @beta
|
|
110
|
+
*/
|
|
111
|
+
export declare function onLane(lane: LaneSide, at: Vec2): {
|
|
112
|
+
along: number;
|
|
113
|
+
off: number;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The point so far along a side's lane from its end
|
|
117
|
+
*
|
|
118
|
+
* @beta
|
|
119
|
+
*/
|
|
120
|
+
export declare function laneAt(lane: LaneSide, along: number): Vec2;
|
|
121
|
+
/**
|
|
122
|
+
* Whom a hero of a lanes brain hits (micro's `targets`, the file's comment): the minion its next hit kills, one of their
|
|
123
|
+
* heroes not under their tower, a building (a tower its side's minions take the shots of), the weakest of the rest; never
|
|
124
|
+
* what stands where their tower would turn on it
|
|
125
|
+
*
|
|
126
|
+
* @beta
|
|
127
|
+
*/
|
|
128
|
+
export declare const lanesTargets: (options?: Pick<LanesPlayOptions, 'lastHits'>) => TargetPicker;
|
|
129
|
+
/**
|
|
130
|
+
* The lanes of a lanes brain, read as its side sees them, and what its heroes do on them (`ai.module('lanes')`'s
|
|
131
|
+
* `play`): the module's goals read it
|
|
132
|
+
*
|
|
133
|
+
* @beta
|
|
134
|
+
*/
|
|
135
|
+
export declare class LanesPlay {
|
|
136
|
+
/** The brain it plays for */
|
|
137
|
+
readonly ai: Brain;
|
|
138
|
+
/** How it plays: the module's, the seat's over it */
|
|
139
|
+
readonly options: LanesPlayOptions;
|
|
140
|
+
readonly memory: LanesPlayMemory;
|
|
141
|
+
private sides;
|
|
142
|
+
constructor(
|
|
143
|
+
/** The brain it plays for */
|
|
144
|
+
ai: Brain,
|
|
145
|
+
/** How it plays: the module's, the seat's over it */
|
|
146
|
+
options: LanesPlayOptions);
|
|
147
|
+
/** The lanes as its side reads them: each measured from the end its side's spawner stands at. None it has no end of */
|
|
148
|
+
lanes(): readonly LaneSide[];
|
|
149
|
+
/** A lane of its side's, by its path's name */
|
|
150
|
+
lane(path: string): LaneSide | undefined;
|
|
151
|
+
/** The units it commands: its heroes, or what `units` says. Alive */
|
|
152
|
+
commanded(units?: UnitSet): UnitSet;
|
|
153
|
+
/**
|
|
154
|
+
* Where its heroes rest: `home`, else its side's building nearest the middle of its side's ends of the lanes (a core),
|
|
155
|
+
* else that middle, else its first building
|
|
156
|
+
*/
|
|
157
|
+
home(): Vec2 | undefined;
|
|
158
|
+
/** Each lane as it stands this think: fronts, minions, heroes, towers. Once a think */
|
|
159
|
+
states(): readonly LaneState[];
|
|
160
|
+
/** One lane as it stands this think */
|
|
161
|
+
state(path: string): LaneState | undefined;
|
|
162
|
+
private stateOf;
|
|
163
|
+
/**
|
|
164
|
+
* Where a hero walks on a lane now: a little behind its side's front; with no wave there, by its side's furthest tower
|
|
165
|
+
* on it (or a little out of its end); never into reach of a tower of theirs that no minion of its side is in reach of
|
|
166
|
+
*/
|
|
167
|
+
spot(path: string): Vec2 | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* What is at stake on a lane, 0..1: how far along its side's wave is (a tower of theirs to take, their core), or how
|
|
170
|
+
* near its side's end theirs is (its own towers under attack), whichever is more
|
|
171
|
+
*/
|
|
172
|
+
stake(path: string): number;
|
|
173
|
+
/** Where a hero outmatched on a lane falls back to: its side's nearest tower behind it, or so far back along it */
|
|
174
|
+
fallBack(path: string, from: Vec2): Vec2 | undefined;
|
|
175
|
+
/** The odds of its side against theirs where a unit stands (`Strength.odds`): their towers that reach there count */
|
|
176
|
+
oddsAt(at: Vec2, reach?: number): number;
|
|
177
|
+
/** The heroes resting, alive */
|
|
178
|
+
resting(): readonly EntityState[];
|
|
179
|
+
/** Heroes turned for home, those back out: what the `lanes.back` goal reads. Each think, before the goals */
|
|
180
|
+
think(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Sends a resting hero home: by an ability that takes it there (one whose effects, at its end, teleport home), where
|
|
183
|
+
* it has one ready and nothing hostile is near; else on foot. Nothing while it channels, or once home
|
|
184
|
+
*/
|
|
185
|
+
sendHome(hero: EntityState): void;
|
|
186
|
+
/** An ally's hero in a fight one of its heroes could go to: the most hurt, near enough; or a person's call for help */
|
|
187
|
+
call(from: Vec2): Vec2 | undefined;
|
|
188
|
+
/** The ally's hero nearest a place: what a hero helping goes with */
|
|
189
|
+
allyAt(at: Vec2): EntityState | undefined;
|
|
190
|
+
/** The nearest camp it may take from a place: not cleared, in reach, its creeps (as seen) beatable */
|
|
191
|
+
camp(hero: EntityState): Vec2 | undefined;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The lanes module, with the play it runs (`LanesPlay`): what the tests reach
|
|
195
|
+
*
|
|
196
|
+
* @beta
|
|
197
|
+
*/
|
|
198
|
+
export interface LanesModule extends AiModule {
|
|
199
|
+
play: LanesPlay;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* What finds a lanes brain's module with its shape (`ai.module(LANES)`)
|
|
203
|
+
*
|
|
204
|
+
* @beta
|
|
205
|
+
*/
|
|
206
|
+
export declare const LANES: import("./module").ModuleKey<LanesModule>;
|
|
207
|
+
/**
|
|
208
|
+
* The module of a lanes brain: the lanes read for its side, its heroes' rest, and its goals put on the picker (the
|
|
209
|
+
* file's comment). Its options under the brain's settings (`AiSettings.lanes`)
|
|
210
|
+
*
|
|
211
|
+
* @beta
|
|
212
|
+
*/
|
|
213
|
+
export declare const lanesPlay: (options?: LanesPlayOptions) => AiModuleDef;
|
|
214
|
+
/**
|
|
215
|
+
* The engine's computer player for a game of lanes (`withLanes`): a brain of its rules, the words, `lanesPlay`, the
|
|
216
|
+
* team, the picker, squads and micro (the file's comment). Heroes walk the lanes with their waves, rest at home when
|
|
217
|
+
* hurt, help an ally's hero, take a camp with no wave to walk with. A variant is `lanesBrain.with({ ... })`; a game's
|
|
218
|
+
* own lanes brain is `lanesBrainOf({ id, lanes, ... })`
|
|
219
|
+
*
|
|
220
|
+
* @beta
|
|
221
|
+
*/
|
|
222
|
+
export declare function lanesBrainOf(def: BrainExtension & {
|
|
223
|
+
id: string;
|
|
224
|
+
lanes?: LanesPlayOptions;
|
|
225
|
+
}): BrainDef;
|
|
226
|
+
/**
|
|
227
|
+
* The engine's computer player for a game of lanes, as it is: `lanesBrainOf({ id: 'core.lanes' })`. List it in the
|
|
228
|
+
* game's `GameModule.brains` and seat it (`world.computers.seat(player, { brain: lanesBrain })`)
|
|
229
|
+
*
|
|
230
|
+
* @beta
|
|
231
|
+
*/
|
|
232
|
+
export declare const lanesBrain: BrainDef;
|