@datamoc/mw_games 0.2.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/README.md +73 -24
- package/dist/actors/Affix.d.ts +26 -0
- package/dist/actors/Affix.d.ts.map +1 -1
- package/dist/actors/Affix.js +32 -1
- package/dist/actors/Affix.js.map +1 -1
- package/dist/actors/Barrier.d.ts +47 -0
- package/dist/actors/Barrier.d.ts.map +1 -0
- package/dist/actors/Barrier.js +70 -0
- package/dist/actors/Barrier.js.map +1 -0
- package/dist/actors/Charges.d.ts +22 -0
- package/dist/actors/Charges.d.ts.map +1 -1
- package/dist/actors/Charges.js +26 -0
- package/dist/actors/Charges.js.map +1 -1
- package/dist/actors/Equipment.d.ts +30 -0
- package/dist/actors/Equipment.d.ts.map +1 -1
- package/dist/actors/Equipment.js +33 -1
- package/dist/actors/Equipment.js.map +1 -1
- package/dist/actors/Inventory.d.ts +58 -3
- package/dist/actors/Inventory.d.ts.map +1 -1
- package/dist/actors/Inventory.js +97 -5
- package/dist/actors/Inventory.js.map +1 -1
- package/dist/actors/ItemState.d.ts +11 -2
- package/dist/actors/ItemState.d.ts.map +1 -1
- package/dist/actors/ItemState.js +18 -2
- package/dist/actors/ItemState.js.map +1 -1
- package/dist/actors/Loot.js +1 -1
- package/dist/actors/Loot.js.map +1 -1
- package/dist/actors/Progression.d.ts +9 -0
- package/dist/actors/Progression.d.ts.map +1 -1
- package/dist/actors/Progression.js +7 -0
- package/dist/actors/Progression.js.map +1 -1
- package/dist/actors/Resource.d.ts +16 -0
- package/dist/actors/Resource.d.ts.map +1 -1
- package/dist/actors/Resource.js +22 -0
- package/dist/actors/Resource.js.map +1 -1
- package/dist/actors/SkillPoints.d.ts +14 -0
- package/dist/actors/SkillPoints.d.ts.map +1 -1
- package/dist/actors/SkillPoints.js +16 -0
- package/dist/actors/SkillPoints.js.map +1 -1
- package/dist/actors/StatBlock.d.ts +16 -0
- package/dist/actors/StatBlock.d.ts.map +1 -1
- package/dist/actors/StatBlock.js +21 -0
- package/dist/actors/StatBlock.js.map +1 -1
- package/dist/actors/Support.d.ts +2 -2
- package/dist/actors/Support.d.ts.map +1 -1
- package/dist/actors/Support.js +2 -2
- package/dist/actors/Support.js.map +1 -1
- package/dist/actors/index.d.ts +8 -5
- package/dist/actors/index.d.ts.map +1 -1
- package/dist/actors/index.js +3 -2
- package/dist/actors/index.js.map +1 -1
- package/dist/assets/ByteProgress.d.ts +27 -0
- package/dist/assets/ByteProgress.d.ts.map +1 -0
- package/dist/assets/ByteProgress.js +44 -0
- package/dist/assets/ByteProgress.js.map +1 -0
- package/dist/assets/Streaming.d.ts +10 -4
- package/dist/assets/Streaming.d.ts.map +1 -1
- package/dist/assets/Streaming.js +18 -7
- package/dist/assets/Streaming.js.map +1 -1
- package/dist/assets/index.d.ts +11 -44
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +9 -76
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/loader.d.ts +34 -0
- package/dist/assets/loader.d.ts.map +1 -0
- package/dist/assets/loader.js +61 -0
- package/dist/assets/loader.js.map +1 -0
- package/dist/assets/paths.d.ts +40 -0
- package/dist/assets/paths.d.ts.map +1 -0
- package/dist/assets/paths.js +49 -0
- package/dist/assets/paths.js.map +1 -0
- package/dist/audio/Music.d.ts +10 -0
- package/dist/audio/Music.d.ts.map +1 -1
- package/dist/audio/Music.js +36 -1
- package/dist/audio/Music.js.map +1 -1
- package/dist/audio/Playable.d.ts +3 -0
- package/dist/audio/Playable.d.ts.map +1 -1
- package/dist/audio/Playable.js +1 -1
- package/dist/audio/Playable.js.map +1 -1
- package/dist/battle/Field.d.ts +2 -2
- package/dist/battle/Field.d.ts.map +1 -1
- package/dist/battle/Field.js +3 -3
- package/dist/battle/Field.js.map +1 -1
- package/dist/battle/Hooks.d.ts +7 -13
- package/dist/battle/Hooks.d.ts.map +1 -1
- package/dist/battle/Hooks.js +20 -18
- package/dist/battle/Hooks.js.map +1 -1
- package/dist/core/Feedback.d.ts +3 -9
- package/dist/core/Feedback.d.ts.map +1 -1
- package/dist/core/Feedback.js +6 -18
- package/dist/core/Feedback.js.map +1 -1
- package/dist/core/Hooks.d.ts +34 -0
- package/dist/core/Hooks.d.ts.map +1 -0
- package/dist/core/Hooks.js +33 -0
- package/dist/core/Hooks.js.map +1 -0
- package/dist/core/HttpTransport.d.ts +22 -0
- package/dist/core/HttpTransport.d.ts.map +1 -0
- package/dist/core/HttpTransport.js +33 -0
- package/dist/core/HttpTransport.js.map +1 -0
- package/dist/core/Input.d.ts +41 -0
- package/dist/core/Input.d.ts.map +1 -1
- package/dist/core/Input.js +126 -21
- package/dist/core/Input.js.map +1 -1
- package/dist/core/Multiplayer.d.ts +63 -0
- package/dist/core/Multiplayer.d.ts.map +1 -0
- package/dist/core/Multiplayer.js +73 -0
- package/dist/core/Multiplayer.js.map +1 -0
- package/dist/core/PlayerInput.d.ts +5 -0
- package/dist/core/PlayerInput.d.ts.map +1 -1
- package/dist/core/PlayerInput.js +11 -0
- package/dist/core/PlayerInput.js.map +1 -1
- package/dist/core/Random.d.ts +14 -5
- package/dist/core/Random.d.ts.map +1 -1
- package/dist/core/Random.js +14 -5
- package/dist/core/Random.js.map +1 -1
- package/dist/core/SaveSync.d.ts +17 -14
- package/dist/core/SaveSync.d.ts.map +1 -1
- package/dist/core/SaveSync.js +35 -31
- package/dist/core/SaveSync.js.map +1 -1
- package/dist/core/Scene.d.ts +16 -6
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/core/Scene.js +18 -6
- package/dist/core/Scene.js.map +1 -1
- package/dist/core/SceneStack.d.ts +8 -4
- package/dist/core/SceneStack.d.ts.map +1 -1
- package/dist/core/SceneStack.js +4 -0
- package/dist/core/SceneStack.js.map +1 -1
- package/dist/core/Stats.d.ts +33 -0
- package/dist/core/Stats.d.ts.map +1 -0
- package/dist/core/Stats.js +34 -0
- package/dist/core/Stats.js.map +1 -0
- package/dist/core/Telemetry.d.ts +34 -0
- package/dist/core/Telemetry.d.ts.map +1 -0
- package/dist/core/Telemetry.js +47 -0
- package/dist/core/Telemetry.js.map +1 -0
- package/dist/core/index.d.ts +9 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/mw_games.global.js +88 -87
- package/dist/roguelike/Boss.d.ts +4 -4
- package/dist/roguelike/Boss.d.ts.map +1 -1
- package/dist/roguelike/Boss.js +6 -6
- package/dist/roguelike/Boss.js.map +1 -1
- package/dist/roguelike/Combat.d.ts +10 -11
- package/dist/roguelike/Combat.d.ts.map +1 -1
- package/dist/roguelike/Combat.js +9 -16
- package/dist/roguelike/Combat.js.map +1 -1
- package/dist/roguelike/ContentRoll.d.ts +43 -0
- package/dist/roguelike/ContentRoll.d.ts.map +1 -0
- package/dist/roguelike/ContentRoll.js +38 -0
- package/dist/roguelike/ContentRoll.js.map +1 -0
- package/dist/roguelike/DungeonParity.d.ts +42 -0
- package/dist/roguelike/DungeonParity.d.ts.map +1 -0
- package/dist/roguelike/DungeonParity.js +63 -0
- package/dist/roguelike/DungeonParity.js.map +1 -0
- package/dist/roguelike/Features.d.ts +42 -0
- package/dist/roguelike/Features.d.ts.map +1 -0
- package/dist/roguelike/Features.js +59 -0
- package/dist/roguelike/Features.js.map +1 -0
- package/dist/roguelike/MonsterAI.js +1 -1
- package/dist/roguelike/MonsterAI.js.map +1 -1
- package/dist/roguelike/MultiStageAbility.d.ts +43 -0
- package/dist/roguelike/MultiStageAbility.d.ts.map +1 -0
- package/dist/roguelike/MultiStageAbility.js +60 -0
- package/dist/roguelike/MultiStageAbility.js.map +1 -0
- package/dist/roguelike/RoomBuilders.d.ts +43 -0
- package/dist/roguelike/RoomBuilders.d.ts.map +1 -0
- package/dist/roguelike/RoomBuilders.js +40 -0
- package/dist/roguelike/RoomBuilders.js.map +1 -0
- package/dist/roguelike/Targeting.d.ts +22 -0
- package/dist/roguelike/Targeting.d.ts.map +1 -1
- package/dist/roguelike/Targeting.js +20 -0
- package/dist/roguelike/Targeting.js.map +1 -1
- package/dist/roguelike/TriggerTracker.d.ts +36 -0
- package/dist/roguelike/TriggerTracker.d.ts.map +1 -0
- package/dist/roguelike/TriggerTracker.js +49 -0
- package/dist/roguelike/TriggerTracker.js.map +1 -0
- package/dist/roguelike/generate.d.ts +49 -0
- package/dist/roguelike/generate.d.ts.map +1 -1
- package/dist/roguelike/generate.js +38 -10
- package/dist/roguelike/generate.js.map +1 -1
- package/dist/roguelike/index.d.ts +16 -4
- package/dist/roguelike/index.d.ts.map +1 -1
- package/dist/roguelike/index.js +8 -2
- package/dist/roguelike/index.js.map +1 -1
- package/dist/rpg/EventRunner.d.ts +30 -8
- package/dist/rpg/EventRunner.d.ts.map +1 -1
- package/dist/rpg/EventRunner.js +1 -13
- package/dist/rpg/EventRunner.js.map +1 -1
- package/dist/rpg/FreeMover.d.ts +2 -2
- package/dist/rpg/FreeMover.d.ts.map +1 -1
- package/dist/rpg/FreeMover.js +5 -5
- package/dist/rpg/FreeMover.js.map +1 -1
- package/dist/rpg/GridMover.d.ts +2 -2
- package/dist/rpg/GridMover.d.ts.map +1 -1
- package/dist/rpg/GridMover.js +5 -5
- package/dist/rpg/GridMover.js.map +1 -1
- package/dist/rpg/MovableSprite.d.ts +25 -0
- package/dist/rpg/MovableSprite.d.ts.map +1 -0
- package/dist/rpg/MovableSprite.js +2 -0
- package/dist/rpg/MovableSprite.js.map +1 -0
- package/dist/rpg/Quest.d.ts +6 -1
- package/dist/rpg/Quest.d.ts.map +1 -1
- package/dist/rpg/Quest.js +6 -1
- package/dist/rpg/Quest.js.map +1 -1
- package/dist/rpg/automap.d.ts +24 -2
- package/dist/rpg/automap.d.ts.map +1 -1
- package/dist/rpg/automap.js +9 -1
- package/dist/rpg/automap.js.map +1 -1
- package/dist/rpg/index.d.ts +4 -4
- package/dist/rpg/index.d.ts.map +1 -1
- package/dist/rpg/index.js +1 -1
- package/dist/rpg/index.js.map +1 -1
- package/dist/simulation/Scenario.d.ts +29 -0
- package/dist/simulation/Scenario.d.ts.map +1 -0
- package/dist/simulation/Scenario.js +25 -0
- package/dist/simulation/Scenario.js.map +1 -0
- package/dist/simulation/Turns.d.ts +29 -0
- package/dist/simulation/Turns.d.ts.map +1 -0
- package/dist/simulation/Turns.js +30 -0
- package/dist/simulation/Turns.js.map +1 -0
- package/dist/simulation/index.d.ts +5 -0
- package/dist/simulation/index.d.ts.map +1 -0
- package/dist/simulation/index.js +3 -0
- package/dist/simulation/index.js.map +1 -0
- package/dist/three-d/Character3D.d.ts +26 -1
- package/dist/three-d/Character3D.d.ts.map +1 -1
- package/dist/three-d/Character3D.js +31 -14
- package/dist/three-d/Character3D.js.map +1 -1
- package/dist/three-d/Collision3D.d.ts +63 -0
- package/dist/three-d/Collision3D.d.ts.map +1 -0
- package/dist/three-d/Collision3D.js +75 -0
- package/dist/three-d/Collision3D.js.map +1 -0
- package/dist/three-d/Models.js +1 -1
- package/dist/three-d/index.d.ts +3 -1
- package/dist/three-d/index.d.ts.map +1 -1
- package/dist/three-d/index.js +1 -0
- package/dist/three-d/index.js.map +1 -1
- package/dist/{core → two-d}/Game.d.ts +7 -6
- package/dist/two-d/Game.d.ts.map +1 -0
- package/dist/{core → two-d}/Game.js +3 -3
- package/dist/two-d/Game.js.map +1 -0
- package/dist/two-d/Scene2D.d.ts +19 -0
- package/dist/two-d/Scene2D.d.ts.map +1 -0
- package/dist/two-d/Scene2D.js +23 -0
- package/dist/two-d/Scene2D.js.map +1 -0
- package/dist/two-d/index.d.ts +20 -0
- package/dist/two-d/index.d.ts.map +1 -0
- package/dist/two-d/index.js +18 -0
- package/dist/two-d/index.js.map +1 -0
- package/dist/two-d/render/ActorAnimator.d.ts.map +1 -0
- package/dist/two-d/render/ActorAnimator.js.map +1 -0
- package/dist/two-d/render/AnimatedSprite.d.ts.map +1 -0
- package/dist/two-d/render/AnimatedSprite.js.map +1 -0
- package/dist/two-d/render/Autotile.d.ts.map +1 -0
- package/dist/two-d/render/Autotile.js.map +1 -0
- package/dist/two-d/render/Camera.d.ts.map +1 -0
- package/dist/{render → two-d/render}/Camera.js +2 -2
- package/dist/two-d/render/Camera.js.map +1 -0
- package/dist/two-d/render/Capabilities.d.ts.map +1 -0
- package/dist/two-d/render/Capabilities.js.map +1 -0
- package/dist/two-d/render/ColorBlindness.d.ts.map +1 -0
- package/dist/two-d/render/ColorBlindness.js.map +1 -0
- package/dist/two-d/render/ColorTransformBatcher.d.ts.map +1 -0
- package/dist/{render → two-d/render}/ColorTransformBatcher.js +3 -2
- package/dist/two-d/render/ColorTransformBatcher.js.map +1 -0
- package/dist/two-d/render/LayeredSprite.d.ts.map +1 -0
- package/dist/two-d/render/LayeredSprite.js.map +1 -0
- package/dist/two-d/render/Minimap.d.ts.map +1 -0
- package/dist/{render → two-d/render}/Minimap.js +1 -1
- package/dist/two-d/render/Minimap.js.map +1 -0
- package/dist/two-d/render/Particles.d.ts +109 -0
- package/dist/two-d/render/Particles.d.ts.map +1 -0
- package/dist/two-d/render/Particles.js +178 -0
- package/dist/two-d/render/Particles.js.map +1 -0
- package/dist/two-d/render/Projectile.d.ts.map +1 -0
- package/dist/two-d/render/Projectile.js.map +1 -0
- package/dist/two-d/render/ScreenEffects.d.ts +71 -0
- package/dist/two-d/render/ScreenEffects.d.ts.map +1 -0
- package/dist/two-d/render/ScreenEffects.js +133 -0
- package/dist/two-d/render/ScreenEffects.js.map +1 -0
- package/dist/two-d/render/SpriteSheet.d.ts.map +1 -0
- package/dist/{render → two-d/render}/SpriteSheet.js +1 -1
- package/dist/two-d/render/SpriteSheet.js.map +1 -0
- package/dist/two-d/render/StatusVisuals.d.ts +46 -0
- package/dist/two-d/render/StatusVisuals.d.ts.map +1 -0
- package/dist/two-d/render/StatusVisuals.js +48 -0
- package/dist/two-d/render/StatusVisuals.js.map +1 -0
- package/dist/two-d/render/TileMap.d.ts.map +1 -0
- package/dist/{render → two-d/render}/TileMap.js +1 -1
- package/dist/two-d/render/TileMap.js.map +1 -0
- package/dist/{rpg → two-d/render}/TiledMap.d.ts +2 -2
- package/dist/two-d/render/TiledMap.d.ts.map +1 -0
- package/dist/{rpg → two-d/render}/TiledMap.js +2 -2
- package/dist/two-d/render/TiledMap.js.map +1 -0
- package/dist/two-d/render/TintedSprite.d.ts.map +1 -0
- package/dist/two-d/render/TintedSprite.js.map +1 -0
- package/dist/two-d/render/Viewport.d.ts.map +1 -0
- package/dist/two-d/render/Viewport.js.map +1 -0
- package/dist/{render → two-d/render}/index.d.ts +8 -0
- package/dist/two-d/render/index.d.ts.map +1 -0
- package/dist/{render → two-d/render}/index.js +4 -0
- package/dist/two-d/render/index.js.map +1 -0
- package/dist/two-d/stage/DialogueStage.d.ts.map +1 -0
- package/dist/{stage → two-d/stage}/DialogueStage.js +1 -1
- package/dist/two-d/stage/DialogueStage.js.map +1 -0
- package/dist/two-d/stage/index.d.ts.map +1 -0
- package/dist/two-d/stage/index.js.map +1 -0
- package/dist/two-d/stage/script.d.ts.map +1 -0
- package/dist/{stage → two-d/stage}/script.js +0 -0
- package/dist/two-d/stage/script.js.map +1 -0
- package/dist/two-d/stage/twee.d.ts.map +1 -0
- package/dist/two-d/stage/twee.js.map +1 -0
- package/dist/two-d/ui/Bar.d.ts.map +1 -0
- package/dist/two-d/ui/Bar.js.map +1 -0
- package/dist/two-d/ui/BitmapLabel.d.ts.map +1 -0
- package/dist/two-d/ui/BitmapLabel.js.map +1 -0
- package/dist/{ui → two-d/ui}/Button.d.ts +25 -2
- package/dist/two-d/ui/Button.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/Button.js +35 -9
- package/dist/two-d/ui/Button.js.map +1 -0
- package/dist/two-d/ui/EventDialogue.d.ts +23 -0
- package/dist/two-d/ui/EventDialogue.d.ts.map +1 -0
- package/dist/two-d/ui/EventDialogue.js +27 -0
- package/dist/two-d/ui/EventDialogue.js.map +1 -0
- package/dist/two-d/ui/FloatingText.d.ts.map +1 -0
- package/dist/two-d/ui/FloatingText.js.map +1 -0
- package/dist/{ui → two-d/ui}/HelpScreen.d.ts +1 -1
- package/dist/two-d/ui/HelpScreen.d.ts.map +1 -0
- package/dist/two-d/ui/HelpScreen.js.map +1 -0
- package/dist/{ui → two-d/ui}/IconGrid.d.ts +1 -1
- package/dist/two-d/ui/IconGrid.d.ts.map +1 -0
- package/dist/two-d/ui/IconGrid.js.map +1 -0
- package/dist/{ui → two-d/ui}/Label.d.ts +8 -0
- package/dist/two-d/ui/Label.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/Label.js +3 -0
- package/dist/two-d/ui/Label.js.map +1 -0
- package/dist/{ui → two-d/ui}/ListView.d.ts +1 -1
- package/dist/two-d/ui/ListView.d.ts.map +1 -0
- package/dist/two-d/ui/ListView.js.map +1 -0
- package/dist/{ui → two-d/ui}/LoadingScreen.d.ts +1 -1
- package/dist/two-d/ui/LoadingScreen.d.ts.map +1 -0
- package/dist/two-d/ui/LoadingScreen.js.map +1 -0
- package/dist/{ui → two-d/ui}/MessageBox.d.ts +1 -1
- package/dist/two-d/ui/MessageBox.d.ts.map +1 -0
- package/dist/two-d/ui/MessageBox.js.map +1 -0
- package/dist/two-d/ui/NinePatch.d.ts.map +1 -0
- package/dist/two-d/ui/NinePatch.js.map +1 -0
- package/dist/{ui → two-d/ui}/RebindScreen.d.ts +1 -1
- package/dist/two-d/ui/RebindScreen.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/RebindScreen.js +1 -1
- package/dist/two-d/ui/RebindScreen.js.map +1 -0
- package/dist/two-d/ui/StatsScreen.d.ts +25 -0
- package/dist/two-d/ui/StatsScreen.d.ts.map +1 -0
- package/dist/two-d/ui/StatsScreen.js +27 -0
- package/dist/two-d/ui/StatsScreen.js.map +1 -0
- package/dist/two-d/ui/Toast.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/Toast.js +1 -1
- package/dist/two-d/ui/Toast.js.map +1 -0
- package/dist/two-d/ui/Tooltip.d.ts +94 -0
- package/dist/two-d/ui/Tooltip.d.ts.map +1 -0
- package/dist/two-d/ui/Tooltip.js +149 -0
- package/dist/two-d/ui/Tooltip.js.map +1 -0
- package/dist/two-d/ui/VerticalLabel.d.ts.map +1 -0
- package/dist/two-d/ui/VerticalLabel.js.map +1 -0
- package/dist/{ui → two-d/ui}/Window.d.ts +2 -2
- package/dist/two-d/ui/Window.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/Window.js +1 -1
- package/dist/two-d/ui/Window.js.map +1 -0
- package/dist/two-d/ui/WindowStack.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/WindowStack.js +1 -1
- package/dist/two-d/ui/WindowStack.js.map +1 -0
- package/dist/{ui → two-d/ui}/index.d.ts +7 -1
- package/dist/two-d/ui/index.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/index.js +3 -0
- package/dist/two-d/ui/index.js.map +1 -0
- package/dist/{ui → two-d/ui}/theme.d.ts +2 -2
- package/dist/two-d/ui/theme.d.ts.map +1 -0
- package/dist/{ui → two-d/ui}/theme.js +1 -1
- package/dist/two-d/ui/theme.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/world/Encounters.js +1 -1
- package/dist/world/Encounters.js.map +1 -1
- package/dist/world/Environment.d.ts +12 -3
- package/dist/world/Environment.d.ts.map +1 -1
- package/dist/world/Environment.js +18 -9
- package/dist/world/Environment.js.map +1 -1
- package/package.json +138 -23
- package/dist/core/Game.d.ts.map +0 -1
- package/dist/core/Game.js.map +0 -1
- package/dist/render/ActorAnimator.d.ts.map +0 -1
- package/dist/render/ActorAnimator.js.map +0 -1
- package/dist/render/AnimatedSprite.d.ts.map +0 -1
- package/dist/render/AnimatedSprite.js.map +0 -1
- package/dist/render/Autotile.d.ts.map +0 -1
- package/dist/render/Autotile.js.map +0 -1
- package/dist/render/Camera.d.ts.map +0 -1
- package/dist/render/Camera.js.map +0 -1
- package/dist/render/Capabilities.d.ts.map +0 -1
- package/dist/render/Capabilities.js.map +0 -1
- package/dist/render/ColorBlindness.d.ts.map +0 -1
- package/dist/render/ColorBlindness.js.map +0 -1
- package/dist/render/ColorTransformBatcher.d.ts.map +0 -1
- package/dist/render/ColorTransformBatcher.js.map +0 -1
- package/dist/render/LayeredSprite.d.ts.map +0 -1
- package/dist/render/LayeredSprite.js.map +0 -1
- package/dist/render/Minimap.d.ts.map +0 -1
- package/dist/render/Minimap.js.map +0 -1
- package/dist/render/Projectile.d.ts.map +0 -1
- package/dist/render/Projectile.js.map +0 -1
- package/dist/render/SpriteSheet.d.ts.map +0 -1
- package/dist/render/SpriteSheet.js.map +0 -1
- package/dist/render/TileMap.d.ts.map +0 -1
- package/dist/render/TileMap.js.map +0 -1
- package/dist/render/TintedSprite.d.ts.map +0 -1
- package/dist/render/TintedSprite.js.map +0 -1
- package/dist/render/Viewport.d.ts.map +0 -1
- package/dist/render/Viewport.js.map +0 -1
- package/dist/render/index.d.ts.map +0 -1
- package/dist/render/index.js.map +0 -1
- package/dist/rpg/TiledMap.d.ts.map +0 -1
- package/dist/rpg/TiledMap.js.map +0 -1
- package/dist/stage/DialogueStage.d.ts.map +0 -1
- package/dist/stage/DialogueStage.js.map +0 -1
- package/dist/stage/index.d.ts.map +0 -1
- package/dist/stage/index.js.map +0 -1
- package/dist/stage/script.d.ts.map +0 -1
- package/dist/stage/script.js.map +0 -1
- package/dist/stage/twee.d.ts.map +0 -1
- package/dist/stage/twee.js.map +0 -1
- package/dist/ui/Bar.d.ts.map +0 -1
- package/dist/ui/Bar.js.map +0 -1
- package/dist/ui/BitmapLabel.d.ts.map +0 -1
- package/dist/ui/BitmapLabel.js.map +0 -1
- package/dist/ui/Button.d.ts.map +0 -1
- package/dist/ui/Button.js.map +0 -1
- package/dist/ui/FloatingText.d.ts.map +0 -1
- package/dist/ui/FloatingText.js.map +0 -1
- package/dist/ui/HelpScreen.d.ts.map +0 -1
- package/dist/ui/HelpScreen.js.map +0 -1
- package/dist/ui/IconGrid.d.ts.map +0 -1
- package/dist/ui/IconGrid.js.map +0 -1
- package/dist/ui/Label.d.ts.map +0 -1
- package/dist/ui/Label.js.map +0 -1
- package/dist/ui/ListView.d.ts.map +0 -1
- package/dist/ui/ListView.js.map +0 -1
- package/dist/ui/LoadingScreen.d.ts.map +0 -1
- package/dist/ui/LoadingScreen.js.map +0 -1
- package/dist/ui/MessageBox.d.ts.map +0 -1
- package/dist/ui/MessageBox.js.map +0 -1
- package/dist/ui/NinePatch.d.ts.map +0 -1
- package/dist/ui/NinePatch.js.map +0 -1
- package/dist/ui/RebindScreen.d.ts.map +0 -1
- package/dist/ui/RebindScreen.js.map +0 -1
- package/dist/ui/Toast.d.ts.map +0 -1
- package/dist/ui/Toast.js.map +0 -1
- package/dist/ui/VerticalLabel.d.ts.map +0 -1
- package/dist/ui/VerticalLabel.js.map +0 -1
- package/dist/ui/Window.d.ts.map +0 -1
- package/dist/ui/Window.js.map +0 -1
- package/dist/ui/WindowStack.d.ts.map +0 -1
- package/dist/ui/WindowStack.js.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/theme.d.ts.map +0 -1
- package/dist/ui/theme.js.map +0 -1
- /package/dist/{render → two-d/render}/ActorAnimator.d.ts +0 -0
- /package/dist/{render → two-d/render}/ActorAnimator.js +0 -0
- /package/dist/{render → two-d/render}/AnimatedSprite.d.ts +0 -0
- /package/dist/{render → two-d/render}/AnimatedSprite.js +0 -0
- /package/dist/{render → two-d/render}/Autotile.d.ts +0 -0
- /package/dist/{render → two-d/render}/Autotile.js +0 -0
- /package/dist/{render → two-d/render}/Camera.d.ts +0 -0
- /package/dist/{render → two-d/render}/Capabilities.d.ts +0 -0
- /package/dist/{render → two-d/render}/Capabilities.js +0 -0
- /package/dist/{render → two-d/render}/ColorBlindness.d.ts +0 -0
- /package/dist/{render → two-d/render}/ColorBlindness.js +0 -0
- /package/dist/{render → two-d/render}/ColorTransformBatcher.d.ts +0 -0
- /package/dist/{render → two-d/render}/LayeredSprite.d.ts +0 -0
- /package/dist/{render → two-d/render}/LayeredSprite.js +0 -0
- /package/dist/{render → two-d/render}/Minimap.d.ts +0 -0
- /package/dist/{render → two-d/render}/Projectile.d.ts +0 -0
- /package/dist/{render → two-d/render}/Projectile.js +0 -0
- /package/dist/{render → two-d/render}/SpriteSheet.d.ts +0 -0
- /package/dist/{render → two-d/render}/TileMap.d.ts +0 -0
- /package/dist/{render → two-d/render}/TintedSprite.d.ts +0 -0
- /package/dist/{render → two-d/render}/TintedSprite.js +0 -0
- /package/dist/{render → two-d/render}/Viewport.d.ts +0 -0
- /package/dist/{render → two-d/render}/Viewport.js +0 -0
- /package/dist/{stage → two-d/stage}/DialogueStage.d.ts +0 -0
- /package/dist/{stage → two-d/stage}/index.d.ts +0 -0
- /package/dist/{stage → two-d/stage}/index.js +0 -0
- /package/dist/{stage → two-d/stage}/script.d.ts +0 -0
- /package/dist/{stage → two-d/stage}/twee.d.ts +0 -0
- /package/dist/{stage → two-d/stage}/twee.js +0 -0
- /package/dist/{ui → two-d/ui}/Bar.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/Bar.js +0 -0
- /package/dist/{ui → two-d/ui}/BitmapLabel.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/BitmapLabel.js +0 -0
- /package/dist/{ui → two-d/ui}/FloatingText.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/FloatingText.js +0 -0
- /package/dist/{ui → two-d/ui}/HelpScreen.js +0 -0
- /package/dist/{ui → two-d/ui}/IconGrid.js +0 -0
- /package/dist/{ui → two-d/ui}/ListView.js +0 -0
- /package/dist/{ui → two-d/ui}/LoadingScreen.js +0 -0
- /package/dist/{ui → two-d/ui}/MessageBox.js +0 -0
- /package/dist/{ui → two-d/ui}/NinePatch.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/NinePatch.js +0 -0
- /package/dist/{ui → two-d/ui}/Toast.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/VerticalLabel.d.ts +0 -0
- /package/dist/{ui → two-d/ui}/VerticalLabel.js +0 -0
- /package/dist/{ui → two-d/ui}/WindowStack.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# mwg
|
|
2
2
|
|
|
3
|
-
A framework for building
|
|
4
|
-
|
|
3
|
+
A framework for building tile games that run **from a local file**: no server, no install,
|
|
4
|
+
no runtime to download. The game logic depends on no renderer at all, so a game draws through
|
|
5
|
+
PixiJS in 2D (`mwg/two-d`) or Babylon.js in 3D (`mwg/3d`), and the dungeon generation, map
|
|
6
|
+
events, quests, stats and turn order underneath are the same either way.
|
|
5
7
|
|
|
6
8
|
Licensed under the [MPL-2.0](LICENSE): games built with `mwg` carry no licence obligation
|
|
7
9
|
of their own; improvements to `mwg`'s own files are shared back.
|
|
@@ -9,10 +11,14 @@ of their own; improvements to `mwg`'s own files are shared back.
|
|
|
9
11
|
**[Live examples and API docs](https://datamoc.github.io/mwg/)**: every example below,
|
|
10
12
|
playable in the browser with no download, plus the generated API reference.
|
|
11
13
|
|
|
12
|
-
> **Status: early release (v0.
|
|
14
|
+
> **Status: early release (v0.4.0).** Every module in the shared floor below, plus optional
|
|
13
15
|
> 3D, mobile (Capacitor) and desktop (WebView2) packaging, is built and tested - see
|
|
14
|
-
> [ROADMAP.md](ROADMAP.md) for the full, numbered history.
|
|
15
|
-
>
|
|
16
|
+
> [ROADMAP.md](ROADMAP.md) for the full, numbered history.
|
|
17
|
+
>
|
|
18
|
+
> 0.4.0 is the reshaping release: the renderer moved out of `mwg/core`, `render`/`ui`/`stage`
|
|
19
|
+
> became `mwg/two-d`, and a set of names that meant several things each were made to mean one.
|
|
20
|
+
> It is deliberately the last such release planned before 1.0. Still `0.y.z` until then, but
|
|
21
|
+
> the intent from here is additions rather than renames.
|
|
16
22
|
|
|
17
23
|
## What it is for
|
|
18
24
|
|
|
@@ -75,7 +81,7 @@ npm install @datamoc/mw_games
|
|
|
75
81
|
```
|
|
76
82
|
```ts
|
|
77
83
|
import { Game, Scene } from '@datamoc/mw_games/core';
|
|
78
|
-
import { Sprite } from '@datamoc/mw_games/render';
|
|
84
|
+
import { Sprite } from '@datamoc/mw_games/two-d/render';
|
|
79
85
|
```
|
|
80
86
|
|
|
81
87
|
No npm registry access (an offline machine, a pinned artifact for reproducible builds)?
|
|
@@ -130,21 +136,21 @@ only some do.
|
|
|
130
136
|
| | deterministic seeded RNG, reproducible across machines | `mwg/core` |
|
|
131
137
|
| | named, versioned save slots with a preview | `mwg/core` |
|
|
132
138
|
| **render** | sprite batching at thousands of tiles | PixiJS |
|
|
133
|
-
| | per-sprite colour transform: multiply **and** add | `mwg/render` |
|
|
134
|
-
| | animated sprites driven by named frame sets | `mwg/render` |
|
|
135
|
-
| | dense tile maps, multi-layer, with per-cell visibility | `mwg/render` |
|
|
136
|
-
| | hexagonal tile maps, alongside square, as a second grid shape | `mwg/render` |
|
|
137
|
-
| | camera with follow, pan, shake and zoom | `mwg/render` |
|
|
138
|
-
| | particle effects | `mwg/render` |
|
|
139
|
-
| | screen transitions: fade, flash, tint | `mwg/render` |
|
|
140
|
-
| **ui** | windows, lists, tooltips | `mwg/ui` |
|
|
139
|
+
| | per-sprite colour transform: multiply **and** add | `mwg/two-d/render` |
|
|
140
|
+
| | animated sprites driven by named frame sets | `mwg/two-d/render` |
|
|
141
|
+
| | dense tile maps, multi-layer, with per-cell visibility | `mwg/two-d/render` |
|
|
142
|
+
| | hexagonal tile maps, alongside square, as a second grid shape | `mwg/two-d/render` |
|
|
143
|
+
| | camera with follow, pan, shake and zoom | `mwg/two-d/render` |
|
|
144
|
+
| | particle effects | `mwg/two-d/render` |
|
|
145
|
+
| | screen transitions: fade, flash, tint | `mwg/two-d/render` |
|
|
146
|
+
| **ui** | windows, lists, tooltips | `mwg/two-d/ui` |
|
|
141
147
|
| | text and fonts, including non-latin fallback | PixiJS |
|
|
142
148
|
| | pointer, keyboard and gamepad input with rebinding | `mwg/core` |
|
|
143
149
|
| **text** | message tables per language, compiled at build time | `mwg/i18n` |
|
|
144
150
|
| | plurals, gendered forms and interpolation | `mwg/i18n` |
|
|
145
151
|
| | Fluent-style FTL catalogs with locale-aware fallback and variants | `mwg/i18n` |
|
|
146
152
|
| | left-to-right, right-to-left and vertical writing | `mwg/i18n` |
|
|
147
|
-
| | interface mirrored for right-to-left languages | `mwg/ui` |
|
|
153
|
+
| | interface mirrored for right-to-left languages | `mwg/two-d/ui` |
|
|
148
154
|
| | a missing translation falls back rather than showing a key | `mwg/i18n` |
|
|
149
155
|
| **audio** | sound effects with pooling, music with crossfade | `mwg/audio` |
|
|
150
156
|
|
|
@@ -175,10 +181,10 @@ The Wesnoth-shaped half: a grid whose shape is a parameter, not a parallel imple
|
|
|
175
181
|
|
|
176
182
|
| capability | provided by |
|
|
177
183
|
| --- | --- |
|
|
178
|
-
| hexagonal tile maps, addressed by axial or offset coordinates | `mwg/render` |
|
|
184
|
+
| hexagonal tile maps, addressed by axial or offset coordinates | `mwg/two-d/render` |
|
|
179
185
|
| movement cost and defense bonus by terrain, hex or square alike | `mwg/roguelike` |
|
|
180
186
|
| field of view and pathfinding over a hex grid, not just square | `mwg/roguelike` |
|
|
181
|
-
| isometric (and staggered) projection, alongside orthogonal and hex | `mwg/render` |
|
|
187
|
+
| isometric (and staggered) projection, alongside orthogonal and hex | `mwg/two-d/render` |
|
|
182
188
|
| zone of control: a hex a unit can only move into, not through, unless already engaged | `mwg/board` |
|
|
183
189
|
| an army economy: recruiting against a currency, recalling from a pool, per-turn upkeep | `mwg/board` |
|
|
184
190
|
|
|
@@ -199,11 +205,11 @@ reference, the same way Wesnoth is the hex-shaped one.
|
|
|
199
205
|
| event triggers: action, touch, autorun, parallel | `mwg/rpg` |
|
|
200
206
|
| a command interpreter for cutscenes: move routes, waits, branches, calls | `mwg/rpg` |
|
|
201
207
|
| global switches and variables, saved with the game | `mwg/rpg` |
|
|
202
|
-
| message box with portraits, choices and typewriter reveal | `mwg/rpg` + `mwg/ui` |
|
|
208
|
+
| message box with portraits, choices and typewriter reveal | `mwg/rpg` + `mwg/two-d/ui` |
|
|
203
209
|
| grid movement tweened between tiles, with a walk cycle | `mwg/rpg` |
|
|
204
|
-
| a dialogue stage: backdrop, characters, expressions, speaker focus | `mwg/stage` |
|
|
205
|
-
| scenes written as a list of commands, awaited as one call | `mwg/stage` |
|
|
206
|
-
| named passages a choice can jump between, for a story that is a graph, not a line | `mwg/stage` |
|
|
210
|
+
| a dialogue stage: backdrop, characters, expressions, speaker focus | `mwg/two-d/stage` |
|
|
211
|
+
| scenes written as a list of commands, awaited as one call | `mwg/two-d/stage` |
|
|
212
|
+
| named passages a choice can jump between, for a story that is a graph, not a line | `mwg/two-d/stage` |
|
|
207
213
|
| named save slots with a preview | `mwg/core` |
|
|
208
214
|
|
|
209
215
|
### Characters, equipment and stats
|
|
@@ -220,7 +226,7 @@ rather than classes.
|
|
|
220
226
|
| modifiers from equipment, buffs and states, resolved in a stated order | `mwg/actors` |
|
|
221
227
|
| an inventory with stacking, weight and containers | `mwg/actors` |
|
|
222
228
|
| item identification, and cursed or blessed states | `mwg/actors` |
|
|
223
|
-
| a layered character sprite, so worn equipment is visible | `mwg/render` |
|
|
229
|
+
| a layered character sprite, so worn equipment is visible | `mwg/two-d/render` |
|
|
224
230
|
|
|
225
231
|
That last row is why `tools/make-example-assets.mjs` draws its character in parts. A figure
|
|
226
232
|
assembled from skin, eyes, hair and garments is one palette away from being a second
|
|
@@ -256,7 +262,7 @@ white on a hit, a room lit by a fireplace, a screen-wide tint for a night scene:
|
|
|
256
262
|
is that one operation.
|
|
257
263
|
|
|
258
264
|
Pixi's built-in `tint` is multiply-only, which can only ever darken. The additive term is
|
|
259
|
-
what `mwg/render` adds, in the batch shader rather than as a per-object filter, so it costs
|
|
265
|
+
what `mwg/two-d/render` adds, in the batch shader rather than as a per-object filter, so it costs
|
|
260
266
|
nothing per sprite. See `examples/colour-transform`.
|
|
261
267
|
|
|
262
268
|
### Why maps and events are data, not code
|
|
@@ -279,7 +285,7 @@ Supporting more than one language is mostly bookkeeping. Supporting more than on
|
|
|
279
285
|
can handle: canvas applies the Unicode bidirectional algorithm and shapes the glyphs, so
|
|
280
286
|
a label mostly comes out right once its direction is declared. The *interface* is the
|
|
281
287
|
harder half, because a right-to-left reader expects it mirrored: lists indent from the
|
|
282
|
-
right, a back arrow points the other way, a progress bar fills the other way. `mwg/ui`
|
|
288
|
+
right, a back arrow points the other way, a progress bar fills the other way. `mwg/two-d/ui`
|
|
283
289
|
lays widgets out against a direction rather than against "left" so this can be flipped,
|
|
284
290
|
and a game only has to mark which of its own icons must not be mirrored.
|
|
285
291
|
- **Vertical**, top to bottom (traditional Chinese, Japanese, Mongolian), gets no help at
|
|
@@ -310,6 +316,49 @@ play imported animation clips. `parseVox` and `createVoxModel3D` load one Magica
|
|
|
310
316
|
`loadModel3D` handles glTF/GLB.
|
|
311
317
|
Run `npm run example:3d` for the live example or `npm run benchmark:3d` for its FPS gate.
|
|
312
318
|
|
|
319
|
+
## Headless simulation
|
|
320
|
+
|
|
321
|
+
`@datamoc/mw_games/simulation` has no rendering or browser imports. It provides two
|
|
322
|
+
small runners while games keep their state, commands, rules, and event types:
|
|
323
|
+
|
|
324
|
+
- `advanceToInput(rules, budget)` runs automatic scheduled actions until an actor needs
|
|
325
|
+
input, the game finishes, the queue is empty, or the action budget is reached. Rules
|
|
326
|
+
supply `scheduler`, `finished`, `needsInput`, and `act`. `act` returns the cost to
|
|
327
|
+
charge to the current queue entry after the action, or `null` when it handled its own
|
|
328
|
+
scheduling. A `limit` result does not grant input; the caller chooses how to resume.
|
|
329
|
+
- `runScenario({ state, commands, random, step, status? })` applies a finite command
|
|
330
|
+
sequence, preserving event order and stopping when a rule returns `finished`. Each
|
|
331
|
+
rule returns `{ state, events, status: 'ready' | 'finished' }`. Results also report
|
|
332
|
+
`processedCommands`; a command need not consume a game turn.
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
import { runScenario } from '@datamoc/mw_games/simulation';
|
|
336
|
+
|
|
337
|
+
const result = runScenario({
|
|
338
|
+
state: { position: 0 },
|
|
339
|
+
commands: [1, 2, -1],
|
|
340
|
+
random: null, // This example has no randomness; supply a generator when needed.
|
|
341
|
+
step: (state, distance, _random) => ({
|
|
342
|
+
state: { position: state.position + distance },
|
|
343
|
+
events: [{ moved: distance }],
|
|
344
|
+
status: 'ready',
|
|
345
|
+
}),
|
|
346
|
+
});
|
|
347
|
+
// result.state.position === 2; result.processedCommands === 3
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
The root/standalone build also exposes these as `Simulation`. The dungeon example uses
|
|
351
|
+
the scheduled runner and shares its own damage rule between the scene and headless
|
|
352
|
+
scenario tests. Neither runner implements a game's combat, inventory, or movement rules.
|
|
353
|
+
|
|
354
|
+
For reproducibility, supply the same initial state, commands, and random state, and keep
|
|
355
|
+
rules independent of wall-clock time and ambient randomness. Existing `Generator`
|
|
356
|
+
instances expose `getState()`/`setState()`; store that state alongside a game's snapshot.
|
|
357
|
+
The runners do not clone state, serialize arbitrary graphs, or roll back a throwing rule.
|
|
358
|
+
Frame-based `core.Recorder`/`Player` remains available for UI replay; command scenarios do
|
|
359
|
+
not need a frame loop. Callers must bound automatic work inside each rule, for example
|
|
360
|
+
with `advanceToInput`.
|
|
361
|
+
|
|
313
362
|
## Roadmap
|
|
314
363
|
|
|
315
364
|
See [ROADMAP.md](ROADMAP.md) for the full, numbered build order and implementation notes.
|
package/dist/actors/Affix.d.ts
CHANGED
|
@@ -11,9 +11,22 @@ import type { InventoryItem } from './Inventory.ts';
|
|
|
11
11
|
* itself when that trigger fires, the same way `Move.effects` is data `mwg` never reads.
|
|
12
12
|
*/
|
|
13
13
|
export type AffixTrigger = 'strike' | 'defend' | 'passive';
|
|
14
|
+
/** the kind of action a `strike`/`defend` trigger fired from - melee, thrown, a bow, an ability */
|
|
15
|
+
export type AttackKind = 'melee' | 'thrown' | 'bow' | 'ability' | string;
|
|
16
|
+
/** what actually happened, for `matchesContext` to check an affix against */
|
|
17
|
+
export interface AffixContext {
|
|
18
|
+
trigger: AffixTrigger;
|
|
19
|
+
kind?: AttackKind;
|
|
20
|
+
}
|
|
14
21
|
export interface AffixDef {
|
|
15
22
|
id: string;
|
|
16
23
|
trigger: AffixTrigger;
|
|
24
|
+
/**
|
|
25
|
+
* restricts this affix to specific attack kinds within its trigger (a "bow only" affix on
|
|
26
|
+
* a `strike` trigger); omitted, the affix fires for any kind, the same as before this
|
|
27
|
+
* existed
|
|
28
|
+
*/
|
|
29
|
+
kinds?: readonly AttackKind[];
|
|
17
30
|
/** relative likelihood within its own table; 0 never rolls */
|
|
18
31
|
weight: number;
|
|
19
32
|
/** a curse locks the item (see `EquipmentSlots`' lock option) once identified */
|
|
@@ -41,4 +54,17 @@ export declare function affixOf(item: InventoryItem): string | undefined;
|
|
|
41
54
|
export declare function applyAffix(item: InventoryItem, affix: AffixDef): void;
|
|
42
55
|
/** removes an item's affix (and its curse mark, if the affix was a curse) */
|
|
43
56
|
export declare function removeAffix(item: InventoryItem): void;
|
|
57
|
+
/**
|
|
58
|
+
* Copies `from`'s affix (and curse mark) onto `to`, replacing whatever `to` already had -
|
|
59
|
+
* "transfer" an enchantment or rune between item instances. Clears `to`'s affix when `from`
|
|
60
|
+
* carries none. A true transfer (move rather than copy) is this plus `removeAffix(from)`,
|
|
61
|
+
* left to the caller rather than a second near-identical function.
|
|
62
|
+
*/
|
|
63
|
+
export declare function copyAffix(from: InventoryItem, to: InventoryItem): void;
|
|
64
|
+
/**
|
|
65
|
+
* Whether `affix` should fire for `context`: the trigger must match, and when the affix
|
|
66
|
+
* restricts itself to specific attack `kinds`, `context.kind` must be one of them. An affix
|
|
67
|
+
* with no `kinds` fires for any attack kind, unchanged from before this existed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function matchesContext(affix: AffixDef, context: AffixContext): boolean;
|
|
44
70
|
//# sourceMappingURL=Affix.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Affix.d.ts","sourceRoot":"","sources":["../../src/actors/Affix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,YAAY,CAAC;IAEtB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IAEf,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,GAAG,IAAI,CAK5D;AAED,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"Affix.d.ts","sourceRoot":"","sources":["../../src/actors/Affix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,mGAAmG;AACnG,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzE,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,YAAY,CAAC;IAEtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAE9B,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IAEf,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,GAAG,IAAI,CAK5D;AAED,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAOrE;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAGrD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,aAAa,GAAG,IAAI,CAOtE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAI9E"}
|
package/dist/actors/Affix.js
CHANGED
|
@@ -10,7 +10,7 @@ export function rollAffix(table) {
|
|
|
10
10
|
if (live.length === 0)
|
|
11
11
|
return null;
|
|
12
12
|
const index = Random.weighted(live.map((entry) => entry.weight));
|
|
13
|
-
return index ===
|
|
13
|
+
return index === null ? null : live[index];
|
|
14
14
|
}
|
|
15
15
|
/** the affix an item carries, if any - stored on the item next to its upgrade `level` */
|
|
16
16
|
export function affixOf(item) {
|
|
@@ -22,9 +22,14 @@ export function affixOf(item) {
|
|
|
22
22
|
* wiring them separately.
|
|
23
23
|
*/
|
|
24
24
|
export function applyAffix(item, affix) {
|
|
25
|
+
const hadAffix = item.affix !== undefined;
|
|
25
26
|
item.affix = affix.id;
|
|
27
|
+
// The curse bit belongs to the affix currently installed. Replacing a cursed
|
|
28
|
+
// affix with a benign one must not leave the item permanently cursed.
|
|
26
29
|
if (affix.curse)
|
|
27
30
|
item.cursed = true;
|
|
31
|
+
else if (hadAffix)
|
|
32
|
+
item.cursed = false;
|
|
28
33
|
}
|
|
29
34
|
/** removes an item's affix (and its curse mark, if the affix was a curse) */
|
|
30
35
|
export function removeAffix(item) {
|
|
@@ -32,4 +37,30 @@ export function removeAffix(item) {
|
|
|
32
37
|
item.cursed = false;
|
|
33
38
|
delete item.affix;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Copies `from`'s affix (and curse mark) onto `to`, replacing whatever `to` already had -
|
|
42
|
+
* "transfer" an enchantment or rune between item instances. Clears `to`'s affix when `from`
|
|
43
|
+
* carries none. A true transfer (move rather than copy) is this plus `removeAffix(from)`,
|
|
44
|
+
* left to the caller rather than a second near-identical function.
|
|
45
|
+
*/
|
|
46
|
+
export function copyAffix(from, to) {
|
|
47
|
+
if (from.affix === undefined) {
|
|
48
|
+
removeAffix(to);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
to.affix = from.affix;
|
|
52
|
+
to.cursed = from.cursed ?? false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether `affix` should fire for `context`: the trigger must match, and when the affix
|
|
56
|
+
* restricts itself to specific attack `kinds`, `context.kind` must be one of them. An affix
|
|
57
|
+
* with no `kinds` fires for any attack kind, unchanged from before this existed.
|
|
58
|
+
*/
|
|
59
|
+
export function matchesContext(affix, context) {
|
|
60
|
+
if (affix.trigger !== context.trigger)
|
|
61
|
+
return false;
|
|
62
|
+
if (affix.kinds && (context.kind === undefined || !affix.kinds.includes(context.kind)))
|
|
63
|
+
return false;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
35
66
|
//# sourceMappingURL=Affix.js.map
|
package/dist/actors/Affix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Affix.js","sourceRoot":"","sources":["../../src/actors/Affix.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Affix.js","sourceRoot":"","sources":["../../src/actors/Affix.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAmD5C;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAiB;IAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,OAAO,CAAC,IAAmB;IAC1C,OAAO,IAAI,CAAC,KAAK,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAmB,EAAE,KAAe;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;IACtB,8EAA8E;IAC9E,sEAAsE;IACtE,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SAC/B,IAAI,QAAQ;QAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;AACxC,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,WAAW,CAAC,IAAmB;IAC9C,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IAClD,OAAO,IAAI,CAAC,KAAK,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAmB,EAAE,EAAiB;IAC/D,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,WAAW,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO;IACR,CAAC;IACD,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACtB,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAe,EAAE,OAAqB;IACpE,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrG,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shield/barrier pool absorbed before HP, decaying on its own each tick unlike a plain
|
|
3
|
+
* `StatBlock` stat, which only ever changes when something explicitly touches it. Several
|
|
4
|
+
* layers can be held at once - a fresh cast over an older one, a ward stacked on a shield -
|
|
5
|
+
* absorption always drains the most recently added layer first, so a ward cast on top of a
|
|
6
|
+
* standing shield breaks before the shield underneath it does, matching how a layered proc
|
|
7
|
+
* family (barrier-then-shield, shield-then-barrier) is meant to read regardless of order cast.
|
|
8
|
+
*/
|
|
9
|
+
export interface BarrierLayer {
|
|
10
|
+
amount: number;
|
|
11
|
+
/** how much this layer's `amount` drops per turn advanced; 0 (the default) never decays on its own */
|
|
12
|
+
decayPerTick?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class Barrier {
|
|
15
|
+
private layers;
|
|
16
|
+
/** adds a new outermost layer; a non-positive amount is a no-op rather than an empty layer */
|
|
17
|
+
add(amount: number, decayPerTick?: number): void;
|
|
18
|
+
/** total absorption currently held, across every layer */
|
|
19
|
+
get total(): number;
|
|
20
|
+
/** how many independent layers are currently held */
|
|
21
|
+
get layerCount(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Absorbs up to `amount` of incoming damage, draining the outermost layer first and
|
|
24
|
+
* spilling into the next one once a layer empties.
|
|
25
|
+
*
|
|
26
|
+
* @returns the amount actually absorbed - never more than `amount`, never more than
|
|
27
|
+
* `total` was before the call - so the caller applies `amount - absorbed` to HP
|
|
28
|
+
*/
|
|
29
|
+
absorb(amount: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* Decays every layer by its own `decayPerTick`, removing any that reach zero or below.
|
|
32
|
+
*
|
|
33
|
+
* Named `advance(turns)` like every other turn-scale ticker here (`TurnClock`, `Charges`,
|
|
34
|
+
* `Field`, `AbilityCycle`) rather than `decay`, so one word means one thing across the
|
|
35
|
+
* framework: `advance` takes whole turns, `update` takes `dt` seconds.
|
|
36
|
+
*/
|
|
37
|
+
advance(turns?: number): void;
|
|
38
|
+
/** drops every layer at once - a dispel, a fresh encounter starting clean */
|
|
39
|
+
clear(): void;
|
|
40
|
+
toJSON(): {
|
|
41
|
+
layers: BarrierLayer[];
|
|
42
|
+
};
|
|
43
|
+
static fromJSON(data: {
|
|
44
|
+
layers: BarrierLayer[];
|
|
45
|
+
}): Barrier;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=Barrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Barrier.d.ts","sourceRoot":"","sources":["../../src/actors/Barrier.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IAEf,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,OAAO;IACnB,OAAO,CAAC,MAAM,CAAsB;IAEpC,8FAA8F;IAC9F,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,SAAI,GAAG,IAAI,CAG1C;IAED,0DAA0D;IAC1D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,qDAAqD;IACrD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAY7B;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,SAAI,GAAG,IAAI,CAOvB;IAED,6EAA6E;IAC7E,KAAK,IAAI,IAAI,CAEZ;IAED,MAAM,IAAI;QAAE,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAEnC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,GAAG,OAAO,CAIzD;CACD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export class Barrier {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.layers = [];
|
|
4
|
+
}
|
|
5
|
+
/** adds a new outermost layer; a non-positive amount is a no-op rather than an empty layer */
|
|
6
|
+
add(amount, decayPerTick = 0) {
|
|
7
|
+
if (amount <= 0)
|
|
8
|
+
return;
|
|
9
|
+
this.layers.push({ amount, decayPerTick });
|
|
10
|
+
}
|
|
11
|
+
/** total absorption currently held, across every layer */
|
|
12
|
+
get total() {
|
|
13
|
+
return this.layers.reduce((sum, layer) => sum + layer.amount, 0);
|
|
14
|
+
}
|
|
15
|
+
/** how many independent layers are currently held */
|
|
16
|
+
get layerCount() {
|
|
17
|
+
return this.layers.length;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Absorbs up to `amount` of incoming damage, draining the outermost layer first and
|
|
21
|
+
* spilling into the next one once a layer empties.
|
|
22
|
+
*
|
|
23
|
+
* @returns the amount actually absorbed - never more than `amount`, never more than
|
|
24
|
+
* `total` was before the call - so the caller applies `amount - absorbed` to HP
|
|
25
|
+
*/
|
|
26
|
+
absorb(amount) {
|
|
27
|
+
let remaining = amount;
|
|
28
|
+
let absorbed = 0;
|
|
29
|
+
while (remaining > 0 && this.layers.length > 0) {
|
|
30
|
+
const layer = this.layers[this.layers.length - 1];
|
|
31
|
+
const take = Math.min(layer.amount, remaining);
|
|
32
|
+
layer.amount -= take;
|
|
33
|
+
remaining -= take;
|
|
34
|
+
absorbed += take;
|
|
35
|
+
if (layer.amount <= 0)
|
|
36
|
+
this.layers.pop();
|
|
37
|
+
}
|
|
38
|
+
return absorbed;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Decays every layer by its own `decayPerTick`, removing any that reach zero or below.
|
|
42
|
+
*
|
|
43
|
+
* Named `advance(turns)` like every other turn-scale ticker here (`TurnClock`, `Charges`,
|
|
44
|
+
* `Field`, `AbilityCycle`) rather than `decay`, so one word means one thing across the
|
|
45
|
+
* framework: `advance` takes whole turns, `update` takes `dt` seconds.
|
|
46
|
+
*/
|
|
47
|
+
advance(turns = 1) {
|
|
48
|
+
for (let i = this.layers.length - 1; i >= 0; i--) {
|
|
49
|
+
const layer = this.layers[i];
|
|
50
|
+
if (!layer.decayPerTick)
|
|
51
|
+
continue;
|
|
52
|
+
layer.amount -= layer.decayPerTick * turns;
|
|
53
|
+
if (layer.amount <= 0)
|
|
54
|
+
this.layers.splice(i, 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** drops every layer at once - a dispel, a fresh encounter starting clean */
|
|
58
|
+
clear() {
|
|
59
|
+
this.layers = [];
|
|
60
|
+
}
|
|
61
|
+
toJSON() {
|
|
62
|
+
return { layers: this.layers.map((layer) => ({ ...layer })) };
|
|
63
|
+
}
|
|
64
|
+
static fromJSON(data) {
|
|
65
|
+
const barrier = new Barrier();
|
|
66
|
+
barrier.layers = data.layers.map((layer) => ({ ...layer }));
|
|
67
|
+
return barrier;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=Barrier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Barrier.js","sourceRoot":"","sources":["../../src/actors/Barrier.ts"],"names":[],"mappings":"AAeA,MAAM,OAAO,OAAO;IAApB;QACS,WAAM,GAAmB,EAAE,CAAC;IAqErC,CAAC;IAnEA,8FAA8F;IAC9F,GAAG,CAAC,MAAc,EAAE,YAAY,GAAG,CAAC;QACnC,IAAI,MAAM,IAAI,CAAC;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,0DAA0D;IAC1D,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,qDAAqD;IACrD,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAc;QACpB,IAAI,SAAS,GAAG,MAAM,CAAC;QACvB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,OAAO,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,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gC;QAC/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;QAC5D,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
|
package/dist/actors/Charges.d.ts
CHANGED
|
@@ -25,7 +25,29 @@ export declare class Charges {
|
|
|
25
25
|
canAfford(cost: number): boolean;
|
|
26
26
|
/** @returns false, spending nothing, if `cost` is not affordable right now */
|
|
27
27
|
spend(cost: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Restores charges directly, outside the normal regen path - a killing blow or a crit
|
|
30
|
+
* refunding one on the spot. Capped at `max`.
|
|
31
|
+
*
|
|
32
|
+
* @returns how many were actually added, which is less than `amount` once `max` is hit
|
|
33
|
+
*/
|
|
34
|
+
refund(amount?: number): number;
|
|
28
35
|
/** banks `turns` of regeneration time, converting whole `regenRate`-sized chunks into charges */
|
|
29
36
|
advance(turns?: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Charges held, and progress banked towards the next one.
|
|
39
|
+
*
|
|
40
|
+
* The banked progress matters as much as the count: without it, saving and loading part
|
|
41
|
+
* way to a recharge would silently reset that wait, so a player could refresh a wand a
|
|
42
|
+
* little faster by reloading. `max` and `regenRate` are definitions, supplied fresh.
|
|
43
|
+
*/
|
|
44
|
+
toJSON(): {
|
|
45
|
+
current: number;
|
|
46
|
+
progress: number;
|
|
47
|
+
};
|
|
48
|
+
static fromJSON(options: ChargesOptions, data: {
|
|
49
|
+
current: number;
|
|
50
|
+
progress: number;
|
|
51
|
+
}): Charges;
|
|
30
52
|
}
|
|
31
53
|
//# sourceMappingURL=Charges.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charges.d.ts","sourceRoot":"","sources":["../../src/actors/Charges.ts"],"names":[],"mappings":"A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,CAI3B;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,SAAI,GAAG,MAAM,CAIzB;IAED,iGAAiG;IACjG,OAAO,CAAC,KAAK,SAAI,GAAG,IAAI,CAWvB;IAED;;;;;;OAMG;IACH,MAAM,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAE9C;IAED,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAI7F;CACD"}
|
package/dist/actors/Charges.js
CHANGED
|
@@ -18,6 +18,17 @@ export class Charges {
|
|
|
18
18
|
this.value -= cost;
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Restores charges directly, outside the normal regen path - a killing blow or a crit
|
|
23
|
+
* refunding one on the spot. Capped at `max`.
|
|
24
|
+
*
|
|
25
|
+
* @returns how many were actually added, which is less than `amount` once `max` is hit
|
|
26
|
+
*/
|
|
27
|
+
refund(amount = 1) {
|
|
28
|
+
const added = Math.min(amount, this.max - this.value);
|
|
29
|
+
this.value += added;
|
|
30
|
+
return added;
|
|
31
|
+
}
|
|
21
32
|
/** banks `turns` of regeneration time, converting whole `regenRate`-sized chunks into charges */
|
|
22
33
|
advance(turns = 1) {
|
|
23
34
|
if (this.value >= this.max)
|
|
@@ -31,5 +42,20 @@ export class Charges {
|
|
|
31
42
|
if (this.value >= this.max)
|
|
32
43
|
this.progress = 0;
|
|
33
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Charges held, and progress banked towards the next one.
|
|
47
|
+
*
|
|
48
|
+
* The banked progress matters as much as the count: without it, saving and loading part
|
|
49
|
+
* way to a recharge would silently reset that wait, so a player could refresh a wand a
|
|
50
|
+
* little faster by reloading. `max` and `regenRate` are definitions, supplied fresh.
|
|
51
|
+
*/
|
|
52
|
+
toJSON() {
|
|
53
|
+
return { current: this.value, progress: this.progress };
|
|
54
|
+
}
|
|
55
|
+
static fromJSON(options, data) {
|
|
56
|
+
const charges = new Charges({ ...options, current: data.current });
|
|
57
|
+
charges.progress = data.progress;
|
|
58
|
+
return charges;
|
|
59
|
+
}
|
|
34
60
|
}
|
|
35
61
|
//# sourceMappingURL=Charges.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charges.js","sourceRoot":"","sources":["../../src/actors/Charges.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,OAAO;IAMnB,YAAY,OAAuB;QAF3B,aAAQ,GAAG,CAAC,CAAC;QAGpB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAC7C,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,SAAS,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,8EAA8E;IAC9E,KAAK,CAAC,IAAY;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACxC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,iGAAiG;IACjG,OAAO,CAAC,KAAK,GAAG,CAAC;QAChB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG;YAAE,OAAO;QAEnC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACjE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AAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG;YAAE,OAAO;QAEnC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACjE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;QAED,qFAAqF;QACrF,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG;YAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACL,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,OAAuB,EAAE,IAA2C;QACnF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
|
|
@@ -32,9 +32,39 @@ export declare class EquipmentSlots<Slot extends string, Item extends Equippable
|
|
|
32
32
|
* changing anything when the slot is locked
|
|
33
33
|
*/
|
|
34
34
|
equip(slot: Slot, item: Item): Item | undefined;
|
|
35
|
+
/** puts an item on and applies its modifiers, with no lock check - the shared half of `equip` and `fromJSON` */
|
|
36
|
+
private wear;
|
|
35
37
|
/** @returns the removed item, or undefined for an empty slot - or a locked one, which stays put */
|
|
36
38
|
unequip(slot: Slot): Item | undefined;
|
|
37
39
|
get slots(): readonly Slot[];
|
|
38
40
|
private assertSlot;
|
|
41
|
+
/**
|
|
42
|
+
* Which slot holds which item, by whatever id `identify` gives each one.
|
|
43
|
+
*
|
|
44
|
+
* An item is a game's own object here (`Item` is a type parameter, and `EquippableItem`
|
|
45
|
+
* requires only `modifiers`), so this framework has no idea what identifies one. The
|
|
46
|
+
* caller says, usually with the same id its item table is keyed by.
|
|
47
|
+
*/
|
|
48
|
+
toJSON(identify: (item: Item) => string): SavedEquipment<Slot>;
|
|
49
|
+
/**
|
|
50
|
+
* Rebuilds the slots and re-equips everything, so each item's modifiers land back on the
|
|
51
|
+
* `StatBlock` exactly as they were.
|
|
52
|
+
*
|
|
53
|
+
* That reapplication is the point: `StatBlock.toJSON` deliberately saves no modifiers,
|
|
54
|
+
* precisely because whatever applied them puts them back on load. A locked item is
|
|
55
|
+
* restored rather than refused - a cursed ring the character was already wearing is still
|
|
56
|
+
* on their finger after a reload, and `equip`'s refusal is about *putting one on*, which
|
|
57
|
+
* is not what this is doing.
|
|
58
|
+
*/
|
|
59
|
+
static fromJSON<Slot extends string, Item extends EquippableItem>(defs: {
|
|
60
|
+
slots: readonly Slot[];
|
|
61
|
+
/** turns a saved id back into the game's own item object */
|
|
62
|
+
resolve: (id: string) => Item;
|
|
63
|
+
stats?: StatBlock | null;
|
|
64
|
+
locked?: (slot: Slot, item: Item) => boolean;
|
|
65
|
+
}, data: SavedEquipment<Slot>): EquipmentSlots<Slot, Item>;
|
|
66
|
+
}
|
|
67
|
+
export interface SavedEquipment<Slot extends string> {
|
|
68
|
+
worn: [Slot, string][];
|
|
39
69
|
}
|
|
40
70
|
//# sourceMappingURL=Equipment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Equipment.d.ts","sourceRoot":"","sources":["../../src/actors/Equipment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC9B,oFAAoF;IACpF,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB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EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;KAC7C,EACD,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,GACxB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAQ5B;CACD;AAED,MAAM,WAAW,cAAc,CAAC,IAAI,SAAS,MAAM;IAClD,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACvB"}
|
package/dist/actors/Equipment.js
CHANGED
|
@@ -29,11 +29,15 @@ export class EquipmentSlots {
|
|
|
29
29
|
if (this.isLocked(slot))
|
|
30
30
|
return undefined;
|
|
31
31
|
const previous = this.unequip(slot);
|
|
32
|
+
this.wear(slot, item);
|
|
33
|
+
return previous;
|
|
34
|
+
}
|
|
35
|
+
/** puts an item on and applies its modifiers, with no lock check - the shared half of `equip` and `fromJSON` */
|
|
36
|
+
wear(slot, item) {
|
|
32
37
|
this.worn.set(slot, item);
|
|
33
38
|
for (const modifier of item.modifiers ?? []) {
|
|
34
39
|
this.stats?.addModifier({ ...modifier, source: item });
|
|
35
40
|
}
|
|
36
|
-
return previous;
|
|
37
41
|
}
|
|
38
42
|
/** @returns the removed item, or undefined for an empty slot - or a locked one, which stays put */
|
|
39
43
|
unequip(slot) {
|
|
@@ -53,5 +57,33 @@ export class EquipmentSlots {
|
|
|
53
57
|
if (!this.names.has(slot))
|
|
54
58
|
throw new Error(`no such equipment slot: "${slot}"`);
|
|
55
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Which slot holds which item, by whatever id `identify` gives each one.
|
|
62
|
+
*
|
|
63
|
+
* An item is a game's own object here (`Item` is a type parameter, and `EquippableItem`
|
|
64
|
+
* requires only `modifiers`), so this framework has no idea what identifies one. The
|
|
65
|
+
* caller says, usually with the same id its item table is keyed by.
|
|
66
|
+
*/
|
|
67
|
+
toJSON(identify) {
|
|
68
|
+
return { worn: [...this.worn].map(([slot, item]) => [slot, identify(item)]) };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Rebuilds the slots and re-equips everything, so each item's modifiers land back on the
|
|
72
|
+
* `StatBlock` exactly as they were.
|
|
73
|
+
*
|
|
74
|
+
* That reapplication is the point: `StatBlock.toJSON` deliberately saves no modifiers,
|
|
75
|
+
* precisely because whatever applied them puts them back on load. A locked item is
|
|
76
|
+
* restored rather than refused - a cursed ring the character was already wearing is still
|
|
77
|
+
* on their finger after a reload, and `equip`'s refusal is about *putting one on*, which
|
|
78
|
+
* is not what this is doing.
|
|
79
|
+
*/
|
|
80
|
+
static fromJSON(defs, data) {
|
|
81
|
+
const equipment = new EquipmentSlots(defs.slots, defs.stats ?? null, { locked: defs.locked });
|
|
82
|
+
for (const [slot, id] of data.worn) {
|
|
83
|
+
equipment.assertSlot(slot);
|
|
84
|
+
equipment.wear(slot, defs.resolve(id));
|
|
85
|
+
}
|
|
86
|
+
return equipment;
|
|
87
|
+
}
|
|
56
88
|
}
|
|
57
89
|
//# sourceMappingURL=Equipment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Equipment.js","sourceRoot":"","sources":["../../src/actors/Equipment.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IAM1B,YAAY,KAAsB,EAAE,KAAK,GAAqB,IAAI,EAAE,OAAO,GAAiC,EAAE;QAJtG,SAAI,GAAG,IAAI,GAAG,EAAc,CAAC;QAKpC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,GAAG,CAAC,IAAU;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,4JAA4J;IAC5J,QAAQ,CAAC,IAAU;QAClB,MAAM,I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