@v12-engine/engine 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abilities/amounts.d.ts +28 -0
- package/dist/abilities/amounts.js +74 -0
- package/dist/abilities/amounts.js.map +1 -0
- package/dist/abilities/buffs.d.ts +106 -6
- package/dist/abilities/buffs.js +443 -0
- package/dist/abilities/buffs.js.map +1 -0
- package/dist/abilities/castTold.d.ts +2 -0
- package/dist/abilities/castTold.js +66 -0
- package/dist/abilities/castTold.js.map +1 -0
- package/dist/abilities/chance.d.ts +38 -0
- package/dist/abilities/chance.js +77 -0
- package/dist/abilities/chance.js.map +1 -0
- package/dist/abilities/charges.d.ts +18 -0
- package/dist/abilities/charges.js +101 -0
- package/dist/abilities/charges.js.map +1 -0
- package/dist/abilities/control.d.ts +28 -0
- package/dist/abilities/control.js +113 -0
- package/dist/abilities/control.js.map +1 -0
- package/dist/abilities/dispel.js +51 -0
- package/dist/abilities/dispel.js.map +1 -0
- package/dist/abilities/effectFields.d.ts +1 -1
- package/dist/abilities/effectFields.js +676 -0
- package/dist/abilities/effectFields.js.map +1 -0
- package/dist/abilities/effectIndex.d.ts +27 -0
- package/dist/abilities/effectIndex.js +64 -0
- package/dist/abilities/effectIndex.js.map +1 -0
- package/dist/abilities/effects/buff.d.ts +9 -3
- package/dist/abilities/effects/buff.js +84 -0
- package/dist/abilities/effects/buff.js.map +1 -0
- package/dist/abilities/effects/conditions.d.ts +2 -0
- package/dist/abilities/effects/conditions.js +41 -0
- package/dist/abilities/effects/conditions.js.map +1 -0
- package/dist/abilities/effects/core.js +54 -0
- package/dist/abilities/effects/core.js.map +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -1
- package/dist/abilities/effects/damage.js +43 -0
- package/dist/abilities/effects/damage.js.map +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -2
- package/dist/abilities/effects/heal.js +51 -0
- package/dist/abilities/effects/heal.js.map +1 -0
- package/dist/abilities/effects/missile.d.ts +13 -1
- package/dist/abilities/effects/missile.js +104 -0
- package/dist/abilities/effects/missile.js.map +1 -0
- package/dist/abilities/effects/morph.d.ts +5 -0
- package/dist/abilities/effects/morph.js +43 -0
- package/dist/abilities/effects/morph.js.map +1 -0
- package/dist/abilities/effects/moves.d.ts +16 -4
- package/dist/abilities/effects/moves.js +212 -0
- package/dist/abilities/effects/moves.js.map +1 -0
- package/dist/abilities/effects/passives.d.ts +19 -9
- package/dist/abilities/effects/passives.js +131 -0
- package/dist/abilities/effects/passives.js.map +1 -0
- package/dist/abilities/effects/proxy.d.ts +5 -0
- package/dist/abilities/effects/proxy.js +60 -0
- package/dist/abilities/effects/proxy.js.map +1 -0
- package/dist/abilities/effects/sight.d.ts +2 -2
- package/dist/abilities/effects/sight.js +39 -0
- package/dist/abilities/effects/sight.js.map +1 -0
- package/dist/abilities/effects/spawn.d.ts +5 -2
- package/dist/abilities/effects/spawn.js +40 -0
- package/dist/abilities/effects/spawn.js.map +1 -0
- package/dist/abilities/effects/timed.d.ts +2 -2
- package/dist/abilities/effects/timed.js +96 -0
- package/dist/abilities/effects/timed.js.map +1 -0
- package/dist/abilities/effects/trade.d.ts +1 -1
- package/dist/abilities/effects/trade.js +25 -0
- package/dist/abilities/effects/trade.js.map +1 -0
- package/dist/abilities/effects.d.ts +97 -23
- package/dist/abilities/effects.js +860 -0
- package/dist/abilities/effects.js.map +1 -0
- package/dist/abilities/land.d.ts +38 -4
- package/dist/abilities/land.js +189 -0
- package/dist/abilities/land.js.map +1 -0
- package/dist/abilities/recast.d.ts +45 -0
- package/dist/abilities/recast.js +118 -0
- package/dist/abilities/recast.js.map +1 -0
- package/dist/abilities/scaled.js +40 -0
- package/dist/abilities/scaled.js.map +1 -0
- package/dist/abilities/screen.d.ts +6 -0
- package/dist/abilities/screen.js +83 -0
- package/dist/abilities/screen.js.map +1 -0
- package/dist/abilities/shapes.d.ts +66 -0
- package/dist/abilities/shapes.js +122 -0
- package/dist/abilities/shapes.js.map +1 -0
- package/dist/abilities/text.d.ts +14 -2
- package/dist/abilities/text.js +204 -0
- package/dist/abilities/text.js.map +1 -0
- package/dist/abilities/triggers.d.ts +98 -0
- package/dist/abilities/triggers.js +351 -0
- package/dist/abilities/triggers.js.map +1 -0
- package/dist/abilityChanges.d.ts +131 -0
- package/dist/abilityChanges.js +345 -0
- package/dist/abilityChanges.js.map +1 -0
- package/dist/ai/area.d.ts +4 -1
- package/dist/ai/brain.d.ts +4 -1
- package/dist/ai/brain.js +844 -0
- package/dist/ai/brain.js.map +1 -0
- package/dist/ai/budget.js +74 -0
- package/dist/ai/budget.js.map +1 -0
- package/dist/ai/checks.d.ts +9 -1
- package/dist/ai/checks.js +242 -0
- package/dist/ai/checks.js.map +1 -0
- package/dist/ai/computer.d.ts +11 -4
- package/dist/ai/computer.js +251 -0
- package/dist/ai/computer.js.map +1 -0
- package/dist/ai/defence.d.ts +4 -0
- package/dist/ai/defence.js +430 -0
- package/dist/ai/defence.js.map +1 -0
- package/dist/ai/define.d.ts +3 -2
- package/dist/ai/define.js +31 -0
- package/dist/ai/define.js.map +1 -0
- package/dist/ai/economy.d.ts +10 -7
- package/dist/ai/economy.js +780 -0
- package/dist/ai/economy.js.map +1 -0
- package/dist/ai/geometry.js +38 -0
- package/dist/ai/geometry.js.map +1 -0
- package/dist/ai/goals.d.ts +1 -0
- package/dist/ai/goals.js +560 -0
- package/dist/ai/goals.js.map +1 -0
- package/dist/ai/knowledge.d.ts +72 -7
- package/dist/ai/knowledge.js +804 -0
- package/dist/ai/knowledge.js.map +1 -0
- package/dist/ai/lanes.d.ts +10 -2
- package/dist/ai/lanes.js +715 -0
- package/dist/ai/lanes.js.map +1 -0
- package/dist/ai/melee/build.js +264 -0
- package/dist/ai/melee/build.js.map +1 -0
- package/dist/ai/melee/goals.d.ts +7 -0
- package/dist/ai/melee/goals.js +720 -0
- package/dist/ai/melee/goals.js.map +1 -0
- package/dist/ai/melee/heroes.js +68 -0
- package/dist/ai/melee/heroes.js.map +1 -0
- package/dist/ai/melee/index.d.ts +1 -1
- package/dist/ai/melee/index.js +51 -0
- package/dist/ai/melee/index.js.map +1 -0
- package/dist/ai/melee/production.js +29 -0
- package/dist/ai/melee/production.js.map +1 -0
- package/dist/ai/melee/surrender.js +64 -0
- package/dist/ai/melee/surrender.js.map +1 -0
- package/dist/ai/micro.d.ts +9 -0
- package/dist/ai/micro.js +1316 -0
- package/dist/ai/micro.js.map +1 -0
- package/dist/ai/mission.d.ts +9 -2
- package/dist/ai/mission.js +538 -0
- package/dist/ai/mission.js.map +1 -0
- package/dist/ai/missionRules.d.ts +1 -1
- package/dist/ai/missionRules.js +26 -0
- package/dist/ai/missionRules.js.map +1 -0
- package/dist/ai/module.d.ts +6 -2
- package/dist/ai/module.js +37 -0
- package/dist/ai/module.js.map +1 -0
- package/dist/ai/options.d.ts +3 -3
- package/dist/ai/plans/build.d.ts +20 -1
- package/dist/ai/plans/build.js +608 -0
- package/dist/ai/plans/build.js.map +1 -0
- package/dist/ai/plans/placement.d.ts +4 -1
- package/dist/ai/plans/placement.js +295 -0
- package/dist/ai/plans/placement.js.map +1 -0
- package/dist/ai/plans/plans.d.ts +9 -0
- package/dist/ai/plans/plans.js +110 -0
- package/dist/ai/plans/plans.js.map +1 -0
- package/dist/ai/plans/production.d.ts +14 -2
- package/dist/ai/plans/production.js +434 -0
- package/dist/ai/plans/production.js.map +1 -0
- package/dist/ai/plans/purse.d.ts +6 -3
- package/dist/ai/plans/purse.js +139 -0
- package/dist/ai/plans/purse.js.map +1 -0
- package/dist/ai/plans/tech.d.ts +6 -0
- package/dist/ai/plans/tech.js +122 -0
- package/dist/ai/plans/tech.js.map +1 -0
- package/dist/ai/profiles.d.ts +4 -4
- package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
- package/dist/ai/profiles.js.map +1 -0
- package/dist/ai/reach.js +54 -0
- package/dist/ai/reach.js.map +1 -0
- package/dist/ai/report.d.ts +8 -0
- package/dist/ai/report.js +87 -0
- package/dist/ai/report.js.map +1 -0
- package/dist/ai/roles.d.ts +4 -0
- package/dist/ai/roles.js +207 -0
- package/dist/ai/roles.js.map +1 -0
- package/dist/ai/rules.d.ts +8 -2
- package/dist/ai/rules.js +416 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/scouting.d.ts +6 -0
- package/dist/ai/scouting.js +324 -0
- package/dist/ai/scouting.js.map +1 -0
- package/dist/ai/settings.js +99 -0
- package/dist/ai/settings.js.map +1 -0
- package/dist/ai/squads.d.ts +21 -2
- package/dist/ai/squads.js +916 -0
- package/dist/ai/squads.js.map +1 -0
- package/dist/ai/strength.js +320 -0
- package/dist/ai/strength.js.map +1 -0
- package/dist/ai/task.d.ts +3 -1
- package/dist/ai/task.js +17 -0
- package/dist/ai/task.js.map +1 -0
- package/dist/ai/tasks/attack.js +24 -0
- package/dist/ai/tasks/attack.js.map +1 -0
- package/dist/ai/tasks/capture.d.ts +3 -3
- package/dist/ai/tasks/capture.js +37 -0
- package/dist/ai/tasks/capture.js.map +1 -0
- package/dist/ai/tasks/creep.js +29 -0
- package/dist/ai/tasks/creep.js.map +1 -0
- package/dist/ai/tasks/defend.js +61 -0
- package/dist/ai/tasks/defend.js.map +1 -0
- package/dist/ai/tasks/drop.js +81 -0
- package/dist/ai/tasks/drop.js.map +1 -0
- package/dist/ai/tasks/escort.js +59 -0
- package/dist/ai/tasks/escort.js.map +1 -0
- package/dist/ai/tasks/gather.js +48 -0
- package/dist/ai/tasks/gather.js.map +1 -0
- package/dist/ai/tasks/harass.js +39 -0
- package/dist/ai/tasks/harass.js.map +1 -0
- package/dist/ai/tasks/hold.js +32 -0
- package/dist/ai/tasks/hold.js.map +1 -0
- package/dist/ai/tasks/index.js +34 -0
- package/dist/ai/tasks/index.js.map +1 -0
- package/dist/ai/tasks/move.js +26 -0
- package/dist/ai/tasks/move.js.map +1 -0
- package/dist/ai/tasks/patrol.js +59 -0
- package/dist/ai/tasks/patrol.js.map +1 -0
- package/dist/ai/tasks/retreat.js +28 -0
- package/dist/ai/tasks/retreat.js.map +1 -0
- package/dist/ai/tasks/scout.js +73 -0
- package/dist/ai/tasks/scout.js.map +1 -0
- package/dist/ai/tasks/shared.d.ts +1 -1
- package/dist/ai/tasks/shared.js +137 -0
- package/dist/ai/tasks/shared.js.map +1 -0
- package/dist/ai/team.d.ts +18 -1
- package/dist/ai/team.js +492 -0
- package/dist/ai/team.js.map +1 -0
- package/dist/ai/threat.d.ts +6 -0
- package/dist/ai/threat.js +206 -0
- package/dist/ai/threat.js.map +1 -0
- package/dist/ai/view.d.ts +21 -7
- package/dist/ai/view.js +677 -0
- package/dist/ai/view.js.map +1 -0
- package/dist/ai/waves.d.ts +6 -0
- package/dist/ai/waves.js +410 -0
- package/dist/ai/waves.js.map +1 -0
- package/dist/ai.js +54 -6239
- package/dist/aiTesting.d.ts +6 -3
- package/dist/aiTesting.js +229 -0
- package/dist/aiTesting.js.map +1 -0
- package/dist/areas.d.ts +4 -1
- package/dist/areas.js +295 -0
- package/dist/areas.js.map +1 -0
- package/dist/attacks.d.ts +3 -3
- package/dist/attacks.js +127 -0
- package/dist/attacks.js.map +1 -0
- package/dist/burning.d.ts +267 -0
- package/dist/burning.js +795 -0
- package/dist/burning.js.map +1 -0
- package/dist/bytes.js +21 -0
- package/dist/bytes.js.map +1 -0
- package/dist/callings.d.ts +71 -0
- package/dist/callings.js +157 -0
- package/dist/callings.js.map +1 -0
- package/dist/cameraOrders.d.ts +78 -0
- package/dist/cameraOrders.js +114 -0
- package/dist/cameraOrders.js.map +1 -0
- package/dist/camps.d.ts +70 -4
- package/dist/camps.js +501 -0
- package/dist/camps.js.map +1 -0
- package/dist/capture.d.ts +15 -3
- package/dist/capture.js +304 -0
- package/dist/capture.js.map +1 -0
- package/dist/cellLayers.d.ts +78 -13
- package/dist/cellLayers.js +275 -0
- package/dist/cellLayers.js.map +1 -0
- package/dist/cellPatches.d.ts +24 -0
- package/dist/cellPatches.js +73 -0
- package/dist/cellPatches.js.map +1 -0
- package/dist/cinematics.d.ts +10 -5
- package/dist/cinematics.js +161 -0
- package/dist/cinematics.js.map +1 -0
- package/dist/clock.d.ts +2 -2
- package/dist/clock.js +78 -0
- package/dist/clock.js.map +1 -0
- package/dist/commands.d.ts +36 -4
- package/dist/commands.js +636 -0
- package/dist/commands.js.map +1 -0
- package/dist/components.d.ts +31 -10
- package/dist/components.js +74 -0
- package/dist/components.js.map +1 -0
- package/dist/computers.d.ts +4 -4
- package/dist/computers.js +194 -0
- package/dist/computers.js.map +1 -0
- package/dist/concealment.d.ts +25 -2
- package/dist/concealment.js +409 -0
- package/dist/concealment.js.map +1 -0
- package/dist/coreComponents.js +130 -0
- package/dist/coreComponents.js.map +1 -0
- package/dist/createGame.d.ts +306 -0
- package/dist/createGame.js +405 -0
- package/dist/createGame.js.map +1 -0
- package/dist/dashing.d.ts +18 -2
- package/dist/dashing.js +41 -0
- package/dist/dashing.js.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +5 -3
- package/dist/debug2.js +76 -0
- package/dist/debug2.js.map +1 -0
- package/dist/debugCommands.d.ts +6 -6
- package/dist/debugCommands.js +537 -0
- package/dist/debugCommands.js.map +1 -0
- package/dist/debugging.d.ts +1 -0
- package/dist/defaultSets.d.ts +183 -0
- package/dist/defaultSets.js +216 -0
- package/dist/defaultSets.js.map +1 -0
- package/dist/definitions.d.ts +6 -0
- package/dist/definitions.js +78 -0
- package/dist/definitions.js.map +1 -0
- package/dist/defs.d.ts +1895 -165
- package/dist/defs.js +380 -0
- package/dist/defs.js.map +1 -0
- package/dist/denying.d.ts +4 -4
- package/dist/denying.js +106 -0
- package/dist/denying.js.map +1 -0
- package/dist/destructibles.d.ts +2 -2
- package/dist/destructibles.js +36 -0
- package/dist/destructibles.js.map +1 -0
- package/dist/determinism.d.ts +4 -4
- package/dist/determinism.js +247 -0
- package/dist/determinism.js.map +1 -0
- package/dist/dialog.d.ts +17 -2
- package/dist/dialog.js +108 -0
- package/dist/dialog.js.map +1 -0
- package/dist/effectRefs.js +28 -0
- package/dist/effectRefs.js.map +1 -0
- package/dist/effects.d.ts +27 -11
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/endings.d.ts +1 -1
- package/dist/endings.js +78 -0
- package/dist/endings.js.map +1 -0
- package/dist/engagement.d.ts +40 -6
- package/dist/engagement.js +530 -0
- package/dist/engagement.js.map +1 -0
- package/dist/engineEvents.d.ts +72 -9
- package/dist/engineEvents.js +520 -0
- package/dist/engineEvents.js.map +1 -0
- package/dist/entity.d.ts +275 -26
- package/dist/entity.js +441 -0
- package/dist/entity.js.map +1 -0
- package/dist/entityIndex.d.ts +10 -3
- package/dist/entityIndex.js +149 -0
- package/dist/entityIndex.js.map +1 -0
- package/dist/errors.d.ts +6 -2
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +11 -5
- package/dist/events.js +158 -0
- package/dist/events.js.map +1 -0
- package/dist/exactMath.js +273 -0
- package/dist/exactMath.js.map +1 -0
- package/dist/features.d.ts +1 -1
- package/dist/features.js +127 -0
- package/dist/features.js.map +1 -0
- package/dist/fields.d.ts +25 -5
- package/dist/fields.js +140 -0
- package/dist/fields.js.map +1 -0
- package/dist/fixture.d.ts +3 -3
- package/dist/fixture.js +512 -0
- package/dist/fixture.js.map +1 -0
- package/dist/fog.d.ts +26 -3
- package/dist/fog.js +333 -0
- package/dist/fog.js.map +1 -0
- package/dist/foliage.d.ts +476 -0
- package/dist/foliage.js +1478 -0
- package/dist/foliage.js.map +1 -0
- package/dist/foliageDebug.d.ts +57 -0
- package/dist/foliageDebug.js +172 -0
- package/dist/foliageDebug.js.map +1 -0
- package/dist/foliageRegrowth.d.ts +20 -0
- package/dist/foliageRegrowth.js +332 -0
- package/dist/foliageRegrowth.js.map +1 -0
- package/dist/formState.d.ts +67 -0
- package/dist/formState.js +65 -0
- package/dist/formState.js.map +1 -0
- package/dist/formation.d.ts +46 -8
- package/dist/formation.js +297 -0
- package/dist/formation.js.map +1 -0
- package/dist/forms.d.ts +58 -0
- package/dist/forms.js +146 -0
- package/dist/forms.js.map +1 -0
- package/dist/friendlyFire.d.ts +2 -2
- package/dist/friendlyFire.js +37 -0
- package/dist/friendlyFire.js.map +1 -0
- package/dist/game.d.ts +141 -48
- package/dist/game.js +834 -0
- package/dist/game.js.map +1 -0
- package/dist/gameData.d.ts +96 -22
- package/dist/gameData.js +1690 -0
- package/dist/gameData.js.map +1 -0
- package/dist/gameFiles.d.ts +3 -3
- package/dist/gameFiles.js +14 -0
- package/dist/gameFiles.js.map +1 -0
- package/dist/gates.js +92 -0
- package/dist/gates.js.map +1 -0
- package/dist/generate.d.ts +28 -1
- package/dist/generate.js +1062 -0
- package/dist/generate.js.map +1 -0
- package/dist/generateWorker.d.ts +7 -3
- package/dist/generateWorker.js +86 -0
- package/dist/generateWorker.js.map +1 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +102 -0
- package/dist/grid.js.map +1 -0
- package/dist/ground.d.ts +17 -1
- package/dist/ground.js +375 -0
- package/dist/ground.js.map +1 -0
- package/dist/groundObjects.d.ts +70 -0
- package/dist/groundObjects.js +371 -0
- package/dist/groundObjects.js.map +1 -0
- package/dist/groundSpeed.d.ts +20 -3
- package/dist/groundSpeed.js +117 -0
- package/dist/groundSpeed.js.map +1 -0
- package/dist/hero.d.ts +126 -10
- package/dist/hero.js +432 -0
- package/dist/hero.js.map +1 -0
- package/dist/holds.d.ts +94 -0
- package/dist/holds.js +305 -0
- package/dist/holds.js.map +1 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +30 -0
- package/dist/home.js.map +1 -0
- package/dist/hooks.d.ts +339 -57
- package/dist/hooks.js +105 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hotReload.d.ts +6 -5
- package/dist/hotReload.js +145 -0
- package/dist/hotReload.js.map +1 -0
- package/dist/ids.d.ts +3 -3
- package/dist/ids.js +30 -0
- package/dist/ids.js.map +1 -0
- package/dist/idsFile.d.ts +36 -0
- package/dist/idsFile.js +134 -0
- package/dist/idsFile.js.map +1 -0
- package/dist/index.d.ts +105 -68
- package/dist/index.js +194 -4701
- package/dist/inspect.d.ts +29 -2
- package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
- package/dist/inspect.js.map +1 -0
- package/dist/inventory.d.ts +14 -1
- package/dist/inventory.js +84 -0
- package/dist/inventory.js.map +1 -0
- package/dist/items.d.ts +136 -8
- package/dist/items.js +585 -0
- package/dist/items.js.map +1 -0
- package/dist/lanes.d.ts +12 -3
- package/dist/lanes.js +496 -0
- package/dist/lanes.js.map +1 -0
- package/dist/life.d.ts +6 -2
- package/dist/life.js +287 -0
- package/dist/life.js.map +1 -0
- package/dist/log.d.ts +26 -3
- package/dist/log.js +192 -0
- package/dist/log.js.map +1 -0
- package/dist/manaBurn.d.ts +2 -2
- package/dist/manaBurn.js +75 -0
- package/dist/manaBurn.js.map +1 -0
- package/dist/map/file.d.ts +56 -3
- package/dist/map/file.js +264 -0
- package/dist/map/file.js.map +1 -0
- package/dist/map/images.js +61 -0
- package/dist/map/images.js.map +1 -0
- package/dist/map/look.d.ts +1 -1
- package/dist/map/look.js +30 -0
- package/dist/map/look.js.map +1 -0
- package/dist/map/pathProfile.js +183 -0
- package/dist/map/pathProfile.js.map +1 -0
- package/dist/map/resize.d.ts +4 -0
- package/dist/map/resize.js +136 -0
- package/dist/map/resize.js.map +1 -0
- package/dist/map/schema.js +257 -0
- package/dist/map/schema.js.map +1 -0
- package/dist/map/terrain.js +214 -0
- package/dist/map/terrain.js.map +1 -0
- package/dist/map/types.d.ts +92 -13
- package/dist/map/types.js +251 -0
- package/dist/map/types.js.map +1 -0
- package/dist/mapCheck/cells.js +94 -0
- package/dist/mapCheck/cells.js.map +1 -0
- package/dist/mapCheck/rules/foliage.d.ts +9 -0
- package/dist/mapCheck/rules/foliage.js +83 -0
- package/dist/mapCheck/rules/foliage.js.map +1 -0
- package/dist/mapCheck/rules/names.js +39 -0
- package/dist/mapCheck/rules/names.js.map +1 -0
- package/dist/mapCheck/rules/objects.d.ts +1 -1
- package/dist/mapCheck/rules/objects.js +56 -0
- package/dist/mapCheck/rules/objects.js.map +1 -0
- package/dist/mapCheck/rules/paths.js +32 -0
- package/dist/mapCheck/rules/paths.js.map +1 -0
- package/dist/mapCheck/rules/players.js +20 -0
- package/dist/mapCheck/rules/players.js.map +1 -0
- package/dist/mapCheck/rules/races.js +56 -0
- package/dist/mapCheck/rules/races.js.map +1 -0
- package/dist/mapCheck/rules/random.js +47 -0
- package/dist/mapCheck/rules/random.js.map +1 -0
- package/dist/mapCheck/rules/regions.js +30 -0
- package/dist/mapCheck/rules/regions.js.map +1 -0
- package/dist/mapCheck/rules/targets.js +31 -0
- package/dist/mapCheck/rules/targets.js.map +1 -0
- package/dist/mapCheck/rules/walking.js +45 -0
- package/dist/mapCheck/rules/walking.js.map +1 -0
- package/dist/mapCheck.d.ts +2 -2
- package/dist/mapCheck.js +63 -0
- package/dist/mapCheck.js.map +1 -0
- package/dist/mapFields.d.ts +25 -2
- package/dist/mapFields.js +134 -0
- package/dist/mapFields.js.map +1 -0
- package/dist/mapFile.js +176 -0
- package/dist/mapFile.js.map +1 -0
- package/dist/mapMeasure.d.ts +8 -0
- package/dist/mapMeasure.js +283 -0
- package/dist/mapMeasure.js.map +1 -0
- package/dist/mapMerge.d.ts +1 -0
- package/dist/mapMerge.js +172 -0
- package/dist/mapMerge.js.map +1 -0
- package/dist/mapObjectives.js +138 -0
- package/dist/mapObjectives.js.map +1 -0
- package/dist/mapObjects.js +80 -0
- package/dist/mapObjects.js.map +1 -0
- package/dist/math.d.ts +37 -7
- package/dist/math.js +155 -0
- package/dist/math.js.map +1 -0
- package/dist/messages.d.ts +71 -4
- package/dist/messages.js +29 -0
- package/dist/messages.js.map +1 -0
- package/dist/missionRules.d.ts +10 -2
- package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
- package/dist/missionRules.js.map +1 -0
- package/dist/mods.d.ts +39 -20
- package/dist/mods.js +271 -0
- package/dist/mods.js.map +1 -0
- package/dist/moves.d.ts +87 -0
- package/dist/moves.js +539 -0
- package/dist/moves.js.map +1 -0
- package/dist/names.d.ts +7 -0
- package/dist/names.js +122 -0
- package/dist/names.js.map +1 -0
- package/dist/navigation/agentParams.js +14 -0
- package/dist/navigation/agentParams.js.map +1 -0
- package/dist/navigation/air.d.ts +7 -3
- package/dist/navigation/air.js +401 -0
- package/dist/navigation/air.js.map +1 -0
- package/dist/navigation/builds.d.ts +34 -2
- package/dist/navigation/builds.js +287 -0
- package/dist/navigation/builds.js.map +1 -0
- package/dist/navigation/groundAreas.d.ts +59 -1
- package/dist/navigation/groundAreas.js +407 -0
- package/dist/navigation/groundAreas.js.map +1 -0
- package/dist/navigation/navigation.d.ts +98 -9
- package/dist/navigation/recast.d.ts +194 -18
- package/dist/navigation/recast.js +1379 -0
- package/dist/navigation/recast.js.map +1 -0
- package/dist/navigation/sidePaths.d.ts +8 -3
- package/dist/navigation/sidePaths.js +241 -0
- package/dist/navigation/sidePaths.js.map +1 -0
- package/dist/navigation/sized.js +243 -0
- package/dist/navigation/sized.js.map +1 -0
- package/dist/nearest.js +32 -0
- package/dist/nearest.js.map +1 -0
- package/dist/noise.js +59 -0
- package/dist/noise.js.map +1 -0
- package/dist/objectives.d.ts +12 -3
- package/dist/objectives.js +144 -0
- package/dist/objectives.js.map +1 -0
- package/dist/orders/basic.d.ts +5 -5
- package/dist/orders/basic.js +417 -0
- package/dist/orders/basic.js.map +1 -0
- package/dist/orders/build.js +278 -0
- package/dist/orders/build.js.map +1 -0
- package/dist/orders/cast.d.ts +13 -3
- package/dist/orders/cast.js +558 -0
- package/dist/orders/cast.js.map +1 -0
- package/dist/orders/facts.js +16 -0
- package/dist/orders/facts.js.map +1 -0
- package/dist/orders/harvest.d.ts +21 -5
- package/dist/orders/harvest.js +540 -0
- package/dist/orders/harvest.js.map +1 -0
- package/dist/orders/idle.d.ts +3 -1
- package/dist/orders/idle.js +234 -0
- package/dist/orders/idle.js.map +1 -0
- package/dist/orders/items.js +92 -0
- package/dist/orders/items.js.map +1 -0
- package/dist/orders/queue.js +108 -0
- package/dist/orders/queue.js.map +1 -0
- package/dist/orders/waiting.d.ts +39 -0
- package/dist/orders/waiting.js +149 -0
- package/dist/orders/waiting.js.map +1 -0
- package/dist/pack.schema.js +13 -0
- package/dist/pack.schema.js.map +1 -0
- package/dist/pack.schema.json +7622 -841
- package/dist/packs/director/index.d.ts +13 -5
- package/dist/packs/director/index.js +204 -0
- package/dist/packs/director/index.js.map +1 -0
- package/dist/packs/heroes/campaign.d.ts +3 -2
- package/dist/packs/heroes/campaign.js +241 -0
- package/dist/packs/heroes/campaign.js.map +1 -0
- package/dist/packs/heroes/carry.d.ts +6 -0
- package/dist/packs/heroes/carry.js +112 -0
- package/dist/packs/heroes/carry.js.map +1 -0
- package/dist/packs/heroes/commands.js +115 -0
- package/dist/packs/heroes/commands.js.map +1 -0
- package/dist/packs/heroes/fallen.d.ts +43 -0
- package/dist/packs/heroes/fallen.js +61 -0
- package/dist/packs/heroes/fallen.js.map +1 -0
- package/dist/packs/heroes/hire.js +60 -0
- package/dist/packs/heroes/hire.js.map +1 -0
- package/dist/packs/heroes/index.d.ts +7 -6
- package/dist/packs/heroes/index.js +130 -0
- package/dist/packs/heroes/index.js.map +1 -0
- package/dist/packs/heroes/loop.d.ts +95 -0
- package/dist/packs/heroes/loop.js +250 -0
- package/dist/packs/heroes/loop.js.map +1 -0
- package/dist/packs/heroes/making.d.ts +6 -3
- package/dist/packs/heroes/making.js +55 -0
- package/dist/packs/heroes/making.js.map +1 -0
- package/dist/packs/heroes/respawn.d.ts +3 -3
- package/dist/packs/heroes/respawn.js +87 -0
- package/dist/packs/heroes/respawn.js.map +1 -0
- package/dist/packs/heroes/sets.d.ts +32 -0
- package/dist/packs/heroes/sets.js +51 -0
- package/dist/packs/heroes/sets.js.map +1 -0
- package/dist/packs/heroes/spells.d.ts +16 -0
- package/dist/packs/heroes/spells.js +269 -0
- package/dist/packs/heroes/spells.js.map +1 -0
- package/dist/packs/items/defaults.d.ts +43 -0
- package/dist/packs/items/defaults.js +1504 -0
- package/dist/packs/items/defaults.js.map +1 -0
- package/dist/packs/items/index.d.ts +27 -0
- package/dist/packs/items/index.js +214 -0
- package/dist/packs/items/index.js.map +1 -0
- package/dist/packs/moba/index.d.ts +3 -3
- package/dist/packs/moba/index.js +174 -0
- package/dist/packs/moba/index.js.map +1 -0
- package/dist/packs/pack.d.ts +15 -15
- package/dist/packs/pack.js +14 -0
- package/dist/packs/pack.js.map +1 -0
- package/dist/packs.d.ts +15 -7
- package/dist/packs.js +222 -0
- package/dist/packs.js.map +1 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +109 -0
- package/dist/paths.js.map +1 -0
- package/dist/plain.js +57 -0
- package/dist/plain.js.map +1 -0
- package/dist/player.d.ts +33 -10
- package/dist/player.js +159 -0
- package/dist/player.js.map +1 -0
- package/dist/portals.d.ts +1 -1
- package/dist/portals.js +194 -0
- package/dist/portals.js.map +1 -0
- package/dist/prefabs.d.ts +25 -2
- package/dist/prefabs.js +239 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/presetBuildings.js +58 -0
- package/dist/presetBuildings.js.map +1 -0
- package/dist/presetFoliage.d.ts +27 -0
- package/dist/presetFoliage.js +98 -0
- package/dist/presetFoliage.js.map +1 -0
- package/dist/presetGround.js +65 -0
- package/dist/presetGround.js.map +1 -0
- package/dist/proxies.d.ts +12 -0
- package/dist/proxies.js +79 -0
- package/dist/proxies.js.map +1 -0
- package/dist/query.d.ts +56 -0
- package/dist/query.js +88 -0
- package/dist/query.js.map +1 -0
- package/dist/races.d.ts +15 -14
- package/dist/races.js +172 -0
- package/dist/races.js.map +1 -0
- package/dist/randomGroups.js +91 -0
- package/dist/randomGroups.js.map +1 -0
- package/dist/registry.d.ts +117 -53
- package/dist/registry.js +323 -0
- package/dist/registry.js.map +1 -0
- package/dist/remains.d.ts +11 -9
- package/dist/remains.js +188 -0
- package/dist/remains.js.map +1 -0
- package/dist/replication.d.ts +12 -7
- package/dist/replication.js +100 -0
- package/dist/replication.js.map +1 -0
- package/dist/rng.d.ts +2 -0
- package/dist/rng.js +40 -0
- package/dist/rng.js.map +1 -0
- package/dist/rules.d.ts +186 -99
- package/dist/rules.js +179 -0
- package/dist/rules.js.map +1 -0
- package/dist/rulesCheck.d.ts +5 -4
- package/dist/rulesCheck.js +693 -0
- package/dist/rulesCheck.js.map +1 -0
- package/dist/runes.d.ts +2 -2
- package/dist/runes.js +80 -0
- package/dist/runes.js.map +1 -0
- package/dist/save.d.ts +37 -12
- package/dist/save.js +532 -0
- package/dist/save.js.map +1 -0
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +99 -0
- package/dist/scenario.js.map +1 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/scheduler.js +156 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/score.d.ts +19 -19
- package/dist/score.js +709 -0
- package/dist/score.js.map +1 -0
- package/dist/sequences.d.ts +10 -6
- package/dist/sequences.js +206 -0
- package/dist/sequences.js.map +1 -0
- package/dist/server/doorman.js +154 -0
- package/dist/server/doorman.js.map +1 -0
- package/dist/server/gameServer.d.ts +16 -1
- package/dist/server/gameServer.js +643 -0
- package/dist/server/gameServer.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/lobby.js +199 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/log.js +18 -0
- package/dist/server/log.js.map +1 -0
- package/dist/server/match.js +267 -0
- package/dist/server/match.js.map +1 -0
- package/dist/server/mode.d.ts +18 -9
- package/dist/server/mode.js +220 -0
- package/dist/server/mode.js.map +1 -0
- package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
- package/dist/server/navigation-worker.js.map +1 -0
- package/dist/server/navigation.js +39 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/ops.d.ts +4 -0
- package/dist/server/ops.js +137 -0
- package/dist/server/ops.js.map +1 -0
- package/dist/server/packs.d.ts +3 -3
- package/dist/server/packs.js +32 -0
- package/dist/server/packs.js.map +1 -0
- package/dist/server/ratings.d.ts +5 -0
- package/dist/server/ratings.js +104 -0
- package/dist/server/ratings.js.map +1 -0
- package/dist/server/relay.d.ts +12 -2
- package/dist/server/relay.js +144 -0
- package/dist/server/relay.js.map +1 -0
- package/dist/server/rooms.d.ts +9 -2
- package/dist/server/rooms.js +442 -0
- package/dist/server/rooms.js.map +1 -0
- package/dist/server/seat.js +116 -0
- package/dist/server/seat.js.map +1 -0
- package/dist/server/seatSettings.d.ts +3 -3
- package/dist/server/seatSettings.js +63 -0
- package/dist/server/seatSettings.js.map +1 -0
- package/dist/server/secret.js +13 -0
- package/dist/server/secret.js.map +1 -0
- package/dist/server/start.d.ts +13 -6
- package/dist/server/start.js +76 -0
- package/dist/server/start.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -1
- package/dist/server/websocket.js +306 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server.js +15 -2861
- package/dist/session/can.js +26 -0
- package/dist/session/can.js.map +1 -0
- package/dist/session/commandReplay.d.ts +8 -2
- package/dist/session/commandReplay.js +293 -0
- package/dist/session/commandReplay.js.map +1 -0
- package/dist/session/debug.js +151 -0
- package/dist/session/debug.js.map +1 -0
- package/dist/session/delay.js +62 -0
- package/dist/session/delay.js.map +1 -0
- package/dist/session/delta.d.ts +14 -1
- package/dist/session/delta.js +407 -0
- package/dist/session/delta.js.map +1 -0
- package/dist/session/entityState.js +415 -0
- package/dist/session/entityState.js.map +1 -0
- package/dist/session/local.d.ts +47 -5
- package/dist/session/local.js +670 -0
- package/dist/session/local.js.map +1 -0
- package/dist/session/memory.d.ts +20 -2
- package/dist/session/memory.js +131 -0
- package/dist/session/memory.js.map +1 -0
- package/dist/session/protocol.d.ts +325 -31
- package/dist/session/protocol.js +55 -0
- package/dist/session/protocol.js.map +1 -0
- package/dist/session/remote.d.ts +74 -12
- package/dist/session/remote.js +1394 -0
- package/dist/session/remote.js.map +1 -0
- package/dist/session/replay.d.ts +11 -2
- package/dist/session/replay.js +160 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/seed.js +12 -0
- package/dist/session/seed.js.map +1 -0
- package/dist/session/share.d.ts +5 -1
- package/dist/session/share.js +94 -0
- package/dist/session/share.js.map +1 -0
- package/dist/session/socket.d.ts +1 -1
- package/dist/session/socket.js +29 -0
- package/dist/session/socket.js.map +1 -0
- package/dist/session/wire.d.ts +5 -0
- package/dist/session/wire.js +84 -0
- package/dist/session/wire.js.map +1 -0
- package/dist/session/worker.d.ts +77 -12
- package/dist/session/worker.js +499 -0
- package/dist/session/worker.js.map +1 -0
- package/dist/shared.d.ts +31 -5
- package/dist/shared.js +166 -0
- package/dist/shared.js.map +1 -0
- package/dist/sides.d.ts +9 -3
- package/dist/sides.js +149 -0
- package/dist/sides.js.map +1 -0
- package/dist/sight.js +85 -0
- package/dist/sight.js.map +1 -0
- package/dist/simulate-worker.js +1 -1
- package/dist/simulate.d.ts +12 -8
- package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
- package/dist/simulate.js.map +1 -0
- package/dist/smart.js +77 -0
- package/dist/smart.js.map +1 -0
- package/dist/spatial.d.ts +32 -16
- package/dist/spatial.js +234 -0
- package/dist/spatial.js.map +1 -0
- package/dist/spawning.d.ts +1 -0
- package/dist/spawning.js +224 -0
- package/dist/spawning.js.map +1 -0
- package/dist/stances.d.ts +6 -3
- package/dist/stances.js +169 -0
- package/dist/stances.js.map +1 -0
- package/dist/start.d.ts +10 -10
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/stats.d.ts +42 -16
- package/dist/stats.js +290 -0
- package/dist/stats.js.map +1 -0
- package/dist/summoned.d.ts +52 -0
- package/dist/summoned.js +38 -0
- package/dist/summoned.js.map +1 -0
- package/dist/summons.d.ts +10 -13
- package/dist/summons.js +271 -0
- package/dist/summons.js.map +1 -0
- package/dist/systems/abilities.js +224 -0
- package/dist/systems/abilities.js.map +1 -0
- package/dist/systems/combat.d.ts +35 -1
- package/dist/systems/combat.js +677 -0
- package/dist/systems/combat.js.map +1 -0
- package/dist/systems/combatTold.d.ts +3 -1
- package/dist/systems/combatTold.js +85 -0
- package/dist/systems/combatTold.js.map +1 -0
- package/dist/systems/construction.js +80 -0
- package/dist/systems/construction.js.map +1 -0
- package/dist/systems/economy.d.ts +0 -6
- package/dist/systems/economy.js +128 -0
- package/dist/systems/economy.js.map +1 -0
- package/dist/systems/fog.d.ts +1 -1
- package/dist/systems/fog.js +120 -0
- package/dist/systems/fog.js.map +1 -0
- package/dist/systems/life.js +32 -0
- package/dist/systems/life.js.map +1 -0
- package/dist/systems/movement.d.ts +24 -12
- package/dist/systems/movement.js +1247 -0
- package/dist/systems/movement.js.map +1 -0
- package/dist/systems/orders.js +64 -0
- package/dist/systems/orders.js.map +1 -0
- package/dist/systems/production.js +322 -0
- package/dist/systems/production.js.map +1 -0
- package/dist/systems/productionQueue.js +120 -0
- package/dist/systems/productionQueue.js.map +1 -0
- package/dist/systems/victory.d.ts +1 -1
- package/dist/systems/victory.js +56 -0
- package/dist/systems/victory.js.map +1 -0
- package/dist/talk.d.ts +6 -6
- package/dist/talk.js +153 -0
- package/dist/talk.js.map +1 -0
- package/dist/targeting.d.ts +142 -0
- package/dist/targeting.js +49 -0
- package/dist/targeting.js.map +1 -0
- package/dist/tech.d.ts +20 -3
- package/dist/tech.js +239 -0
- package/dist/tech.js.map +1 -0
- package/dist/techTree.d.ts +7 -0
- package/dist/techTree.js +90 -0
- package/dist/techTree.js.map +1 -0
- package/dist/terrain.d.ts +59 -7
- package/dist/terrain.js +389 -0
- package/dist/terrain.js.map +1 -0
- package/dist/terrainSave.d.ts +6 -0
- package/dist/terrainSave.js +74 -0
- package/dist/terrainSave.js.map +1 -0
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +13 -739
- package/dist/testing.js.map +1 -1
- package/dist/tiles.d.ts +1 -1
- package/dist/tiles.js +43 -0
- package/dist/tiles.js.map +1 -0
- package/dist/timers.d.ts +29 -4
- package/dist/timers.js +242 -0
- package/dist/timers.js.map +1 -0
- package/dist/tomes.d.ts +4 -4
- package/dist/tomes.js +94 -0
- package/dist/tomes.js.map +1 -0
- package/dist/trade.js +103 -0
- package/dist/trade.js.map +1 -0
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +281 -0
- package/dist/transport.js.map +1 -0
- package/dist/tunables.d.ts +10 -3
- package/dist/tunables.js +56 -0
- package/dist/tunables.js.map +1 -0
- package/dist/unitResources.d.ts +67 -0
- package/dist/unitResources.js +266 -0
- package/dist/unitResources.js.map +1 -0
- package/dist/upkeep.d.ts +6 -1
- package/dist/upkeep.js +26 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/veterancy.d.ts +8 -3
- package/dist/veterancy.js +131 -0
- package/dist/veterancy.js.map +1 -0
- package/dist/vision.d.ts +36 -0
- package/dist/vision.js +133 -0
- package/dist/vision.js.map +1 -0
- package/dist/walls.d.ts +1 -1
- package/dist/walls.js +278 -0
- package/dist/walls.js.map +1 -0
- package/dist/world.d.ts +606 -88
- package/dist/world.js +1263 -0
- package/dist/world.js.map +1 -0
- package/package.json +2 -2
- package/dist/ai.js.map +0 -1
- package/dist/attributes.d.ts +0 -66
- package/dist/brain-BvVdUhX8.js +0 -7659
- package/dist/brain-BvVdUhX8.js.map +0 -1
- package/dist/builds-C6LfgvEU.js +0 -460
- package/dist/builds-C6LfgvEU.js.map +0 -1
- package/dist/coreComponents-syuh2fPG.js +0 -5149
- package/dist/coreComponents-syuh2fPG.js.map +0 -1
- package/dist/debugCommands-CzjrSm66.js +0 -14739
- package/dist/debugCommands-CzjrSm66.js.map +0 -1
- package/dist/determinism-BCymQwiE.js +0 -518
- package/dist/determinism-BCymQwiE.js.map +0 -1
- package/dist/game-DiJEN-Ks.js +0 -5800
- package/dist/game-DiJEN-Ks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inspect-D9dWHmZ0.js.map +0 -1
- package/dist/local-Dkovq42k.js +0 -1379
- package/dist/local-Dkovq42k.js.map +0 -1
- package/dist/missionRules-C-bGxm0Q.js.map +0 -1
- package/dist/navigation-worker.js.map +0 -1
- package/dist/packs-g5thvmGn.js +0 -3199
- package/dist/packs-g5thvmGn.js.map +0 -1
- package/dist/profiles-B3NS9jwk.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/simulate-oXBiw1Ff.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { slotsOf } from "../../inventory.js";
|
|
2
|
+
import { refreshVitals } from "../../stats.js";
|
|
3
|
+
import { inventoryChanged } from "../../engineEvents.js";
|
|
4
|
+
import { readyAgain } from "../../abilities/charges.js";
|
|
5
|
+
import { heroOf, maxLevelOf } from "../../hero.js";
|
|
6
|
+
import { createItem } from "../../items.js";
|
|
7
|
+
//#region src/packs/heroes/carry.ts
|
|
8
|
+
/**
|
|
9
|
+
* A hero of a world as a record, to carry into another (see `applyHeroRecord`). Throws for what is no hero
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
function heroRecord(world, hero) {
|
|
14
|
+
const state = heroOf(hero);
|
|
15
|
+
if (!state) throw new Error(`${hero.def.id} is no hero to carry over`);
|
|
16
|
+
const name = world.nameOf(hero);
|
|
17
|
+
return {
|
|
18
|
+
type: hero.def.id,
|
|
19
|
+
...name !== void 0 && { name },
|
|
20
|
+
level: state.level,
|
|
21
|
+
xp: state.xp,
|
|
22
|
+
points: state.points,
|
|
23
|
+
abilities: Object.fromEntries(hero.abilities.filter((ability) => ability.level > 0).map((ability) => [ability.id, ability.level])),
|
|
24
|
+
items: (slotsOf(hero) ?? []).map((slot) => slot ? {
|
|
25
|
+
item: slot.item,
|
|
26
|
+
charges: slot.charges,
|
|
27
|
+
...slot.data && { data: structuredClone(slot.data) }
|
|
28
|
+
} : null)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Makes a hero of a world what a record says it was: its level, experience and points, its abilities as far as they
|
|
33
|
+
* were learned, and its items in their slots. In place of what it had. What the game no longer has, an ability or an
|
|
34
|
+
* item, is left out. Whole: health and mana full, nothing cooling down
|
|
35
|
+
*
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
function applyHeroRecord(world, hero, record) {
|
|
39
|
+
const state = heroOf(hero);
|
|
40
|
+
if (!state) throw new Error(`${hero.def.id} is no hero to carry a hero into`);
|
|
41
|
+
state.level = Math.max(1, Math.min(Math.floor(record.level), maxLevelOf(world, hero)));
|
|
42
|
+
state.xp = Math.max(record.xp, world.settings.heroes.xpForLevel(state.level));
|
|
43
|
+
state.points = Math.max(Math.floor(record.points), 0);
|
|
44
|
+
for (const ability of hero.abilities) {
|
|
45
|
+
const level = record.abilities[ability.id] ?? 0;
|
|
46
|
+
const max = world.registry.abilities.has(ability.id) ? world.registry.ability(ability.id).maxLevel ?? 3 : 0;
|
|
47
|
+
ability.level = Math.min(level, max);
|
|
48
|
+
readyAgain(ability);
|
|
49
|
+
ability.autocast = ability.level > 0 && (world.registry.ability(ability.id).autocast ?? false);
|
|
50
|
+
}
|
|
51
|
+
const slots = slotsOf(hero);
|
|
52
|
+
if (slots) {
|
|
53
|
+
slots.fill(null);
|
|
54
|
+
record.items.forEach((carried, slot) => {
|
|
55
|
+
if (!carried || slot >= slots.length || !world.registry.items.has(carried.item)) return;
|
|
56
|
+
const instance = createItem(world, carried.item, carried.charges);
|
|
57
|
+
if (carried.data) instance.data = structuredClone(carried.data);
|
|
58
|
+
slots[slot] = instance;
|
|
59
|
+
});
|
|
60
|
+
world.events.emit(inventoryChanged, { entity: hero });
|
|
61
|
+
}
|
|
62
|
+
refreshVitals(world, hero);
|
|
63
|
+
hero.health = hero.maxHealth;
|
|
64
|
+
hero.mana = hero.maxMana;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A hero made from a record (see `heroRecord`) for a player at a point, under the name it had unless told another
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
function heroFromRecord(world, record, owner, at, options = {}) {
|
|
72
|
+
const name = options.name ?? record.name;
|
|
73
|
+
const hero = world.spawn(record.type, owner, at, {
|
|
74
|
+
...options,
|
|
75
|
+
...name !== void 0 && { name }
|
|
76
|
+
});
|
|
77
|
+
applyHeroRecord(world, hero, record);
|
|
78
|
+
return hero;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A record read back from what was kept (a campaign's progress, a file), checked. Throws on what is wrong
|
|
82
|
+
*
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
function readHeroRecord(data) {
|
|
86
|
+
const record = data;
|
|
87
|
+
if (typeof record !== "object" || record === null) throw new Error("A hero record is an object");
|
|
88
|
+
if (typeof record.type !== "string" || !record.type) throw new Error("A hero record says what type of unit it is");
|
|
89
|
+
const number = (value, what) => {
|
|
90
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`A hero record's ${what} is a number`);
|
|
91
|
+
return value;
|
|
92
|
+
};
|
|
93
|
+
const abilities = record.abilities ?? {};
|
|
94
|
+
if (typeof abilities !== "object" || Array.isArray(abilities)) throw new Error("A hero record's abilities are levels by id");
|
|
95
|
+
return {
|
|
96
|
+
type: record.type,
|
|
97
|
+
...typeof record.name === "string" && { name: record.name },
|
|
98
|
+
level: number(record.level, "level"),
|
|
99
|
+
xp: number(record.xp ?? 0, "experience"),
|
|
100
|
+
points: number(record.points ?? 0, "points"),
|
|
101
|
+
abilities: Object.fromEntries(Object.entries(abilities).map(([id, level]) => [id, number(level, `level of ${id}`)])),
|
|
102
|
+
items: (Array.isArray(record.items) ? record.items : []).map((slot) => slot && typeof slot === "object" && typeof slot.item === "string" ? {
|
|
103
|
+
item: slot.item,
|
|
104
|
+
charges: number(slot.charges ?? 0, "charges"),
|
|
105
|
+
...slot.data && { data: slot.data }
|
|
106
|
+
} : null)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { applyHeroRecord, heroFromRecord, heroRecord, readHeroRecord };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=carry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carry.js","names":[],"sources":["../../../src/packs/heroes/carry.ts"],"sourcesContent":["import { inventoryChanged } from '#engine/engineEvents'\nimport type { Entity, PlayerId } from '#engine/entity'\nimport { createItem } from '#engine/items'\nimport { slotsOf } from '#engine/inventory'\nimport { heroOf, maxLevelOf } from '#engine/hero'\nimport { refreshVitals } from '#engine/stats'\nimport { readyAgain } from '#engine/abilities/charges'\nimport type { Vec2 } from '#engine/math'\nimport type { SpawnOptions, World } from '#engine/world'\n\n/**\n * An item a hero carries, as it is carried over: what it is, its uses left, the game's own state of it\n *\n * @beta\n */\nexport interface HeroItem {\n\t/** The id of the item type carried */\n\titem: string\n\t/** Uses left of the item */\n\tcharges: number\n\t/** The game's own state of the item, carried over as plain data */\n\tdata?: Record<string, unknown>\n}\n\n/**\n * A hero as plain data, to take from one world into another: a campaign's hero going on to the next mission with all\n * it has earned. Its level and experience, the points it has not spent, the abilities it learned and how far, and its\n * items slot by slot. Not where it is or how hurt: the next mission puts it where it starts, whole\n *\n * @beta\n */\nexport interface HeroRecord {\n\t/** Its unit type */\n\ttype: string\n\t/** The name it was known by in the rules (`world.named`), when it had one */\n\tname?: string\n\t/** The hero's level */\n\tlevel: number\n\t/** The hero's experience points */\n\txp: number\n\t/** Skill points the hero has earned and not yet spent */\n\tpoints: number\n\t/** Learned abilities and their level. Ones not learned are left out */\n\tabilities: Record<string, number>\n\t/** Its inventory slot by slot: null for an empty slot */\n\titems: (HeroItem | null)[]\n}\n\n/**\n * A hero of a world as a record, to carry into another (see `applyHeroRecord`). Throws for what is no hero\n *\n * @beta\n */\nexport function heroRecord(world: World, hero: Entity): HeroRecord {\n\tconst state = heroOf(hero)\n\tif (!state) throw new Error(`${hero.def.id} is no hero to carry over`)\n\tconst name = world.nameOf(hero)\n\treturn {\n\t\ttype: hero.def.id,\n\t\t...(name !== undefined && { name }),\n\t\tlevel: state.level,\n\t\txp: state.xp,\n\t\tpoints: state.points,\n\t\tabilities: Object.fromEntries(hero.abilities.filter((ability) => ability.level > 0).map((ability) => [ability.id, ability.level])),\n\t\titems: (slotsOf(hero) ?? []).map((slot) =>\n\t\t\tslot ? { item: slot.item, charges: slot.charges, ...(slot.data && { data: structuredClone(slot.data) }) } : null\n\t\t)\n\t}\n}\n\n/**\n * Makes a hero of a world what a record says it was: its level, experience and points, its abilities as far as they\n * were learned, and its items in their slots. In place of what it had. What the game no longer has, an ability or an\n * item, is left out. Whole: health and mana full, nothing cooling down\n *\n * @beta\n */\nexport function applyHeroRecord(world: World, hero: Entity, record: HeroRecord): void {\n\tconst state = heroOf(hero)\n\tif (!state) throw new Error(`${hero.def.id} is no hero to carry a hero into`)\n\tstate.level = Math.max(1, Math.min(Math.floor(record.level), maxLevelOf(world, hero)))\n\tstate.xp = Math.max(record.xp, world.settings.heroes.xpForLevel(state.level))\n\tstate.points = Math.max(Math.floor(record.points), 0)\n\tfor (const ability of hero.abilities) {\n\t\tconst level = record.abilities[ability.id] ?? 0\n\t\tconst max = world.registry.abilities.has(ability.id) ? (world.registry.ability(ability.id).maxLevel ?? 3) : 0\n\t\tability.level = Math.min(level, max)\n\t\treadyAgain(ability)\n\t\tability.autocast = ability.level > 0 && (world.registry.ability(ability.id).autocast ?? false)\n\t}\n\tconst slots = slotsOf(hero)\n\tif (slots) {\n\t\tslots.fill(null)\n\t\trecord.items.forEach((carried, slot) => {\n\t\t\tif (!carried || slot >= slots.length || !world.registry.items.has(carried.item)) return\n\t\t\tconst instance = createItem(world, carried.item, carried.charges)\n\t\t\tif (carried.data) instance.data = structuredClone(carried.data)\n\t\t\tslots[slot] = instance\n\t\t})\n\t\tworld.events.emit(inventoryChanged, { entity: hero })\n\t}\n\trefreshVitals(world, hero)\n\thero.health = hero.maxHealth\n\thero.mana = hero.maxMana\n}\n\n/**\n * A hero made from a record (see `heroRecord`) for a player at a point, under the name it had unless told another\n *\n * @beta\n */\nexport function heroFromRecord(world: World, record: HeroRecord, owner: PlayerId, at: Vec2, options: SpawnOptions = {}): Entity {\n\tconst name = options.name ?? record.name\n\tconst hero = world.spawn(record.type, owner, at, { ...options, ...(name !== undefined && { name }) })\n\tapplyHeroRecord(world, hero, record)\n\treturn hero\n}\n\n/**\n * A record read back from what was kept (a campaign's progress, a file), checked. Throws on what is wrong\n *\n * @beta\n */\nexport function readHeroRecord(data: unknown): HeroRecord {\n\tconst record = data as Partial<HeroRecord> | null\n\tif (typeof record !== 'object' || record === null) throw new Error('A hero record is an object')\n\tif (typeof record.type !== 'string' || !record.type) throw new Error('A hero record says what type of unit it is')\n\tconst number = (value: unknown, what: string) => {\n\t\tif (typeof value !== 'number' || !Number.isFinite(value)) throw new Error(`A hero record's ${what} is a number`)\n\t\treturn value\n\t}\n\tconst abilities = record.abilities ?? {}\n\tif (typeof abilities !== 'object' || Array.isArray(abilities)) throw new Error(\"A hero record's abilities are levels by id\")\n\treturn {\n\t\ttype: record.type,\n\t\t...(typeof record.name === 'string' && { name: record.name }),\n\t\tlevel: number(record.level, 'level'),\n\t\txp: number(record.xp ?? 0, 'experience'),\n\t\tpoints: number(record.points ?? 0, 'points'),\n\t\tabilities: Object.fromEntries(Object.entries(abilities).map(([id, level]) => [id, number(level, `level of ${id}`)])),\n\t\titems: (Array.isArray(record.items) ? record.items : []).map((slot) =>\n\t\t\tslot && typeof slot === 'object' && typeof (slot as HeroItem).item === 'string'\n\t\t\t\t? {\n\t\t\t\t\t\titem: (slot as HeroItem).item,\n\t\t\t\t\t\tcharges: number((slot as HeroItem).charges ?? 0, 'charges'),\n\t\t\t\t\t\t...((slot as HeroItem).data && { data: (slot as HeroItem).data })\n\t\t\t\t\t}\n\t\t\t\t: null\n\t\t)\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { learn } from "../../hero.js";
|
|
2
|
+
import { id, index, optional, string } from "../../fields.js";
|
|
3
|
+
import { buy, sell, undoBuy } from "../../items.js";
|
|
4
|
+
import { enqueueRevive } from "../../systems/production.js";
|
|
5
|
+
import { defineCommand, known, leastBusy, owned, producers } from "../../commands.js";
|
|
6
|
+
import { hire } from "./hire.js";
|
|
7
|
+
import { buyBack } from "./loop.js";
|
|
8
|
+
//#region src/packs/heroes/commands.ts
|
|
9
|
+
/**
|
|
10
|
+
* The heroes pack's commands: buying and selling at a shop, taking a purchase back, hiring, putting a point into an ability, bringing a hero
|
|
11
|
+
* back at an altar. Taken by a world whose game has the pack on (`heroesPack`); a game without it refuses them as it
|
|
12
|
+
* does any command it does not know. Their type is among `Command`s, as the pack adds it (`Commands`)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Buys from a shop, for the hero that is named, or else the one of the player that stands closest to it
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
var buyCommand = defineCommand("buy", {
|
|
20
|
+
shop: id,
|
|
21
|
+
item: string,
|
|
22
|
+
hero: optional(id)
|
|
23
|
+
}, (world, player, command) => {
|
|
24
|
+
const shop = known(world, player, command.shop);
|
|
25
|
+
const [buyer] = command.hero === void 0 ? [] : owned(world, player, [command.hero]);
|
|
26
|
+
if (shop && !world.areEnemies(shop.owner, player)) buy(world, shop, command.item, player, buyer);
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Hires a unit at a place that hires, a tavern or a dock: someone of the player's has to be there
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
var hireCommand = defineCommand("hire", {
|
|
34
|
+
shop: id,
|
|
35
|
+
unit: string
|
|
36
|
+
}, (world, player, command) => {
|
|
37
|
+
const shop = known(world, player, command.shop);
|
|
38
|
+
if (shop) hire(world, shop, command.unit, player);
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Gives something a hero carries back at a shop nearby, for a part of its price
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
var sellCommand = defineCommand("sell", {
|
|
46
|
+
entity: id,
|
|
47
|
+
item: index
|
|
48
|
+
}, (world, player, command) => {
|
|
49
|
+
const [seller] = owned(world, player, [command.entity]);
|
|
50
|
+
if (seller) sell(world, seller, command.item);
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Takes a purchase of a hero's back (`undoBuy`, `ShopSettings.undo`): the latest it may still undo, or the one named
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
var undoBuyCommand = defineCommand("undoBuy", {
|
|
58
|
+
hero: id,
|
|
59
|
+
purchase: optional(id)
|
|
60
|
+
}, (world, player, command) => {
|
|
61
|
+
const [hero] = owned(world, player, [command.hero]);
|
|
62
|
+
if (hero) undoBuy(world, hero, command.purchase);
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Puts a point a hero has to spend into an ability
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
var learnCommand = defineCommand("learn", {
|
|
70
|
+
entity: id,
|
|
71
|
+
ability: string
|
|
72
|
+
}, (world, player, command) => {
|
|
73
|
+
const [hero] = owned(world, player, [command.entity]);
|
|
74
|
+
if (hero) learn(world, hero, command.ability);
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* The `revive` command: queues the revival of a dead hero at the player's least busy building that revives
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
var reviveCommand = defineCommand("revive", {
|
|
82
|
+
...producers,
|
|
83
|
+
hero: id
|
|
84
|
+
}, (world, player, command) => {
|
|
85
|
+
const building = leastBusy(world, player, command, (entity) => !!entity.def.revives);
|
|
86
|
+
if (building) enqueueRevive(world, building, command.hero);
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* The `buyback` command: a fallen hero of the player's back at once, for its price (`buyBack`)
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
var buybackCommand = defineCommand("buyback", { hero: id }, (world, player, command) => {
|
|
94
|
+
const hero = world.entities.get(command.hero);
|
|
95
|
+
if (hero && hero.owner === player) buyBack(world, hero);
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* The commands of the heroes pack (`heroesPack`): buying, hiring, selling, learning, bringing a hero back at an altar
|
|
99
|
+
* or buying it back. A game without the pack refuses them as it does any command it does not know
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
var heroCommands = [
|
|
104
|
+
buyCommand,
|
|
105
|
+
hireCommand,
|
|
106
|
+
sellCommand,
|
|
107
|
+
undoBuyCommand,
|
|
108
|
+
learnCommand,
|
|
109
|
+
reviveCommand,
|
|
110
|
+
buybackCommand
|
|
111
|
+
];
|
|
112
|
+
//#endregion
|
|
113
|
+
export { buyCommand, buybackCommand, heroCommands, hireCommand, learnCommand, reviveCommand, sellCommand, undoBuyCommand };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","names":[],"sources":["../../../src/packs/heroes/commands.ts"],"sourcesContent":["/**\n * The heroes pack's commands: buying and selling at a shop, taking a purchase back, hiring, putting a point into an ability, bringing a hero\n * back at an altar. Taken by a world whose game has the pack on (`heroesPack`); a game without it refuses them as it\n * does any command it does not know. Their type is among `Command`s, as the pack adds it (`Commands`)\n */\nimport { defineCommand, known, leastBusy, owned, producers } from '#engine/commands'\nimport { id, index, optional, string } from '#engine/fields'\nimport { learn } from '#engine/hero'\nimport { buy, sell, undoBuy } from '#engine/items'\nimport { enqueueRevive } from '#engine/systems/production'\nimport { hire } from './hire'\nimport { buyBack } from './loop'\n\n/**\n * Buys from a shop, for the hero that is named, or else the one of the player that stands closest to it\n *\n * @internal\n */\nexport const buyCommand = defineCommand('buy', { shop: id, item: string, hero: optional(id) }, (world, player, command) => {\n\t// shops sell to whoever comes by, not only to their owner\n\tconst shop = known(world, player, command.shop)\n\tconst [buyer] = command.hero === undefined ? [] : owned(world, player, [command.hero])\n\tif (shop && !world.areEnemies(shop.owner, player)) buy(world, shop, command.item, player, buyer)\n})\n\n/**\n * Hires a unit at a place that hires, a tavern or a dock: someone of the player's has to be there\n *\n * @internal\n */\nexport const hireCommand = defineCommand('hire', { shop: id, unit: string }, (world, player, command) => {\n\tconst shop = known(world, player, command.shop)\n\tif (shop) hire(world, shop, command.unit, player)\n})\n\n/**\n * Gives something a hero carries back at a shop nearby, for a part of its price\n *\n * @internal\n */\nexport const sellCommand = defineCommand('sell', { entity: id, item: index }, (world, player, command) => {\n\tconst [seller] = owned(world, player, [command.entity])\n\tif (seller) sell(world, seller, command.item)\n})\n\n/**\n * Takes a purchase of a hero's back (`undoBuy`, `ShopSettings.undo`): the latest it may still undo, or the one named\n *\n * @internal\n */\nexport const undoBuyCommand = defineCommand('undoBuy', { hero: id, purchase: optional(id) }, (world, player, command) => {\n\tconst [hero] = owned(world, player, [command.hero])\n\tif (hero) undoBuy(world, hero, command.purchase)\n})\n\n/**\n * Puts a point a hero has to spend into an ability\n *\n * @internal\n */\nexport const learnCommand = defineCommand('learn', { entity: id, ability: string }, (world, player, command) => {\n\tconst [hero] = owned(world, player, [command.entity])\n\tif (hero) learn(world, hero, command.ability)\n})\n\n/**\n * The `revive` command: queues the revival of a dead hero at the player's least busy building that revives\n *\n * @internal\n */\nexport const reviveCommand = defineCommand('revive', { ...producers, hero: id }, (world, player, command) => {\n\tconst building = leastBusy(world, player, command, (entity) => !!entity.def.revives)\n\tif (building) enqueueRevive(world, building, command.hero)\n})\n\n/**\n * The `buyback` command: a fallen hero of the player's back at once, for its price (`buyBack`)\n *\n * @internal\n */\nexport const buybackCommand = defineCommand('buyback', { hero: id }, (world, player, command) => {\n\tconst hero = world.entities.get(command.hero)\n\tif (hero && hero.owner === player) buyBack(world, hero)\n})\n\n/**\n * The commands of the heroes pack (`heroesPack`): buying, hiring, selling, learning, bringing a hero back at an altar\n * or buying it back. A game without the pack refuses them as it does any command it does not know\n *\n * @internal\n */\nexport const heroCommands = [buyCommand, hireCommand, sellCommand, undoBuyCommand, learnCommand, reviveCommand, buybackCommand] as const\n\ndeclare module '#engine/commands' {\n\tinterface Commands {\n\t\theroes: (typeof heroCommands)[number]\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,aAAa,cAAc,OAAO;CAAE,MAAM;CAAI,MAAM;CAAQ,MAAM,SAAS,EAAE;AAAE,IAAI,OAAO,QAAQ,YAAY;CAE1H,MAAM,OAAO,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC9C,MAAM,CAAC,SAAS,QAAQ,SAAS,KAAA,IAAY,CAAC,IAAI,MAAM,OAAO,QAAQ,CAAC,QAAQ,IAAI,CAAC;CACrF,IAAI,QAAQ,CAAC,MAAM,WAAW,KAAK,OAAO,MAAM,GAAG,IAAI,OAAO,MAAM,QAAQ,MAAM,QAAQ,KAAK;AAChG,CAAC;;;;;;AAOD,IAAa,cAAc,cAAc,QAAQ;CAAE,MAAM;CAAI,MAAM;AAAO,IAAI,OAAO,QAAQ,YAAY;CACxG,MAAM,OAAO,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC9C,IAAI,MAAM,KAAK,OAAO,MAAM,QAAQ,MAAM,MAAM;AACjD,CAAC;;;;;;AAOD,IAAa,cAAc,cAAc,QAAQ;CAAE,QAAQ;CAAI,MAAM;AAAM,IAAI,OAAO,QAAQ,YAAY;CACzG,MAAM,CAAC,UAAU,MAAM,OAAO,QAAQ,CAAC,QAAQ,MAAM,CAAC;CACtD,IAAI,QAAQ,KAAK,OAAO,QAAQ,QAAQ,IAAI;AAC7C,CAAC;;;;;;AAOD,IAAa,iBAAiB,cAAc,WAAW;CAAE,MAAM;CAAI,UAAU,SAAS,EAAE;AAAE,IAAI,OAAO,QAAQ,YAAY;CACxH,MAAM,CAAC,QAAQ,MAAM,OAAO,QAAQ,CAAC,QAAQ,IAAI,CAAC;CAClD,IAAI,MAAM,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAChD,CAAC;;;;;;AAOD,IAAa,eAAe,cAAc,SAAS;CAAE,QAAQ;CAAI,SAAS;AAAO,IAAI,OAAO,QAAQ,YAAY;CAC/G,MAAM,CAAC,QAAQ,MAAM,OAAO,QAAQ,CAAC,QAAQ,MAAM,CAAC;CACpD,IAAI,MAAM,MAAM,OAAO,MAAM,QAAQ,OAAO;AAC7C,CAAC;;;;;;AAOD,IAAa,gBAAgB,cAAc,UAAU;CAAE,GAAG;CAAW,MAAM;AAAG,IAAI,OAAO,QAAQ,YAAY;CAC5G,MAAM,WAAW,UAAU,OAAO,QAAQ,UAAU,WAAW,CAAC,CAAC,OAAO,IAAI,OAAO;CACnF,IAAI,UAAU,cAAc,OAAO,UAAU,QAAQ,IAAI;AAC1D,CAAC;;;;;;AAOD,IAAa,iBAAiB,cAAc,WAAW,EAAE,MAAM,GAAG,IAAI,OAAO,QAAQ,YAAY;CAChG,MAAM,OAAO,MAAM,SAAS,IAAI,QAAQ,IAAI;CAC5C,IAAI,QAAQ,KAAK,UAAU,QAAQ,QAAQ,OAAO,IAAI;AACvD,CAAC;;;;;;;AAQD,IAAa,eAAe;CAAC;CAAY;CAAa;CAAa;CAAgB;CAAc;CAAe;AAAc"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Entity, EntityId, PlayerId } from '#engine/entity';
|
|
2
|
+
import type { Vec2 } from '#engine/math';
|
|
3
|
+
import type { World } from '#engine/world';
|
|
4
|
+
/**
|
|
5
|
+
* A hero that fell a moment ago (`fallenHeroes`): what it was, at what levels, where and when
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export interface FallenRecord {
|
|
10
|
+
/** Its id: a fallen hero waits out of the world to be brought back, as the same entity */
|
|
11
|
+
id: EntityId;
|
|
12
|
+
/** Its unit type, as itself: one that fell in a form, the type it is as itself */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Its player */
|
|
15
|
+
owner: PlayerId;
|
|
16
|
+
/** Its hero level */
|
|
17
|
+
level: number;
|
|
18
|
+
/** The levels of what it learns (its type's `hero.learns`), by ability id: what it had not learned is not there */
|
|
19
|
+
levels: Record<string, number>;
|
|
20
|
+
/** The game's time it fell, in seconds */
|
|
21
|
+
at: number;
|
|
22
|
+
/** Where it fell */
|
|
23
|
+
pos: Vec2;
|
|
24
|
+
/** Who killed it, if anyone */
|
|
25
|
+
killer?: EntityId;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The heroes that fell, as the heroes pack remembers them (`fallenHeroes`): saved with the world. Those older than
|
|
29
|
+
* `HeroSettings.fallenFor` go as the next falls
|
|
30
|
+
*
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export declare const fallen: import("#engine/components").Component<FallenRecord[], FallenRecord[]>;
|
|
34
|
+
/**
|
|
35
|
+
* The heroes that fell within the last `HeroSettings.fallenFor` seconds (8 when the game says nothing), the oldest first.
|
|
36
|
+
* Read it from a `death` listener (`entityDied`) to know what the hero that just fell was. None in a game without the
|
|
37
|
+
* heroes pack
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export declare function fallenHeroes(world: World): readonly FallenRecord[];
|
|
42
|
+
/** A hero falls: remembered, as itself, and those remembered past their time forgotten. Called by the pack's `death` hook */
|
|
43
|
+
export declare function rememberFallen(world: World, entity: Entity, killer: Entity | undefined): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineComponent } from "../../components.js";
|
|
2
|
+
import { form } from "../../formState.js";
|
|
3
|
+
import { heroOf } from "../../hero.js";
|
|
4
|
+
//#region src/packs/heroes/fallen.ts
|
|
5
|
+
/**
|
|
6
|
+
* Heroes that fell a moment ago (E2E-PLAN LB4): what each was where it fell, remembered a while by the heroes pack, for
|
|
7
|
+
* a game's own that takes a fallen hero over (Viego's souls, a necromancer's echo of the dead)
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The heroes that fell, as the heroes pack remembers them (`fallenHeroes`): saved with the world. Those older than
|
|
11
|
+
* `HeroSettings.fallenFor` go as the next falls
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
var fallen = defineComponent({
|
|
16
|
+
id: "heroes.fallen",
|
|
17
|
+
default: () => []
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* The heroes that fell within the last `HeroSettings.fallenFor` seconds (8 when the game says nothing), the oldest first.
|
|
21
|
+
* Read it from a `death` listener (`entityDied`) to know what the hero that just fell was. None in a game without the
|
|
22
|
+
* heroes pack
|
|
23
|
+
*
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
function fallenHeroes(world) {
|
|
27
|
+
if (!world.states.has(fallen)) return [];
|
|
28
|
+
const since = world.time - world.settings.heroes.fallenFor;
|
|
29
|
+
return world.state(fallen).filter((each) => each.at >= since);
|
|
30
|
+
}
|
|
31
|
+
/** A hero falls: remembered, as itself, and those remembered past their time forgotten. Called by the pack's `death` hook */
|
|
32
|
+
function rememberFallen(world, entity, killer) {
|
|
33
|
+
const hero = heroOf(entity);
|
|
34
|
+
if (!hero) return;
|
|
35
|
+
const inForm = entity.get(form);
|
|
36
|
+
const type = inForm?.from ?? entity.def.id;
|
|
37
|
+
const had = [...entity.abilities, ...inForm?.kept ?? []];
|
|
38
|
+
const levels = {};
|
|
39
|
+
for (const id of world.registry.unit(type).hero?.learns ?? []) {
|
|
40
|
+
const level = had.find((state) => state.id === id)?.level ?? 0;
|
|
41
|
+
if (level > 0) levels[id] = level;
|
|
42
|
+
}
|
|
43
|
+
const since = world.time - world.settings.heroes.fallenFor;
|
|
44
|
+
world.setState(fallen, [...world.states.has(fallen) ? world.state(fallen).filter((each) => each.at >= since) : [], {
|
|
45
|
+
id: entity.id,
|
|
46
|
+
type,
|
|
47
|
+
owner: entity.owner,
|
|
48
|
+
level: hero.level,
|
|
49
|
+
levels,
|
|
50
|
+
at: world.time,
|
|
51
|
+
pos: {
|
|
52
|
+
x: entity.pos.x,
|
|
53
|
+
z: entity.pos.z
|
|
54
|
+
},
|
|
55
|
+
...killer && { killer: killer.id }
|
|
56
|
+
}]);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { fallen, fallenHeroes, rememberFallen };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=fallen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallen.js","names":[],"sources":["../../../src/packs/heroes/fallen.ts"],"sourcesContent":["/**\n * Heroes that fell a moment ago (E2E-PLAN LB4): what each was where it fell, remembered a while by the heroes pack, for\n * a game's own that takes a fallen hero over (Viego's souls, a necromancer's echo of the dead)\n */\nimport { defineComponent } from '#engine/components'\nimport type { Entity, EntityId, PlayerId } from '#engine/entity'\nimport { form } from '#engine/formState'\nimport { heroOf } from '#engine/hero'\nimport type { Vec2 } from '#engine/math'\nimport type { World } from '#engine/world'\n\n/**\n * A hero that fell a moment ago (`fallenHeroes`): what it was, at what levels, where and when\n *\n * @beta\n */\nexport interface FallenRecord {\n\t/** Its id: a fallen hero waits out of the world to be brought back, as the same entity */\n\tid: EntityId\n\t/** Its unit type, as itself: one that fell in a form, the type it is as itself */\n\ttype: string\n\t/** Its player */\n\towner: PlayerId\n\t/** Its hero level */\n\tlevel: number\n\t/** The levels of what it learns (its type's `hero.learns`), by ability id: what it had not learned is not there */\n\tlevels: Record<string, number>\n\t/** The game's time it fell, in seconds */\n\tat: number\n\t/** Where it fell */\n\tpos: Vec2\n\t/** Who killed it, if anyone */\n\tkiller?: EntityId\n}\n\n/**\n * The heroes that fell, as the heroes pack remembers them (`fallenHeroes`): saved with the world. Those older than\n * `HeroSettings.fallenFor` go as the next falls\n *\n * @beta\n */\nexport const fallen = defineComponent<FallenRecord[]>({ id: 'heroes.fallen', default: () => [] })\n\n/**\n * The heroes that fell within the last `HeroSettings.fallenFor` seconds (8 when the game says nothing), the oldest first.\n * Read it from a `death` listener (`entityDied`) to know what the hero that just fell was. None in a game without the\n * heroes pack\n *\n * @beta\n */\nexport function fallenHeroes(world: World): readonly FallenRecord[] {\n\tif (!world.states.has(fallen)) return []\n\tconst since = world.time - world.settings.heroes.fallenFor\n\treturn world.state(fallen).filter((each) => each.at >= since)\n}\n\n/** A hero falls: remembered, as itself, and those remembered past their time forgotten. Called by the pack's `death` hook */\nexport function rememberFallen(world: World, entity: Entity, killer: Entity | undefined): void {\n\tconst hero = heroOf(entity)\n\tif (!hero) return\n\tconst inForm = entity.get(form)\n\tconst type = inForm?.from ?? entity.def.id\n\tconst had = [...entity.abilities, ...(inForm?.kept ?? [])]\n\tconst levels: Record<string, number> = {}\n\tfor (const id of world.registry.unit(type).hero?.learns ?? []) {\n\t\tconst level = had.find((state) => state.id === id)?.level ?? 0\n\t\tif (level > 0) levels[id] = level\n\t}\n\tconst since = world.time - world.settings.heroes.fallenFor\n\tworld.setState(fallen, [\n\t\t...(world.states.has(fallen) ? world.state(fallen).filter((each) => each.at >= since) : []),\n\t\t{\n\t\t\tid: entity.id,\n\t\t\ttype,\n\t\t\towner: entity.owner,\n\t\t\tlevel: hero.level,\n\t\t\tlevels,\n\t\t\tat: world.time,\n\t\t\tpos: { x: entity.pos.x, z: entity.pos.z },\n\t\t\t...(killer && { killer: killer.id })\n\t\t}\n\t])\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,IAAa,SAAS,gBAAgC;CAAE,IAAI;CAAiB,eAAe,CAAC;AAAE,CAAC;;;;;;;;AAShG,SAAgB,aAAa,OAAuC;CACnE,IAAI,CAAC,MAAM,OAAO,IAAI,MAAM,GAAG,OAAO,CAAC;CACvC,MAAM,QAAQ,MAAM,OAAO,MAAM,SAAS,OAAO;CACjD,OAAO,MAAM,MAAM,MAAM,CAAC,CAAC,QAAQ,SAAS,KAAK,MAAM,KAAK;AAC7D;;AAGA,SAAgB,eAAe,OAAc,QAAgB,QAAkC;CAC9F,MAAM,OAAO,OAAO,MAAM;CAC1B,IAAI,CAAC,MAAM;CACX,MAAM,SAAS,OAAO,IAAI,IAAI;CAC9B,MAAM,OAAO,QAAQ,QAAQ,OAAO,IAAI;CACxC,MAAM,MAAM,CAAC,GAAG,OAAO,WAAW,GAAI,QAAQ,QAAQ,CAAC,CAAE;CACzD,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,MAAM,MAAM,SAAS,KAAK,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG;EAC9D,MAAM,QAAQ,IAAI,MAAM,UAAU,MAAM,OAAO,EAAE,CAAC,EAAE,SAAS;EAC7D,IAAI,QAAQ,GAAG,OAAO,MAAM;CAC7B;CACA,MAAM,QAAQ,MAAM,OAAO,MAAM,SAAS,OAAO;CACjD,MAAM,SAAS,QAAQ,CACtB,GAAI,MAAM,OAAO,IAAI,MAAM,IAAI,MAAM,MAAM,MAAM,CAAC,CAAC,QAAQ,SAAS,KAAK,MAAM,KAAK,IAAI,CAAC,GACzF;EACC,IAAI,OAAO;EACX;EACA,OAAO,OAAO;EACd,OAAO,KAAK;EACZ;EACA,IAAI,MAAM;EACV,KAAK;GAAE,GAAG,OAAO,IAAI;GAAG,GAAG,OAAO,IAAI;EAAE;EACxC,GAAI,UAAU,EAAE,QAAQ,OAAO,GAAG;CACnC,CACD,CAAC;AACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { unitHired } from "../../engineEvents.js";
|
|
2
|
+
import { shortOf, spend } from "../../player.js";
|
|
3
|
+
import { engineMessage } from "../../messages.js";
|
|
4
|
+
import { heroesOf } from "../../hero.js";
|
|
5
|
+
import { atShop } from "../../items.js";
|
|
6
|
+
//#region src/packs/heroes/hire.ts
|
|
7
|
+
/**
|
|
8
|
+
* Whether someone of a player's stands at a place that hires (`UnitTypeDef.hires`) to hire there: any unit of theirs
|
|
9
|
+
* close enough, as at a shop. The first one found
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function hirerAt(world, shop, player) {
|
|
14
|
+
for (const entity of world.index.ownedBy(player)) if (entity.alive && !entity.hidden && entity.def.kind === "unit" && atShop(entity, shop)) return entity;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Why a player cannot hire a unit at a place now, as the message the player is told: none of theirs there, a hero
|
|
18
|
+
* they have already (a hero is hired once), as many heroes as they may have, what it costs. Nothing when they can
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function hireRefusal(world, shop, unit, player) {
|
|
23
|
+
if (!shop.def.hires?.includes(unit) || !world.registry.units.has(unit)) return engineMessage("cannotDoThat");
|
|
24
|
+
if (!shop.alive || !shop.operational || world.areEnemies(shop.owner, player)) return engineMessage("cannotDoThat");
|
|
25
|
+
const def = world.registry.unit(unit);
|
|
26
|
+
if (def.hero && heroesOf(world, player).some((hero) => hero.def.id === unit)) return engineMessage("alreadyHired", { unit });
|
|
27
|
+
if (def.hero && heroesOf(world, player).length >= world.settings.heroes.maxHeroes) return engineMessage("tooManyHeroes");
|
|
28
|
+
if (!hirerAt(world, shop, player)) return engineMessage("unitAtShop");
|
|
29
|
+
const short = shortOf(world.player(player).resources, def.cost);
|
|
30
|
+
if (short) return engineMessage("notEnough", { resource: short });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hires a unit at a place that hires for a player: a tavern's hero, a dock's boat. Paid for, and made next to the
|
|
34
|
+
* place, a boat on the water nearest it. The unit, or nothing with the player told why
|
|
35
|
+
*
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
function hire(world, shop, unit, player) {
|
|
39
|
+
const refusal = hireRefusal(world, shop, unit, player);
|
|
40
|
+
if (refusal) {
|
|
41
|
+
world.message(player, refusal);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const def = world.registry.unit(unit);
|
|
45
|
+
spend(world, player, def.cost, "hire", unit);
|
|
46
|
+
const hired = world.spawn(unit, player, {
|
|
47
|
+
x: shop.pos.x,
|
|
48
|
+
z: shop.pos.z + shop.def.radius + def.radius + .5
|
|
49
|
+
});
|
|
50
|
+
world.events.emit(unitHired, {
|
|
51
|
+
shop,
|
|
52
|
+
unit: hired,
|
|
53
|
+
player
|
|
54
|
+
});
|
|
55
|
+
return hired;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { hire, hireRefusal, hirerAt };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=hire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hire.js","names":[],"sources":["../../../src/packs/heroes/hire.ts"],"sourcesContent":["import { unitHired } from '#engine/engineEvents'\nimport type { Entity, PlayerId } from '#engine/entity'\nimport { heroesOf } from '#engine/hero'\nimport { atShop } from '#engine/items'\nimport { engineMessage } from '#engine/messages'\nimport { shortOf, spend } from '#engine/player'\nimport type { World } from '#engine/world'\n\n/**\n * Whether someone of a player's stands at a place that hires (`UnitTypeDef.hires`) to hire there: any unit of theirs\n * close enough, as at a shop. The first one found\n *\n * @internal\n */\nexport function hirerAt(world: World, shop: Entity, player: PlayerId): Entity | undefined {\n\tfor (const entity of world.index.ownedBy(player))\n\t\tif (entity.alive && !entity.hidden && entity.def.kind === 'unit' && atShop(entity, shop)) return entity\n\treturn undefined\n}\n\n/**\n * Why a player cannot hire a unit at a place now, as the message the player is told: none of theirs there, a hero\n * they have already (a hero is hired once), as many heroes as they may have, what it costs. Nothing when they can\n *\n * @internal\n */\nexport function hireRefusal(world: World, shop: Entity, unit: string, player: PlayerId) {\n\tif (!shop.def.hires?.includes(unit) || !world.registry.units.has(unit)) return engineMessage('cannotDoThat')\n\tif (!shop.alive || !shop.operational || world.areEnemies(shop.owner, player)) return engineMessage('cannotDoThat')\n\tconst def = world.registry.unit(unit)\n\tif (def.hero && heroesOf(world, player).some((hero) => hero.def.id === unit)) return engineMessage('alreadyHired', { unit })\n\t// no more heroes than the game lets a player have, however they come (`HeroSettings.maxHeroes`)\n\tif (def.hero && heroesOf(world, player).length >= world.settings.heroes.maxHeroes) return engineMessage('tooManyHeroes')\n\tif (!hirerAt(world, shop, player)) return engineMessage('unitAtShop')\n\tconst short = shortOf(world.player(player).resources, def.cost)\n\tif (short) return engineMessage('notEnough', { resource: short })\n\treturn undefined\n}\n\n/**\n * Hires a unit at a place that hires for a player: a tavern's hero, a dock's boat. Paid for, and made next to the\n * place, a boat on the water nearest it. The unit, or nothing with the player told why\n *\n * @beta\n */\nexport function hire(world: World, shop: Entity, unit: string, player: PlayerId): Entity | undefined {\n\tconst refusal = hireRefusal(world, shop, unit, player)\n\tif (refusal) {\n\t\tworld.message(player, refusal)\n\t\treturn undefined\n\t}\n\tconst def = world.registry.unit(unit)\n\tspend(world, player, def.cost, 'hire', unit)\n\tconst hired = world.spawn(unit, player, { x: shop.pos.x, z: shop.pos.z + shop.def.radius + def.radius + 0.5 })\n\tworld.events.emit(unitHired, { shop, unit: hired, player })\n\treturn hired\n}\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,QAAQ,OAAc,MAAc,QAAsC;CACzF,KAAK,MAAM,UAAU,MAAM,MAAM,QAAQ,MAAM,GAC9C,IAAI,OAAO,SAAS,CAAC,OAAO,UAAU,OAAO,IAAI,SAAS,UAAU,OAAO,QAAQ,IAAI,GAAG,OAAO;AAEnG;;;;;;;AAQA,SAAgB,YAAY,OAAc,MAAc,MAAc,QAAkB;CACvF,IAAI,CAAC,KAAK,IAAI,OAAO,SAAS,IAAI,KAAK,CAAC,MAAM,SAAS,MAAM,IAAI,IAAI,GAAG,OAAO,cAAc,cAAc;CAC3G,IAAI,CAAC,KAAK,SAAS,CAAC,KAAK,eAAe,MAAM,WAAW,KAAK,OAAO,MAAM,GAAG,OAAO,cAAc,cAAc;CACjH,MAAM,MAAM,MAAM,SAAS,KAAK,IAAI;CACpC,IAAI,IAAI,QAAQ,SAAS,OAAO,MAAM,CAAC,CAAC,MAAM,SAAS,KAAK,IAAI,OAAO,IAAI,GAAG,OAAO,cAAc,gBAAgB,EAAE,KAAK,CAAC;CAE3H,IAAI,IAAI,QAAQ,SAAS,OAAO,MAAM,CAAC,CAAC,UAAU,MAAM,SAAS,OAAO,WAAW,OAAO,cAAc,eAAe;CACvH,IAAI,CAAC,QAAQ,OAAO,MAAM,MAAM,GAAG,OAAO,cAAc,YAAY;CACpE,MAAM,QAAQ,QAAQ,MAAM,OAAO,MAAM,CAAC,CAAC,WAAW,IAAI,IAAI;CAC9D,IAAI,OAAO,OAAO,cAAc,aAAa,EAAE,UAAU,MAAM,CAAC;AAEjE;;;;;;;AAQA,SAAgB,KAAK,OAAc,MAAc,MAAc,QAAsC;CACpG,MAAM,UAAU,YAAY,OAAO,MAAM,MAAM,MAAM;CACrD,IAAI,SAAS;EACZ,MAAM,QAAQ,QAAQ,OAAO;EAC7B;CACD;CACA,MAAM,MAAM,MAAM,SAAS,KAAK,IAAI;CACpC,MAAM,OAAO,QAAQ,IAAI,MAAM,QAAQ,IAAI;CAC3C,MAAM,QAAQ,MAAM,MAAM,MAAM,QAAQ;EAAE,GAAG,KAAK,IAAI;EAAG,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,SAAS,IAAI,SAAS;CAAI,CAAC;CAC7G,MAAM,OAAO,KAAK,WAAW;EAAE;EAAM,MAAM;EAAO;CAAO,CAAC;CAC1D,OAAO;AACR"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type HeroesPack, type
|
|
1
|
+
import { type HeroesPack, type HeroSettings } from '#engine/hero';
|
|
2
2
|
/**
|
|
3
|
-
* The heroes pack: what makes a game a classic hero RTS, opted into (`
|
|
4
|
-
* their experience, levels, points and abilities to learn, brought back at an altar (`revive`)
|
|
3
|
+
* The heroes pack: what makes a game a classic hero RTS, opted into (`Rules.packs: [heroesPack()]`). Heroes, with
|
|
4
|
+
* their experience, levels, points and abilities to learn, brought back at an altar (`revive`) or bought back
|
|
5
|
+
* (`buyback`), their kills shared with those who assisted, their streaks paid for when they end (`HeroSettings`); creeps' camps that guard
|
|
5
6
|
* their ground, sleep at night and come back (`Camp.respawn`); shops that sell (`buy`, `sell`) and places that hire
|
|
6
|
-
* (`hire`). `rules` change its numbers (`
|
|
7
|
+
* (`hire`). `rules` change its numbers (`HeroSettings`: how many heroes, the experience a level takes), the classic RTS numbers for
|
|
7
8
|
* those left out. A game without it pays nothing for any of it: no hero is made of a hero's type, no command of these
|
|
8
9
|
* is taken, no camp is looked at
|
|
9
10
|
*
|
|
10
|
-
* @
|
|
11
|
+
* @public
|
|
11
12
|
*/
|
|
12
|
-
export declare function
|
|
13
|
+
export declare function heroesPack(rules?: Partial<HeroSettings>): HeroesPack;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { HEROES, defaultHeroSettings, heroOf, heroState, keepInnate } from "../../hero.js";
|
|
2
|
+
import { defineHook } from "../../hooks.js";
|
|
3
|
+
import { shopStock } from "../../items.js";
|
|
4
|
+
import { corpseSystem, worthless } from "../../summons.js";
|
|
5
|
+
import { campHooks, campListeners, campRespawnSystem } from "../../camps.js";
|
|
6
|
+
import { assistListeners, assistLog, heroAssists, heroTally, settleHeroKill } from "./loop.js";
|
|
7
|
+
import { heroCommands } from "./commands.js";
|
|
8
|
+
import { awardKill, makeHero } from "./making.js";
|
|
9
|
+
import { fallen, rememberFallen } from "./fallen.js";
|
|
10
|
+
//#region src/packs/heroes/index.ts
|
|
11
|
+
/** A shop's wares, each as many as it stocks; what it stocked already as it was, where it sells it still */
|
|
12
|
+
function stockShop(world, entity) {
|
|
13
|
+
const sells = entity.def.sells ?? [];
|
|
14
|
+
const had = entity.get(shopStock);
|
|
15
|
+
if (!sells.length) {
|
|
16
|
+
if (had) entity.remove(shopStock);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
entity.set(shopStock, sells.map((item) => {
|
|
20
|
+
const kept = had?.find((stock) => stock.item === item);
|
|
21
|
+
if (kept) return kept;
|
|
22
|
+
const stock = world.registry.item(item).stock;
|
|
23
|
+
return {
|
|
24
|
+
item,
|
|
25
|
+
count: stock?.max ?? 1,
|
|
26
|
+
restock: stock?.restock ?? 60
|
|
27
|
+
};
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
/** What the pack does as things are made, change type, die and fall: heroes, their experience, shops' wares */
|
|
31
|
+
var heroHooks = [
|
|
32
|
+
defineHook({
|
|
33
|
+
hook: "made",
|
|
34
|
+
id: "hero",
|
|
35
|
+
run(world, entity) {
|
|
36
|
+
if (entity.def.hero) makeHero(world, entity);
|
|
37
|
+
stockShop(world, entity);
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
defineHook({
|
|
41
|
+
hook: "morphed",
|
|
42
|
+
id: "hero",
|
|
43
|
+
run(world, { entity }) {
|
|
44
|
+
if (entity.def.hero && !entity.has(heroState)) makeHero(world, entity);
|
|
45
|
+
else if (entity.def.hero) keepInnate(world, entity);
|
|
46
|
+
if (entity.def.sells?.length || entity.has(shopStock)) stockShop(world, entity);
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
defineHook({
|
|
50
|
+
hook: "death",
|
|
51
|
+
id: "experience",
|
|
52
|
+
run(world, { entity, killer }) {
|
|
53
|
+
if (worthless(entity)) return;
|
|
54
|
+
const assists = heroAssists(world, entity, killer);
|
|
55
|
+
awardKill(world, entity, killer, assists);
|
|
56
|
+
if (entity.has(heroState)) settleHeroKill(world, entity, killer, assists);
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
defineHook({
|
|
60
|
+
hook: "death",
|
|
61
|
+
id: "fallen",
|
|
62
|
+
run(world, { entity, killer }) {
|
|
63
|
+
if (entity.has(heroState) && !worthless(entity)) rememberFallen(world, entity, killer);
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
defineHook({
|
|
67
|
+
hook: "fallenHero",
|
|
68
|
+
id: "heroesStay",
|
|
69
|
+
run(_world, event) {
|
|
70
|
+
if (event.entity.has(heroState)) event.stays = true;
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
...campHooks
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* A hero's stats grow with its level, as its type says (`UnitTypeDef.hero.growth`): stamped with the level past the
|
|
77
|
+
* first, so that a level set however it is set is added up again
|
|
78
|
+
*/
|
|
79
|
+
var heroGrowth = {
|
|
80
|
+
id: "heroGrowth",
|
|
81
|
+
stamp(entity) {
|
|
82
|
+
if (!entity.def.hero) return 0;
|
|
83
|
+
const level = heroOf(entity)?.level ?? 1;
|
|
84
|
+
return level > 1 ? level : 0;
|
|
85
|
+
},
|
|
86
|
+
add(_world, entity, sum) {
|
|
87
|
+
const growth = entity.def.hero?.growth;
|
|
88
|
+
const hero = growth && heroOf(entity);
|
|
89
|
+
if (hero && hero.level > 1) sum.add(growth, hero.level - 1);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/** Camps come back as the engine's own did: in the clean-up, before the corpses go */
|
|
93
|
+
var campsComeBack = {
|
|
94
|
+
...campRespawnSystem,
|
|
95
|
+
before: [corpseSystem.name]
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The heroes pack: what makes a game a classic hero RTS, opted into (`Rules.packs: [heroesPack()]`). Heroes, with
|
|
99
|
+
* their experience, levels, points and abilities to learn, brought back at an altar (`revive`) or bought back
|
|
100
|
+
* (`buyback`), their kills shared with those who assisted, their streaks paid for when they end (`HeroSettings`); creeps' camps that guard
|
|
101
|
+
* their ground, sleep at night and come back (`Camp.respawn`); shops that sell (`buy`, `sell`) and places that hire
|
|
102
|
+
* (`hire`). `rules` change its numbers (`HeroSettings`: how many heroes, the experience a level takes), the classic RTS numbers for
|
|
103
|
+
* those left out. A game without it pays nothing for any of it: no hero is made of a hero's type, no command of these
|
|
104
|
+
* is taken, no camp is looked at
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
function heroesPack(rules = {}) {
|
|
109
|
+
for (const key of Object.keys(rules)) if (!(key in defaultHeroSettings)) throw new Error(`"${key}" is not a rule of the heroes pack`);
|
|
110
|
+
return {
|
|
111
|
+
id: HEROES,
|
|
112
|
+
options: rules,
|
|
113
|
+
callings: rules.callings ?? defaultHeroSettings.callings,
|
|
114
|
+
settings: () => ({ heroes: rules }),
|
|
115
|
+
commands: [...heroCommands],
|
|
116
|
+
systems: [campsComeBack],
|
|
117
|
+
hooks: heroHooks,
|
|
118
|
+
listeners: [...campListeners, ...assistListeners],
|
|
119
|
+
components: [
|
|
120
|
+
fallen,
|
|
121
|
+
assistLog,
|
|
122
|
+
heroTally
|
|
123
|
+
],
|
|
124
|
+
statFields: [heroGrowth]
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { heroesPack };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/packs/heroes/index.ts"],"sourcesContent":["import type { CommandDef } from '#engine/commands'\nimport { heroCommands } from './commands'\nimport { campHooks, campListeners, campRespawnSystem } from '#engine/camps'\nimport { defineHook, type HookDef } from '#engine/hooks'\nimport { defaultHeroSettings, HEROES, type HeroesPack, type HeroSettings, heroOf, heroState, keepInnate } from '#engine/hero'\nimport { awardKill, makeHero } from './making'\nimport { fallen, rememberFallen } from './fallen'\nimport { assistListeners, assistLog, heroAssists, heroTally, settleHeroKill } from './loop'\nimport { shopStock } from '#engine/items'\nimport { corpseSystem, worthless } from '#engine/summons'\nimport type { System } from '#engine/registry'\nimport type { StatField } from '#engine/stats'\nimport type { Entity } from '#engine/entity'\nimport type { World } from '#engine/world'\n\n/** A shop's wares, each as many as it stocks; what it stocked already as it was, where it sells it still */\nfunction stockShop(world: World, entity: Entity): void {\n\tconst sells = entity.def.sells ?? []\n\tconst had = entity.get(shopStock)\n\tif (!sells.length) {\n\t\tif (had) entity.remove(shopStock)\n\t\treturn\n\t}\n\tentity.set(\n\t\tshopStock,\n\t\tsells.map((item) => {\n\t\t\tconst kept = had?.find((stock) => stock.item === item)\n\t\t\tif (kept) return kept\n\t\t\tconst stock = world.registry.item(item).stock\n\t\t\treturn { item, count: stock?.max ?? 1, restock: stock?.restock ?? 60 }\n\t\t})\n\t)\n}\n\n/** What the pack does as things are made, change type, die and fall: heroes, their experience, shops' wares */\nconst heroHooks: HookDef[] = [\n\tdefineHook({\n\t\thook: 'made',\n\t\tid: 'hero',\n\t\trun(world, entity) {\n\t\t\t// a hero of a hero's type: level 1, a point to spend, what it learns\n\t\t\tif (entity.def.hero) makeHero(world, entity)\n\t\t\tstockShop(world, entity)\n\t\t}\n\t}),\n\tdefineHook({\n\t\thook: 'morphed',\n\t\tid: 'hero',\n\t\trun(world, { entity }) {\n\t\t\t// what became a hero's type is a hero from level 1; a hero that stays one keeps its level and what it learned,\n\t\t\t// and has the innate of the form it took (`HeroDef.innate`)\n\t\t\tif (entity.def.hero && !entity.has(heroState)) makeHero(world, entity)\n\t\t\telse if (entity.def.hero) keepInnate(world, entity)\n\t\t\t// what became a shop stocks its wares; one that sells no more has none\n\t\t\tif (entity.def.sells?.length || entity.has(shopStock)) stockShop(world, entity)\n\t\t}\n\t}),\n\tdefineHook({\n\t\thook: 'death',\n\t\tid: 'experience',\n\t\trun(world, { entity, killer }) {\n\t\t\t// an illusion gains its killer nothing\n\t\t\tif (worthless(entity)) return\n\t\t\t// a hero's kill is shared with those who assisted it (`HeroSettings.assistTime`), and settles the streaks\n\t\t\tconst assists = heroAssists(world, entity, killer)\n\t\t\tawardKill(world, entity, killer, assists)\n\t\t\tif (entity.has(heroState)) settleHeroKill(world, entity, killer, assists)\n\t\t}\n\t}),\n\tdefineHook({\n\t\thook: 'death',\n\t\tid: 'fallen',\n\t\trun(world, { entity, killer }) {\n\t\t\t// a hero is remembered a while as it fell (`fallenHeroes`); an illusion is nobody\n\t\t\tif (entity.has(heroState) && !worthless(entity)) rememberFallen(world, entity, killer)\n\t\t}\n\t}),\n\tdefineHook({\n\t\thook: 'fallenHero',\n\t\tid: 'heroesStay',\n\t\trun(_world, event) {\n\t\t\t// a fallen hero waits out of the world to be brought back: at an altar, by its own time (`respawnPack`)\n\t\t\tif (event.entity.has(heroState)) event.stays = true\n\t\t}\n\t}),\n\t...campHooks\n]\n\n/**\n * A hero's stats grow with its level, as its type says (`UnitTypeDef.hero.growth`): stamped with the level past the\n * first, so that a level set however it is set is added up again\n */\nconst heroGrowth: StatField = {\n\tid: 'heroGrowth',\n\tstamp(entity) {\n\t\tif (!entity.def.hero) return 0\n\t\tconst level = heroOf(entity)?.level ?? 1\n\t\treturn level > 1 ? level : 0\n\t},\n\tadd(_world, entity, sum) {\n\t\tconst growth = entity.def.hero?.growth\n\t\tconst hero = growth && heroOf(entity)\n\t\tif (hero && hero.level > 1) sum.add(growth, hero.level - 1)\n\t}\n}\n\n/** Camps come back as the engine's own did: in the clean-up, before the corpses go */\nconst campsComeBack: System = { ...campRespawnSystem, before: [corpseSystem.name] }\n\n/**\n * The heroes pack: what makes a game a classic hero RTS, opted into (`Rules.packs: [heroesPack()]`). Heroes, with\n * their experience, levels, points and abilities to learn, brought back at an altar (`revive`) or bought back\n * (`buyback`), their kills shared with those who assisted, their streaks paid for when they end (`HeroSettings`); creeps' camps that guard\n * their ground, sleep at night and come back (`Camp.respawn`); shops that sell (`buy`, `sell`) and places that hire\n * (`hire`). `rules` change its numbers (`HeroSettings`: how many heroes, the experience a level takes), the classic RTS numbers for\n * those left out. A game without it pays nothing for any of it: no hero is made of a hero's type, no command of these\n * is taken, no camp is looked at\n *\n * @public\n */\nexport function heroesPack(rules: Partial<HeroSettings> = {}): HeroesPack {\n\tfor (const key of Object.keys(rules)) if (!(key in defaultHeroSettings)) throw new Error(`\"${key}\" is not a rule of the heroes pack`)\n\treturn {\n\t\tid: HEROES,\n\t\toptions: rules,\n\t\tcallings: rules.callings ?? defaultHeroSettings.callings,\n\t\tsettings: () => ({ heroes: rules }),\n\t\tcommands: [...heroCommands] as unknown as CommandDef[],\n\t\tsystems: [campsComeBack],\n\t\thooks: heroHooks,\n\t\tlisteners: [...campListeners, ...assistListeners],\n\t\tcomponents: [fallen, assistLog, heroTally],\n\t\tstatFields: [heroGrowth]\n\t}\n}\n"],"mappings":"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"}
|