playlist-data-engine 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +352 -0
- package/dist/__vite-browser-external-DYxpcVy9.js +4 -0
- package/dist/constants/DefaultClasses.d.ts +46 -0
- package/dist/constants/DefaultClasses.d.ts.map +1 -0
- package/dist/constants/DefaultEnchantments.d.ts +337 -0
- package/dist/constants/DefaultEnchantments.d.ts.map +1 -0
- package/dist/constants/DefaultEnemies.d.ts +83 -0
- package/dist/constants/DefaultEnemies.d.ts.map +1 -0
- package/dist/constants/DefaultEquipment.d.ts +23 -0
- package/dist/constants/DefaultEquipment.d.ts.map +1 -0
- package/dist/constants/DefaultFeatures.d.ts +22 -0
- package/dist/constants/DefaultFeatures.d.ts.map +1 -0
- package/dist/constants/DefaultRaces.d.ts +102 -0
- package/dist/constants/DefaultRaces.d.ts.map +1 -0
- package/dist/constants/DefaultSkills.d.ts +26 -0
- package/dist/constants/DefaultSkills.d.ts.map +1 -0
- package/dist/constants/DefaultSpells.d.ts +41 -0
- package/dist/constants/DefaultSpells.d.ts.map +1 -0
- package/dist/constants/EncounterBalance.d.ts +208 -0
- package/dist/constants/EncounterBalance.d.ts.map +1 -0
- package/dist/constants/EnemyEquipment.d.ts +71 -0
- package/dist/constants/EnemyEquipment.d.ts.map +1 -0
- package/dist/constants/EnemyRarity.d.ts +79 -0
- package/dist/constants/EnemyRarity.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Construct.d.ts +63 -0
- package/dist/constants/EnemyTemplates/Construct.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Dragon.d.ts +68 -0
- package/dist/constants/EnemyTemplates/Dragon.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Elemental.d.ts +64 -0
- package/dist/constants/EnemyTemplates/Elemental.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Fiend.d.ts +62 -0
- package/dist/constants/EnemyTemplates/Fiend.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Monstrosity.d.ts +63 -0
- package/dist/constants/EnemyTemplates/Monstrosity.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Undead.d.ts +61 -0
- package/dist/constants/EnemyTemplates/Undead.d.ts.map +1 -0
- package/dist/constants/ItemTemplates.d.ts +40 -0
- package/dist/constants/ItemTemplates.d.ts.map +1 -0
- package/dist/constants/MagicItems.d.ts +30 -0
- package/dist/constants/MagicItems.d.ts.map +1 -0
- package/dist/constants/SpellSlots.d.ts +30 -0
- package/dist/constants/SpellSlots.d.ts.map +1 -0
- package/dist/constants/StatScaling.d.ts +113 -0
- package/dist/constants/StatScaling.d.ts.map +1 -0
- package/dist/core/analysis/AudioAnalyzer.d.ts +599 -0
- package/dist/core/analysis/AudioAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/ColorExtractor.d.ts +64 -0
- package/dist/core/analysis/ColorExtractor.d.ts.map +1 -0
- package/dist/core/analysis/EssentiaPitchDetector.d.ts +282 -0
- package/dist/core/analysis/EssentiaPitchDetector.d.ts.map +1 -0
- package/dist/core/analysis/LevelSerializer.d.ts +265 -0
- package/dist/core/analysis/LevelSerializer.d.ts.map +1 -0
- package/dist/core/analysis/MelodyContourAnalyzer.d.ts +283 -0
- package/dist/core/analysis/MelodyContourAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/MultiBandAnalyzer.d.ts +214 -0
- package/dist/core/analysis/MultiBandAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/MusicClassifier.d.ts +524 -0
- package/dist/core/analysis/MusicClassifier.d.ts.map +1 -0
- package/dist/core/analysis/PitchAnalyzer.d.ts +266 -0
- package/dist/core/analysis/PitchAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/PitchDetector.d.ts +251 -0
- package/dist/core/analysis/PitchDetector.d.ts.map +1 -0
- package/dist/core/analysis/SpectrumScanner.d.ts +52 -0
- package/dist/core/analysis/SpectrumScanner.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatInterpolator.d.ts +477 -0
- package/dist/core/analysis/beat/BeatInterpolator.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatMapGenerator.d.ts +170 -0
- package/dist/core/analysis/beat/BeatMapGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatStream.d.ts +316 -0
- package/dist/core/analysis/beat/BeatStream.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatSubdivider.d.ts +205 -0
- package/dist/core/analysis/beat/BeatSubdivider.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatTracker.d.ts +137 -0
- package/dist/core/analysis/beat/BeatTracker.d.ts.map +1 -0
- package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts +180 -0
- package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/DensityAnalyzer.d.ts +246 -0
- package/dist/core/analysis/beat/DensityAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts +1082 -0
- package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/GrooveAnalyzer.d.ts +192 -0
- package/dist/core/analysis/beat/GrooveAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts +133 -0
- package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts.map +1 -0
- package/dist/core/analysis/beat/PhraseAnalyzer.d.ts +230 -0
- package/dist/core/analysis/beat/PhraseAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/RhythmQuantizer.d.ts +399 -0
- package/dist/core/analysis/beat/RhythmQuantizer.d.ts.map +1 -0
- package/dist/core/analysis/beat/RhythmicBalancer.d.ts +262 -0
- package/dist/core/analysis/beat/RhythmicBalancer.d.ts.map +1 -0
- package/dist/core/analysis/beat/StreamScorer.d.ts +275 -0
- package/dist/core/analysis/beat/StreamScorer.d.ts.map +1 -0
- package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts +256 -0
- package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts.map +1 -0
- package/dist/core/analysis/beat/TempoDetector.d.ts +220 -0
- package/dist/core/analysis/beat/TempoDetector.d.ts.map +1 -0
- package/dist/core/analysis/beat/TransientDetector.d.ts +303 -0
- package/dist/core/analysis/beat/TransientDetector.d.ts.map +1 -0
- package/dist/core/analysis/beat/beatKeyHelpers.d.ts +180 -0
- package/dist/core/analysis/beat/beatKeyHelpers.d.ts.map +1 -0
- package/dist/core/analysis/beat/index.d.ts +41 -0
- package/dist/core/analysis/beat/index.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/audioUtils.d.ts +204 -0
- package/dist/core/analysis/beat/utils/audioUtils.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts +404 -0
- package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts +61 -0
- package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts +33 -0
- package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts.map +1 -0
- package/dist/core/analysis/index.d.ts +18 -0
- package/dist/core/analysis/index.d.ts.map +1 -0
- package/dist/core/combat/AI/AICombatRunner.d.ts +108 -0
- package/dist/core/combat/AI/AICombatRunner.d.ts.map +1 -0
- package/dist/core/combat/AI/CombatAI.d.ts +179 -0
- package/dist/core/combat/AI/CombatAI.d.ts.map +1 -0
- package/dist/core/combat/AI/CombatMetricsTracker.d.ts +30 -0
- package/dist/core/combat/AI/CombatMetricsTracker.d.ts.map +1 -0
- package/dist/core/combat/Analysis/BalanceValidator.d.ts +170 -0
- package/dist/core/combat/Analysis/BalanceValidator.d.ts.map +1 -0
- package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts +231 -0
- package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts.map +1 -0
- package/dist/core/combat/Analysis/DifficultyCalculator.d.ts +203 -0
- package/dist/core/combat/Analysis/DifficultyCalculator.d.ts.map +1 -0
- package/dist/core/combat/Analysis/ParameterSweep.d.ts +201 -0
- package/dist/core/combat/Analysis/ParameterSweep.d.ts.map +1 -0
- package/dist/core/combat/AttackResolver.d.ts +220 -0
- package/dist/core/combat/AttackResolver.d.ts.map +1 -0
- package/dist/core/combat/CombatEngine.d.ts +388 -0
- package/dist/core/combat/CombatEngine.d.ts.map +1 -0
- package/dist/core/combat/DiceRoller.d.ts +115 -0
- package/dist/core/combat/DiceRoller.d.ts.map +1 -0
- package/dist/core/combat/InitiativeRoller.d.ts +62 -0
- package/dist/core/combat/InitiativeRoller.d.ts.map +1 -0
- package/dist/core/combat/PartyAnalyzer.d.ts +215 -0
- package/dist/core/combat/PartyAnalyzer.d.ts.map +1 -0
- package/dist/core/combat/SeededDiceRoller.d.ts +120 -0
- package/dist/core/combat/SeededDiceRoller.d.ts.map +1 -0
- package/dist/core/combat/Simulation/CombatSimulator.d.ts +366 -0
- package/dist/core/combat/Simulation/CombatSimulator.d.ts.map +1 -0
- package/dist/core/combat/SpellCaster.d.ts +113 -0
- package/dist/core/combat/SpellCaster.d.ts.map +1 -0
- package/dist/core/config/index.d.ts +24 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/progressionConfig.d.ts +73 -0
- package/dist/core/config/progressionConfig.d.ts.map +1 -0
- package/dist/core/config/sensorConfig.d.ts +134 -0
- package/dist/core/config/sensorConfig.d.ts.map +1 -0
- package/dist/core/equipment/BoxOpener.d.ts +175 -0
- package/dist/core/equipment/BoxOpener.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentEffectApplier.d.ts +189 -0
- package/dist/core/equipment/EquipmentEffectApplier.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentModifier.d.ts +327 -0
- package/dist/core/equipment/EquipmentModifier.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentSpawnHelper.d.ts +246 -0
- package/dist/core/equipment/EquipmentSpawnHelper.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentValidator.d.ts +173 -0
- package/dist/core/equipment/EquipmentValidator.d.ts.map +1 -0
- package/dist/core/extensions/ExtensionManager.d.ts +517 -0
- package/dist/core/extensions/ExtensionManager.d.ts.map +1 -0
- package/dist/core/extensions/WeightedSelector.d.ts +156 -0
- package/dist/core/extensions/WeightedSelector.d.ts.map +1 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/initializeDefaults.d.ts +170 -0
- package/dist/core/extensions/initializeDefaults.d.ts.map +1 -0
- package/dist/core/features/FeatureEffectApplier.d.ts +102 -0
- package/dist/core/features/FeatureEffectApplier.d.ts.map +1 -0
- package/dist/core/features/FeatureQuery.d.ts +368 -0
- package/dist/core/features/FeatureQuery.d.ts.map +1 -0
- package/dist/core/features/FeatureTypes.d.ts +199 -0
- package/dist/core/features/FeatureTypes.d.ts.map +1 -0
- package/dist/core/features/FeatureValidator.d.ts +149 -0
- package/dist/core/features/FeatureValidator.d.ts.map +1 -0
- package/dist/core/features/index.d.ts +12 -0
- package/dist/core/features/index.d.ts.map +1 -0
- package/dist/core/generation/AbilityScoreCalculator.d.ts +83 -0
- package/dist/core/generation/AbilityScoreCalculator.d.ts.map +1 -0
- package/dist/core/generation/AppearanceGenerator.d.ts +32 -0
- package/dist/core/generation/AppearanceGenerator.d.ts.map +1 -0
- package/dist/core/generation/BeatConverter.d.ts +127 -0
- package/dist/core/generation/BeatConverter.d.ts.map +1 -0
- package/dist/core/generation/ButtonMapper.d.ts +346 -0
- package/dist/core/generation/ButtonMapper.d.ts.map +1 -0
- package/dist/core/generation/ButtonPatternLibrary.d.ts +92 -0
- package/dist/core/generation/ButtonPatternLibrary.d.ts.map +1 -0
- package/dist/core/generation/CRLevelConverter.d.ts +242 -0
- package/dist/core/generation/CRLevelConverter.d.ts.map +1 -0
- package/dist/core/generation/CharacterGenerator.d.ts +194 -0
- package/dist/core/generation/CharacterGenerator.d.ts.map +1 -0
- package/dist/core/generation/ClassSuggester.d.ts +184 -0
- package/dist/core/generation/ClassSuggester.d.ts.map +1 -0
- package/dist/core/generation/EnemyEquipmentGenerator.d.ts +151 -0
- package/dist/core/generation/EnemyEquipmentGenerator.d.ts.map +1 -0
- package/dist/core/generation/EnemyGenerator.d.ts +595 -0
- package/dist/core/generation/EnemyGenerator.d.ts.map +1 -0
- package/dist/core/generation/EquipmentGenerator.d.ts +204 -0
- package/dist/core/generation/EquipmentGenerator.d.ts.map +1 -0
- package/dist/core/generation/LegendaryGenerator.d.ts +213 -0
- package/dist/core/generation/LegendaryGenerator.d.ts.map +1 -0
- package/dist/core/generation/LevelGenerator.d.ts +390 -0
- package/dist/core/generation/LevelGenerator.d.ts.map +1 -0
- package/dist/core/generation/NamingEngine.d.ts +136 -0
- package/dist/core/generation/NamingEngine.d.ts.map +1 -0
- package/dist/core/generation/PitchBeatLinker.d.ts +150 -0
- package/dist/core/generation/PitchBeatLinker.d.ts.map +1 -0
- package/dist/core/generation/RaceSelector.d.ts +58 -0
- package/dist/core/generation/RaceSelector.d.ts.map +1 -0
- package/dist/core/generation/RhythmGenerator.d.ts +597 -0
- package/dist/core/generation/RhythmGenerator.d.ts.map +1 -0
- package/dist/core/generation/SkillAssigner.d.ts +78 -0
- package/dist/core/generation/SkillAssigner.d.ts.map +1 -0
- package/dist/core/generation/SpellManager.d.ts +132 -0
- package/dist/core/generation/SpellManager.d.ts.map +1 -0
- package/dist/core/generation/SpellcastingGenerator.d.ts +255 -0
- package/dist/core/generation/SpellcastingGenerator.d.ts.map +1 -0
- package/dist/core/generation/index.d.ts +41 -0
- package/dist/core/generation/index.d.ts.map +1 -0
- package/dist/core/parser/MetadataExtractor.d.ts +66 -0
- package/dist/core/parser/MetadataExtractor.d.ts.map +1 -0
- package/dist/core/parser/PlaylistParser.d.ts +45 -0
- package/dist/core/parser/PlaylistParser.d.ts.map +1 -0
- package/dist/core/playback/SubdivisionPlaybackController.d.ts +333 -0
- package/dist/core/playback/SubdivisionPlaybackController.d.ts.map +1 -0
- package/dist/core/playback/index.d.ts +5 -0
- package/dist/core/playback/index.d.ts.map +1 -0
- package/dist/core/progression/CharacterUpdater.d.ts +203 -0
- package/dist/core/progression/CharacterUpdater.d.ts.map +1 -0
- package/dist/core/progression/LevelUpProcessor.d.ts +234 -0
- package/dist/core/progression/LevelUpProcessor.d.ts.map +1 -0
- package/dist/core/progression/PrestigeSystem.d.ts +217 -0
- package/dist/core/progression/PrestigeSystem.d.ts.map +1 -0
- package/dist/core/progression/RhythmXPCalculator.d.ts +182 -0
- package/dist/core/progression/RhythmXPCalculator.d.ts.map +1 -0
- package/dist/core/progression/SessionTracker.d.ts +169 -0
- package/dist/core/progression/SessionTracker.d.ts.map +1 -0
- package/dist/core/progression/XPCalculator.d.ts +128 -0
- package/dist/core/progression/XPCalculator.d.ts.map +1 -0
- package/dist/core/progression/stat/StatIncreaseStrategy.d.ts +97 -0
- package/dist/core/progression/stat/StatIncreaseStrategy.d.ts.map +1 -0
- package/dist/core/progression/stat/StatManager.d.ts +179 -0
- package/dist/core/progression/stat/StatManager.d.ts.map +1 -0
- package/dist/core/sensors/EnvironmentalSensors.d.ts +301 -0
- package/dist/core/sensors/EnvironmentalSensors.d.ts.map +1 -0
- package/dist/core/sensors/GamingPlatformSensors.d.ts +162 -0
- package/dist/core/sensors/GamingPlatformSensors.d.ts.map +1 -0
- package/dist/core/sensors/GeolocationProvider.d.ts +156 -0
- package/dist/core/sensors/GeolocationProvider.d.ts.map +1 -0
- package/dist/core/sensors/MotionDetector.d.ts +58 -0
- package/dist/core/sensors/MotionDetector.d.ts.map +1 -0
- package/dist/core/sensors/SteamAPIClient.d.ts +108 -0
- package/dist/core/sensors/SteamAPIClient.d.ts.map +1 -0
- package/dist/core/sensors/WeatherAPIClient.d.ts +360 -0
- package/dist/core/sensors/WeatherAPIClient.d.ts.map +1 -0
- package/dist/core/sensors/schemas/weather.schema.d.ts +144 -0
- package/dist/core/sensors/schemas/weather.schema.d.ts.map +1 -0
- package/dist/core/skills/SkillQuery.d.ts +159 -0
- package/dist/core/skills/SkillQuery.d.ts.map +1 -0
- package/dist/core/skills/SkillTypes.d.ts +233 -0
- package/dist/core/skills/SkillTypes.d.ts.map +1 -0
- package/dist/core/skills/SkillValidator.d.ts +146 -0
- package/dist/core/skills/SkillValidator.d.ts.map +1 -0
- package/dist/core/skills/index.d.ts +11 -0
- package/dist/core/skills/index.d.ts.map +1 -0
- package/dist/core/spells/SpellQuery.d.ts +194 -0
- package/dist/core/spells/SpellQuery.d.ts.map +1 -0
- package/dist/core/spells/SpellTypes.d.ts +71 -0
- package/dist/core/spells/SpellTypes.d.ts.map +1 -0
- package/dist/core/spells/SpellValidator.d.ts +129 -0
- package/dist/core/spells/SpellValidator.d.ts.map +1 -0
- package/dist/core/spells/index.d.ts +11 -0
- package/dist/core/spells/index.d.ts.map +1 -0
- package/dist/core/types/AudioProfile.d.ts +143 -0
- package/dist/core/types/AudioProfile.d.ts.map +1 -0
- package/dist/core/types/BeatMap.d.ts +1825 -0
- package/dist/core/types/BeatMap.d.ts.map +1 -0
- package/dist/core/types/ButtonMapping.d.ts +345 -0
- package/dist/core/types/ButtonMapping.d.ts.map +1 -0
- package/dist/core/types/Character.d.ts +397 -0
- package/dist/core/types/Character.d.ts.map +1 -0
- package/dist/core/types/ChartedBeatMap.d.ts +169 -0
- package/dist/core/types/ChartedBeatMap.d.ts.map +1 -0
- package/dist/core/types/Combat.d.ts +268 -0
- package/dist/core/types/Combat.d.ts.map +1 -0
- package/dist/core/types/CombatAI.d.ts +143 -0
- package/dist/core/types/CombatAI.d.ts.map +1 -0
- package/dist/core/types/Enemy.d.ts +447 -0
- package/dist/core/types/Enemy.d.ts.map +1 -0
- package/dist/core/types/Environmental.d.ts +213 -0
- package/dist/core/types/Environmental.d.ts.map +1 -0
- package/dist/core/types/Equipment.d.ts +309 -0
- package/dist/core/types/Equipment.d.ts.map +1 -0
- package/dist/core/types/ISessionTracker.d.ts +48 -0
- package/dist/core/types/ISessionTracker.d.ts.map +1 -0
- package/dist/core/types/LevelExport.d.ts +366 -0
- package/dist/core/types/LevelExport.d.ts.map +1 -0
- package/dist/core/types/Playlist.d.ts +70 -0
- package/dist/core/types/Playlist.d.ts.map +1 -0
- package/dist/core/types/Prestige.d.ts +94 -0
- package/dist/core/types/Prestige.d.ts.map +1 -0
- package/dist/core/types/Progression.d.ts +214 -0
- package/dist/core/types/Progression.d.ts.map +1 -0
- package/dist/core/types/RhythmXP.d.ts +398 -0
- package/dist/core/types/RhythmXP.d.ts.map +1 -0
- package/dist/core/utils/AbilityConstants.d.ts +31 -0
- package/dist/core/utils/AbilityConstants.d.ts.map +1 -0
- package/dist/core/utils/EffectApplierUtils.d.ts +56 -0
- package/dist/core/utils/EffectApplierUtils.d.ts.map +1 -0
- package/dist/core/utils/ImageValidator.d.ts +66 -0
- package/dist/core/utils/ImageValidator.d.ts.map +1 -0
- package/dist/core/utils/PrerequisiteValidator.d.ts +88 -0
- package/dist/core/utils/PrerequisiteValidator.d.ts.map +1 -0
- package/dist/essentia-wasm.es-BUEnKUts.js +2990 -0
- package/dist/essentia.js-model.es-CGA0xotH.js +306 -0
- package/dist/index.d.ts +176 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/playlist-data-engine.js +124 -0
- package/dist/playlist-data-engine.mjs +49251 -0
- package/dist/utils/EnchantmentLibrary.d.ts +378 -0
- package/dist/utils/EnchantmentLibrary.d.ts.map +1 -0
- package/dist/utils/arweaveGatewayManager.d.ts +485 -0
- package/dist/utils/arweaveGatewayManager.d.ts.map +1 -0
- package/dist/utils/arweaveUtils.d.ts +118 -0
- package/dist/utils/arweaveUtils.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +439 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/equipmentConstants.d.ts +60 -0
- package/dist/utils/equipmentConstants.d.ts.map +1 -0
- package/dist/utils/hash.d.ts +33 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +192 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/magicItemExamples.d.ts +46 -0
- package/dist/utils/magicItemExamples.d.ts.map +1 -0
- package/dist/utils/playlistUtils.d.ts +149 -0
- package/dist/utils/playlistUtils.d.ts.map +1 -0
- package/dist/utils/random.d.ts +34 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/sensorDashboard.d.ts +60 -0
- package/dist/utils/sensorDashboard.d.ts.map +1 -0
- package/dist/utils/validators.d.ts +189 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CombatEngine - Main orchestrator for D&D 5e turn-based combat
|
|
3
|
+
* Manages combat lifecycle, turn order, and action resolution
|
|
4
|
+
*/
|
|
5
|
+
import type { CharacterSheet, Attack, Spell } from '../types/Character';
|
|
6
|
+
import type { CombatInstance, Combatant, CombatAction, CombatConfig, CombatResult, DiceRollerAPI, StatusEffect } from '../types/Combat';
|
|
7
|
+
import type { EnvironmentalContext } from '../types/Progression';
|
|
8
|
+
/**
|
|
9
|
+
* Describes a single validation issue found in spell slot data.
|
|
10
|
+
*/
|
|
11
|
+
export interface SpellSlotValidationIssue {
|
|
12
|
+
/** Human-readable description of the issue */
|
|
13
|
+
message: string;
|
|
14
|
+
/** Which spell level is affected (1-9), or undefined if structural */
|
|
15
|
+
level?: number;
|
|
16
|
+
/** Severity: 'error' means data is unusable, 'warn' means data is questionable but usable */
|
|
17
|
+
severity: 'error' | 'warn';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* D&D 5e turn-based combat engine
|
|
21
|
+
*
|
|
22
|
+
* Fully implements D&D 5e combat rules:
|
|
23
|
+
* - Initiative rolls (d20 + DEX modifier)
|
|
24
|
+
* - Attack rolls (d20 + attack bonus vs AC)
|
|
25
|
+
* - Damage calculation with dice rolling
|
|
26
|
+
* - Critical hits (natural 20 = double damage dice)
|
|
27
|
+
* - Spell casting with spell slots and saving throws
|
|
28
|
+
* - Environmental modifiers and music bonuses
|
|
29
|
+
* - Deterministic treasure generation using seeded RNG
|
|
30
|
+
*/
|
|
31
|
+
export declare class CombatEngine {
|
|
32
|
+
private initiativeRoller;
|
|
33
|
+
private attackResolver;
|
|
34
|
+
private spellCaster;
|
|
35
|
+
private config;
|
|
36
|
+
private rng;
|
|
37
|
+
private diceRoller?;
|
|
38
|
+
/**
|
|
39
|
+
* Initialize the combat engine with configuration options
|
|
40
|
+
*
|
|
41
|
+
* @param {CombatConfig} [config] - Combat configuration
|
|
42
|
+
* @param {boolean} [config.useEnvironment=true] - Apply environmental bonuses
|
|
43
|
+
* @param {boolean} [config.useMusic=false] - Apply music bonuses to combat
|
|
44
|
+
* @param {boolean} [config.tacticalMode=false] - Enable advanced tactical rules
|
|
45
|
+
* @param {number} [config.maxTurnsBeforeDraw=100] - Max turns before combat draws
|
|
46
|
+
* @param {boolean} [config.allowFleeing=false] - Allow combatants to flee
|
|
47
|
+
* @param {string} [config.seed] - Seed for deterministic treasure generation
|
|
48
|
+
* @param {DiceRollerAPI} [diceRoller] - Optional dice roller for deterministic simulations
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const combat = new CombatEngine({ tacticalMode: true, seed: 'my-seed' });
|
|
52
|
+
* const seeded = new CombatEngine({}, createSeededRoller('sim-42'));
|
|
53
|
+
*/
|
|
54
|
+
constructor(config?: CombatConfig, diceRoller?: DiceRollerAPI);
|
|
55
|
+
/**
|
|
56
|
+
* Initialize a combat encounter with players vs enemies
|
|
57
|
+
*
|
|
58
|
+
* Sets up the combat instance, creates combatant objects, rolls initiative,
|
|
59
|
+
* and establishes turn order based on DEX modifiers and initiative rolls.
|
|
60
|
+
*
|
|
61
|
+
* @param {CharacterSheet[]} playerCharacters - Playable characters
|
|
62
|
+
* @param {CharacterSheet[]} enemies - Non-player characters/enemies
|
|
63
|
+
* @param {EnvironmentalContext} [environment] - Environmental modifiers (optional)
|
|
64
|
+
* @returns {CombatInstance} Active combat instance with established turn order
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const combat = combatEngine.startCombat(
|
|
68
|
+
* [playerCharacter],
|
|
69
|
+
* [enemy1, enemy2],
|
|
70
|
+
* environmentalContext
|
|
71
|
+
* );
|
|
72
|
+
* console.log(`Combat started! Turn order: ${combat.combatants.map(c => c.character.name).join(' → ')}`);
|
|
73
|
+
*/
|
|
74
|
+
startCombat(playerCharacters: CharacterSheet[], enemies: CharacterSheet[], environment?: EnvironmentalContext): CombatInstance;
|
|
75
|
+
/**
|
|
76
|
+
* Get the current active combatant
|
|
77
|
+
*/
|
|
78
|
+
getCurrentCombatant(combat: CombatInstance): Combatant;
|
|
79
|
+
/**
|
|
80
|
+
* Execute an attack action
|
|
81
|
+
*
|
|
82
|
+
* Checks attacker and target status effects for advantage/disadvantage
|
|
83
|
+
* (e.g., Charmed → disadvantage vs non-source, Frightened → disadvantage,
|
|
84
|
+
* Prone target → advantage on melee/ranged).
|
|
85
|
+
*/
|
|
86
|
+
executeAttack(combat: CombatInstance, attacker: Combatant, target: Combatant, attack: Attack): CombatAction;
|
|
87
|
+
/**
|
|
88
|
+
* Execute an attack using equipped weapon(s) or unarmed strike
|
|
89
|
+
*
|
|
90
|
+
* Automatically builds Attack object from equipped weapons or unarmed combat.
|
|
91
|
+
* Uses the first equipped weapon by default, or a specific weapon if named.
|
|
92
|
+
* If no weapon equipped or weaponName is "unarmed", uses unarmed strike.
|
|
93
|
+
*
|
|
94
|
+
* @param combat - Combat instance
|
|
95
|
+
* @param attacker - Attacking combatant
|
|
96
|
+
* @param target - Target combatant
|
|
97
|
+
* @param weaponName - Optional specific weapon name (if multiple equipped), or "unarmed" for unarmed strike
|
|
98
|
+
* @returns Combat action with result
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Attack with first equipped weapon (or unarmed if none)
|
|
102
|
+
* combat.executeWeaponAttack(combat, attacker, target);
|
|
103
|
+
*
|
|
104
|
+
* // Attack with specific weapon
|
|
105
|
+
* combat.executeWeaponAttack(combat, attacker, target, 'Longsword');
|
|
106
|
+
*
|
|
107
|
+
* // Unarmed strike explicitly
|
|
108
|
+
* combat.executeWeaponAttack(combat, attacker, target, 'unarmed');
|
|
109
|
+
*/
|
|
110
|
+
executeWeaponAttack(combat: CombatInstance, attacker: Combatant, target: Combatant, weaponName?: string): CombatAction;
|
|
111
|
+
/**
|
|
112
|
+
* Build an Attack object from a weapon
|
|
113
|
+
* Prefers damage_dice set during enemy generation (on the weapon object),
|
|
114
|
+
* falling back to DEFAULT_EQUIPMENT for player characters using standard gear.
|
|
115
|
+
* Uses character's stats to calculate attack bonus.
|
|
116
|
+
*/
|
|
117
|
+
private buildAttackFromWeapon;
|
|
118
|
+
/**
|
|
119
|
+
* Build an unarmed strike Attack object
|
|
120
|
+
* D&D 5e: 1 + STR modifier damage, proficiency bonus applies to attack
|
|
121
|
+
*/
|
|
122
|
+
private buildUnarmedAttack;
|
|
123
|
+
/**
|
|
124
|
+
* Execute a spell casting action
|
|
125
|
+
*/
|
|
126
|
+
executeCastSpell(combat: CombatInstance, caster: Combatant, spell: Spell, targets: Combatant[]): CombatAction;
|
|
127
|
+
/**
|
|
128
|
+
* Execute a legendary action for a boss combatant.
|
|
129
|
+
*
|
|
130
|
+
* Legendary actions are special abilities that boss enemies can use at the end
|
|
131
|
+
* of another creature's turn, spending legendary action points (3 per round).
|
|
132
|
+
*
|
|
133
|
+
* Validates that the action exists on the boss's `legendary_config`, checks
|
|
134
|
+
* that enough action points remain, resolves damage if applicable, and records
|
|
135
|
+
* the action in combat history.
|
|
136
|
+
*
|
|
137
|
+
* @param combat - Combat instance
|
|
138
|
+
* @param bossCombatant - The boss combatant executing the legendary action
|
|
139
|
+
* @param action - The legendary action to execute (from `legendary_config.actions`)
|
|
140
|
+
* @param target - Optional target combatant for damaging/controlling actions
|
|
141
|
+
* @returns Combat action with result
|
|
142
|
+
* @throws {Error} If the combatant has no legendary config, the action doesn't
|
|
143
|
+
* belong to this boss, or not enough action points remain
|
|
144
|
+
*/
|
|
145
|
+
executeLegendaryAction(combat: CombatInstance, bossCombatant: Combatant, action: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
cost: number;
|
|
149
|
+
effect: string;
|
|
150
|
+
damage?: string;
|
|
151
|
+
damage_type?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
tags?: string[];
|
|
154
|
+
}, target?: Combatant): CombatAction;
|
|
155
|
+
/**
|
|
156
|
+
* Use a legendary resistance to automatically succeed a saving throw.
|
|
157
|
+
*
|
|
158
|
+
* Per D&D 5e: If the boss fails a saving throw, it can choose to use one
|
|
159
|
+
* legendary resistance to succeed instead. This is a per-day resource
|
|
160
|
+
* (tracked by `legendaryResistancesRemaining` on the Combatant).
|
|
161
|
+
*
|
|
162
|
+
* @param combat - Combat instance (for history logging)
|
|
163
|
+
* @param bossCombatant - The boss combatant using the resistance
|
|
164
|
+
* @returns true if the resistance was available and used, false if no resistances remain
|
|
165
|
+
*/
|
|
166
|
+
useLegendaryResistance(combat: CombatInstance, bossCombatant: Combatant): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Execute a dodge action (increase AC by 2)
|
|
169
|
+
*/
|
|
170
|
+
executeDodge(combat: CombatInstance, combatant: Combatant): CombatAction;
|
|
171
|
+
/**
|
|
172
|
+
* Execute a dash action (increase movement speed)
|
|
173
|
+
*/
|
|
174
|
+
executeDash(combat: CombatInstance, combatant: Combatant): CombatAction;
|
|
175
|
+
/**
|
|
176
|
+
* Execute a disengage action (avoid opportunity attacks)
|
|
177
|
+
*/
|
|
178
|
+
executeDisengage(combat: CombatInstance, combatant: Combatant): CombatAction;
|
|
179
|
+
/**
|
|
180
|
+
* Check if fleeing is allowed by configuration
|
|
181
|
+
*/
|
|
182
|
+
canFlee(): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Execute a flee action (combatant flees from combat)
|
|
185
|
+
*
|
|
186
|
+
* Removes the combatant from the active combat instance and records
|
|
187
|
+
* the flee action in combat history. Only available when allowFleeing
|
|
188
|
+
* configuration is enabled.
|
|
189
|
+
*
|
|
190
|
+
* @param combat - Combat instance
|
|
191
|
+
* @param combatant - Combatant attempting to flee
|
|
192
|
+
* @returns Combat action with result
|
|
193
|
+
* @throws {Error} If fleeing is not allowed by configuration
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* const combat = combatEngine.startCombat([player], [enemy]);
|
|
197
|
+
* const current = combatEngine.getCurrentCombatant(combat);
|
|
198
|
+
*
|
|
199
|
+
* if (combatEngine.canFlee()) {
|
|
200
|
+
* combatEngine.executeFlee(combat, current);
|
|
201
|
+
* // current is now removed from combat.combatants
|
|
202
|
+
* }
|
|
203
|
+
*/
|
|
204
|
+
executeFlee(combat: CombatInstance, combatant: Combatant): CombatAction;
|
|
205
|
+
/**
|
|
206
|
+
* Advance to the next turn
|
|
207
|
+
* Resets action trackers and moves to next combatant.
|
|
208
|
+
*
|
|
209
|
+
* Handles skipTurn effects (Stunned, Unconscious): the combatant's
|
|
210
|
+
* actions are marked as used and the turn auto-advances. Damage
|
|
211
|
+
* effects (Burning, Poison) are processed before the skip.
|
|
212
|
+
*
|
|
213
|
+
* Uses a loop instead of recursion to avoid resetting stunned
|
|
214
|
+
* combatants' action flags when advancing past them.
|
|
215
|
+
*/
|
|
216
|
+
nextTurn(combat: CombatInstance): CombatInstance;
|
|
217
|
+
/**
|
|
218
|
+
* Process start-of-turn damage effects (Burning, Poison, etc.).
|
|
219
|
+
*
|
|
220
|
+
* Deals damage equal to each effect's `damage` value and logs it
|
|
221
|
+
* in combat history. Called before the skip-turn check so that
|
|
222
|
+
* stunned combatants still take damage from burning/poison.
|
|
223
|
+
*/
|
|
224
|
+
private processStartOfTurnDamage;
|
|
225
|
+
/**
|
|
226
|
+
* Process status effect tick-down at the start of a combatant's turn.
|
|
227
|
+
*
|
|
228
|
+
* Decrements duration by 1 for all active status effects, then removes
|
|
229
|
+
* any that have expired (duration <= 0). If effects expired, a
|
|
230
|
+
* 'statusEffectTick' entry is added to combat history for logging.
|
|
231
|
+
*/
|
|
232
|
+
private tickStatusEffects;
|
|
233
|
+
/**
|
|
234
|
+
* Determine whether an attack should be rolled with advantage, disadvantage,
|
|
235
|
+
* or normally, based on the attacker's and target's active status effects.
|
|
236
|
+
*
|
|
237
|
+
* Advantage and disadvantage cancel each other out per D&D 5e rules.
|
|
238
|
+
*
|
|
239
|
+
* Sources of advantage:
|
|
240
|
+
* - Target has `advantageOnMeleeAttackAgainst` and attack is melee (Prone)
|
|
241
|
+
* - Target has `advantageOnRangedAttackAgainst` and attack is ranged (Prone)
|
|
242
|
+
*
|
|
243
|
+
* Sources of disadvantage:
|
|
244
|
+
* - Attacker has `disadvantageOnAttack` (Frightened, Prone attacker)
|
|
245
|
+
* - Attacker has `disadvantageOnAttackNonSource` and target is not the source (Charmed)
|
|
246
|
+
*/
|
|
247
|
+
private getAttackAdvantageDisadvantage;
|
|
248
|
+
/**
|
|
249
|
+
* Check if a combatant has any status effect that causes them to skip
|
|
250
|
+
* their turn (e.g., Stunned, Unconscious).
|
|
251
|
+
*/
|
|
252
|
+
private shouldSkipTurn;
|
|
253
|
+
/**
|
|
254
|
+
* Check if combat should end
|
|
255
|
+
* Ends when:
|
|
256
|
+
* - All enemies defeated
|
|
257
|
+
* - All players defeated
|
|
258
|
+
* - Max turns reached
|
|
259
|
+
* - Player surrender
|
|
260
|
+
*/
|
|
261
|
+
private checkCombatStatus;
|
|
262
|
+
/**
|
|
263
|
+
* Get combat result when combat ends
|
|
264
|
+
*/
|
|
265
|
+
getCombatResult(combat: CombatInstance): CombatResult | null;
|
|
266
|
+
/**
|
|
267
|
+
* Create a combatant from a character
|
|
268
|
+
*/
|
|
269
|
+
private createCombatant;
|
|
270
|
+
/**
|
|
271
|
+
* Validate spell slot data on a character sheet.
|
|
272
|
+
*
|
|
273
|
+
* Checks for common issues:
|
|
274
|
+
* - Negative `total` or `used` values
|
|
275
|
+
* - `used` exceeding `total` (more slots consumed than exist)
|
|
276
|
+
* - Non-integer spell level keys
|
|
277
|
+
* - Spell levels outside the 1-9 range
|
|
278
|
+
* - `total` of 0 with non-zero `used`
|
|
279
|
+
*
|
|
280
|
+
* Returns an array of issues (empty = valid). Does not throw — callers
|
|
281
|
+
* decide how to handle issues (log, warn, fall back to table).
|
|
282
|
+
*/
|
|
283
|
+
validateSpellSlots(character: CharacterSheet): SpellSlotValidationIssue[];
|
|
284
|
+
/**
|
|
285
|
+
* Validate that combatant spell slots are consistent with the source character.
|
|
286
|
+
*
|
|
287
|
+
* After `createCombatant()` runs, this checks that the combatant's remaining
|
|
288
|
+
* spell slots match what the character's `spells.spell_slots` would produce.
|
|
289
|
+
* Useful for catching regressions in the initialization pipeline.
|
|
290
|
+
*
|
|
291
|
+
* Returns an array of issues (empty = consistent).
|
|
292
|
+
*/
|
|
293
|
+
validateCombatantSpellSlots(combatant: Combatant): SpellSlotValidationIssue[];
|
|
294
|
+
/**
|
|
295
|
+
* Initialize spell slots for a character.
|
|
296
|
+
*
|
|
297
|
+
* Priority:
|
|
298
|
+
* 1. If `character.spells.spell_slots` is populated (e.g. generated enemies),
|
|
299
|
+
* convert `{ [level]: { total, used } }` → `{ [level]: total - used }`.
|
|
300
|
+
* 2. Fall back to the D&D 5e full-caster table for known spellcasting classes.
|
|
301
|
+
* 3. Return undefined for non-spellcasters with no spell slot data.
|
|
302
|
+
*
|
|
303
|
+
* If validation errors are found in source spell slot data, the problematic
|
|
304
|
+
* levels are skipped (treated as if they don't exist) and the method falls
|
|
305
|
+
* through to the fallback table for known classes.
|
|
306
|
+
*/
|
|
307
|
+
private initializeSpellSlots;
|
|
308
|
+
/**
|
|
309
|
+
* Get combat status summary
|
|
310
|
+
*/
|
|
311
|
+
getCombatSummary(combat: CombatInstance): string;
|
|
312
|
+
/**
|
|
313
|
+
* Apply damage to a combatant (accounting for armor class)
|
|
314
|
+
*/
|
|
315
|
+
applyDamage(combatant: Combatant, damage: number): number;
|
|
316
|
+
/**
|
|
317
|
+
* Heal a combatant
|
|
318
|
+
*/
|
|
319
|
+
healCombatant(combatant: Combatant, healing: number): number;
|
|
320
|
+
/**
|
|
321
|
+
* Apply temporary hit points
|
|
322
|
+
*/
|
|
323
|
+
applyTemporaryHP(combatant: Combatant, tempHP: number): void;
|
|
324
|
+
/**
|
|
325
|
+
* Apply a status effect to a combatant.
|
|
326
|
+
*
|
|
327
|
+
* Handles stacking rules:
|
|
328
|
+
* - If an effect with the same name already exists on the combatant,
|
|
329
|
+
* the duration is refreshed to the new effect's duration (take the higher).
|
|
330
|
+
* - If the new effect has `damage`, keep the higher damage value.
|
|
331
|
+
* - Otherwise, the new effect is pushed onto the combatant's statusEffects array.
|
|
332
|
+
*
|
|
333
|
+
* Returns the effect that is now active on the combatant (either the existing
|
|
334
|
+
* refreshed effect or the newly pushed one).
|
|
335
|
+
*/
|
|
336
|
+
applyStatusEffect(combatant: Combatant, effect: StatusEffect): StatusEffect;
|
|
337
|
+
/**
|
|
338
|
+
* Drop a combatant's concentration, removing the concentrated effect.
|
|
339
|
+
*
|
|
340
|
+
* Per D&D 5e: a combatant can only maintain concentration on one effect
|
|
341
|
+
* at a time. When concentration ends (new concentration spell, failed save,
|
|
342
|
+
* incapacitated, or dead), the effect is removed immediately.
|
|
343
|
+
*
|
|
344
|
+
* @param combatant - The concentrating combatant
|
|
345
|
+
* @param reason - Why concentration was dropped (for logging)
|
|
346
|
+
* @returns The dropped StatusEffect, or undefined if not concentrating
|
|
347
|
+
*/
|
|
348
|
+
dropConcentration(combatant: Combatant, reason?: string): StatusEffect | undefined;
|
|
349
|
+
/**
|
|
350
|
+
* Make a concentration saving throw when a concentrating combatant takes damage.
|
|
351
|
+
*
|
|
352
|
+
* Per D&D 5e: DC = 10 or half the damage taken (rounded down), whichever is higher.
|
|
353
|
+
* The save is a CON saving throw.
|
|
354
|
+
*
|
|
355
|
+
* @param combatant - The concentrating combatant
|
|
356
|
+
* @param damage - The total damage taken in the triggering event
|
|
357
|
+
* @returns true if concentration maintained, false if broken
|
|
358
|
+
*/
|
|
359
|
+
private rollConcentrationSave;
|
|
360
|
+
/**
|
|
361
|
+
* Check and potentially break concentration when a combatant takes damage.
|
|
362
|
+
*
|
|
363
|
+
* Should be called whenever a concentrating combatant takes damage.
|
|
364
|
+
* If the concentration save fails, the concentrated effect is dropped.
|
|
365
|
+
*
|
|
366
|
+
* @param combat - Combat instance (for history logging)
|
|
367
|
+
* @param combatant - The combatant who took damage
|
|
368
|
+
* @param damage - The amount of damage taken
|
|
369
|
+
* @returns true if concentration was broken, false if maintained or not concentrating
|
|
370
|
+
*/
|
|
371
|
+
checkConcentration(combat: CombatInstance, combatant: Combatant, damage: number): boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Remove expired status effects from a combatant.
|
|
374
|
+
*
|
|
375
|
+
* Filters out all effects where `duration <= 0`.
|
|
376
|
+
* Returns the array of removed effects for logging purposes.
|
|
377
|
+
*/
|
|
378
|
+
removeExpiredStatusEffects(combatant: Combatant): StatusEffect[];
|
|
379
|
+
/**
|
|
380
|
+
* Get all living combatants
|
|
381
|
+
*/
|
|
382
|
+
getLivingCombatants(combat: CombatInstance): Combatant[];
|
|
383
|
+
/**
|
|
384
|
+
* Get all defeated combatants
|
|
385
|
+
*/
|
|
386
|
+
getDefeatedCombatants(combat: CombatInstance): Combatant[];
|
|
387
|
+
}
|
|
388
|
+
//# sourceMappingURL=CombatEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CombatEngine.d.ts","sourceRoot":"","sources":["../../../src/core/combat/CombatEngine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACZ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A0B,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,EAAE;IAsBhE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE;IAIxD;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE;CAG3D"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiceRoller - Utility for D&D-style dice rolling
|
|
3
|
+
* Supports standard polyhedral dice and dice formulas
|
|
4
|
+
*
|
|
5
|
+
* All methods are static - call directly without instantiation:
|
|
6
|
+
* DiceRoller.rollD20(), DiceRoller.parseDiceFormula('2d6+3'), etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DiceRoller {
|
|
9
|
+
/**
|
|
10
|
+
* Roll a single die
|
|
11
|
+
* @param sides Number of sides on the die (4, 6, 8, 10, 12, 20, 100)
|
|
12
|
+
* @returns Roll result (1 to sides)
|
|
13
|
+
*/
|
|
14
|
+
static rollDie(sides: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Roll multiple dice and sum results
|
|
17
|
+
* @param count Number of dice to roll
|
|
18
|
+
* @param sides Sides per die
|
|
19
|
+
* @returns Array of individual rolls
|
|
20
|
+
*/
|
|
21
|
+
static rollMultipleDice(count: number, sides: number): number[];
|
|
22
|
+
/**
|
|
23
|
+
* Parse and roll a dice formula like "2d6+3"
|
|
24
|
+
* @param formula Dice formula (e.g., "1d20", "2d6+3", "3d8-1")
|
|
25
|
+
* @returns Object with parsed formula and results
|
|
26
|
+
*/
|
|
27
|
+
static parseDiceFormula(formula: string): {
|
|
28
|
+
diceCount: number;
|
|
29
|
+
diceSides: number;
|
|
30
|
+
modifier: number;
|
|
31
|
+
rolls: number[];
|
|
32
|
+
total: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Roll a d20 (common for attacks and ability checks)
|
|
36
|
+
* @returns Roll result (1-20)
|
|
37
|
+
*/
|
|
38
|
+
static rollD20(): number;
|
|
39
|
+
/**
|
|
40
|
+
* Roll with advantage (roll twice, take higher)
|
|
41
|
+
* @returns Object with both rolls and final result
|
|
42
|
+
*/
|
|
43
|
+
static rollWithAdvantage(): {
|
|
44
|
+
roll1: number;
|
|
45
|
+
roll2: number;
|
|
46
|
+
result: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Roll with disadvantage (roll twice, take lower)
|
|
50
|
+
* @returns Object with both rolls and final result
|
|
51
|
+
*/
|
|
52
|
+
static rollWithDisadvantage(): {
|
|
53
|
+
roll1: number;
|
|
54
|
+
roll2: number;
|
|
55
|
+
result: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Roll initiative (d20 + DEX modifier)
|
|
59
|
+
* @param dexModifier Character's dexterity modifier
|
|
60
|
+
* @returns Initiative value
|
|
61
|
+
*/
|
|
62
|
+
static rollInitiative(dexModifier: number): number;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a roll is a critical hit (natural 20)
|
|
65
|
+
*/
|
|
66
|
+
static isCriticalHit(d20Roll: number): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Check if a roll is a critical miss (natural 1)
|
|
69
|
+
*/
|
|
70
|
+
static isCriticalMiss(d20Roll: number): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Double the damage from a critical hit
|
|
73
|
+
*/
|
|
74
|
+
static doubleDamage(rolls: number[]): number[];
|
|
75
|
+
/**
|
|
76
|
+
* Calculate total damage from a damage formula with modifier
|
|
77
|
+
* @param formula Dice formula (e.g., "1d8")
|
|
78
|
+
* @param modifier Ability modifier to add
|
|
79
|
+
* @param isCritical Whether this is a critical hit
|
|
80
|
+
* @returns Total damage
|
|
81
|
+
*/
|
|
82
|
+
static calculateDamage(formula: string, modifier: number, isCritical?: boolean): {
|
|
83
|
+
diceFormula: string;
|
|
84
|
+
rolls: number[];
|
|
85
|
+
modifier: number;
|
|
86
|
+
total: number;
|
|
87
|
+
isCritical: boolean;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Roll a saving throw (d20 + ability modifier)
|
|
91
|
+
* @param abilityModifier Modifier from the ability being saved
|
|
92
|
+
* @param proficiencyBonus Optional proficiency bonus if character is proficient
|
|
93
|
+
* @returns Save result
|
|
94
|
+
*/
|
|
95
|
+
static rollSavingThrow(abilityModifier: number, proficiencyBonus?: number): number;
|
|
96
|
+
/**
|
|
97
|
+
* Roll an ability check (d20 + ability modifier + proficiency if applicable)
|
|
98
|
+
* @param abilityModifier The ability modifier
|
|
99
|
+
* @param proficiencyBonus Proficiency bonus if character is proficient (default 0)
|
|
100
|
+
* @returns Check result
|
|
101
|
+
*/
|
|
102
|
+
static rollAbilityCheck(abilityModifier: number, proficiencyBonus?: number): number;
|
|
103
|
+
/**
|
|
104
|
+
* Generate a deterministic "seeded" roll for reproducibility
|
|
105
|
+
* @param seed Seed value for RNG
|
|
106
|
+
* @returns Roll result (1-20)
|
|
107
|
+
*/
|
|
108
|
+
static seededRoll(seed: number): number;
|
|
109
|
+
/**
|
|
110
|
+
* Roll percentiles (d100)
|
|
111
|
+
* @returns Roll result (1-100)
|
|
112
|
+
*/
|
|
113
|
+
static rollPercentile(): number;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=DiceRoller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiceRoller.d.ts","sourceRoot":"","sources":["../../../src/core/combat/DiceRoller.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qBAAa,UAAU;IACrB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAKrC;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAQ/D;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;QACxC,SAAS,EAAE,MAAM,C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EAAE,gBAAgB,GAAE,MAAU,GAAG,MAAM;IAItF;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMvC;;;OAGG;IACH,MAAM,CAAC,cAAc,IAAI,MAAM;CAGhC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InitiativeRoller - Handles initiative rolling and turn order sorting
|
|
3
|
+
* D&D 5e: Initiative = d20 + DEX modifier
|
|
4
|
+
*/
|
|
5
|
+
import type { Combatant, DiceRollerAPI } from '../types/Combat';
|
|
6
|
+
/**
|
|
7
|
+
* Result of initiative rolling
|
|
8
|
+
*/
|
|
9
|
+
export interface InitiativeResult {
|
|
10
|
+
combatant: Combatant;
|
|
11
|
+
d20Roll: number;
|
|
12
|
+
dexModifier: number;
|
|
13
|
+
initiativeTotal: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* InitiativeRoller - Manages initiative system for D&D combat
|
|
17
|
+
*/
|
|
18
|
+
export declare class InitiativeRoller {
|
|
19
|
+
private diceRoller?;
|
|
20
|
+
constructor(diceRoller?: DiceRollerAPI);
|
|
21
|
+
/**
|
|
22
|
+
* Roll initiative for a single combatant
|
|
23
|
+
* Initiative = d20 + DEX modifier
|
|
24
|
+
*/
|
|
25
|
+
rollInitiativeForCombatant(combatant: Combatant): InitiativeResult;
|
|
26
|
+
/**
|
|
27
|
+
* Roll initiative for all combatants and sort by descending initiative
|
|
28
|
+
* Higher initiative acts first
|
|
29
|
+
*/
|
|
30
|
+
rollInitiativeForAll(combatants: Combatant[]): {
|
|
31
|
+
results: InitiativeResult[];
|
|
32
|
+
sortedCombatants: Combatant[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Get the next combatant in turn order
|
|
36
|
+
* Wraps around to beginning when reaching end of list
|
|
37
|
+
*/
|
|
38
|
+
getNextCombatant(combatants: Combatant[], currentIndex: number): {
|
|
39
|
+
combatant: Combatant;
|
|
40
|
+
index: number;
|
|
41
|
+
isNewRound: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Get initiative order as a formatted string for display
|
|
45
|
+
*/
|
|
46
|
+
getInitiativeOrder(combatants: Combatant[]): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Re-roll initiative for a specific combatant (e.g., if an effect changes DEX)
|
|
49
|
+
*/
|
|
50
|
+
rerollInitiativeForCombatant(combatant: Combatant): number;
|
|
51
|
+
/**
|
|
52
|
+
* Delay a combatant's turn (move them later in initiative order)
|
|
53
|
+
* Used when a combatant takes the "Ready" action
|
|
54
|
+
*/
|
|
55
|
+
delayTurn(combatants: Combatant[], combatantId: string): Combatant[];
|
|
56
|
+
/**
|
|
57
|
+
* Shuffle combatants back into position by exact initiative value
|
|
58
|
+
* Used if new combatants join mid-combat
|
|
59
|
+
*/
|
|
60
|
+
resortByInitiative(combatants: Combatant[]): Combatant[];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=InitiativeRoller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitiativeRoller.d.ts","sourceRoot":"","sources":["../../../src/core/combat/InitiativeRoller.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAgB;gBAEvB,UAAU,CAAC,EAAE,aAAa;IAItC;;;OAGG;IACH,0BAA0B,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB;IAkBlE;;;OAGG;IACH,oBAAoB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG;QAC7C,OAAO,EAAE,gBAAgB,EAAE,CAAC;QAC5B,gBAAgB,EAAE,SAAS,EAAE,CAAC;KAC/B;IA0BD;;;OAGG;IACH,gBAAgB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG;QAC/D,SAAS,EAAE,SAAS,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,OAAO,CAAC;KACrB;IAWD;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;IAOrD;;OAEG;IACH,4BAA4B,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAS1D;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE;IAcpE;;;OAGG;IACH,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;CAWzD"}
|