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.
Files changed (345) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +352 -0
  3. package/dist/__vite-browser-external-DYxpcVy9.js +4 -0
  4. package/dist/constants/DefaultClasses.d.ts +46 -0
  5. package/dist/constants/DefaultClasses.d.ts.map +1 -0
  6. package/dist/constants/DefaultEnchantments.d.ts +337 -0
  7. package/dist/constants/DefaultEnchantments.d.ts.map +1 -0
  8. package/dist/constants/DefaultEnemies.d.ts +83 -0
  9. package/dist/constants/DefaultEnemies.d.ts.map +1 -0
  10. package/dist/constants/DefaultEquipment.d.ts +23 -0
  11. package/dist/constants/DefaultEquipment.d.ts.map +1 -0
  12. package/dist/constants/DefaultFeatures.d.ts +22 -0
  13. package/dist/constants/DefaultFeatures.d.ts.map +1 -0
  14. package/dist/constants/DefaultRaces.d.ts +102 -0
  15. package/dist/constants/DefaultRaces.d.ts.map +1 -0
  16. package/dist/constants/DefaultSkills.d.ts +26 -0
  17. package/dist/constants/DefaultSkills.d.ts.map +1 -0
  18. package/dist/constants/DefaultSpells.d.ts +41 -0
  19. package/dist/constants/DefaultSpells.d.ts.map +1 -0
  20. package/dist/constants/EncounterBalance.d.ts +208 -0
  21. package/dist/constants/EncounterBalance.d.ts.map +1 -0
  22. package/dist/constants/EnemyEquipment.d.ts +71 -0
  23. package/dist/constants/EnemyEquipment.d.ts.map +1 -0
  24. package/dist/constants/EnemyRarity.d.ts +79 -0
  25. package/dist/constants/EnemyRarity.d.ts.map +1 -0
  26. package/dist/constants/EnemyTemplates/Construct.d.ts +63 -0
  27. package/dist/constants/EnemyTemplates/Construct.d.ts.map +1 -0
  28. package/dist/constants/EnemyTemplates/Dragon.d.ts +68 -0
  29. package/dist/constants/EnemyTemplates/Dragon.d.ts.map +1 -0
  30. package/dist/constants/EnemyTemplates/Elemental.d.ts +64 -0
  31. package/dist/constants/EnemyTemplates/Elemental.d.ts.map +1 -0
  32. package/dist/constants/EnemyTemplates/Fiend.d.ts +62 -0
  33. package/dist/constants/EnemyTemplates/Fiend.d.ts.map +1 -0
  34. package/dist/constants/EnemyTemplates/Monstrosity.d.ts +63 -0
  35. package/dist/constants/EnemyTemplates/Monstrosity.d.ts.map +1 -0
  36. package/dist/constants/EnemyTemplates/Undead.d.ts +61 -0
  37. package/dist/constants/EnemyTemplates/Undead.d.ts.map +1 -0
  38. package/dist/constants/ItemTemplates.d.ts +40 -0
  39. package/dist/constants/ItemTemplates.d.ts.map +1 -0
  40. package/dist/constants/MagicItems.d.ts +30 -0
  41. package/dist/constants/MagicItems.d.ts.map +1 -0
  42. package/dist/constants/SpellSlots.d.ts +30 -0
  43. package/dist/constants/SpellSlots.d.ts.map +1 -0
  44. package/dist/constants/StatScaling.d.ts +113 -0
  45. package/dist/constants/StatScaling.d.ts.map +1 -0
  46. package/dist/core/analysis/AudioAnalyzer.d.ts +599 -0
  47. package/dist/core/analysis/AudioAnalyzer.d.ts.map +1 -0
  48. package/dist/core/analysis/ColorExtractor.d.ts +64 -0
  49. package/dist/core/analysis/ColorExtractor.d.ts.map +1 -0
  50. package/dist/core/analysis/EssentiaPitchDetector.d.ts +282 -0
  51. package/dist/core/analysis/EssentiaPitchDetector.d.ts.map +1 -0
  52. package/dist/core/analysis/LevelSerializer.d.ts +265 -0
  53. package/dist/core/analysis/LevelSerializer.d.ts.map +1 -0
  54. package/dist/core/analysis/MelodyContourAnalyzer.d.ts +283 -0
  55. package/dist/core/analysis/MelodyContourAnalyzer.d.ts.map +1 -0
  56. package/dist/core/analysis/MultiBandAnalyzer.d.ts +214 -0
  57. package/dist/core/analysis/MultiBandAnalyzer.d.ts.map +1 -0
  58. package/dist/core/analysis/MusicClassifier.d.ts +524 -0
  59. package/dist/core/analysis/MusicClassifier.d.ts.map +1 -0
  60. package/dist/core/analysis/PitchAnalyzer.d.ts +266 -0
  61. package/dist/core/analysis/PitchAnalyzer.d.ts.map +1 -0
  62. package/dist/core/analysis/PitchDetector.d.ts +251 -0
  63. package/dist/core/analysis/PitchDetector.d.ts.map +1 -0
  64. package/dist/core/analysis/SpectrumScanner.d.ts +52 -0
  65. package/dist/core/analysis/SpectrumScanner.d.ts.map +1 -0
  66. package/dist/core/analysis/beat/BeatInterpolator.d.ts +477 -0
  67. package/dist/core/analysis/beat/BeatInterpolator.d.ts.map +1 -0
  68. package/dist/core/analysis/beat/BeatMapGenerator.d.ts +170 -0
  69. package/dist/core/analysis/beat/BeatMapGenerator.d.ts.map +1 -0
  70. package/dist/core/analysis/beat/BeatStream.d.ts +316 -0
  71. package/dist/core/analysis/beat/BeatStream.d.ts.map +1 -0
  72. package/dist/core/analysis/beat/BeatSubdivider.d.ts +205 -0
  73. package/dist/core/analysis/beat/BeatSubdivider.d.ts.map +1 -0
  74. package/dist/core/analysis/beat/BeatTracker.d.ts +137 -0
  75. package/dist/core/analysis/beat/BeatTracker.d.ts.map +1 -0
  76. package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts +180 -0
  77. package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts.map +1 -0
  78. package/dist/core/analysis/beat/DensityAnalyzer.d.ts +246 -0
  79. package/dist/core/analysis/beat/DensityAnalyzer.d.ts.map +1 -0
  80. package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts +1082 -0
  81. package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts.map +1 -0
  82. package/dist/core/analysis/beat/GrooveAnalyzer.d.ts +192 -0
  83. package/dist/core/analysis/beat/GrooveAnalyzer.d.ts.map +1 -0
  84. package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts +133 -0
  85. package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts.map +1 -0
  86. package/dist/core/analysis/beat/PhraseAnalyzer.d.ts +230 -0
  87. package/dist/core/analysis/beat/PhraseAnalyzer.d.ts.map +1 -0
  88. package/dist/core/analysis/beat/RhythmQuantizer.d.ts +399 -0
  89. package/dist/core/analysis/beat/RhythmQuantizer.d.ts.map +1 -0
  90. package/dist/core/analysis/beat/RhythmicBalancer.d.ts +262 -0
  91. package/dist/core/analysis/beat/RhythmicBalancer.d.ts.map +1 -0
  92. package/dist/core/analysis/beat/StreamScorer.d.ts +275 -0
  93. package/dist/core/analysis/beat/StreamScorer.d.ts.map +1 -0
  94. package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts +256 -0
  95. package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts.map +1 -0
  96. package/dist/core/analysis/beat/TempoDetector.d.ts +220 -0
  97. package/dist/core/analysis/beat/TempoDetector.d.ts.map +1 -0
  98. package/dist/core/analysis/beat/TransientDetector.d.ts +303 -0
  99. package/dist/core/analysis/beat/TransientDetector.d.ts.map +1 -0
  100. package/dist/core/analysis/beat/beatKeyHelpers.d.ts +180 -0
  101. package/dist/core/analysis/beat/beatKeyHelpers.d.ts.map +1 -0
  102. package/dist/core/analysis/beat/index.d.ts +41 -0
  103. package/dist/core/analysis/beat/index.d.ts.map +1 -0
  104. package/dist/core/analysis/beat/utils/audioUtils.d.ts +204 -0
  105. package/dist/core/analysis/beat/utils/audioUtils.d.ts.map +1 -0
  106. package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts +404 -0
  107. package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts.map +1 -0
  108. package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts +61 -0
  109. package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts.map +1 -0
  110. package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts +33 -0
  111. package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts.map +1 -0
  112. package/dist/core/analysis/index.d.ts +18 -0
  113. package/dist/core/analysis/index.d.ts.map +1 -0
  114. package/dist/core/combat/AI/AICombatRunner.d.ts +108 -0
  115. package/dist/core/combat/AI/AICombatRunner.d.ts.map +1 -0
  116. package/dist/core/combat/AI/CombatAI.d.ts +179 -0
  117. package/dist/core/combat/AI/CombatAI.d.ts.map +1 -0
  118. package/dist/core/combat/AI/CombatMetricsTracker.d.ts +30 -0
  119. package/dist/core/combat/AI/CombatMetricsTracker.d.ts.map +1 -0
  120. package/dist/core/combat/Analysis/BalanceValidator.d.ts +170 -0
  121. package/dist/core/combat/Analysis/BalanceValidator.d.ts.map +1 -0
  122. package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts +231 -0
  123. package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts.map +1 -0
  124. package/dist/core/combat/Analysis/DifficultyCalculator.d.ts +203 -0
  125. package/dist/core/combat/Analysis/DifficultyCalculator.d.ts.map +1 -0
  126. package/dist/core/combat/Analysis/ParameterSweep.d.ts +201 -0
  127. package/dist/core/combat/Analysis/ParameterSweep.d.ts.map +1 -0
  128. package/dist/core/combat/AttackResolver.d.ts +220 -0
  129. package/dist/core/combat/AttackResolver.d.ts.map +1 -0
  130. package/dist/core/combat/CombatEngine.d.ts +388 -0
  131. package/dist/core/combat/CombatEngine.d.ts.map +1 -0
  132. package/dist/core/combat/DiceRoller.d.ts +115 -0
  133. package/dist/core/combat/DiceRoller.d.ts.map +1 -0
  134. package/dist/core/combat/InitiativeRoller.d.ts +62 -0
  135. package/dist/core/combat/InitiativeRoller.d.ts.map +1 -0
  136. package/dist/core/combat/PartyAnalyzer.d.ts +215 -0
  137. package/dist/core/combat/PartyAnalyzer.d.ts.map +1 -0
  138. package/dist/core/combat/SeededDiceRoller.d.ts +120 -0
  139. package/dist/core/combat/SeededDiceRoller.d.ts.map +1 -0
  140. package/dist/core/combat/Simulation/CombatSimulator.d.ts +366 -0
  141. package/dist/core/combat/Simulation/CombatSimulator.d.ts.map +1 -0
  142. package/dist/core/combat/SpellCaster.d.ts +113 -0
  143. package/dist/core/combat/SpellCaster.d.ts.map +1 -0
  144. package/dist/core/config/index.d.ts +24 -0
  145. package/dist/core/config/index.d.ts.map +1 -0
  146. package/dist/core/config/progressionConfig.d.ts +73 -0
  147. package/dist/core/config/progressionConfig.d.ts.map +1 -0
  148. package/dist/core/config/sensorConfig.d.ts +134 -0
  149. package/dist/core/config/sensorConfig.d.ts.map +1 -0
  150. package/dist/core/equipment/BoxOpener.d.ts +175 -0
  151. package/dist/core/equipment/BoxOpener.d.ts.map +1 -0
  152. package/dist/core/equipment/EquipmentEffectApplier.d.ts +189 -0
  153. package/dist/core/equipment/EquipmentEffectApplier.d.ts.map +1 -0
  154. package/dist/core/equipment/EquipmentModifier.d.ts +327 -0
  155. package/dist/core/equipment/EquipmentModifier.d.ts.map +1 -0
  156. package/dist/core/equipment/EquipmentSpawnHelper.d.ts +246 -0
  157. package/dist/core/equipment/EquipmentSpawnHelper.d.ts.map +1 -0
  158. package/dist/core/equipment/EquipmentValidator.d.ts +173 -0
  159. package/dist/core/equipment/EquipmentValidator.d.ts.map +1 -0
  160. package/dist/core/extensions/ExtensionManager.d.ts +517 -0
  161. package/dist/core/extensions/ExtensionManager.d.ts.map +1 -0
  162. package/dist/core/extensions/WeightedSelector.d.ts +156 -0
  163. package/dist/core/extensions/WeightedSelector.d.ts.map +1 -0
  164. package/dist/core/extensions/index.d.ts +11 -0
  165. package/dist/core/extensions/index.d.ts.map +1 -0
  166. package/dist/core/extensions/initializeDefaults.d.ts +170 -0
  167. package/dist/core/extensions/initializeDefaults.d.ts.map +1 -0
  168. package/dist/core/features/FeatureEffectApplier.d.ts +102 -0
  169. package/dist/core/features/FeatureEffectApplier.d.ts.map +1 -0
  170. package/dist/core/features/FeatureQuery.d.ts +368 -0
  171. package/dist/core/features/FeatureQuery.d.ts.map +1 -0
  172. package/dist/core/features/FeatureTypes.d.ts +199 -0
  173. package/dist/core/features/FeatureTypes.d.ts.map +1 -0
  174. package/dist/core/features/FeatureValidator.d.ts +149 -0
  175. package/dist/core/features/FeatureValidator.d.ts.map +1 -0
  176. package/dist/core/features/index.d.ts +12 -0
  177. package/dist/core/features/index.d.ts.map +1 -0
  178. package/dist/core/generation/AbilityScoreCalculator.d.ts +83 -0
  179. package/dist/core/generation/AbilityScoreCalculator.d.ts.map +1 -0
  180. package/dist/core/generation/AppearanceGenerator.d.ts +32 -0
  181. package/dist/core/generation/AppearanceGenerator.d.ts.map +1 -0
  182. package/dist/core/generation/BeatConverter.d.ts +127 -0
  183. package/dist/core/generation/BeatConverter.d.ts.map +1 -0
  184. package/dist/core/generation/ButtonMapper.d.ts +346 -0
  185. package/dist/core/generation/ButtonMapper.d.ts.map +1 -0
  186. package/dist/core/generation/ButtonPatternLibrary.d.ts +92 -0
  187. package/dist/core/generation/ButtonPatternLibrary.d.ts.map +1 -0
  188. package/dist/core/generation/CRLevelConverter.d.ts +242 -0
  189. package/dist/core/generation/CRLevelConverter.d.ts.map +1 -0
  190. package/dist/core/generation/CharacterGenerator.d.ts +194 -0
  191. package/dist/core/generation/CharacterGenerator.d.ts.map +1 -0
  192. package/dist/core/generation/ClassSuggester.d.ts +184 -0
  193. package/dist/core/generation/ClassSuggester.d.ts.map +1 -0
  194. package/dist/core/generation/EnemyEquipmentGenerator.d.ts +151 -0
  195. package/dist/core/generation/EnemyEquipmentGenerator.d.ts.map +1 -0
  196. package/dist/core/generation/EnemyGenerator.d.ts +595 -0
  197. package/dist/core/generation/EnemyGenerator.d.ts.map +1 -0
  198. package/dist/core/generation/EquipmentGenerator.d.ts +204 -0
  199. package/dist/core/generation/EquipmentGenerator.d.ts.map +1 -0
  200. package/dist/core/generation/LegendaryGenerator.d.ts +213 -0
  201. package/dist/core/generation/LegendaryGenerator.d.ts.map +1 -0
  202. package/dist/core/generation/LevelGenerator.d.ts +390 -0
  203. package/dist/core/generation/LevelGenerator.d.ts.map +1 -0
  204. package/dist/core/generation/NamingEngine.d.ts +136 -0
  205. package/dist/core/generation/NamingEngine.d.ts.map +1 -0
  206. package/dist/core/generation/PitchBeatLinker.d.ts +150 -0
  207. package/dist/core/generation/PitchBeatLinker.d.ts.map +1 -0
  208. package/dist/core/generation/RaceSelector.d.ts +58 -0
  209. package/dist/core/generation/RaceSelector.d.ts.map +1 -0
  210. package/dist/core/generation/RhythmGenerator.d.ts +597 -0
  211. package/dist/core/generation/RhythmGenerator.d.ts.map +1 -0
  212. package/dist/core/generation/SkillAssigner.d.ts +78 -0
  213. package/dist/core/generation/SkillAssigner.d.ts.map +1 -0
  214. package/dist/core/generation/SpellManager.d.ts +132 -0
  215. package/dist/core/generation/SpellManager.d.ts.map +1 -0
  216. package/dist/core/generation/SpellcastingGenerator.d.ts +255 -0
  217. package/dist/core/generation/SpellcastingGenerator.d.ts.map +1 -0
  218. package/dist/core/generation/index.d.ts +41 -0
  219. package/dist/core/generation/index.d.ts.map +1 -0
  220. package/dist/core/parser/MetadataExtractor.d.ts +66 -0
  221. package/dist/core/parser/MetadataExtractor.d.ts.map +1 -0
  222. package/dist/core/parser/PlaylistParser.d.ts +45 -0
  223. package/dist/core/parser/PlaylistParser.d.ts.map +1 -0
  224. package/dist/core/playback/SubdivisionPlaybackController.d.ts +333 -0
  225. package/dist/core/playback/SubdivisionPlaybackController.d.ts.map +1 -0
  226. package/dist/core/playback/index.d.ts +5 -0
  227. package/dist/core/playback/index.d.ts.map +1 -0
  228. package/dist/core/progression/CharacterUpdater.d.ts +203 -0
  229. package/dist/core/progression/CharacterUpdater.d.ts.map +1 -0
  230. package/dist/core/progression/LevelUpProcessor.d.ts +234 -0
  231. package/dist/core/progression/LevelUpProcessor.d.ts.map +1 -0
  232. package/dist/core/progression/PrestigeSystem.d.ts +217 -0
  233. package/dist/core/progression/PrestigeSystem.d.ts.map +1 -0
  234. package/dist/core/progression/RhythmXPCalculator.d.ts +182 -0
  235. package/dist/core/progression/RhythmXPCalculator.d.ts.map +1 -0
  236. package/dist/core/progression/SessionTracker.d.ts +169 -0
  237. package/dist/core/progression/SessionTracker.d.ts.map +1 -0
  238. package/dist/core/progression/XPCalculator.d.ts +128 -0
  239. package/dist/core/progression/XPCalculator.d.ts.map +1 -0
  240. package/dist/core/progression/stat/StatIncreaseStrategy.d.ts +97 -0
  241. package/dist/core/progression/stat/StatIncreaseStrategy.d.ts.map +1 -0
  242. package/dist/core/progression/stat/StatManager.d.ts +179 -0
  243. package/dist/core/progression/stat/StatManager.d.ts.map +1 -0
  244. package/dist/core/sensors/EnvironmentalSensors.d.ts +301 -0
  245. package/dist/core/sensors/EnvironmentalSensors.d.ts.map +1 -0
  246. package/dist/core/sensors/GamingPlatformSensors.d.ts +162 -0
  247. package/dist/core/sensors/GamingPlatformSensors.d.ts.map +1 -0
  248. package/dist/core/sensors/GeolocationProvider.d.ts +156 -0
  249. package/dist/core/sensors/GeolocationProvider.d.ts.map +1 -0
  250. package/dist/core/sensors/MotionDetector.d.ts +58 -0
  251. package/dist/core/sensors/MotionDetector.d.ts.map +1 -0
  252. package/dist/core/sensors/SteamAPIClient.d.ts +108 -0
  253. package/dist/core/sensors/SteamAPIClient.d.ts.map +1 -0
  254. package/dist/core/sensors/WeatherAPIClient.d.ts +360 -0
  255. package/dist/core/sensors/WeatherAPIClient.d.ts.map +1 -0
  256. package/dist/core/sensors/schemas/weather.schema.d.ts +144 -0
  257. package/dist/core/sensors/schemas/weather.schema.d.ts.map +1 -0
  258. package/dist/core/skills/SkillQuery.d.ts +159 -0
  259. package/dist/core/skills/SkillQuery.d.ts.map +1 -0
  260. package/dist/core/skills/SkillTypes.d.ts +233 -0
  261. package/dist/core/skills/SkillTypes.d.ts.map +1 -0
  262. package/dist/core/skills/SkillValidator.d.ts +146 -0
  263. package/dist/core/skills/SkillValidator.d.ts.map +1 -0
  264. package/dist/core/skills/index.d.ts +11 -0
  265. package/dist/core/skills/index.d.ts.map +1 -0
  266. package/dist/core/spells/SpellQuery.d.ts +194 -0
  267. package/dist/core/spells/SpellQuery.d.ts.map +1 -0
  268. package/dist/core/spells/SpellTypes.d.ts +71 -0
  269. package/dist/core/spells/SpellTypes.d.ts.map +1 -0
  270. package/dist/core/spells/SpellValidator.d.ts +129 -0
  271. package/dist/core/spells/SpellValidator.d.ts.map +1 -0
  272. package/dist/core/spells/index.d.ts +11 -0
  273. package/dist/core/spells/index.d.ts.map +1 -0
  274. package/dist/core/types/AudioProfile.d.ts +143 -0
  275. package/dist/core/types/AudioProfile.d.ts.map +1 -0
  276. package/dist/core/types/BeatMap.d.ts +1825 -0
  277. package/dist/core/types/BeatMap.d.ts.map +1 -0
  278. package/dist/core/types/ButtonMapping.d.ts +345 -0
  279. package/dist/core/types/ButtonMapping.d.ts.map +1 -0
  280. package/dist/core/types/Character.d.ts +397 -0
  281. package/dist/core/types/Character.d.ts.map +1 -0
  282. package/dist/core/types/ChartedBeatMap.d.ts +169 -0
  283. package/dist/core/types/ChartedBeatMap.d.ts.map +1 -0
  284. package/dist/core/types/Combat.d.ts +268 -0
  285. package/dist/core/types/Combat.d.ts.map +1 -0
  286. package/dist/core/types/CombatAI.d.ts +143 -0
  287. package/dist/core/types/CombatAI.d.ts.map +1 -0
  288. package/dist/core/types/Enemy.d.ts +447 -0
  289. package/dist/core/types/Enemy.d.ts.map +1 -0
  290. package/dist/core/types/Environmental.d.ts +213 -0
  291. package/dist/core/types/Environmental.d.ts.map +1 -0
  292. package/dist/core/types/Equipment.d.ts +309 -0
  293. package/dist/core/types/Equipment.d.ts.map +1 -0
  294. package/dist/core/types/ISessionTracker.d.ts +48 -0
  295. package/dist/core/types/ISessionTracker.d.ts.map +1 -0
  296. package/dist/core/types/LevelExport.d.ts +366 -0
  297. package/dist/core/types/LevelExport.d.ts.map +1 -0
  298. package/dist/core/types/Playlist.d.ts +70 -0
  299. package/dist/core/types/Playlist.d.ts.map +1 -0
  300. package/dist/core/types/Prestige.d.ts +94 -0
  301. package/dist/core/types/Prestige.d.ts.map +1 -0
  302. package/dist/core/types/Progression.d.ts +214 -0
  303. package/dist/core/types/Progression.d.ts.map +1 -0
  304. package/dist/core/types/RhythmXP.d.ts +398 -0
  305. package/dist/core/types/RhythmXP.d.ts.map +1 -0
  306. package/dist/core/utils/AbilityConstants.d.ts +31 -0
  307. package/dist/core/utils/AbilityConstants.d.ts.map +1 -0
  308. package/dist/core/utils/EffectApplierUtils.d.ts +56 -0
  309. package/dist/core/utils/EffectApplierUtils.d.ts.map +1 -0
  310. package/dist/core/utils/ImageValidator.d.ts +66 -0
  311. package/dist/core/utils/ImageValidator.d.ts.map +1 -0
  312. package/dist/core/utils/PrerequisiteValidator.d.ts +88 -0
  313. package/dist/core/utils/PrerequisiteValidator.d.ts.map +1 -0
  314. package/dist/essentia-wasm.es-BUEnKUts.js +2990 -0
  315. package/dist/essentia.js-model.es-CGA0xotH.js +306 -0
  316. package/dist/index.d.ts +176 -0
  317. package/dist/index.d.ts.map +1 -0
  318. package/dist/playlist-data-engine.js +124 -0
  319. package/dist/playlist-data-engine.mjs +49251 -0
  320. package/dist/utils/EnchantmentLibrary.d.ts +378 -0
  321. package/dist/utils/EnchantmentLibrary.d.ts.map +1 -0
  322. package/dist/utils/arweaveGatewayManager.d.ts +485 -0
  323. package/dist/utils/arweaveGatewayManager.d.ts.map +1 -0
  324. package/dist/utils/arweaveUtils.d.ts +118 -0
  325. package/dist/utils/arweaveUtils.d.ts.map +1 -0
  326. package/dist/utils/constants.d.ts +439 -0
  327. package/dist/utils/constants.d.ts.map +1 -0
  328. package/dist/utils/equipmentConstants.d.ts +60 -0
  329. package/dist/utils/equipmentConstants.d.ts.map +1 -0
  330. package/dist/utils/hash.d.ts +33 -0
  331. package/dist/utils/hash.d.ts.map +1 -0
  332. package/dist/utils/logger.d.ts +192 -0
  333. package/dist/utils/logger.d.ts.map +1 -0
  334. package/dist/utils/magicItemExamples.d.ts +46 -0
  335. package/dist/utils/magicItemExamples.d.ts.map +1 -0
  336. package/dist/utils/playlistUtils.d.ts +149 -0
  337. package/dist/utils/playlistUtils.d.ts.map +1 -0
  338. package/dist/utils/random.d.ts +34 -0
  339. package/dist/utils/random.d.ts.map +1 -0
  340. package/dist/utils/sensorDashboard.d.ts +60 -0
  341. package/dist/utils/sensorDashboard.d.ts.map +1 -0
  342. package/dist/utils/validators.d.ts +189 -0
  343. package/dist/utils/validators.d.ts.map +1 -0
  344. package/dist/vite.svg +1 -0
  345. package/package.json +82 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * CombatAI — Decision engine for AI-controlled combatants
3
+ *
4
+ * Produces an `AIDecision` for each combatant's turn based on:
5
+ * 1. Threat assessment (current battlefield state)
6
+ * 2. Play style (normal vs aggressive)
7
+ * 3. Available actions (weapons, spells, items, legendary actions)
8
+ *
9
+ * The AI is designed to be **deterministic given the same combat state** —
10
+ * it uses no randomness internally. All randomness comes from the dice roller
11
+ * when the AICombatRunner executes the decision.
12
+ */
13
+ import type { Combatant, CombatInstance } from '../../types/Combat';
14
+ import type { AIConfig, AIPlayStyle, AIDecision, AIThreatAssessment } from '../../types/CombatAI';
15
+ import type { Spell } from '../../types/Character';
16
+ /**
17
+ * Weapon evaluation — internal representation used to compare weapons.
18
+ */
19
+ interface WeaponEvaluation {
20
+ name: string;
21
+ expectedDamage: number;
22
+ attackBonus: number;
23
+ type: 'melee' | 'ranged';
24
+ properties: string[];
25
+ }
26
+ export declare class CombatAI {
27
+ private config;
28
+ constructor(config: AIConfig);
29
+ /**
30
+ * Get the effective play style for a combatant.
31
+ * Per-combatant overrides take priority over side defaults.
32
+ */
33
+ getStyleForCombatant(combatant: Combatant): AIPlayStyle;
34
+ /**
35
+ * Determine which side a combatant belongs to.
36
+ */
37
+ getSide(combatant: Combatant): 'player' | 'enemy';
38
+ /**
39
+ * Get all living enemies of a given combatant.
40
+ */
41
+ getEnemies(combatant: Combatant, combat: CombatInstance): Combatant[];
42
+ /**
43
+ * Get all living allies of a given combatant (including self).
44
+ */
45
+ getAllies(combatant: Combatant, combat: CombatInstance): Combatant[];
46
+ /**
47
+ * Assess the current battlefield state from a combatant's perspective.
48
+ *
49
+ * Provides a snapshot of tactical conditions that drive style-dependent
50
+ * decision-making. Called at the start of each turn.
51
+ */
52
+ assessThreat(combatant: Combatant, combat: CombatInstance): AIThreatAssessment;
53
+ /**
54
+ * Main decision entry point.
55
+ *
56
+ * Evaluates the battlefield, selects the best action based on play style,
57
+ * and returns an `AIDecision` for the AICombatRunner to execute.
58
+ */
59
+ decide(combatant: Combatant, combat: CombatInstance): AIDecision;
60
+ /**
61
+ * Decide whether to cast a spell and which one.
62
+ * Returns null if no spell is worth casting.
63
+ */
64
+ private selectSpellAction;
65
+ /**
66
+ * Get all spells available to a combatant (cantrips + slotted spells).
67
+ */
68
+ getAvailableSpells(combatant: Combatant): Spell[];
69
+ /**
70
+ * Check if spell slots are available for a given spell level.
71
+ */
72
+ private hasSlotForLevel;
73
+ /**
74
+ * Evaluate a spell for decision-making.
75
+ */
76
+ private evaluateSpell;
77
+ /**
78
+ * Get the best available spell slot level for a spell.
79
+ */
80
+ private getBestAvailableSlot;
81
+ /**
82
+ * Decide whether the AI should heal this turn.
83
+ */
84
+ private shouldHeal;
85
+ /**
86
+ * Pick the best healing spell from available options.
87
+ */
88
+ private pickHealingSpell;
89
+ /**
90
+ * Pick the best target for a healing spell.
91
+ */
92
+ private pickHealingTarget;
93
+ /**
94
+ * Get all allies that would benefit from a healing spell.
95
+ */
96
+ private getHealingTargets;
97
+ /**
98
+ * Decide whether to cast a damage spell instead of attacking.
99
+ */
100
+ private shouldCastDamageSpell;
101
+ /**
102
+ * Pick the best damage spell.
103
+ */
104
+ private pickDamageSpell;
105
+ /**
106
+ * Calculate total remaining spell slots across all levels.
107
+ */
108
+ private totalSlotsRemaining;
109
+ /**
110
+ * Pick targets for a spell.
111
+ */
112
+ private pickSpellTargets;
113
+ /**
114
+ * Decide whether to cast a control spell.
115
+ */
116
+ private shouldCastControlSpell;
117
+ /**
118
+ * Pick the best target for a buff spell.
119
+ */
120
+ private pickBuffTarget;
121
+ /**
122
+ * Decide whether to use an item this turn.
123
+ * Returns null if no item usage is warranted.
124
+ */
125
+ private selectItemAction;
126
+ /**
127
+ * Decide whether to take a defensive action (dodge/flee).
128
+ * Returns null if an offensive action is better.
129
+ */
130
+ private selectDefensiveAction;
131
+ /**
132
+ * Select a weapon attack action.
133
+ */
134
+ private selectAttackAction;
135
+ /**
136
+ * Select the best target from available enemies.
137
+ *
138
+ * **Normal**: target the enemy with the lowest AC (balanced — easiest to hit).
139
+ * **Aggressive**: target the enemy with the lowest HP (finish them off for action economy).
140
+ */
141
+ selectTarget(enemies: Combatant[], style: AIPlayStyle): Combatant;
142
+ /**
143
+ * Select the best weapon to attack with.
144
+ *
145
+ * Evaluates all equipped weapons + unarmed strike.
146
+ * **Normal**: balanced (highest expected damage with reasonable hit chance).
147
+ * **Aggressive**: highest expected damage regardless of hit chance.
148
+ */
149
+ selectWeapon(combatant: Combatant, style: AIPlayStyle): WeaponEvaluation;
150
+ /**
151
+ * Evaluate all available weapons for a combatant.
152
+ */
153
+ private evaluateWeapons;
154
+ /**
155
+ * Select a legendary action for a boss combatant.
156
+ *
157
+ * Called by AICombatRunner between other combatants' turns.
158
+ * **Normal**: spread actions across the round, prefer damage actions.
159
+ * **Aggressive**: use highest-cost damage actions immediately.
160
+ *
161
+ * @param boss - The boss combatant with legendary actions
162
+ * @param combat - The combat instance
163
+ * @returns An AIDecision with action='legendaryAction', or null if no action should be taken
164
+ */
165
+ selectLegendaryAction(boss: Combatant, combat: CombatInstance): AIDecision | null;
166
+ /**
167
+ * Calculate the average (expected) damage from a dice formula string.
168
+ *
169
+ * Handles simple formulas like "2d6", "2d6+5", "1d8+3", "3d10".
170
+ * Returns the mathematical expectation.
171
+ */
172
+ averageDamageFromFormula(formula: string): number;
173
+ /**
174
+ * Check if a combatant is a support archetype (healer/buffer).
175
+ */
176
+ isSupportArchetype(combatant: Combatant): boolean;
177
+ }
178
+ export {};
179
+ //# sourceMappingURL=CombatAI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CombatAI.d.ts","sourceRoot":"","sources":["../../../../src/core/combat/AI/CombatAI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,QAAQ,EACR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OAAO,CAAC,iBAAiB;IAyBzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA8B7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAkCvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAuCxB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,SAAS;IAsBjE;;;;;;OAMG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB;IA0BxE;;OAEG;IACH,OAAO,CAAC,eAAe;IA6CvB;;;;;;;;;;OAUG;IACH,qBAAqB,CACnB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,cAAc,GACrB,UAAU,GAAG,IAAI;IAmFpB;;;;;OAKG;IACH,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAmBjD;;OAEG;IACH,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;CAWlD"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * CombatMetricsTracker — Computes per-combatant statistics from combat history
3
+ *
4
+ * Analyzes the action log of a completed CombatInstance to produce
5
+ * CombatantMetrics for every combatant. This is a post-hoc analysis
6
+ * — it reads the existing history without modifying the engine.
7
+ *
8
+ * Used by AICombatRunner after combat completes, and by the Monte Carlo
9
+ * simulator to aggregate per-combatant performance across many runs.
10
+ */
11
+ import type { CombatInstance } from '../../types/Combat.js';
12
+ import type { CombatantMetrics } from '../../types/CombatAI.js';
13
+ export declare class CombatMetricsTracker {
14
+ /**
15
+ * Compute per-combatant metrics from a completed combat instance.
16
+ *
17
+ * Iterates the full action history and tallies damage dealt/taken,
18
+ * healing, spells, items, criticals, and action counts per combatant.
19
+ *
20
+ * @param combat - A completed CombatInstance (isActive should be false)
21
+ * @returns Map of combatant ID → CombatantMetrics
22
+ */
23
+ computeMetrics(combat: CombatInstance): Map<string, CombatantMetrics>;
24
+ /**
25
+ * Check if a spell action is a healing spell.
26
+ * Healing spells target allies and have the 'healing' tag.
27
+ */
28
+ private isHealingSpell;
29
+ }
30
+ //# sourceMappingURL=CombatMetricsTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CombatMetricsTracker.d.ts","sourceRoot":"","sources":["../../../../src/core/combat/AI/CombatMetricsTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,qBAAa,oBAAoB;IAC/B;;;;;;;;OAQG;IACH,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAwNrE;;;OAGG;IACH,OAAO,CAAC,cAAc;CAKvB"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * BalanceValidator — Validates encounter balance using Monte Carlo simulation results
3
+ *
4
+ * Takes simulation results and an intended difficulty, then compares actual player
5
+ * win rate against expected win rates per difficulty tier. Produces a BalanceReport
6
+ * with a balance score, variance classification, and actionable recommendations.
7
+ *
8
+ * Expected win rates (D&D 5e-inspired):
9
+ * - Easy: ~90%+ player win rate
10
+ * - Medium: ~70-80% player win rate
11
+ * - Hard: ~50-60% player win rate
12
+ * - Deadly: ~30-40% player win rate
13
+ *
14
+ * Usage:
15
+ * ```ts
16
+ * const simulator = new CombatSimulator();
17
+ * const results = simulator.run(party, enemies, config);
18
+ * const validator = new BalanceValidator();
19
+ * const report = validator.validate(results, 'medium');
20
+ * console.log(report.balanceScore); // 0-100
21
+ * console.log(report.difficultyVariance); // 'balanced' | 'underpowered' | 'overpowered'
22
+ * ```
23
+ */
24
+ import type { CharacterSheet } from '../../types/Character.js';
25
+ import type { EncounterDifficulty } from '../../types/Enemy.js';
26
+ import type { SimulationConfig, SimulationResults } from '../Simulation/CombatSimulator.js';
27
+ /**
28
+ * Variance classification — how the actual difficulty compares to intended.
29
+ */
30
+ export type DifficultyVariance = 'underpowered' | 'balanced' | 'overpowered';
31
+ /**
32
+ * A single actionable recommendation for adjusting encounter balance.
33
+ */
34
+ export interface BalanceRecommendation {
35
+ /** Human-readable description of the suggested change */
36
+ description: string;
37
+ /** Expected impact on win rate (e.g., '+5-10% player win rate') */
38
+ expectedImpact: string;
39
+ /** Confidence level for this recommendation (0-1, based on run count) */
40
+ confidence: number;
41
+ }
42
+ /**
43
+ * Complete balance analysis report from validating an encounter.
44
+ */
45
+ export interface BalanceReport {
46
+ /** The difficulty the encounter was designed for */
47
+ intendedDifficulty: EncounterDifficulty;
48
+ /** The difficulty the simulation data actually reflects */
49
+ actualDifficulty: EncounterDifficulty;
50
+ /** How well actual matches intended (0-100, 100 = perfect) */
51
+ balanceScore: number;
52
+ /** Actual player win rate from simulation */
53
+ playerWinRate: number;
54
+ /** Expected win rate range for the intended difficulty */
55
+ expectedWinRate: {
56
+ min: number;
57
+ max: number;
58
+ };
59
+ /** Whether encounter is underpowered, balanced, or overpowered */
60
+ difficultyVariance: DifficultyVariance;
61
+ /** Statistical confidence based on run count (0-1) */
62
+ confidence: number;
63
+ /** Actionable suggestions for improving balance */
64
+ recommendations: BalanceRecommendation[];
65
+ /** Average HP remaining for players on winning runs (0-100) */
66
+ averagePlayerHPPercentRemaining: number;
67
+ /** Total simulation runs used for this analysis */
68
+ totalRuns: number;
69
+ }
70
+ /**
71
+ * Expected player win rate ranges per encounter difficulty tier.
72
+ *
73
+ * These are D&D 5e-inspired targets:
74
+ * - Easy: party should almost always win (~90%+)
75
+ * - Medium: comfortable but not trivial (~70-80%)
76
+ * - Hard: challenging, real risk of death (~50-60%)
77
+ * - Deadly: likely TPK, major achievement to win (~30-40%)
78
+ *
79
+ * Tunable — adjust these values to change what "balanced" means for your game.
80
+ */
81
+ export declare const EXPECTED_WIN_RATES: Record<EncounterDifficulty, {
82
+ min: number;
83
+ max: number;
84
+ }>;
85
+ /**
86
+ * BalanceValidator — Analyzes simulation results to assess encounter balance.
87
+ *
88
+ * Stateless between calls. Each `validate()` or `validateFromSimulation()`
89
+ * call produces an independent BalanceReport.
90
+ */
91
+ export declare class BalanceValidator {
92
+ /**
93
+ * Validate an encounter by running simulations and analyzing results.
94
+ *
95
+ * Convenience method that combines CombatSimulator.run() + validate().
96
+ * Use this when you don't already have simulation results.
97
+ *
98
+ * @param players - Player character sheets
99
+ * @param enemies - Enemy character sheets
100
+ * @param intendedDifficulty - The difficulty the encounter is designed for
101
+ * @param config - Simulation configuration (run count, seed, AI styles)
102
+ * @returns Complete balance analysis report
103
+ */
104
+ validate(players: CharacterSheet[], enemies: CharacterSheet[], intendedDifficulty: EncounterDifficulty, config: SimulationConfig): BalanceReport;
105
+ /**
106
+ * Analyze existing simulation results to produce a balance report.
107
+ *
108
+ * Use this when you already have simulation results and want to evaluate
109
+ * them against a target difficulty.
110
+ *
111
+ * @param results - Simulation results from CombatSimulator.run()
112
+ * @param intendedDifficulty - The difficulty the encounter was designed for
113
+ * @returns Complete balance analysis report
114
+ */
115
+ analyze(results: SimulationResults, intendedDifficulty: EncounterDifficulty): BalanceReport;
116
+ /**
117
+ * Classify what difficulty tier a given win rate falls into.
118
+ *
119
+ * Maps win rate to the closest matching difficulty tier:
120
+ * - >= 90% → easy
121
+ * - >= 70% → medium
122
+ * - >= 50% → hard
123
+ * - < 50% → deadly
124
+ */
125
+ private classifyDifficulty;
126
+ /**
127
+ * Calculate a balance score (0-100) comparing actual win rate to expected range.
128
+ *
129
+ * Score calculation:
130
+ * - If win rate is within the expected range: 100 - distance from midpoint
131
+ * - If win rate is outside the expected range: penalty proportional to distance
132
+ *
133
+ * A perfect score of 100 means the win rate exactly hits the midpoint of the
134
+ * expected range. Scores decrease as the actual win rate deviates.
135
+ *
136
+ * The score also factors in HP remaining — a 100% win rate with 1 HP left
137
+ * is different from 100% with full HP. This adjusts the score by up to 10 points.
138
+ */
139
+ private calculateBalanceScore;
140
+ /**
141
+ * Classify the difficulty variance based on win rate vs expected range.
142
+ *
143
+ * - Win rate within expected range → balanced
144
+ * - Win rate above expected range → underpowered (encounter too easy)
145
+ * - Win rate below expected range → overpowered (encounter too hard)
146
+ */
147
+ private classifyVariance;
148
+ /**
149
+ * Calculate statistical confidence based on run count.
150
+ *
151
+ * More runs = higher confidence in the results.
152
+ * Uses a power curve: 1 - 1 / sqrt(n)
153
+ * - 100 runs → ~0.90 confidence
154
+ * - 500 runs → ~0.96 confidence
155
+ * - 1000 runs → ~0.97 confidence
156
+ * - 2000 runs → ~0.98 confidence
157
+ * - 5000 runs → ~0.99 confidence
158
+ */
159
+ private calculateConfidence;
160
+ /**
161
+ * Generate actionable recommendations for improving encounter balance.
162
+ *
163
+ * Recommendations are context-aware:
164
+ * - If overpowered (too hard): suggest reducing enemy strength
165
+ * - If underpowered (too easy): suggest increasing enemy strength
166
+ * - If balanced: suggest tuning for HP remaining
167
+ */
168
+ private generateRecommendations;
169
+ }
170
+ //# sourceMappingURL=BalanceValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BalanceValidator.d.ts","sourceRoot":"","sources":["../../../../src/core/combat/Analysis/BalanceValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC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H,OAAO,CACL,OAAO,EAAE,iBAAiB,EAC1B,kBAAkB,EAAE,mBAAmB,GACtC,aAAa;IAyChB;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,qBAAqB;IA2B7B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;;;;;;OAOG;IACH,OAAO,CAAC,uBAAuB;CA0GhC"}
@@ -0,0 +1,231 @@
1
+ /**
2
+ * ComparativeAnalyzer — Compare two encounter configurations using
3
+ * identical-seed simulation to isolate the effect of a single variable.
4
+ *
5
+ * Answers questions like: "How much does +2 AC improve win rate?" or
6
+ * "Is adding a 5th party member statistically significant?"
7
+ *
8
+ * Both configurations are simulated with the same sequence of seeds,
9
+ * enabling pair-wise comparison where each seed-pair isolates the
10
+ * variable being tested (dice rolls are identical, only the config differs).
11
+ *
12
+ * Usage:
13
+ * ```ts
14
+ * const analyzer = new ComparativeAnalyzer();
15
+ * const comparison = analyzer.compare(
16
+ * { players, enemies: enemiesA, ... },
17
+ * { players, enemies: enemiesB, ... },
18
+ * { runCount: 500, baseSeed: 'ac-comparison', aiConfig: { playerStyle: 'normal', enemyStyle: 'aggressive' } }
19
+ * );
20
+ * console.log(comparison.winRateDelta); // e.g., +0.15
21
+ * console.log(comparison.isStatisticallySignificant); // true
22
+ * ```
23
+ */
24
+ import type { CharacterSheet } from '../../types/Character.js';
25
+ import type { AIConfig } from '../../types/CombatAI.js';
26
+ import type { SimulationResults, SimulationSummary } from '../Simulation/CombatSimulator.js';
27
+ /**
28
+ * Configuration for one side of a comparative analysis.
29
+ *
30
+ * Defines the party, enemies, and any simulation overrides for one
31
+ * of the two configurations being compared.
32
+ */
33
+ export interface ComparisonConfig {
34
+ /** Player character sheets */
35
+ players: CharacterSheet[];
36
+ /** Enemy character sheets */
37
+ enemies: CharacterSheet[];
38
+ /** Optional label for this configuration (e.g., "Base", "+2 AC") */
39
+ label?: string;
40
+ /** Optional combat config override (max turns, flee, etc.) */
41
+ combatConfig?: import('../../types/Combat.js').CombatConfig;
42
+ }
43
+ /**
44
+ * Options for the comparative analysis.
45
+ */
46
+ export interface ComparisonOptions {
47
+ /** Number of simulations per configuration */
48
+ runCount: number;
49
+ /** Base seed — both configs use the same seed sequence for fair comparison */
50
+ baseSeed: string;
51
+ /** AI configuration for all simulations */
52
+ aiConfig: AIConfig;
53
+ /** Optional combat engine configuration */
54
+ combatConfig?: import('../../types/Combat.js').CombatConfig;
55
+ /**
56
+ * Significance threshold (alpha) for statistical tests.
57
+ * Default: 0.05 (95% confidence).
58
+ */
59
+ significanceThreshold?: number;
60
+ /** AbortSignal for cancellation */
61
+ abortSignal?: AbortSignal;
62
+ /** Progress callback: (completedPerSide, totalPerSide, sideLabel) */
63
+ onProgress?: (completed: number, total: number, side: string) => void;
64
+ }
65
+ /**
66
+ * Delta metrics between two configurations.
67
+ *
68
+ * Positive values favor config A (A is better for players).
69
+ * Negative values favor config B (B is better for players).
70
+ */
71
+ export interface DeltaMetrics {
72
+ /** Win rate difference: A.winRate - B.winRate (e.g., +0.15 means A wins 15% more) */
73
+ winRateDelta: number;
74
+ /** Average rounds difference: A.avgRounds - B.avgRounds */
75
+ averageRoundsDelta: number;
76
+ /** Average player HP remaining difference: A.hpRemaining - B.hpRemaining */
77
+ averageHPRemainingDelta: number;
78
+ /** Total player deaths difference: A.deaths - B.deaths (negative = fewer deaths in A) */
79
+ totalPlayerDeathsDelta: number;
80
+ /** Total enemy deaths difference: A.enemyDeaths - B.enemyDeaths */
81
+ totalEnemyDeathsDelta: number;
82
+ /** Median rounds difference */
83
+ medianRoundsDelta: number;
84
+ }
85
+ /**
86
+ * Per-combatant delta between two configurations.
87
+ */
88
+ export interface CombatantDelta {
89
+ /** Combatant name (from config A) */
90
+ name: string;
91
+ /** Which side this combatant is on */
92
+ side: 'player' | 'enemy';
93
+ /** DPR difference: A.DPR - B.DPR */
94
+ dprDelta: number;
95
+ /** Average total damage dealt difference */
96
+ damageDealtDelta: number;
97
+ /** Average total damage taken difference */
98
+ damageTakenDelta: number;
99
+ /** Survival rate difference */
100
+ survivalRateDelta: number;
101
+ /** Kill rate difference */
102
+ killRateDelta: number;
103
+ /** Critical hit rate difference */
104
+ criticalHitRateDelta: number;
105
+ /** Average healing done difference */
106
+ healingDoneDelta: number;
107
+ }
108
+ /**
109
+ * Result of a statistical significance test.
110
+ */
111
+ export interface SignificanceResult {
112
+ /** Whether the difference is statistically significant at the given threshold */
113
+ isSignificant: boolean;
114
+ /** The p-value from the test (approximation) */
115
+ pValue: number;
116
+ /** The significance threshold used (alpha) */
117
+ threshold: number;
118
+ /** Human-readable interpretation */
119
+ interpretation: string;
120
+ }
121
+ /**
122
+ * Complete comparison result between two encounter configurations.
123
+ */
124
+ export interface ComparisonResult {
125
+ /** Label for configuration A (or "Config A" if not provided) */
126
+ labelA: string;
127
+ /** Label for configuration B (or "Config B" if not provided) */
128
+ labelB: string;
129
+ /** Full simulation results for configuration A */
130
+ resultsA: SimulationResults;
131
+ /** Full simulation results for configuration B */
132
+ resultsB: SimulationResults;
133
+ /** Summary for configuration A */
134
+ summaryA: SimulationSummary;
135
+ /** Summary for configuration B */
136
+ summaryB: SimulationSummary;
137
+ /** Delta metrics (positive = A is better for players) */
138
+ deltas: DeltaMetrics;
139
+ /** Per-combatant deltas (matched by combatant index, not ID) */
140
+ combatantDeltas: CombatantDelta[];
141
+ /** Statistical significance of the win rate difference */
142
+ winRateSignificance: SignificanceResult;
143
+ /** Was the comparison cancelled before completion? */
144
+ wasCancelled: boolean;
145
+ }
146
+ /**
147
+ * ComparativeAnalyzer — Compares two encounter configurations using
148
+ * identical-seed simulation.
149
+ *
150
+ * Both configurations are simulated with the same sequence of seeds,
151
+ * ensuring that dice roll variance is eliminated. The only difference
152
+ * in outcomes comes from the configuration change itself.
153
+ *
154
+ * This enables pair-wise comparison: for each seed, config A and config B
155
+ * experience the exact same dice rolls, so any outcome difference is
156
+ * attributable to the config change.
157
+ *
158
+ * Stateless between `compare()` calls.
159
+ */
160
+ export declare class ComparativeAnalyzer {
161
+ /**
162
+ * Compare two encounter configurations using identical-seed simulation.
163
+ *
164
+ * @param configA - First configuration (baseline)
165
+ * @param configB - Second configuration (modified)
166
+ * @param options - Simulation and comparison options
167
+ * @returns Full comparison result with deltas and significance
168
+ */
169
+ compare(configA: ComparisonConfig, configB: ComparisonConfig, options: ComparisonOptions): ComparisonResult;
170
+ /**
171
+ * Run simulations for a single configuration.
172
+ */
173
+ private runSimulations;
174
+ /**
175
+ * Calculate delta metrics between two simulation summaries.
176
+ *
177
+ * Positive delta = config A is better for players (higher win rate,
178
+ * fewer deaths, more HP remaining).
179
+ */
180
+ private calculateDeltas;
181
+ /**
182
+ * Calculate per-combatant deltas between two simulation results.
183
+ *
184
+ * Matches combatants by side and index position (not ID), since
185
+ * the two configs may have different combatant IDs.
186
+ */
187
+ private calculateCombatantDeltas;
188
+ /**
189
+ * Get metrics sorted by side, preserving insertion order.
190
+ */
191
+ private getMetricsBySide;
192
+ /**
193
+ * Create a CombatantDelta from two metrics entries (either may be null).
194
+ */
195
+ private makeCombatantDelta;
196
+ /**
197
+ * Test whether the win rate difference between two configurations is
198
+ * statistically significant.
199
+ *
200
+ * Uses a normal approximation for the difference of two proportions:
201
+ * - pA = win rate of config A (proportion of wins)
202
+ * - pB = win rate of config B
203
+ * - n = number of runs per config (assumed equal)
204
+ *
205
+ * Standard error of the difference: SE = sqrt(pA*(1-pA)/n + pB*(1-pB)/n)
206
+ * Z-score: Z = (pA - pB) / SE
207
+ * P-value: 2 * (1 - Φ(|Z|)) for two-tailed test
208
+ *
209
+ * For small samples (n < 30), falls back to a conservative check:
210
+ * the difference must exceed a minimum detectable effect threshold.
211
+ */
212
+ private testSignificance;
213
+ /**
214
+ * Calculate two-tailed p-value from a Z-score using an approximation
215
+ * of the standard normal cumulative distribution.
216
+ *
217
+ * Uses the Abramowitz and Stegun approximation (maximum error: 7.5e-8).
218
+ */
219
+ private twoTailedPValue;
220
+ /**
221
+ * Standard normal CDF using the Abramowitz and Stegun approximation.
222
+ *
223
+ * Maximum error: 7.5e-8. Valid for z >= 0.
224
+ */
225
+ private normalCDF;
226
+ /**
227
+ * Round to 4 decimal places for clean output.
228
+ */
229
+ private round;
230
+ }
231
+ //# sourceMappingURL=ComparativeAnalyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComparativeAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/core/combat/Analysis/ComparativeAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAoB,iBAAiB,EAAE,iBAAiB,EAA8B,MAAM,kCAAkC,CAAC;AAK3I;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8BAA8B;IAC9B,OAAO,EAAE,cAAc,EAAE,CAAC;IAE1B,6BAA6B;IAC7B,OAAO,EAAE,cAAc,EAAE,CAAC;IAE1B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,uBAAuB,EAAE,YAAY,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IAEjB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,QAAQ,EAAE,QAAQ,CAAC;IAEnB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,OAAO,uBAAuB,EAAE,YAAY,CAAC;IAE5D;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,mCAAmC;IACnC,WAAW,CAAC,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