@v12-engine/engine 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,61 @@
|
|
|
1
|
+
import { type AiModuleDef } from '#engine/ai/module';
|
|
2
|
+
import type { AiRole } from '#engine/ai/roles';
|
|
3
|
+
import { type AiConditionData } from '#engine/ai/rules';
|
|
4
|
+
/**
|
|
5
|
+
* One rung of the melee player's ladder of wants: what to have, by role, how many, how important, money to spare,
|
|
6
|
+
* when. `counter` and `tier` are worked out each think (the file's comment); any other role is the first type of it
|
|
7
|
+
* the player can make
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export interface MeleeWant {
|
|
12
|
+
/** The want's id on the build plan (`melee.barracks`): what the report shows, what `without` leaves out */
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* A role of the kit's (`hall`, `barracks`, `altar`, `workshop`, `tower`), or one worked out: `counter` (the
|
|
16
|
+
* building its best answer to their army needs), `tier` (the next tier of its hall), `expand` (another hall by a
|
|
17
|
+
* free mine once the mine at home runs low, FJ1)
|
|
18
|
+
*/
|
|
19
|
+
role: AiRole | 'counter' | 'tier' | 'expand';
|
|
20
|
+
/** How many of it to have: 1 when left out */
|
|
21
|
+
count?: number;
|
|
22
|
+
/** How important it is to the purse: a want of more goes first and may spend what is held for one of less */
|
|
23
|
+
priority: number;
|
|
24
|
+
/** Money to keep spare before it is paid for (a luxury waits until there is this much over its price) */
|
|
25
|
+
spare?: number;
|
|
26
|
+
/** Only while this holds (`AiConditionData`): `{ units: { role: 'barracks' } }` for the next tier */
|
|
27
|
+
when?: AiConditionData;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The melee player's ladder as it stands: a hall, a barracks, another hall once the mine at home runs low, an altar,
|
|
31
|
+
* the building its best answer needs, the next tier of its hall once a barracks stands (FJ1: before the workshop, so
|
|
32
|
+
* that what the tier opens is trained while it matters), a workshop, a second barracks with money to spare
|
|
33
|
+
*
|
|
34
|
+
* @beta
|
|
35
|
+
*/
|
|
36
|
+
export declare const MELEE_LADDER: readonly MeleeWant[];
|
|
37
|
+
/**
|
|
38
|
+
* How the melee brain builds (`build()` of the melee brain): its ladder of wants, and how much better an answer to
|
|
39
|
+
* their army must be for its building to be put up
|
|
40
|
+
*
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export interface MeleeBuildOptions {
|
|
44
|
+
/** The ladder of wants, most important first: `MELEE_LADDER` when left out */
|
|
45
|
+
ladder?: readonly MeleeWant[];
|
|
46
|
+
/** How much better a type must answer their armies than what it can train now, for the building it needs to be put up: 1.2 when left out */
|
|
47
|
+
counterMargin?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The part of what it held left in the mine at home under which another hall by a free mine is wanted (the `expand`
|
|
50
|
+
* rung): 0.35 when left out. 0 for never
|
|
51
|
+
*/
|
|
52
|
+
expandAt?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The melee brain's build module: the ladder of wants set on the build plan each think, the counter and the tier
|
|
56
|
+
* worked out, the plan thought. After the heroes, before the production and the picker, as the old turn had it;
|
|
57
|
+
* `steps.construction` honoured
|
|
58
|
+
*
|
|
59
|
+
* @beta
|
|
60
|
+
*/
|
|
61
|
+
export declare const build: (options?: MeleeBuildOptions) => AiModuleDef;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { MeleeSurrenderOptions } from './surrender';
|
|
2
|
+
import { type Brain } from '#engine/ai/brain';
|
|
3
|
+
import { type AiModule, type AiModuleDef } from '#engine/ai/module';
|
|
4
|
+
import { type GoalDef } from '#engine/ai/goals';
|
|
5
|
+
import type { UnitSet } from '#engine/ai/view';
|
|
6
|
+
/**
|
|
7
|
+
* How the melee player's army goes about its own waves and the goals beside them (`AiSettings.army` over the melee
|
|
8
|
+
* brain's `army(options)`). Data: a save keeps the seat's
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface MeleeArmyOptions {
|
|
13
|
+
/** Seconds before its first wave: 150 when left out */
|
|
14
|
+
firstAttack?: number;
|
|
15
|
+
/** Seconds between two waves: 45 when left out */
|
|
16
|
+
attackEvery?: number;
|
|
17
|
+
/** Units in its first wave, each after bringing two more: 6 when left out */
|
|
18
|
+
waveSize?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The odds (`Strength.odds`) of what it has ready against their army as last seen (the last minute) under which a
|
|
21
|
+
* wave whose time has come waits and trains on rather than go: 0.4 when left out; `false` never waits
|
|
22
|
+
*/
|
|
23
|
+
goOdds?: number | false;
|
|
24
|
+
/**
|
|
25
|
+
* Seconds a wave waits past its time at the most, outmatched or short of its size: then it goes with what it has,
|
|
26
|
+
* half the wave at the least, where that would hold against what is remembered to reach the target. Twice
|
|
27
|
+
* `attackEvery` when left out. A wave that could never reach its size (the supply capped) still comes
|
|
28
|
+
*/
|
|
29
|
+
waitAtMost?: number;
|
|
30
|
+
/** Whether a wave that razed what it went for goes on to the next of their buildings it knows, while it is strong enough: yes when left out */
|
|
31
|
+
pressOn?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Where a wave of its own goes among their buildings it knows of: the `nearest`, or the `weakest` (the one the least
|
|
34
|
+
* of their strength is remembered to reach: an expansion before a main with towers; the nearest among those alike).
|
|
35
|
+
* `weakest` when left out
|
|
36
|
+
*/
|
|
37
|
+
target?: 'nearest' | 'weakest';
|
|
38
|
+
/**
|
|
39
|
+
* Whether a wave of theirs that died at its gate is answered at once with what is ready (half a wave at the least),
|
|
40
|
+
* their base being empty of it: yes when left out. `counterAfter` is how many of their fighters must have fallen
|
|
41
|
+
* near its bases in the last twenty seconds (3 when left out)
|
|
42
|
+
*/
|
|
43
|
+
counter?: boolean;
|
|
44
|
+
counterAfter?: number;
|
|
45
|
+
/** The odds against their army as last seen a wave needs to go on: 0.5 when left out */
|
|
46
|
+
pressOdds?: number;
|
|
47
|
+
/** Whether idle fighters at home join a wave that is out, making up what it lost: yes when left out */
|
|
48
|
+
reinforce?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A strike while their army is away (FJ1): every sighting of their army within `awayFor` seconds (60) stands far
|
|
51
|
+
* from what a wave would go for (their base, out raiding or creeping or at a base of mine), and what is ready (half
|
|
52
|
+
* a wave at the least) would hold against what is remembered to reach it at these odds (`odds`, 0.6): the wave goes
|
|
53
|
+
* before its time. `false` for none
|
|
54
|
+
*/
|
|
55
|
+
strike?: false | {
|
|
56
|
+
awayFor?: number;
|
|
57
|
+
odds?: number;
|
|
58
|
+
};
|
|
59
|
+
/** Units more in each wave than the one before: 2 when left out */
|
|
60
|
+
waveGrowth?: number;
|
|
61
|
+
/** The most units a wave of its own asks for: 24 when left out */
|
|
62
|
+
waveMax?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Raids on their workers where their army is not (the `raid` goal): how many go (`size`, 3, the fastest), the odds
|
|
65
|
+
* against what is remembered at the base they need (`odds`, 0.6), seconds between raids (`every`, 60), seconds
|
|
66
|
+
* their army must not have been seen near the base (`armyAwayFor`, 45), how long ago their workers were seen at
|
|
67
|
+
* the most (`workersSeenFor`, 120), the odds the raiders fall back at (`retreatAt`, 0.5). `false` for no raids
|
|
68
|
+
*/
|
|
69
|
+
raid?: false | {
|
|
70
|
+
size?: number;
|
|
71
|
+
odds?: number;
|
|
72
|
+
every?: number;
|
|
73
|
+
armyAwayFor?: number;
|
|
74
|
+
workersSeenFor?: number;
|
|
75
|
+
retreatAt?: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Harassing their main before the first wave (the `harass` goal): the party (`size`, 3: the hero and the fastest),
|
|
79
|
+
* the odds it needs at their base (`odds`, 0.6), seconds between (`every`, 90), the odds it falls back at
|
|
80
|
+
* (`retreatAt`, 0.5). `false` for none
|
|
81
|
+
*/
|
|
82
|
+
harass?: false | {
|
|
83
|
+
size?: number;
|
|
84
|
+
odds?: number;
|
|
85
|
+
every?: number;
|
|
86
|
+
retreatAt?: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Guards at a base past home that has no tower yet (the `expand` goal): how many (`guards`, 2), and how many
|
|
90
|
+
* fighters past a wave must stand idle for any to go (`spare`, 0). `false` for none
|
|
91
|
+
*/
|
|
92
|
+
expand?: false | {
|
|
93
|
+
guards?: number;
|
|
94
|
+
spare?: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Creeping (the `creep` goal): seconds between camps (`every`, 40), seconds into the game before the first
|
|
98
|
+
* (`from`, 30), how far from home a camp may be (`reach`, 70), the fewest in a party (`party`, 3). `false` for none
|
|
99
|
+
*/
|
|
100
|
+
creep?: false | {
|
|
101
|
+
every?: number;
|
|
102
|
+
from?: number;
|
|
103
|
+
reach?: number;
|
|
104
|
+
party?: number;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* When it gives up (the `melee.surrender` module, `MeleeSurrenderOptions`): once it has no hall, no worker and no
|
|
108
|
+
* army that could win the game back, for half a minute, when left out; a condition of the game's own (`when`), and
|
|
109
|
+
* how long it holds first (`after`). `false` plays to the last
|
|
110
|
+
*/
|
|
111
|
+
surrender?: false | MeleeSurrenderOptions;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* What the army module remembers between thinks, as a save keeps it (`BrainMemory.modules['melee.army']`)
|
|
115
|
+
*
|
|
116
|
+
* @beta
|
|
117
|
+
*/
|
|
118
|
+
export interface MeleeArmyMemory {
|
|
119
|
+
v: 1;
|
|
120
|
+
/** Units the next wave of its own asks for */
|
|
121
|
+
waveSize: number;
|
|
122
|
+
/** Seconds into the game the next wave's time comes */
|
|
123
|
+
nextAttack: number;
|
|
124
|
+
/** Seconds into the game it may go creeping again */
|
|
125
|
+
nextCreeping: number;
|
|
126
|
+
/** Waves sent */
|
|
127
|
+
attacks: number;
|
|
128
|
+
/** The tick the wave it last said it falls back with turned at: said once a retreat */
|
|
129
|
+
saidRetreat?: number;
|
|
130
|
+
/** Seconds into the game the wave began waiting past its time, short of its size or outmatched (`goOdds`): none while it is not */
|
|
131
|
+
waiting?: number;
|
|
132
|
+
/** The tick the last raid was sent at */
|
|
133
|
+
raided?: number;
|
|
134
|
+
/** The tick the last harassing party was sent at */
|
|
135
|
+
harassed?: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The army module, with the army it runs (`MeleeArmy`): what the tests and the debug tools reach (`meleeArmyOf`)
|
|
139
|
+
*
|
|
140
|
+
* @beta
|
|
141
|
+
*/
|
|
142
|
+
export interface MeleeArmyModule extends AiModule {
|
|
143
|
+
army: MeleeArmy;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What finds the melee army's module with its shape (`ai.module(MELEE_ARMY)`)
|
|
147
|
+
*
|
|
148
|
+
* @beta
|
|
149
|
+
*/
|
|
150
|
+
export declare const MELEE_ARMY: import("#engine/ai/module").ModuleKey<MeleeArmyModule>;
|
|
151
|
+
/**
|
|
152
|
+
* The melee brain's army (`MeleeArmy`) of a brain: its waves, numbers and memory, for the tests and the debug tools.
|
|
153
|
+
* Throws for a brain without the `melee.army` module
|
|
154
|
+
*
|
|
155
|
+
* @beta
|
|
156
|
+
*/
|
|
157
|
+
export declare function meleeArmyOf(ai: Brain): MeleeArmy;
|
|
158
|
+
/**
|
|
159
|
+
* The melee player's army: its waves of its own and the goals beside them (the file's comment), its numbers from its
|
|
160
|
+
* options (`firstAttack`, `attackEvery`, `waveSize`) and the defence's radius, its memory. Made for a brain by
|
|
161
|
+
* the `army()` module; reached as `ai.module(MELEE_ARMY)?.army` (`meleeArmyOf(ai)`)
|
|
162
|
+
*
|
|
163
|
+
* @beta
|
|
164
|
+
*/
|
|
165
|
+
export declare class MeleeArmy {
|
|
166
|
+
/** The brain it is the army of */
|
|
167
|
+
readonly ai: Brain;
|
|
168
|
+
/** How it goes: the module's options, the brain's settings over them (`ai.settings.army`) */
|
|
169
|
+
readonly options: MeleeArmyOptions;
|
|
170
|
+
readonly memory: MeleeArmyMemory;
|
|
171
|
+
readonly firstAttack: number;
|
|
172
|
+
readonly attackEvery: number;
|
|
173
|
+
readonly defendRadius: number;
|
|
174
|
+
constructor(
|
|
175
|
+
/** The brain it is the army of */
|
|
176
|
+
ai: Brain,
|
|
177
|
+
/** How it goes: the module's options, the brain's settings over them (`ai.settings.army`) */
|
|
178
|
+
options: MeleeArmyOptions);
|
|
179
|
+
private get time();
|
|
180
|
+
/** Its fighters: what is gathering (a ghoul at the trees) is at work, not in the army */
|
|
181
|
+
private armyOf;
|
|
182
|
+
/** The fighters no goal holds and with nothing to do: what a wave or a party is made of. Once a think */
|
|
183
|
+
ready(): UnitSet;
|
|
184
|
+
private readyOf;
|
|
185
|
+
/** Their army as last seen within so many seconds, summed by type: a force to weigh odds against */
|
|
186
|
+
private theirs;
|
|
187
|
+
/** The odds of a force of mine against their army as last seen within so many seconds: 1 where none was seen */
|
|
188
|
+
private oddsAgainstTheirs;
|
|
189
|
+
/** The odds of a force of mine against what is remembered to reach a place (towers, their army seen near it), by the square law */
|
|
190
|
+
private oddsAt;
|
|
191
|
+
/** Whether its team asks it to join an attack together it has not answered, while its waves wait for the team's (`together`) */
|
|
192
|
+
private invited;
|
|
193
|
+
/**
|
|
194
|
+
* Whether it has no mercy (No Mercy, a flag of its profile): the enemy's army as last seen (the last minute) weak
|
|
195
|
+
* against what it has ready, at the odds the flag says (0.75 for `true`), and it goes before its time
|
|
196
|
+
*/
|
|
197
|
+
private merciless;
|
|
198
|
+
/**
|
|
199
|
+
* Whether the wave is worth sending now: what is ready would not lose outright against their army as last seen
|
|
200
|
+
* (`goOdds`), or it has waited long enough (`waitAtMost`). Nothing seen of their army: worth it
|
|
201
|
+
*/
|
|
202
|
+
private worthGoing;
|
|
203
|
+
/**
|
|
204
|
+
* Whether a wave of theirs just died at its gate (so many of their fighters fallen near its bases in the last twenty
|
|
205
|
+
* seconds): their base is empty of it, and what is ready goes at once
|
|
206
|
+
*/
|
|
207
|
+
private counterAttack;
|
|
208
|
+
/**
|
|
209
|
+
* Whether their army is away from what a wave would go for (`strike`): at least one sighting of it within `awayFor`
|
|
210
|
+
* seconds (nothing seen says nothing of where it is), every one far from the target and from every base of mine and
|
|
211
|
+
* every building of my allies' (an army at my gate is the defence's, at an ally's the team's: not a reason to trade
|
|
212
|
+
* bases), and what is ready (half a wave at the least) would hold against what is remembered to reach the target
|
|
213
|
+
* (its towers). Once a think
|
|
214
|
+
*/
|
|
215
|
+
private armyAway;
|
|
216
|
+
/** Whether the wave has waited past its time as long as it will (`waitAtMost`): it goes with what it has then */
|
|
217
|
+
private waitedEnough;
|
|
218
|
+
/**
|
|
219
|
+
* Whether the wave is ready: as many as it asks for stand idle; or half of them, once it has waited long enough and
|
|
220
|
+
* they would hold against what is remembered to reach the target (half a wave is not fed to the towers)
|
|
221
|
+
*/
|
|
222
|
+
private waveReady;
|
|
223
|
+
/**
|
|
224
|
+
* Where a wave goes: of the rival's buildings it knows of (in sight or remembered, not a creep's), the nearest, or
|
|
225
|
+
* (`target: 'weakest'`) the one the least of their strength is remembered to reach (an expansion before a main with
|
|
226
|
+
* towers), the nearest among those alike; else a base it was told of
|
|
227
|
+
*/
|
|
228
|
+
private targetFor;
|
|
229
|
+
/**
|
|
230
|
+
* A way of its own for a wave (Random Paths, a flag of its profile): by the brain's numbers, straight, or by a place a
|
|
231
|
+
* third of the way's length to one side or the other of its middle. None for straight, or without the flag
|
|
232
|
+
*/
|
|
233
|
+
private wayOf;
|
|
234
|
+
/**
|
|
235
|
+
* How the squads it sends out behave: they fall back from a fight away from home at the odds a wave used to (the
|
|
236
|
+
* profile's `retreatOdds`, or Groups Flee), fight on to the last near home, and a wave is made up from home
|
|
237
|
+
* (`reinforce`); the seat's say goes over it
|
|
238
|
+
*/
|
|
239
|
+
private get outward();
|
|
240
|
+
/** A party's options: as a wave's, but it falls back sooner and nobody comes after it */
|
|
241
|
+
private party;
|
|
242
|
+
/** Sends a wave: its squad to attack the target, the next wave set, said where it says things */
|
|
243
|
+
private launch;
|
|
244
|
+
/**
|
|
245
|
+
* The squad a goal of its sent out (`wave`, `creep`, `raid`, `harass`, `expand`), while it is on its errand: on its
|
|
246
|
+
* way, fighting, falling back, or (a wave) done with its target, to go on or to be sent home. None once its task is
|
|
247
|
+
* over, or before it was sent
|
|
248
|
+
*/
|
|
249
|
+
private out;
|
|
250
|
+
/**
|
|
251
|
+
* Whether a wave that razed what it went for goes on: it may, it is still a few, it is strong enough against their
|
|
252
|
+
* army as last seen and against what is remembered to reach the next target (its towers), and it knows of more of theirs
|
|
253
|
+
*/
|
|
254
|
+
private mayPressOn;
|
|
255
|
+
/** The camp its ready units and hero can take near home, when it is time to go creeping */
|
|
256
|
+
private campToTake;
|
|
257
|
+
/** Where a raid would go: the base of theirs with the most workers seen lately and no army seen near it, with how many */
|
|
258
|
+
private raidTarget;
|
|
259
|
+
/** The fastest fighters of some, no heroes among them, up to so many: a party; none where fewer than two */
|
|
260
|
+
private fastest;
|
|
261
|
+
/** The raiders of what may go: the fastest few, where a raid is on and they would not die at the base */
|
|
262
|
+
private raiders;
|
|
263
|
+
/** Their main as known: the first base of theirs with a hall, nearest home */
|
|
264
|
+
private theirMain;
|
|
265
|
+
/** The party that harasses: the hero and the fastest few, where their army was not seen at their main lately and the party would hold */
|
|
266
|
+
private harassers;
|
|
267
|
+
/** Whether a base of mine still wants guards: past home, with no finished tower among its buildings */
|
|
268
|
+
private wantsGuards;
|
|
269
|
+
/** The bases past home that want guards and have none: no fighters of mine standing by them. Once a think */
|
|
270
|
+
private unguarded;
|
|
271
|
+
/** The base the expand squad guards, where it still wants guards */
|
|
272
|
+
private guarded;
|
|
273
|
+
/** The guards for the first base wanting them: the fighters nearest it, so many, from what stands idle past a wave */
|
|
274
|
+
private guards;
|
|
275
|
+
/** The goals, for the picker: attack, creep, raid, harass, expand (each unless left out) */
|
|
276
|
+
goals(): GoalDef[];
|
|
277
|
+
private attackGoal;
|
|
278
|
+
/** The attack goal's turn: the wave out watched (its fall back, its wait for the team, its next target), or sent */
|
|
279
|
+
private attack;
|
|
280
|
+
private creepGoal;
|
|
281
|
+
private raidGoal;
|
|
282
|
+
private harassGoal;
|
|
283
|
+
private expandGoal;
|
|
284
|
+
/** Once a think, before the picker: whether the wave began waiting past its time, short of its size or outmatched */
|
|
285
|
+
think(): void;
|
|
286
|
+
/** What it remembers, for a save: a copy */
|
|
287
|
+
save(): MeleeArmyMemory;
|
|
288
|
+
/** Takes back what `save` gave */
|
|
289
|
+
restore(data: unknown): void;
|
|
290
|
+
/** What it is thinking, for the debug tools: how hard it plays, its next wave, its roles */
|
|
291
|
+
inspect(): Record<string, unknown>;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The melee brain's army module: the goals of the army put on the picker (attack, creep, raid, harass, expand), the
|
|
295
|
+
* wave's wait counted. Before the picker (`goals`), after the building and the production, as the old turn had it. With how the army goes where the seat says nothing (`MeleeArmyOptions`)
|
|
296
|
+
*
|
|
297
|
+
* @beta
|
|
298
|
+
*/
|
|
299
|
+
export declare const army: (options?: MeleeArmyOptions) => AiModuleDef;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AiModuleDef } from '#engine/ai/module';
|
|
2
|
+
/**
|
|
3
|
+
* How the melee brain makes its heroes (`heroes()` of the melee brain): how many once the game is under way (the
|
|
4
|
+
* profile's `heroes`), from when, and how important their price is to the purse
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface MeleeHeroesOptions {
|
|
9
|
+
/** Heroes it has once the game is under way (`secondFrom`): one before. 2 when left out */
|
|
10
|
+
most?: number;
|
|
11
|
+
/** Seconds into the game from which it wants every hero it may have: one before. 240 when left out */
|
|
12
|
+
secondFrom?: number;
|
|
13
|
+
/**
|
|
14
|
+
* How important a hero's price is to the purse while it is short (`Purse.reserve`): the hall, supply, the barracks,
|
|
15
|
+
* the altar, the answer to their army and another hall go before it (their wants are more important); a workshop,
|
|
16
|
+
* the next tier, a second barracks and the soldiers wait for it. 35 when left out
|
|
17
|
+
*/
|
|
18
|
+
priority?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The melee brain's heroes module: a fallen hero revived, the next trained while it wants more, their price held in the
|
|
22
|
+
* purse meanwhile. After the economy, before the building, as the old turn had it; `steps.heroes` and
|
|
23
|
+
* `steps.buildOrder` honoured
|
|
24
|
+
*
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export declare const heroes: (options?: MeleeHeroesOptions) => AiModuleDef;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DefinedBrain } from '#engine/ai/define';
|
|
2
|
+
/**
|
|
3
|
+
* The engine's melee computer player as a brain: what `world.computers.seat` seats where no brain is named and the game
|
|
4
|
+
* lists it first. It thinks as its profile says (the difficulty's `every`), unless the
|
|
5
|
+
* seat's options say how often. The file's comment lists its modules
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare const meleeBrain: DefinedBrain;
|
|
10
|
+
export { build as meleeBuild, MELEE_LADDER, type MeleeBuildOptions, type MeleeWant } from './build';
|
|
11
|
+
export { army as meleeArmy, MeleeArmy, type MeleeArmyMemory, type MeleeArmyModule, type MeleeArmyOptions, meleeArmyOf, MELEE_ARMY } from './goals';
|
|
12
|
+
export { heroes as meleeHeroes, type MeleeHeroesOptions } from './heroes';
|
|
13
|
+
export { production as meleeProduction } from './production';
|
|
14
|
+
export { surrender as meleeSurrender, type MeleeSurrenderOptions } from './surrender';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AiModuleDef } from '#engine/ai/module';
|
|
2
|
+
/**
|
|
3
|
+
* The melee brain's production module: the production plan thought, after the building and before the picker, as the
|
|
4
|
+
* old turn had it; `steps.production` honoured
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare const production: () => AiModuleDef;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AiModuleDef } from '#engine/ai/module';
|
|
2
|
+
import { type AiCondition } from '#engine/ai/rules';
|
|
3
|
+
/**
|
|
4
|
+
* When the melee player gives up (`MeleeArmyOptions.surrender`): the condition, and how long it holds first
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface MeleeSurrenderOptions {
|
|
9
|
+
/**
|
|
10
|
+
* When it cannot come back, as a condition (data or a function of the brain). By default: no hall and no worker of
|
|
11
|
+
* its own, and its fighters (none at all, or) outmatched by their army as last seen in the last two minutes, odds
|
|
12
|
+
* under 0.2
|
|
13
|
+
*/
|
|
14
|
+
when?: AiCondition;
|
|
15
|
+
/** Seconds the condition holds on end before it gives up: 30 when left out */
|
|
16
|
+
after?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The melee brain's surrender module (`melee.surrender`): gives up once it cannot come back (see
|
|
20
|
+
* `MeleeSurrenderOptions`), the engine's `surrender` command sent once. Its options under the settings' (`army.surrender`)
|
|
21
|
+
*
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
export declare const surrender: (options?: MeleeSurrenderOptions) => AiModuleDef;
|