@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Doron Torangy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type AbilityDef, type BuffDef, type Layer } from '#engine/defs';
|
|
2
|
+
import type { Entity } from '#engine/entity';
|
|
3
|
+
import type { World } from '#engine/world';
|
|
4
|
+
/**
|
|
5
|
+
* Auras keep their buff alive by renewing it. It wears off this long after leaving the aura
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare const AURA_LINGER = 0.75;
|
|
10
|
+
/** @beta */
|
|
11
|
+
export declare function hasBuff(entity: Entity, buff: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Puts a buff on an entity. Buffs do not stack with themselves: a second one of the
|
|
14
|
+
* same kind renews the first when it lasts longer.
|
|
15
|
+
*
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyBuff(world: World, target: Entity, buff: string, duration?: number, source?: Entity, level?: number, ability?: string): void;
|
|
19
|
+
/** What the shield of a buff holds when it is new */
|
|
20
|
+
export declare function fullShield(world: World, def: BuffDef, source: Entity, level: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Takes a buff off, before its time is up: the one of it `source` put on, for buffs each source has their own of, or
|
|
23
|
+
* the first. The `buffEnd` hook hears of it, and the buff's `onRemove`
|
|
24
|
+
*
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeBuff(world: World, entity: Entity, buff: string, source?: Entity): void;
|
|
28
|
+
/** Whether an ability gets through a unit's immunity to spells: always, never, or as its function says for the unit */
|
|
29
|
+
export declare const pierces: (world: World, ability: AbilityDef, target: Entity) => boolean;
|
|
30
|
+
/** Whether a buff a unit carries keeps it from attacking now (`BuffDef.disarm`) */
|
|
31
|
+
export declare const isDisarmed: (world: World, entity: Entity) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a unit is immune to spells: by its type, or a buff it carries (an avatar), as declared or as code decides
|
|
34
|
+
*
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSpellImmune(world: World, entity: Entity): boolean;
|
|
38
|
+
/** @beta */
|
|
39
|
+
export declare function avoids(world: World, entity: Entity, ability: AbilityDef): boolean;
|
|
40
|
+
/** Whether a buff keeps a unit from doing what it wants: stuns and slows. Tenacity cuts those short */
|
|
41
|
+
export declare function isCrowdControl(def: BuffDef): boolean;
|
|
42
|
+
/** @beta */
|
|
43
|
+
export declare const isStunned: (world: World, entity: Entity) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Held to the spot: it can do everything but walk
|
|
46
|
+
*
|
|
47
|
+
* @beta
|
|
48
|
+
*/
|
|
49
|
+
export declare const isRooted: (world: World, entity: Entity) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Kept from using its abilities: from this one, when it says which (a silence of fire spells only). Without an
|
|
52
|
+
* ability, whether anything keeps it from using some
|
|
53
|
+
*
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export declare const isSilenced: (world: World, entity: Entity, ability?: AbilityDef) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether a buff's `silence` keeps its carrier from an ability, or from any when none is said. For both ends
|
|
59
|
+
*
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export declare const silences: (silence: BuffDef['silence'], ability?: AbilityDef) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Where an entity is right now. What flies is in the air, unless something holds it down
|
|
65
|
+
*
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export declare function layerOf(world: World, entity: Entity): Layer;
|
|
69
|
+
/**
|
|
70
|
+
* What is left of the shields on an entity
|
|
71
|
+
*
|
|
72
|
+
* @beta
|
|
73
|
+
*/
|
|
74
|
+
export declare function shieldOf(entity: Entity): number;
|
|
75
|
+
/** Lets the shields of an entity take damage. Returns what they could not hold */
|
|
76
|
+
export declare function absorb(entity: Entity, amount: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* A buff put on, to those who see who has it. Put on again, only where its level changed: an aura renews its buff
|
|
79
|
+
* every round, and what is left of it is the snapshot's (`EntityState.buffTimes`)
|
|
80
|
+
*/
|
|
81
|
+
export declare const toldBuffOn: import("..").ReplicatedEvent;
|
|
82
|
+
/** A buff gone, to those who see who had it */
|
|
83
|
+
export declare const toldBuffOff: import("..").ReplicatedEvent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What players are told of casting (the cast order's events): the wind-up, a channel's start and end, the cast. Beside
|
|
3
|
+
* the abilities, whose order emits them
|
|
4
|
+
*/
|
|
5
|
+
/** A spell being wound up, to those who see the caster: where it aims, and for how long */
|
|
6
|
+
export declare const toldWindup: import("..").ReplicatedEvent;
|
|
7
|
+
/** A channel begun, to those who see the caster */
|
|
8
|
+
export declare const toldChannelStarted: import("..").ReplicatedEvent;
|
|
9
|
+
/** A channel over, to those who see the caster */
|
|
10
|
+
export declare const toldChannelEnded: import("..").ReplicatedEvent;
|
|
11
|
+
/** A cast, to those who see the caster or where it lands */
|
|
12
|
+
export declare const toldCast: import("..").ReplicatedEvent;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charges: an ability used so many times before it waits (`AbilityDef.charges`). A use spends one, and one comes back
|
|
3
|
+
* every `refill` seconds while it holds fewer than it can. What a state says nothing of is full, so an ability learned,
|
|
4
|
+
* a level gone up and a save from before it all start full without anyone filling them in
|
|
5
|
+
*/
|
|
6
|
+
import { type AbilityDef } from '#engine/defs';
|
|
7
|
+
import type { AbilityState, Entity } from '#engine/entity';
|
|
8
|
+
import type { World } from '#engine/world';
|
|
9
|
+
/**
|
|
10
|
+
* Spends a use of an ability with charges, as it goes off: the refill starts, where it was not running already.
|
|
11
|
+
* `plain` for what nothing shortens (an item's, a spell brought along). Nothing for one without charges, and nothing
|
|
12
|
+
* while the debug switch for no cooldowns is on
|
|
13
|
+
*/
|
|
14
|
+
export declare function spendUse(world: World, caster: Entity, ability: AbilityDef, state: AbilityState, plain: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* The seconds of a tick go by for the uses of an ability (`pass`: Infinity fills them at once): one back every
|
|
17
|
+
* `refill`, until it holds all it can. `item` for the ability of something carried
|
|
18
|
+
*/
|
|
19
|
+
export declare function refillUses(world: World, caster: Entity, state: AbilityState, pass: number, item?: boolean): void;
|
|
20
|
+
/** Ready again at once, with all the uses it holds: a hero revived, the `refresh` effect */
|
|
21
|
+
export declare function readyAgain(state: AbilityState): void;
|
|
22
|
+
/**
|
|
23
|
+
* Gives an entity's ability with charges uses back, up to all it holds: `count` of them, or all when left out. What a
|
|
24
|
+
* game's effect or hook does where the data's `refill` is not the way (a kill gives one back). Its cooldown stays
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export declare function restoreCharges(world: World, entity: Entity, ability: string, count?: number): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Entity } from '#engine/entity';
|
|
2
|
+
import type { World } from '#engine/world';
|
|
3
|
+
/**
|
|
4
|
+
* Takes buffs off a unit, as a dispel does: the good ones of an enemy of `by`, the bad ones of a friend. Those that say
|
|
5
|
+
* they cannot be (`BuffDef.dispellable: false`) stay. How many it took
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare function dispelBuffs(world: World, entity: Entity, by: Entity): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EffectCommon, EffectFields } from '#engine/defs';
|
|
2
|
+
import type { EditableField } from '#engine/gameData';
|
|
3
|
+
/** The fields every effect may have, whatever its type (`EffectCommon`): offered on every row of effects */
|
|
4
|
+
export declare const COMMON_EFFECT_FIELDS: Readonly<Record<keyof EffectCommon, EditableField>>;
|
|
5
|
+
/**
|
|
6
|
+
* The engine's fields of an effect by name (`EffectFields`), as the Data panel shows them; `effects`, `onEnd` and
|
|
7
|
+
* `otherwise` are lists of effects. Those of a few values (a missile's `arc`) are a field for each, null for one that
|
|
8
|
+
* is no single value
|
|
9
|
+
*/
|
|
10
|
+
export declare const EFFECT_FIELDS: Readonly<Record<keyof EffectFields, EditableField | readonly EditableField[] | null>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const buffEffect: import("../effects").EffectKind<"buff">;
|
|
2
|
+
/**
|
|
3
|
+
* Puts `buff` on the caster for as long as it likes, or takes it off when it has it: a stance, burrowing. Cast again to
|
|
4
|
+
* come back out
|
|
5
|
+
*/
|
|
6
|
+
export declare const toggleEffect: import("../effects").EffectKind<"toggle">;
|
|
7
|
+
/** auras are kept up by the ability system, there is nothing to do at the moment of casting */
|
|
8
|
+
export declare const auraEffect: import("../effects").EffectKind<"aura">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const damageEffect: import("../effects").EffectKind<"damage">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const missileEffect: import("../effects").EffectKind<"missile">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The caster is somewhere else at once: towards where it was aimed, as far as `distance` lets it */
|
|
2
|
+
export declare const blinkEffect: import("../effects").EffectKind<"blink">;
|
|
3
|
+
/**
|
|
4
|
+
* The caster is somewhere else at once, however far (`to`): its side's home (`homeOf`, a recall), where it was aimed
|
|
5
|
+
* (`point`, when left out), or by its target. Nothing where there is no such place
|
|
6
|
+
*/
|
|
7
|
+
export declare const teleportEffect: import("../effects").EffectKind<"teleport">;
|
|
8
|
+
/** The caster rushes to the spot, through whatever is in the way. `effects` happen around where it ends */
|
|
9
|
+
export declare const dashEffect: import("../effects").EffectKind<"dash">;
|
|
10
|
+
/** Throws the targets `distance` away from the caster. Nothing stops them on the way, and who is rushing somewhere is not thrown */
|
|
11
|
+
export declare const knockbackEffect: import("../effects").EffectKind<"knockback">;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** `onHit` is about attacks, not about the moment of casting: see the function of that name */
|
|
2
|
+
export declare const onHitEffect: import("../effects").EffectKind<"onHit">;
|
|
3
|
+
/** For passives: `effects` happen around whoever the carrier kills. The killing sets it off, see `onKill` */
|
|
4
|
+
export declare const onKillEffect: import("../effects").EffectKind<"onKill">;
|
|
5
|
+
/** For passives: `effects` happen to the carrier whenever it casts. The casting sets it off, see `onCast` */
|
|
6
|
+
export declare const onCastEffect: import("../effects").EffectKind<"onCast">;
|
|
7
|
+
/** The caster is ready to strike again at once */
|
|
8
|
+
export declare const resetAttackEffect: import("../effects").EffectKind<"resetAttack">;
|
|
9
|
+
/** An ability of the caster is ready again, with all the charges it holds: the one named, or the one the effect belongs to */
|
|
10
|
+
export declare const refreshEffect: import("../effects").EffectKind<"refresh">;
|
|
11
|
+
/**
|
|
12
|
+
* `effects` when the ability went off charged, `otherwise` when it did not. With `on: 'caster'` what it does
|
|
13
|
+
* charged happens where the caster stands, wherever it was aimed
|
|
14
|
+
*/
|
|
15
|
+
export declare const chargedEffect: import("../effects").EffectKind<"charged">;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The caster's team sees the spot for a while, with nothing standing there */
|
|
2
|
+
export declare const revealEffect: import("../effects").EffectKind<"reveal">;
|
|
3
|
+
/** Finds what is invisible around the spot: the caster's team sees it for as long as `duration` says */
|
|
4
|
+
export declare const detectEffect: import("../effects").EffectKind<"detect">;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** `effects` happen at the spot, `delay` seconds from now */
|
|
2
|
+
export declare const afterEffect: import("../effects").EffectKind<"after">;
|
|
3
|
+
/** For `duration` seconds `effects` happen to what is at the spot, over and over, and `onEnd` to what is there at the end */
|
|
4
|
+
export declare const zoneEffect: import("../effects").EffectKind<"zone">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const exchangeEffect: import("../effects").EffectKind<"exchange">;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type AbilityDef, type EffectCommon, type EffectDef, type EffectFields, type EffectOf, type EffectTypes } from '#engine/defs';
|
|
2
|
+
import type { EditableField } from '#engine/gameData';
|
|
3
|
+
import { type Dash, type Entity } from '#engine/entity';
|
|
4
|
+
import { type Vec2 } from '#engine/math';
|
|
5
|
+
import type { World } from '#engine/world';
|
|
6
|
+
/** @beta */
|
|
7
|
+
export interface EffectContext {
|
|
8
|
+
world: World;
|
|
9
|
+
caster: Entity;
|
|
10
|
+
ability: AbilityDef;
|
|
11
|
+
/** Level the ability was cast at */
|
|
12
|
+
level: number;
|
|
13
|
+
/** The unit the ability was cast on, if any */
|
|
14
|
+
target?: Entity;
|
|
15
|
+
/** Where the ability landed: the target, the chosen spot, or the caster */
|
|
16
|
+
point: Vec2;
|
|
17
|
+
/** How far what carried the effect here has come, for what a missile does */
|
|
18
|
+
distance?: number;
|
|
19
|
+
/**
|
|
20
|
+
* What part of their amounts the effects come to (`damage`, `heal`, `mana`): less on every spring of a missile that
|
|
21
|
+
* bounces (`EffectFields.bounce`). All of it when left out; a game's own effect with an amount multiplies by it too
|
|
22
|
+
*/
|
|
23
|
+
share?: number;
|
|
24
|
+
/** How many of the buff that ran out there were, for what happens when it does */
|
|
25
|
+
stacks?: number;
|
|
26
|
+
/** The ability went off charged, see `charge` on the ability */
|
|
27
|
+
charged?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* For an effect that is kept up all the time (a passive asked every round): the seconds since it was last asked.
|
|
30
|
+
* Something that works per second multiplies by this, rather than counting on how often it is asked
|
|
31
|
+
*/
|
|
32
|
+
interval?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Carries out an effect, whatever its type: what the registry hands for a type (`registry.effect`), to call with an
|
|
36
|
+
* effect of that type
|
|
37
|
+
*
|
|
38
|
+
* @beta
|
|
39
|
+
*/
|
|
40
|
+
export type EffectHandler = (context: EffectContext, effect: EffectDef) => void;
|
|
41
|
+
/**
|
|
42
|
+
* A kind of effect: its type and what it does (`defineEffect`). The engine's are the game's from the start; a game
|
|
43
|
+
* lists its own in `GameModule.effects`, and one of a type the engine has takes its place
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface EffectKind<K extends keyof EffectTypes = keyof EffectTypes> {
|
|
48
|
+
readonly type: K;
|
|
49
|
+
/** Carries out an effect of the type, for a cast (or a passive asked, a missile's hit...) */
|
|
50
|
+
run(context: EffectContext, effect: EffectOf<K>): void;
|
|
51
|
+
/** An effect of the type, for an ability's list: `pull.of({ distance: 3 })` is `{ type: 'pull', distance: 3 }` */
|
|
52
|
+
of(fields: EffectCommon & EffectTypes[K]): EffectOf<K>;
|
|
53
|
+
/**
|
|
54
|
+
* The fields an effect of the type reads, besides those every effect has (`EffectCommon`): what the editor's Data
|
|
55
|
+
* panel offers on a row of the type (campaign plan RC2). None said, it offers those a row has
|
|
56
|
+
*/
|
|
57
|
+
readonly fields?: readonly EditableField[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* What a kind of effect says besides what it does (`defineEffect`): the fields it reads, each the name of one of the
|
|
61
|
+
* engine's (`EffectFields`) or said in full, its path the field's name in the effect (`{ path: 'pull', kind: 'number' }`)
|
|
62
|
+
*
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
65
|
+
export interface EffectKindOptions {
|
|
66
|
+
fields?: readonly (keyof EffectFields | EditableField)[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A kind of effect, its type and what it does together: `defineEffect('pull', (context, effect) => ...)`, listed in
|
|
70
|
+
* `GameModule.effects`. Its fields are said by declaring the type in `EffectTypes`
|
|
71
|
+
* (`declare module '@v12-engine/engine' { interface EffectTypes { pull: { distance: number } } }`), so that a handler
|
|
72
|
+
* reads them typed, and an ability's effect of the type is checked for them
|
|
73
|
+
*
|
|
74
|
+
* @beta
|
|
75
|
+
*/
|
|
76
|
+
export declare function defineEffect<K extends keyof EffectTypes>(type: K, run: (context: EffectContext, effect: EffectOf<K>) => void, options?: EffectKindOptions): EffectKind<K>;
|
|
77
|
+
/**
|
|
78
|
+
* Who an effect applies to
|
|
79
|
+
*
|
|
80
|
+
* @beta
|
|
81
|
+
*/
|
|
82
|
+
export declare function effectTargets(context: EffectContext, effect: EffectDef, fallback: 'enemies' | 'allies'): Entity[];
|
|
83
|
+
/**
|
|
84
|
+
* What the attacks of a unit do on top of their damage: the `onHit` effects among what its abilities, and
|
|
85
|
+
* the items it carries, do all the time. Called for every attack that lands
|
|
86
|
+
*/
|
|
87
|
+
export declare function onHit(world: World, attacker: Entity, target: Entity): void;
|
|
88
|
+
/** Whether an ability of the caster is charged: its `charge` buff is on it with as many stacks as it can have */
|
|
89
|
+
export declare function isCharged(world: World, caster: Entity, ability: AbilityDef): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* What the passives of the caster do whenever it casts an ability: for a hero, one of the abilities it learns.
|
|
92
|
+
* Called once the ability went off, and not for one that went off charged: what spends a charge does not count to the next
|
|
93
|
+
*/
|
|
94
|
+
export declare function onCast(world: World, caster: Entity, cast: AbilityDef): void;
|
|
95
|
+
/**
|
|
96
|
+
* Takes someone off the ground for a leap or a throw. Up there it is nobody's obstacle: it pushes no one
|
|
97
|
+
* on its way over them, and goes straight over what cannot be walked
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* Sends an entity rushing to a spot (`dash.x`, `dash.z`): nothing stops it on the way, its orders wait, and what
|
|
101
|
+
* `dash.effects` do happens where it ends. A leap (`dash.height`) takes it off the ground until it comes down
|
|
102
|
+
*
|
|
103
|
+
* @beta
|
|
104
|
+
*/
|
|
105
|
+
export declare function startDash(world: World, entity: Entity, dash: Omit<Dash, 'from'>): void;
|
|
106
|
+
/**
|
|
107
|
+
* What killing someone sets off: the `onKill` effects among what the abilities of the killer do all the time.
|
|
108
|
+
* `attack` says whether it was one of its attacks that killed
|
|
109
|
+
*/
|
|
110
|
+
export declare function onKill(world: World, killer: Entity, victim: Entity, attack: boolean): void;
|
|
111
|
+
/** Moves the missiles of abilities along, and lets them do what they do to what they pass through and where they come down */
|
|
112
|
+
export declare function updateMissiles(world: World, dt: number): void;
|
|
113
|
+
/** What abilities left behind to happen later, and the ground they go on working on */
|
|
114
|
+
export declare function updateLingering(world: World, dt: number): void;
|
|
115
|
+
/** Carries those who rush somewhere towards where they are going. Nothing holds them up, and what it does happens when they arrive */
|
|
116
|
+
export declare function updateDashes(world: World, dt: number): void;
|
|
117
|
+
/** A missile reaching what it hits, to those who see what it hits */
|
|
118
|
+
export declare const toldMissileHit: import("..").ReplicatedEvent;
|
|
119
|
+
/** Mana given or taken: its side's alone */
|
|
120
|
+
export declare const toldMana: import("..").ReplicatedEvent;
|
|
121
|
+
/** The missiles of abilities in flight the player is told of: their side's, and those where they see (`Snapshot.missiles`); none to a computer */
|
|
122
|
+
export declare const missilesPart: import("..").SnapshotPart<keyof import("..").Snapshot>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type EffectDef } from '#engine/defs';
|
|
2
|
+
import type { BuffInstance, Entity } from '#engine/entity';
|
|
3
|
+
import type { World } from '#engine/world';
|
|
4
|
+
import type { EffectContext } from './effects';
|
|
5
|
+
/** Runs each effect of a list by its handler (`registry.effect`) */
|
|
6
|
+
export declare function run(context: EffectContext, effects: EffectDef[] | undefined): void;
|
|
7
|
+
/** What something an ability set off does where it arrives, and the word to everyone that it did */
|
|
8
|
+
export declare function land(context: EffectContext, effects: EffectDef[] | undefined, impact?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Effects of a buff on its carrier (`onApply`, `onTick`), in the name of who put it there, while they live: from the
|
|
11
|
+
* ability it came from, or from the buff itself for one put on otherwise
|
|
12
|
+
*/
|
|
13
|
+
export declare function buffEffects(world: World, carrier: Entity, instance: BuffInstance, effects: EffectDef[]): void;
|
|
14
|
+
/**
|
|
15
|
+
* What a buff that ran out leaves behind: its `onEnd`, in the name of who put it there
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export declare function buffEnded(world: World, carrier: Entity, instance: BuffInstance): void;
|
|
20
|
+
/** Where a spell lands, to those who see the caster or the spot */
|
|
21
|
+
export declare const toldStrike: import("..").ReplicatedEvent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an ability's numbers come to for the unit that casts it: the parts that grow with its stats, its level as a hero,
|
|
3
|
+
* its own attack (`Scaling`). Above the stats (`stats.ts`), which know nothing of heroes: a hero's level is the heroes
|
|
4
|
+
* pack's
|
|
5
|
+
*/
|
|
6
|
+
import { type CasterFacts } from './text';
|
|
7
|
+
import { type Scaling } from '#engine/defs';
|
|
8
|
+
import type { Entity } from '#engine/entity';
|
|
9
|
+
import type { World } from '#engine/world';
|
|
10
|
+
/**
|
|
11
|
+
* An amount with what the stats of the caster, and the levels of a hero, add to it
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export declare function scaled(world: World, caster: Entity, amount: number, scaling: Scaling | undefined, level: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* What an entity brings to the numbers of its abilities, now (see `CasterFacts`)
|
|
18
|
+
*
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare function casterFacts(world: World, caster: Entity): CasterFacts;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type AbilityDef, type BuffDef, type Scaled, type Scaling, type StatKey, type Stats } from '#engine/defs';
|
|
2
|
+
/**
|
|
3
|
+
* What the caster brings to an ability's numbers: its stats now, its level as a hero, and the attack damage of its own
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface CasterFacts {
|
|
8
|
+
stats: Readonly<Stats>;
|
|
9
|
+
/** 1 for what is not a hero */
|
|
10
|
+
heroLevel: number;
|
|
11
|
+
/** The attack damage it has from its type and its levels, without what it carries or what is on it */
|
|
12
|
+
ownAttackDamage: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What the text of an ability is worked out from: the ability at a level, its caster, and the buffs it puts on
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export interface AbilityTextContext {
|
|
20
|
+
ability: AbilityDef;
|
|
21
|
+
/** The level of the ability: 1 for one that has no levels */
|
|
22
|
+
level: number;
|
|
23
|
+
caster: CasterFacts;
|
|
24
|
+
/** A buff by id, for how long the ones the ability puts on last */
|
|
25
|
+
buff?: (id: string) => BuffDef | undefined;
|
|
26
|
+
/** A value of the ability, by name, worked out (see `abilityValues`) */
|
|
27
|
+
value(name: string): AbilityValue | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A part of a value that comes from a stat of the caster: 60% of ability power
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export interface ValuePart {
|
|
35
|
+
/** The stat, `level` for each level of a hero past the first, `bonusAttackDamage` for what is added to its own */
|
|
36
|
+
stat: StatKey | 'level' | 'bonusAttackDamage';
|
|
37
|
+
/** How much of it: 0.6 */
|
|
38
|
+
ratio: number;
|
|
39
|
+
/** What that comes to now */
|
|
40
|
+
amount: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A number of an ability, worked out: its total, and what it is made of
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface AbilityValue {
|
|
48
|
+
total: number;
|
|
49
|
+
/** What it is without the stats of the caster */
|
|
50
|
+
base: number;
|
|
51
|
+
parts: ValuePart[];
|
|
52
|
+
/** What follows the number: `s` for seconds, `%`. Nothing when left out */
|
|
53
|
+
unit?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* How a game gives a value of an ability: an amount and what scales it, or worked out in code
|
|
57
|
+
*
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
export type AbilityValueDef = {
|
|
61
|
+
amount?: Scaled;
|
|
62
|
+
scaling?: Scaling;
|
|
63
|
+
unit?: string;
|
|
64
|
+
percent?: boolean;
|
|
65
|
+
} | ((context: AbilityTextContext) => number | AbilityValue);
|
|
66
|
+
/**
|
|
67
|
+
* A piece of the text of an ability: words, or a value to show as one (bold, its parts in their colours)
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
export type TextSegment = string | {
|
|
72
|
+
name: string;
|
|
73
|
+
value: AbilityValue;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The values of an ability at a level, for a caster, by name: its own (`AbilityDef.values`), and what its effects say
|
|
77
|
+
* when it does not name them itself: `damage`, `heal`, `shield` and `amount` (the first effect of each kind with an
|
|
78
|
+
* amount), `duration`, `radius`, `range`, `cooldown`, `charges` and `refill`, `mana`, `count` and `distance`
|
|
79
|
+
*
|
|
80
|
+
* @beta
|
|
81
|
+
*/
|
|
82
|
+
export declare function abilityValues(ability: AbilityDef, level: number, caster: CasterFacts, buff?: (id: string) => BuffDef | undefined): Map<string, AbilityValue>;
|
|
83
|
+
/**
|
|
84
|
+
* What the ability says it does, for this caster now: its description with each `{value}` worked out (or its own
|
|
85
|
+
* `describe`), as words and values. A name it has no value for is left as it is written, braces and all
|
|
86
|
+
*
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
export declare function describeAbility(ability: AbilityDef, level: number, caster: CasterFacts, buff?: (id: string) => BuffDef | undefined): TextSegment[];
|
|
90
|
+
/**
|
|
91
|
+
* How a stat is called in the text of an ability
|
|
92
|
+
*
|
|
93
|
+
* @beta
|
|
94
|
+
*/
|
|
95
|
+
export declare const STAT_WORDS: Partial<Record<ValuePart['stat'], string>>;
|
|
96
|
+
/**
|
|
97
|
+
* A number as an ability's text shows it: whole, or with one decimal when it is small and has one
|
|
98
|
+
*
|
|
99
|
+
* @beta
|
|
100
|
+
*/
|
|
101
|
+
export declare function formatNumber(value: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* A value in words: `80`, or `80 (50 + 60% ability power)` when stats add to it
|
|
104
|
+
*
|
|
105
|
+
* @beta
|
|
106
|
+
*/
|
|
107
|
+
export declare function valueText(value: AbilityValue): string;
|
|
108
|
+
/**
|
|
109
|
+
* The text of an ability as plain words: for a tooltip of words only, a log, a test
|
|
110
|
+
*
|
|
111
|
+
* @beta
|
|
112
|
+
*/
|
|
113
|
+
export declare function abilityText(segments: readonly TextSegment[]): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An area of a brain (`AiArea`): a part of what it keeps and does that its modules share, its economy, its scouting, a
|
|
3
|
+
* game's own diplomacy, kept in its memory under its id and reported under it. The brain keeps a list of them and asks
|
|
4
|
+
* each the same things (`ai.area(Economy)`), so that one of a game's own is a peer of the kit's and adding one touches
|
|
5
|
+
* nothing of the brain
|
|
6
|
+
*/
|
|
7
|
+
import type { Brain } from './brain';
|
|
8
|
+
import type { AiReport } from './report';
|
|
9
|
+
/**
|
|
10
|
+
* What a brain asks of each of its areas
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface AiArea {
|
|
15
|
+
/** Unique in a brain: what its memory and its report are kept under */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** Whether it has anything to remember now: one that does not is left out of a save */
|
|
18
|
+
remembers(): boolean;
|
|
19
|
+
/** What it remembers, for a save: plain data */
|
|
20
|
+
save(): unknown;
|
|
21
|
+
/** Takes back what `save` gave: false for a shape it does not read, and it starts afresh */
|
|
22
|
+
restore(memory: unknown): boolean;
|
|
23
|
+
/** What the log says where a save's memory of it is of a shape it does not read */
|
|
24
|
+
readonly afresh?: string;
|
|
25
|
+
/** What it says in its brain's report (`AiReport`): its own part of it, written in */
|
|
26
|
+
reportTo?(report: AiReport): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What finds an area of a brain, and makes it the first time it is asked for (`ai.area(key)`): a class of the kit's
|
|
30
|
+
* with a static `id` and `make`, or what `defineArea` gives
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export interface AreaKey<T extends AiArea> {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
make(ai: Brain): T;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* An area of a game's own, for its brains (`ai.area(diplomacy)`): made for each brain the first time a module asks for it,
|
|
40
|
+
* remembered in a save under its id (`BrainMemory.areas`) as the kit's are
|
|
41
|
+
*
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export declare function defineArea<T extends AiArea>(id: string, make: (ai: Brain) => T): AreaKey<T>;
|
|
45
|
+
/**
|
|
46
|
+
* What a brain's areas remember, by id (`BrainMemory.areas`): each area of the kit adds its own here, as a game's own may
|
|
47
|
+
* (`declare module '@v12-engine/engine/ai' { interface AreaMemories { 'mygame.diplomacy'?: DiplomacyMemory } }`)
|
|
48
|
+
*
|
|
49
|
+
* @beta
|
|
50
|
+
*/
|
|
51
|
+
export interface AreaMemories {
|
|
52
|
+
[id: string]: unknown;
|
|
53
|
+
}
|