@rian8337/osu-difficulty-calculator 1.4.16 → 2.0.0-alpha.2

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.
@@ -1,1255 +1,1157 @@
1
- declare module "@rian8337/osu-difficulty-calculator" {
2
- import {
3
- Accuracy,
4
- Beatmap,
5
- HitObject,
6
- MapStats,
7
- Mod,
8
- modes,
9
- OsuHitWindow,
10
- Slider,
11
- Vector2,
12
- } from "@rian8337/osu-base";
1
+ import { HitObject, modes, Mod, Beatmap, MapStats, Accuracy } from '@rian8337/osu-base';
13
2
 
14
- //#region Classes
15
-
16
- /**
17
- * Represents an osu!standard hit object with difficulty calculation values.
18
- */
19
- export class DifficultyHitObject {
20
- /**
21
- * The underlying hitobject.
22
- */
23
- readonly object: HitObject;
24
- /**
25
- * The aim strain generated by the hitobject if sliders are considered.
26
- */
27
- aimStrainWithSliders: number;
28
- /**
29
- * The aim strain generated by the hitobject if sliders are not considered.
30
- */
31
- aimStrainWithoutSliders: number;
32
- /**
33
- * The tap strain generated by the hitobject.
34
- *
35
- * This is also used for osu!standard as opposed to "speed strain".
36
- */
37
- tapStrain: number;
38
- /**
39
- * The tap strain generated by the hitobject if `strainTime` isn't modified by
40
- * OD. This is used in three-finger detection.
41
- */
42
- originalTapStrain: number;
43
- /**
44
- * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
45
- */
46
- rhythmMultiplier: number;
47
- /**
48
- * The rhythm strain generated by the hitobject.
49
- */
50
- rhythmStrain: number;
51
- /**
52
- * The flashlight strain generated by the hitobject.
53
- */
54
- flashlightStrain: number;
55
- /**
56
- * The visual strain generated by the hitobject.
57
- */
58
- visualStrain: number;
59
- /**
60
- * The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
61
- *
62
- * The "lazy" end position is the position at which the cursor ends up if the previous hitobject is followed with as minimal movement as possible (i.e. on the edge of slider follow circles).
63
- */
64
- lazyJumpDistance: number;
65
- /**
66
- * The normalized shortest distance to consider for a jump between the previous hitobject and this hitobject.
67
- *
68
- * This is bounded from above by `lazyJumpDistance`, and is smaller than the former if a more natural path is able to be taken through the previous hitobject.
69
- *
70
- * Suppose a linear slider - circle pattern. Following the slider lazily (see: `lazyJumpDistance`) will result in underestimating the true end position of the slider as being closer towards the start position.
71
- * As a result, `lazyJumpDistance` overestimates the jump distance because the player is able to take a more natural path by following through the slider to its end,
72
- * such that the jump is felt as only starting from the slider's true end position.
73
- *
74
- * Now consider a slider - circle pattern where the circle is stacked along the path inside the slider.
75
- * In this case, the lazy end position correctly estimates the true end position of the slider and provides the more natural movement path.
76
- */
77
- minimumJumpDistance: number;
78
- /**
79
- * The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
80
- */
81
- minimumJumpTime: number;
82
- /**
83
- * The normalized distance between the start and end position of this hitobject.
84
- */
85
- travelDistance: number;
86
- /**
87
- * The time taken to travel through `travelDistance`, with a minimum value of 25ms for a non-zero distance.
88
- */
89
- travelTime: number;
90
- /**
91
- * Angle the player has to take to hit this hitobject.
92
- *
93
- * Calculated as the angle between the circles (current-2, current-1, current).
94
- */
95
- angle: number | null;
96
- /**
97
- * The amount of milliseconds elapsed between this hitobject and the last hitobject.
98
- */
99
- deltaTime: number;
100
- /**
101
- * The amount of milliseconds elapsed since the start time of the previous hitobject, with a minimum of 25ms.
102
- */
103
- strainTime: number;
104
- /**
105
- * Adjusted start time of the hitobject, taking speed multiplier into account.
106
- */
107
- startTime: number;
108
- /**
109
- * Adjusted end time of the hitobject, taking speed multiplier into account.
110
- */
111
- endTime: number;
112
- /**
113
- * The note density of the hitobject.
114
- */
115
- noteDensity: number;
116
- /**
117
- * The overlapping factor of the hitobject.
118
- *
119
- * This is used to scale visual skill.
120
- */
121
- overlappingFactor: number;
122
- /**
123
- * Adjusted velocity of the hitobject, taking speed multiplier into account.
124
- */
125
- velocity: number;
126
- /**
127
- * @param object The underlying hitobject.
128
- */
129
- constructor(object: HitObject);
130
- }
131
-
132
- /**
133
- * A converter used to convert normal hitobjects into difficulty hitobjects.
134
- */
135
- export class DifficultyHitObjectCreator {
136
- /**
137
- * The threshold for small circle buff for osu!droid.
138
- */
139
- private readonly DROID_CIRCLESIZE_BUFF_THRESHOLD: number;
140
- /**
141
- * The threshold for small circle buff for osu!standard.
142
- */
143
- private readonly PC_CIRCLESIZE_BUFF_THRESHOLD: number;
144
- /**
145
- * The radius of hitobjects.
146
- */
147
- private hitObjectRadius: number;
148
- /**
149
- * The base normalized radius of hitobjects.
150
- */
151
- private readonly normalizedRadius: number;
152
- /**
153
- * Generates difficulty hitobjects for difficulty calculation.
154
- */
155
- generateDifficultyObjects(params: {
156
- objects: HitObject[];
157
- circleSize: number;
158
- speedMultiplier: number;
159
- mode: modes;
160
- preempt?: number;
161
- }): DifficultyHitObject[];
162
- /**
163
- * Calculates a slider's cursor position.
164
- */
165
- private calculateSliderCursorPosition(slider: Slider): void;
166
- /**
167
- * Gets the scaling factor of a radius.
168
- *
169
- * @param mode The mode to get the scaling factor from.
170
- * @param radius The radiust to get the scaling factor from.
171
- */
172
- private getScalingFactor(mode: modes, radius: number): number;
173
- /**
174
- * Returns the end cursor position of a hitobject.
175
- */
176
- private getEndCursorPosition(object: HitObject): Vector2;
177
- }
178
-
179
- /**
180
- * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
181
- */
182
- export class DroidAim extends DroidSkill {
183
- protected override readonly skillMultiplier: number;
184
- protected override readonly strainDecayBase: number;
185
- protected override readonly reducedSectionBaseline: number;
186
- protected override readonly reducedSectionCount: number;
187
- protected override readonly starsPerDouble: number;
188
- /**
189
- * Spacing threshold for a single hitobject spacing.
190
- */
191
- private readonly SINGLE_SPACING_THRESHOLD: number;
192
- private readonly minSpeedBonus: number;
193
- private readonly wideAngleMultiplier: number;
194
- private readonly acuteAngleMultiplier: number;
195
- private readonly sliderMultiplier: number;
196
- private readonly velocityChangeMultiplier: number;
197
- private readonly withSliders: boolean;
198
- constructor(mods: Mod[], withSliders: boolean);
199
- /**
200
- * @param current The hitobject to calculate.
201
- */
202
- protected strainValueOf(current: DifficultyHitObject): number;
203
- /**
204
- * @param current The hitobject to calculate.
205
- */
206
- protected override strainValueAt(current: DifficultyHitObject): number;
207
- /**
208
- * @param current The hitobject to save to.
209
- */
210
- protected override saveToHitObject(current: DifficultyHitObject): void;
211
- }
212
-
213
- /**
214
- * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
215
- */
216
- export class DroidFlashlight extends DroidSkill {
217
- protected override readonly historyLength: number;
218
- protected override readonly skillMultiplier: number;
219
- protected override readonly strainDecayBase: number;
220
- protected override readonly reducedSectionBaseline: number;
221
- protected override readonly reducedSectionCount: number;
222
- protected override readonly starsPerDouble: number;
223
- /**
224
- * @param current The hitobject to calculate.
225
- */
226
- protected strainValueOf(current: DifficultyHitObject): number;
227
- /**
228
- * @param current The hitobject to calculate.
229
- */
230
- protected override strainValueAt(current: DifficultyHitObject): number;
231
- /**
232
- * @param current The hitobject to save to.
233
- */
234
- protected override saveToHitObject(current: DifficultyHitObject): void;
235
- }
236
-
237
- /**
238
- * A performance points calculator that calculates performance points for osu!droid gamemode.
239
- */
240
- export class DroidPerformanceCalculator extends PerformanceCalculator {
241
- override stars: DroidStarRating;
242
- protected override finalMultiplier: number;
243
- /**
244
- * The aim performance value.
245
- */
246
- aim: number;
247
- /**
248
- * The tap performance value.
249
- */
250
- tap: number;
251
- /**
252
- * The accuracy performance value.
253
- */
254
- accuracy: number;
255
- /**
256
- * The flashlight performance value.
257
- */
258
- flashlight: number;
259
- /**
260
- * The visual performance value.
261
- */
262
- visual: number;
263
- private tapPenalty: number;
264
- override calculate(params: {
265
- /**
266
- * The star rating instance to calculate.
267
- */
268
- stars: DroidStarRating;
269
- /**
270
- * The maximum combo achieved in the score.
271
- */
272
- combo?: number;
273
- /**
274
- * The accuracy achieved in the score.
275
- */
276
- accPercent?: Accuracy | number;
277
- /**
278
- * The amount of misses achieved in the score.
279
- */
280
- miss?: number;
281
- /**
282
- * The tap penalty to apply for penalized scores.
283
- */
284
- tapPenalty?: number;
285
- /**
286
- * Custom map statistics to apply custom tap multiplier and force AR values as well as old statistics.
287
- */
288
- stats?: MapStats;
289
- }): this;
290
- protected override calculateValues(): void;
291
- protected override calculateTotalValue(): number;
292
- /**
293
- * Calculates the aim performance value of the beatmap.
294
- */
295
- private calculateAimValue(): void;
296
- /**
297
- * Calculates the tap performance value of the beatmap.
298
- */
299
- private calculateTapValue(): void;
300
- /**
301
- * Calculates the accuracy performance value of the beatmap.
302
- */
303
- private calculateAccuracyValue(): void;
304
- /**
305
- * Calculates the flashlight performance value of the beatmap.
306
- */
307
- private calculateFlashlightValue(): void;
308
- /**
309
- * Calculates the visual performance value of the beatmap.
310
- */
311
- private calculateVisualValue(): void;
312
- override toString(): string;
313
- }
314
-
315
- /**
316
- * Represents the skill required to properly follow a beatmap's rhythm.
317
- */
318
- export class DroidRhythm extends DroidSkill {
319
- protected override readonly historyLength: number;
320
- protected override readonly skillMultiplier: number;
321
- protected override readonly reducedSectionCount: number;
322
- protected override readonly reducedSectionBaseline: number;
323
- protected override readonly strainDecayBase: number;
324
- protected override readonly starsPerDouble: number;
325
- private readonly rhythmMultiplier: number;
326
- private readonly historyTimeMax: number;
327
- private currentRhythm: number;
328
- private readonly hitWindow: OsuHitWindow;
329
- constructor(mods: Mod[], overallDifficulty: number);
330
- /**
331
- * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
332
- */
333
- private calculateRhythmBonus(current: DifficultyHitObject): number;
334
- protected override strainValueAt(current: DifficultyHitObject): number;
335
- protected override saveToHitObject(current: DifficultyHitObject): void;
336
- }
337
-
338
- /**
339
- * Difficulty calculator for osu!droid gamemode.
340
- */
341
- export class DroidStarRating extends StarRating {
342
- /**
343
- * The aim star rating of the beatmap.
344
- */
345
- aim: number;
346
- /**
347
- * The tap star rating of the beatmap.
348
- */
349
- tap: number;
350
- /**
351
- * The rhythm star rating of the beatmap.
352
- */
353
- rhythm: number;
354
- /**
355
- * The flashlight star rating of the beatmap.
356
- */
357
- flashlight: number;
358
- /**
359
- * The visual star rating of the beatmap.
360
- */
361
- visual: number;
362
- protected override readonly difficultyMultiplier: number;
363
- /**
364
- * Calculates the star rating of the specified beatmap.
365
- *
366
- * The beatmap is analyzed in chunks of `sectionLength` duration.
367
- * For each chunk the highest hitobject strains are added to
368
- * a list which is then collapsed into a weighted sum, much
369
- * like scores are weighted on a user's profile.
370
- *
371
- * For subsequent chunks, the initial max strain is calculated
372
- * by decaying the previous hitobject's strain until the
373
- * beginning of the new chunk.
374
- *
375
- * The first object doesn't generate a strain
376
- * so we begin calculating from the second object.
377
- *
378
- * Also don't forget to manually add the peak strain for the last
379
- * section which would otherwise be ignored.
380
- */
381
- calculate(params: {
382
- /**
383
- * The beatmap to calculate.
384
- */
385
- map: Beatmap;
386
- /**
387
- * Applied modifications.
388
- */
389
- mods?: Mod[];
390
- /**
391
- * Custom map statistics to apply custom tap multiplier as well as old statistics.
392
- */
393
- stats?: MapStats;
394
- }): this;
395
- /**
396
- * Calculates the aim star rating of the beatmap and stores it in this instance.
397
- */
398
- calculateAim(): void;
399
- /**
400
- * Calculates the tap star rating of the beatmap and stores it in this instance.
401
- */
402
- calculateTap(): void;
403
- /**
404
- * Calculates the rhythm star rating of the beatmap and stores it in this instance.
405
- */
406
- calculateRhythm(): void;
407
- /**
408
- * Calculates the flashlight star rating of the beatmap and stores it in this instance.
409
- */
410
- calculateFlashlight(): void;
411
- /**
412
- * Calculates the visual star rating of the beatmap and stores it in this instance.
413
- */
414
- calculateVisual(): void;
415
- override calculateTotal(): void;
416
- override calculateAll(): void;
417
- /**
418
- * Returns a string representative of the class.
419
- */
420
- toString(): string;
421
- /**
422
- * Creates skills to be calculated.
423
- */
424
- protected override createSkills(): DroidSkill[];
425
- /**
426
- * Called after aim skill calculation.
427
- *
428
- * @param aimSkill The aim skill that considers sliders.
429
- * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
430
- */
431
- private postCalculateAim(
432
- aimSkill: DroidAim,
433
- aimSkillWithoutSliders: DroidAim
434
- ): void;
435
- /**
436
- * Called after tap skill calculation.
437
- *
438
- * @param tapSkill The tap skill.
439
- */
440
- private postCalculateTap(tapSkill: DroidTap): void;
441
- /**
442
- * Calculates speed-related attributes.
443
- */
444
- private calculateSpeedAttributes(): void;
445
- /**
446
- * Called after rhythm skill calculation.
447
- *
448
- * @param rhythmSkill The rhythm skill.
449
- */
450
- private postCalculateRhythm(rhythmSkill: DroidRhythm): void;
451
- /**
452
- * Called after flashlight skill calculation.
453
- *
454
- * @param flashlightSkill The flashlight skill.
455
- */
456
- private postCalculateFlashlight(flashlightSkill: DroidFlashlight): void;
457
- /**
458
- * Called after visual skill calculation.
459
- *
460
- * @param visualSkill The visual skill.
461
- */
462
- private postCalculateVisual(visualSkill: DroidVisual): void;
463
- }
464
-
465
- /**
466
- * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
467
- */
468
- export class DroidTap extends DroidSkill {
469
- protected override readonly skillMultiplier: number;
470
- protected override readonly strainDecayBase: number;
471
- protected override readonly reducedSectionBaseline: number;
472
- protected override readonly reducedSectionCount: number;
473
- protected override readonly starsPerDouble: number;
474
- private readonly minSpeedBonus: number;
475
- private currentTapStrain: number;
476
- private currentOriginalTapStrain: number;
477
- private readonly hitWindow: OsuHitWindow;
478
- constructor(mods: Mod[], overallDifficulty: number);
479
- /**
480
- * @param current The hitobject to calculate.
481
- */
482
- protected strainValueOf(current: DifficultyHitObject): number;
483
- /**
484
- * Calculates the tap strain of a hitobject given a specific speed bonus and strain time.
485
- */
486
- private tapStrainOf(speedBonus: number, strainTime: number): number;
487
- /**
488
- * @param current The hitobject to calculate.
489
- */
490
- protected override strainValueAt(current: DifficultyHitObject): number;
491
- /**
492
- * @param current The hitobject to save to.
493
- */
494
- protected override saveToHitObject(current: DifficultyHitObject): void;
495
- }
496
-
497
- /**
498
- * Represents the skill required to read every object in the map.
499
- */
500
- export class DroidVisual extends DroidSkill {
501
- protected override readonly skillMultiplier: number;
502
- protected override readonly strainDecayBase: number;
503
- protected override readonly reducedSectionBaseline: number;
504
- protected override readonly reducedSectionCount: number;
505
- protected override readonly starsPerDouble: number;
506
- private readonly preempt: number;
507
- private readonly isHidden: boolean;
508
- constructor(mods: Mod[], preempt: number);
509
- /**
510
- * @param current The hitobject to calculate.
511
- */
512
- protected strainValueOf(current: DifficultyHitObject): number;
513
- /**
514
- * @param current The hitobject to calculate.
515
- */
516
- protected override strainValueAt(current: DifficultyHitObject): number;
517
- /**
518
- * @param current The hitobject to save to.
519
- */
520
- protected override saveToHitObject(current: DifficultyHitObject): void;
521
- }
522
-
523
- /**
524
- * A star rating calculator that configures which mode to calculate difficulty for and what mods are applied.
525
- */
526
- export class MapStars {
527
- /**
528
- * The osu!droid star rating of the beatmap.
529
- */
530
- readonly droidStars: DroidStarRating;
531
- /**
532
- * The osu!standard star rating of the beatmap.
533
- */
534
- readonly pcStars: OsuStarRating;
535
- /**
536
- * Calculates the star rating of a beatmap.
537
- */
538
- calculate(params: {
539
- /**
540
- * The beatmap to calculate.
541
- */
542
- map: Beatmap;
543
- /**
544
- * Applied modifications.
545
- */
546
- mods?: Mod[];
547
- /**
548
- * Custom map statistics to apply speed multiplier and force AR values as well as old statistics.
549
- */
550
- stats?: MapStats;
551
- }): MapStars;
552
- /**
553
- * Returns a string representative of the class.
554
- */
555
- toString(): string;
556
- }
557
-
558
- /**
559
- * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
560
- */
561
- export class OsuAim extends OsuSkill {
562
- protected override readonly skillMultiplier: number;
563
- protected override readonly strainDecayBase: number;
564
- protected override readonly reducedSectionCount: number;
565
- protected override readonly reducedSectionBaseline: number;
566
- protected override readonly difficultyMultiplier: number;
567
- protected override readonly decayWeight: number;
568
- private readonly wideAngleMultiplier: number;
569
- private readonly acuteAngleMultiplier: number;
570
- private readonly sliderMultiplier: number;
571
- private readonly velocityChangeMultiplier: number;
572
- private readonly withSliders: boolean;
573
- constructor(mods: Mod[], withSliders: boolean);
574
- /**
575
- * @param current The hitobject to calculate.
576
- */
577
- protected strainValueOf(current: DifficultyHitObject): number;
578
- /**
579
- * @param current The hitobject to calculate.
580
- */
581
- protected override strainValueAt(current: DifficultyHitObject): number;
582
- /**
583
- * @param current The hitobject to save to.
584
- */
585
- protected override saveToHitObject(current: DifficultyHitObject): void;
586
- }
587
-
588
- /**
589
- * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
590
- */
591
- export class OsuFlashlight extends OsuSkill {
592
- protected override readonly historyLength: number;
593
- protected override readonly skillMultiplier: number;
594
- protected override readonly strainDecayBase: number;
595
- protected override readonly reducedSectionCount: number;
596
- protected override readonly reducedSectionBaseline: number;
597
- protected override readonly difficultyMultiplier: number;
598
- protected override readonly decayWeight: number;
599
- /**
600
- * @param current The hitobject to calculate.
601
- */
602
- protected strainValueOf(current: DifficultyHitObject): number;
603
- /**
604
- * @param current The hitobject to calculate.
605
- */
606
- protected override strainValueAt(current: DifficultyHitObject): number;
607
- /**
608
- * @param current The hitobject to save to.
609
- */
610
- protected override saveToHitObject(current: DifficultyHitObject): void;
611
- }
612
-
613
- /**
614
- * A performance points calculator that calculates performance points for osu!standard gamemode.
615
- */
616
- export class OsuPerformanceCalculator extends PerformanceCalculator {
617
- override stars: OsuStarRating;
618
- protected override finalMultiplier: number;
619
- /**
620
- * The aim performance value.
621
- */
622
- aim: number;
623
- /**
624
- * The speed performance value.
625
- */
626
- speed: number;
627
- /**
628
- * The accuracy performance value.
629
- */
630
- accuracy: number;
631
- /**
632
- * The flashlight performance value.
633
- */
634
- flashlight: number;
635
- override calculate(params: {
636
- /**
637
- * The star rating instance to calculate.
638
- */
639
- stars: OsuStarRating;
640
- /**
641
- * The maximum combo achieved in the score.
642
- */
643
- combo?: number;
644
- /**
645
- * The accuracy achieved in the score.
646
- */
647
- accPercent?: Accuracy | number;
648
- /**
649
- * The amount of misses achieved in the score.
650
- */
651
- miss?: number;
652
- /**
653
- * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
654
- */
655
- stats?: MapStats;
656
- }): this;
657
- protected override calculateValues(): void;
658
- protected override calculateTotalValue(): number;
659
- /**
660
- * Calculates the aim performance value of the beatmap.
661
- */
662
- private calculateAimValue(): void;
663
- /**
664
- * Calculates the speed performance value of the beatmap.
665
- */
666
- private calculateSpeedValue(): void;
667
- /**
668
- * Calculates the accuracy performance value of the beatmap.
669
- */
670
- private calculateAccuracyValue(): void;
671
- /**
672
- * Calculates the flashlight performance value of the beatmap.
673
- */
674
- private calculateFlashlightValue(): void;
675
- override toString(): string;
676
- }
677
-
678
- /**
679
- * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
680
- */
681
- export class OsuSpeed extends OsuSkill {
682
- /**
683
- * Spacing threshold for a single hitobject spacing.
684
- */
685
- private readonly SINGLE_SPACING_THRESHOLD: number;
686
- private readonly angleBonusBegin: number;
687
- protected override readonly skillMultiplier: number;
688
- protected override readonly strainDecayBase: number;
689
- protected override readonly reducedSectionCount: number;
690
- protected override readonly reducedSectionBaseline: number;
691
- protected override readonly difficultyMultiplier: number;
692
- protected override readonly decayWeight: number;
693
- private readonly minSpeedBonus: number;
694
- private readonly maxSpeedBonus: number;
695
- private readonly angleBonusScale: number;
696
- /**
697
- * @param current The hitobject to calculate.
698
- */
699
- protected strainValueOf(current: DifficultyHitObject): number;
700
- /**
701
- * @param current The hitobject to calculate.
702
- */
703
- protected override strainValueAt(current: DifficultyHitObject): number;
704
- /**
705
- * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
706
- */
707
- private calculateRhythmBonus(current: DifficultyHitObject): number;
708
- /**
709
- * @param current The hitobject to save to.
710
- */
711
- protected override saveToHitObject(current: DifficultyHitObject): void;
712
- }
713
-
714
- /**
715
- * Difficulty calculator for osu!standard gamemode.
716
- */
717
- export class OsuStarRating extends StarRating {
718
- /**
719
- * The aim star rating of the beatmap.
720
- */
721
- aim: number;
722
- /**
723
- * The speed star rating of the beatmap.
724
- */
725
- speed: number;
726
- /**
727
- * The flashlight star rating of the beatmap.
728
- */
729
- flashlight: number;
730
- protected readonly difficultyMultiplier: number;
731
- calculate(params: {
732
- /**
733
- * The beatmap to calculate.
734
- */
735
- map: Beatmap;
736
- /**
737
- * Applied modifications.
738
- */
739
- mods?: Mod[];
740
- /**
741
- * Custom map statistics to apply custom speed multiplier as well as old statistics.
742
- */
743
- stats?: MapStats;
744
- }): this;
745
- /**
746
- * Calculates the aim star rating of the beatmap and stores it in this instance.
747
- */
748
- calculateAim(): void;
749
- /**
750
- * Calculates the speed star rating of the beatmap and stores it in this instance.
751
- */
752
- calculateSpeed(): void;
753
- /**
754
- * Calculates the flashlight star rating of the beatmap and stores it in this instance.
755
- */
756
- calculateFlashlight(): void;
757
- override calculateTotal(): void;
758
- override calculateAll(): void;
759
- /**
760
- * Returns a string representative of the class.
761
- */
762
- toString(): string;
763
- /**
764
- * Creates skills to be calculated.
765
- */
766
- protected override createSkills(): OsuSkill[];
767
- /**
768
- * Called after aim skill calculation.
769
- *
770
- * @param aimSkill The aim skill that considers sliders.
771
- * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
772
- */
773
- private postCalculateAim(
774
- aimSkill: OsuAim,
775
- aimSkillWithoutSliders: OsuAim
776
- ): void;
777
- /**
778
- * Called after speed skill calculation.
779
- *
780
- * @param speedSkill The speed skill.
781
- */
782
- private postCalculateSpeed(speedSkill: OsuSpeed): void;
783
- /**
784
- * Called after flashlight skill calculation.
785
- *
786
- * @param flashlightSkill The flashlight skill.
787
- */
788
- private postCalculateFlashlight(flashlightSkill: OsuFlashlight): void;
789
- }
790
-
791
- //#endregion
792
-
793
- //#region Interfaces
794
-
795
- /**
796
- * Holds additional data that is used in difficulty calculation.
797
- */
798
- export interface DifficultyAttributes {
799
- speedNoteCount: number;
800
- sliderFactor: number;
801
- aimDifficultStrainCount: number;
802
- speedDifficultStrainCount: number;
803
- }
804
-
805
- /**
806
- * The strain peaks of various calculated difficulties.
807
- */
808
- export interface StrainPeaks {
809
- /**
810
- * The strain peaks of aim difficulty if sliders are considered.
811
- */
812
- aimWithSliders: number[];
813
- /**
814
- * The strain peaks of aim difficulty if sliders are not considered.
815
- */
816
- aimWithoutSliders: number[];
817
- /**
818
- * The strain peaks of speed difficulty.
819
- */
820
- speed: number[];
821
- /**
822
- * The strain peaks of flashlight difficulty.
823
- */
824
- flashlight: number[];
825
- }
826
-
827
- //#endregion
828
-
829
- //#region Unexported classes
830
-
831
- /**
832
- * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
833
- * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
834
- */
835
- abstract class DroidSkill extends StrainSkill {
836
- /**
837
- * The bonus multiplier that is given for a sequence of notes of equal difficulty.
838
- */
839
- protected abstract readonly starsPerDouble: number;
840
- override difficultyValue(): number;
841
- }
3
+ /**
4
+ * Represents an osu!standard hit object with difficulty calculation values.
5
+ */
6
+ declare class DifficultyHitObject {
7
+ /**
8
+ * The underlying hitobject.
9
+ */
10
+ readonly object: HitObject;
11
+ /**
12
+ * The aim strain generated by the hitobject if sliders are considered.
13
+ */
14
+ aimStrainWithSliders: number;
15
+ /**
16
+ * The aim strain generated by the hitobject if sliders are not considered.
17
+ */
18
+ aimStrainWithoutSliders: number;
19
+ /**
20
+ * The tap strain generated by the hitobject.
21
+ *
22
+ * This is also used for osu!standard as opposed to "speed strain".
23
+ */
24
+ tapStrain: number;
25
+ /**
26
+ * The tap strain generated by the hitobject if `strainTime` isn't modified by
27
+ * OD. This is used in three-finger detection.
28
+ */
29
+ originalTapStrain: number;
30
+ /**
31
+ * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
32
+ */
33
+ rhythmMultiplier: number;
34
+ /**
35
+ * The rhythm strain generated by the hitobject.
36
+ */
37
+ rhythmStrain: number;
38
+ /**
39
+ * The flashlight strain generated by the hitobject.
40
+ */
41
+ flashlightStrain: number;
42
+ /**
43
+ * The visual strain generated by the hitobject.
44
+ */
45
+ visualStrain: number;
46
+ /**
47
+ * The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
48
+ *
49
+ * The "lazy" end position is the position at which the cursor ends up if the previous hitobject is followed with as minimal movement as possible (i.e. on the edge of slider follow circles).
50
+ */
51
+ lazyJumpDistance: number;
52
+ /**
53
+ * The normalized shortest distance to consider for a jump between the previous hitobject and this hitobject.
54
+ *
55
+ * This is bounded from above by `lazyJumpDistance`, and is smaller than the former if a more natural path is able to be taken through the previous hitobject.
56
+ *
57
+ * Suppose a linear slider - circle pattern. Following the slider lazily (see: `lazyJumpDistance`) will result in underestimating the true end position of the slider as being closer towards the start position.
58
+ * As a result, `lazyJumpDistance` overestimates the jump distance because the player is able to take a more natural path by following through the slider to its end,
59
+ * such that the jump is felt as only starting from the slider's true end position.
60
+ *
61
+ * Now consider a slider - circle pattern where the circle is stacked along the path inside the slider.
62
+ * In this case, the lazy end position correctly estimates the true end position of the slider and provides the more natural movement path.
63
+ */
64
+ minimumJumpDistance: number;
65
+ /**
66
+ * The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
67
+ */
68
+ minimumJumpTime: number;
69
+ /**
70
+ * The normalized distance between the start and end position of this hitobject.
71
+ */
72
+ travelDistance: number;
73
+ /**
74
+ * The time taken to travel through `travelDistance`, with a minimum value of 25ms for a non-zero distance.
75
+ */
76
+ travelTime: number;
77
+ /**
78
+ * Angle the player has to take to hit this hitobject.
79
+ *
80
+ * Calculated as the angle between the circles (current-2, current-1, current).
81
+ */
82
+ angle: number | null;
83
+ /**
84
+ * The amount of milliseconds elapsed between this hitobject and the last hitobject.
85
+ */
86
+ deltaTime: number;
87
+ /**
88
+ * The amount of milliseconds elapsed since the start time of the previous hitobject, with a minimum of 25ms.
89
+ */
90
+ strainTime: number;
91
+ /**
92
+ * Adjusted start time of the hitobject, taking speed multiplier into account.
93
+ */
94
+ startTime: number;
95
+ /**
96
+ * Adjusted end time of the hitobject, taking speed multiplier into account.
97
+ */
98
+ endTime: number;
99
+ /**
100
+ * The note density of the hitobject.
101
+ */
102
+ noteDensity: number;
103
+ /**
104
+ * The overlapping factor of the hitobject.
105
+ *
106
+ * This is used to scale visual skill.
107
+ */
108
+ overlappingFactor: number;
109
+ /**
110
+ * Adjusted velocity of the hitobject, taking speed multiplier into account.
111
+ */
112
+ velocity: number;
113
+ /**
114
+ * @param object The underlying hitobject.
115
+ */
116
+ constructor(object: HitObject);
117
+ }
842
118
 
843
- /**
844
- * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
845
- * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
846
- */
847
- abstract class OsuSkill extends StrainSkill {
848
- /**
849
- * The number of sections with the highest strains, which the peak strain reductions will apply to.
850
- * This is done in order to decrease their impact on the overall difficulty of the map for this skill.
851
- */
852
- protected abstract readonly reducedSectionCount: number;
853
- /**
854
- * The baseline multiplier applied to the section with the biggest strain.
855
- */
856
- protected abstract readonly reducedSectionBaseline: number;
857
- /**
858
- * The final multiplier to be applied to the final difficulty value after all other calculations.
859
- */
860
- protected abstract readonly difficultyMultiplier: number;
861
- /**
862
- * The weight by which each strain value decays.
863
- */
864
- protected abstract readonly decayWeight: number;
865
- override difficultyValue(): number;
866
- }
119
+ /**
120
+ * A converter used to convert normal hitobjects into difficulty hitobjects.
121
+ */
122
+ declare class DifficultyHitObjectCreator {
123
+ /**
124
+ * The threshold for small circle buff for osu!droid.
125
+ */
126
+ private readonly DROID_CIRCLESIZE_BUFF_THRESHOLD;
127
+ /**
128
+ * The threshold for small circle buff for osu!standard.
129
+ */
130
+ private readonly PC_CIRCLESIZE_BUFF_THRESHOLD;
131
+ /**
132
+ * The gamemode this creator is creating for.
133
+ */
134
+ private mode;
135
+ /**
136
+ * The base normalized radius of hitobjects.
137
+ */
138
+ private readonly normalizedRadius;
139
+ private readonly maximumSliderRadius;
140
+ private readonly assumedSliderRadius;
141
+ private readonly minDeltaTime;
142
+ /**
143
+ * Generates difficulty hitobjects for difficulty calculation.
144
+ */
145
+ generateDifficultyObjects(params: {
146
+ objects: readonly HitObject[];
147
+ circleSize: number;
148
+ speedMultiplier: number;
149
+ mode: modes;
150
+ preempt?: number;
151
+ }): DifficultyHitObject[];
152
+ /**
153
+ * Calculates a slider's cursor position.
154
+ */
155
+ private calculateSliderCursorPosition;
156
+ /**
157
+ * Gets the scaling factor of a radius.
158
+ *
159
+ * @param radius The radius to get the scaling factor from.
160
+ */
161
+ private getScalingFactor;
162
+ /**
163
+ * Returns the end cursor position of a hitobject.
164
+ */
165
+ private getEndCursorPosition;
166
+ }
867
167
 
868
- /**
869
- * The base class of performance calculators.
870
- */
871
- abstract class PerformanceCalculator {
872
- /**
873
- * The overall performance value.
874
- */
875
- total: number;
876
- /**
877
- * The calculated accuracy.
878
- */
879
- computedAccuracy: Accuracy;
880
- /**
881
- * Bitwise value of enabled modifications.
882
- */
883
- protected convertedMods: number;
884
- /**
885
- * The calculated beatmap.
886
- */
887
- abstract stars: StarRating;
888
- /**
889
- * The map statistics after applying modifications.
890
- */
891
- protected mapStatistics: MapStats;
892
- /**
893
- * Penalty for combo breaks.
894
- */
895
- protected comboPenalty: number;
896
- /**
897
- * The global multiplier to be applied to the final performance value.
898
- *
899
- * This is being adjusted to keep the final value scaled around what it used to be when changing things.
900
- */
901
- protected abstract finalMultiplier: number;
902
- /**
903
- * The amount of misses that are filtered out from sliderbreaks.
904
- */
905
- protected effectiveMissCount: number;
168
+ /**
169
+ * A bare minimal abstract skill for fully custom skill implementations.
170
+ */
171
+ declare abstract class Skill {
172
+ /**
173
+ * The hitobjects that were processed previously. They can affect the strain values of the following objects.
174
+ *
175
+ * The latest hitobject is at index 0.
176
+ */
177
+ protected readonly previous: DifficultyHitObject[];
178
+ /**
179
+ * Number of previous hitobjects to keep inside the `previous` array.
180
+ */
181
+ protected readonly historyLength: number;
182
+ /**
183
+ * The mods that this skill processes.
184
+ */
185
+ protected readonly mods: Mod[];
186
+ constructor(mods: Mod[]);
187
+ processInternal(current: DifficultyHitObject): void;
188
+ /**
189
+ * Processes a hitobject.
190
+ *
191
+ * @param current The hitobject to process.
192
+ */
193
+ protected abstract process(current: DifficultyHitObject): void;
194
+ /**
195
+ * Returns the calculated difficulty value representing all hitobjects that have been processed up to this point.
196
+ */
197
+ abstract difficultyValue(): number;
198
+ }
906
199
 
907
- /**
908
- * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
909
- */
910
- protected sliderNerfFactor: number;
911
- /**
912
- * Calculates the performance points of a beatmap.
913
- */
914
- abstract calculate(params: {
915
- /**
916
- * The star rating instance to calculate.
917
- */
918
- stars: StarRating;
919
- /**
920
- * The maximum combo achieved in the score.
921
- */
922
- combo?: number;
923
- /**
924
- * The accuracy achieved in the score.
925
- */
926
- accPercent?: Accuracy | number;
927
- /**
928
- * The amount of misses achieved in the score.
929
- */
930
- miss?: number;
931
- /**
932
- * The tap penalty to apply for penalized scores. Only applies to droid gamemode.
933
- */
934
- tapPenalty?: number;
935
- /**
936
- * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
937
- */
938
- stats?: MapStats;
939
- }): this;
940
- /**
941
- * Returns a string representative of the class.
942
- */
943
- abstract toString(): string;
944
- /**
945
- * Internal calculation method, used to process calculation from implementations.
946
- */
947
- protected calculateInternal(
948
- params: {
949
- /**
950
- * The star rating instance to calculate.
951
- */
952
- stars: StarRating;
953
- /**
954
- * The maximum combo achieved in the score.
955
- */
956
- combo?: number;
957
- /**
958
- * The accuracy achieved in the score.
959
- */
960
- accPercent?: Accuracy | number;
961
- /**
962
- * The amount of misses achieved in the score.
963
- */
964
- miss?: number;
965
- /**
966
- * The tap penalty to apply for penalized scores. Only applies to droid gamemode.
967
- */
968
- tapPenalty?: number;
969
- /**
970
- * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
971
- */
972
- stats?: MapStats;
973
- },
974
- mode: modes
975
- ): this;
976
- /**
977
- * Calculates values that will be used for calculating the total performance value of the beatmap.
978
- */
979
- protected abstract calculateValues(): void;
980
- /**
981
- * Calculates the total performance value of the beatmap.
982
- */
983
- protected abstract calculateTotalValue(): number;
984
- /**
985
- * Calculates the base performance value of a star rating.
986
- */
987
- protected baseValue(stars: number): number;
988
- /**
989
- * Processes given parameters for usage in performance calculation.
990
- */
991
- private handleParams(
992
- params: {
993
- /**
994
- * The star rating instance to calculate.
995
- */
996
- stars: StarRating;
997
- /**
998
- * The maximum combo achieved in the score.
999
- */
1000
- combo?: number;
1001
- /**
1002
- * The accuracy achieved in the score.
1003
- */
1004
- accPercent?: Accuracy | number;
1005
- /**
1006
- * The amount of misses achieved in the score.
1007
- */
1008
- miss?: number;
1009
- /**
1010
- * The tap penalty to apply for penalized scores.
1011
- */
1012
- tapPenalty?: number;
1013
- /**
1014
- * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
1015
- */
1016
- stats?: MapStats;
1017
- },
1018
- mode: modes
1019
- ): void;
1020
- /**
1021
- * Calculates the amount of misses + sliderbreaks from combo.
1022
- */
1023
- private calculateEffectiveMissCount(
1024
- combo: number,
1025
- maxCombo: number
1026
- ): number;
1027
- }
200
+ /**
201
+ * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
202
+ * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
203
+ */
204
+ declare abstract class StrainSkill extends Skill {
205
+ /**
206
+ * The strain of currently calculated hitobject.
207
+ */
208
+ protected currentStrain: number;
209
+ /**
210
+ * The current section's strain peak.
211
+ */
212
+ protected currentSectionPeak: number;
213
+ /**
214
+ * Strain peaks are stored here.
215
+ */
216
+ readonly strainPeaks: number[];
217
+ /**
218
+ * The number of sections with the highest strains, which the peak strain reductions will apply to.
219
+ * This is done in order to decrease their impact on the overall difficulty of the map for this skill.
220
+ */
221
+ protected abstract readonly reducedSectionCount: number;
222
+ /**
223
+ * The baseline multiplier applied to the section with the biggest strain.
224
+ */
225
+ protected abstract readonly reducedSectionBaseline: number;
226
+ /**
227
+ * Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other.
228
+ */
229
+ protected abstract readonly skillMultiplier: number;
230
+ /**
231
+ * Determines how quickly strain decays for the given skill.
232
+ *
233
+ * For example, a value of 0.15 indicates that strain decays to 15% of its original value in one second.
234
+ */
235
+ protected abstract readonly strainDecayBase: number;
236
+ protected readonly sectionLength: number;
237
+ protected currentSectionEnd: number;
238
+ /**
239
+ * Calculates the strain value of a hitobject and stores the value in it. This value is affected by previously processed objects.
240
+ *
241
+ * @param current The hitobject to process.
242
+ */
243
+ protected process(current: DifficultyHitObject): void;
244
+ /**
245
+ * Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty.
246
+ */
247
+ saveCurrentPeak(): void;
248
+ /**
249
+ * Sets the initial strain level for a new section.
250
+ *
251
+ * @param offset The beginning of the new section in milliseconds, adjusted by speed multiplier.
252
+ */
253
+ protected startNewSectionFrom(offset: number): void;
254
+ /**
255
+ * Calculates strain decay for a specified time frame.
256
+ *
257
+ * @param ms The time frame to calculate.
258
+ */
259
+ protected strainDecay(ms: number): number;
260
+ /**
261
+ * Calculates the strain value at a hitobject.
262
+ */
263
+ protected abstract strainValueAt(current: DifficultyHitObject): number;
264
+ /**
265
+ * Saves the current strain to a hitobject.
266
+ */
267
+ protected abstract saveToHitObject(current: DifficultyHitObject): void;
268
+ }
1028
269
 
1029
- /**
1030
- * A bare minimal abstract skill for fully custom skill implementations.
1031
- */
1032
- abstract class Skill {
1033
- /**
1034
- * The hitobjects that were processed previously. They can affect the strain values of the following objects.
1035
- *
1036
- * The latest hitobject is at index 0.
1037
- */
1038
- protected readonly previous: DifficultyHitObject[];
1039
- /**
1040
- * Number of previous hitobjects to keep inside the `previous` array.
1041
- */
1042
- protected readonly historyLength: number;
1043
- /**
1044
- * The mods that this skill processes.
1045
- */
1046
- protected readonly mods: Mod[];
1047
- processInternal(current: DifficultyHitObject): void;
1048
- /**
1049
- * Processes a hitobject.
1050
- *
1051
- * @param current The hitobject to process.
1052
- */
1053
- protected abstract process(current: DifficultyHitObject): void;
1054
- /**
1055
- * Returns the calculated difficulty value representing all hitobjects that have been processed up to this point.
1056
- */
1057
- abstract difficultyValue(): number;
1058
- }
270
+ /**
271
+ * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
272
+ * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
273
+ */
274
+ declare abstract class DroidSkill extends StrainSkill {
275
+ /**
276
+ * The bonus multiplier that is given for a sequence of notes of equal difficulty.
277
+ */
278
+ protected abstract readonly starsPerDouble: number;
279
+ difficultyValue(): number;
280
+ }
1059
281
 
1060
- /**
1061
- * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
1062
- * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
1063
- */
1064
- abstract class StrainSkill extends Skill {
1065
- /**
1066
- * The strain of currently calculated hitobject.
1067
- */
1068
- protected currentStrain: number;
282
+ /**
283
+ * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
284
+ */
285
+ declare class DroidAim extends DroidSkill {
286
+ protected readonly skillMultiplier: number;
287
+ protected readonly strainDecayBase: number;
288
+ protected readonly reducedSectionCount: number;
289
+ protected readonly reducedSectionBaseline: number;
290
+ protected readonly starsPerDouble: number;
291
+ /**
292
+ * Spacing threshold for a single hitobject spacing.
293
+ */
294
+ private readonly SINGLE_SPACING_THRESHOLD;
295
+ private readonly minSpeedBonus;
296
+ private readonly wideAngleMultiplier;
297
+ private readonly acuteAngleMultiplier;
298
+ private readonly sliderMultiplier;
299
+ private readonly velocityChangeMultiplier;
300
+ private readonly withSliders;
301
+ constructor(mods: Mod[], withSliders: boolean);
302
+ /**
303
+ * @param current The hitobject to calculate.
304
+ */
305
+ protected strainValueOf(current: DifficultyHitObject): number;
306
+ /**
307
+ * Calculates the aim strain of a hitobject.
308
+ */
309
+ private aimStrainOf;
310
+ /**
311
+ * Calculates the movement strain of a hitobject.
312
+ */
313
+ private movementStrainOf;
314
+ /**
315
+ * @param current The hitobject to calculate.
316
+ */
317
+ protected strainValueAt(current: DifficultyHitObject): number;
318
+ /**
319
+ * @param current The hitobject to save to.
320
+ */
321
+ protected saveToHitObject(current: DifficultyHitObject): void;
322
+ /**
323
+ * Calculates the bonus of wide angles.
324
+ */
325
+ private calculateWideAngleBonus;
326
+ /**
327
+ * Calculates the bonus of acute angles.
328
+ */
329
+ private calculateAcuteAngleBonus;
330
+ }
1069
331
 
1070
- /**
1071
- * The current section's strain peak.
1072
- */
1073
- protected currentSectionPeak: number;
332
+ /**
333
+ * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
334
+ */
335
+ declare class DroidFlashlight extends DroidSkill {
336
+ protected readonly historyLength: number;
337
+ protected readonly skillMultiplier: number;
338
+ protected readonly strainDecayBase: number;
339
+ protected readonly reducedSectionCount: number;
340
+ protected readonly reducedSectionBaseline: number;
341
+ protected readonly starsPerDouble: number;
342
+ protected strainValueOf(current: DifficultyHitObject): number;
343
+ /**
344
+ * @param current The hitobject to calculate.
345
+ */
346
+ protected strainValueAt(current: DifficultyHitObject): number;
347
+ protected saveToHitObject(current: DifficultyHitObject): void;
348
+ }
1074
349
 
1075
- /**
1076
- * Strain peaks are stored here.
1077
- */
1078
- readonly strainPeaks: number[];
1079
- /**
1080
- * The number of sections with the highest strains, which the peak strain reductions will apply to.
1081
- * This is done in order to decrease their impact on the overall difficulty of the map for this skill.
1082
- */
1083
- protected abstract readonly reducedSectionCount: number;
350
+ /**
351
+ * Holds additional data that is used in difficulty calculation.
352
+ */
353
+ interface DifficultyAttributes {
354
+ speedNoteCount: number;
355
+ sliderFactor: number;
356
+ }
1084
357
 
1085
- /**
1086
- * The baseline multiplier applied to the section with the biggest strain.
1087
- */
1088
- protected abstract readonly reducedSectionBaseline: number;
358
+ /**
359
+ * The base of difficulty calculation.
360
+ */
361
+ declare abstract class StarRating {
362
+ /**
363
+ * The calculated beatmap.
364
+ */
365
+ map: Beatmap;
366
+ /**
367
+ * The difficulty objects of the beatmap.
368
+ */
369
+ readonly objects: DifficultyHitObject[];
370
+ /**
371
+ * The modifications applied.
372
+ */
373
+ mods: Mod[];
374
+ /**
375
+ * The total star rating of the beatmap.
376
+ */
377
+ total: number;
378
+ /**
379
+ * The map statistics of the beatmap after modifications are applied.
380
+ */
381
+ stats: MapStats;
382
+ /**
383
+ * The strain peaks of various calculated difficulties.
384
+ */
385
+ readonly strainPeaks: {
386
+ /**
387
+ * The strain peaks of aim difficulty if sliders are considered.
388
+ */
389
+ aimWithSliders: number[];
390
+ /**
391
+ * The strain peaks of aim difficulty if sliders are not considered.
392
+ */
393
+ aimWithoutSliders: number[];
394
+ /**
395
+ * The strain peaks of speed difficulty.
396
+ */
397
+ speed: number[];
398
+ /**
399
+ * The strain peaks of flashlight difficulty.
400
+ */
401
+ flashlight: number[];
402
+ };
403
+ /**
404
+ * Additional data that is used in performance calculation.
405
+ */
406
+ readonly attributes: DifficultyAttributes;
407
+ protected readonly sectionLength: number;
408
+ protected abstract readonly difficultyMultiplier: number;
409
+ /**
410
+ * Calculates the star rating of the specified beatmap.
411
+ *
412
+ * The beatmap is analyzed in chunks of `sectionLength` duration.
413
+ * For each chunk the highest hitobject strains are added to
414
+ * a list which is then collapsed into a weighted sum, much
415
+ * like scores are weighted on a user's profile.
416
+ *
417
+ * For subsequent chunks, the initial max strain is calculated
418
+ * by decaying the previous hitobject's strain until the
419
+ * beginning of the new chunk.
420
+ *
421
+ * The first object doesn't generate a strain
422
+ * so we begin calculating from the second object.
423
+ *
424
+ * Also don't forget to manually add the peak strain for the last
425
+ * section which would otherwise be ignored.
426
+ */
427
+ calculate(params: {
428
+ /**
429
+ * The beatmap to calculate.
430
+ */
431
+ map: Beatmap;
432
+ /**
433
+ * Applied modifications in osu!standard format.
434
+ */
435
+ mods?: Mod[];
436
+ /**
437
+ * Custom map statistics to apply custom speed multiplier as well as old statistics.
438
+ */
439
+ stats?: MapStats;
440
+ }, mode: modes): this;
441
+ /**
442
+ * Generates difficulty hitobjects for this calculator.
443
+ *
444
+ * @param mode The gamemode to generate difficulty hitobjects for.
445
+ */
446
+ protected generateDifficultyHitObjects(mode: modes): void;
447
+ /**
448
+ * Calculates the skills provided.
449
+ *
450
+ * @param skills The skills to calculate.
451
+ */
452
+ protected calculateSkills(...skills: StrainSkill[]): void;
453
+ /**
454
+ * Calculates the total star rating of the beatmap and stores it in this instance.
455
+ */
456
+ abstract calculateTotal(): void;
457
+ /**
458
+ * Calculates every star rating of the beatmap and stores it in this instance.
459
+ */
460
+ abstract calculateAll(): void;
461
+ /**
462
+ * Returns a string representative of the class.
463
+ */
464
+ abstract toString(): string;
465
+ /**
466
+ * Creates skills to be calculated.
467
+ */
468
+ protected abstract createSkills(): StrainSkill[];
469
+ /**
470
+ * Calculates the star rating value of a difficulty.
471
+ *
472
+ * @param difficulty The difficulty to calculate.
473
+ */
474
+ protected starValue(difficulty: number): number;
475
+ /**
476
+ * Calculates the base performance value of a difficulty rating.
477
+ *
478
+ * @param rating The difficulty rating.
479
+ */
480
+ protected basePerformanceValue(rating: number): number;
481
+ }
1089
482
 
1090
- /**
1091
- * Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other.
1092
- */
1093
- protected abstract readonly skillMultiplier: number;
483
+ /**
484
+ * Difficulty calculator for osu!droid gamemode.
485
+ */
486
+ declare class DroidStarRating extends StarRating {
487
+ /**
488
+ * The aim star rating of the beatmap.
489
+ */
490
+ aim: number;
491
+ /**
492
+ * The tap star rating of the beatmap.
493
+ */
494
+ tap: number;
495
+ /**
496
+ * The rhythm star rating of the beatmap.
497
+ */
498
+ rhythm: number;
499
+ /**
500
+ * The flashlight star rating of the beatmap.
501
+ */
502
+ flashlight: number;
503
+ /**
504
+ * The visual star rating of the beatmap.
505
+ */
506
+ visual: number;
507
+ protected readonly difficultyMultiplier: number;
508
+ /**
509
+ * Calculates the star rating of the specified beatmap.
510
+ *
511
+ * The beatmap is analyzed in chunks of `sectionLength` duration.
512
+ * For each chunk the highest hitobject strains are added to
513
+ * a list which is then collapsed into a weighted sum, much
514
+ * like scores are weighted on a user's profile.
515
+ *
516
+ * For subsequent chunks, the initial max strain is calculated
517
+ * by decaying the previous hitobject's strain until the
518
+ * beginning of the new chunk.
519
+ *
520
+ * The first object doesn't generate a strain
521
+ * so we begin calculating from the second object.
522
+ *
523
+ * Also don't forget to manually add the peak strain for the last
524
+ * section which would otherwise be ignored.
525
+ */
526
+ calculate(params: {
527
+ /**
528
+ * The beatmap to calculate.
529
+ */
530
+ map: Beatmap;
531
+ /**
532
+ * Applied modifications.
533
+ */
534
+ mods?: Mod[];
535
+ /**
536
+ * Custom map statistics to apply custom tap multiplier as well as old statistics.
537
+ */
538
+ stats?: MapStats;
539
+ }): this;
540
+ /**
541
+ * Generates difficulty hitobjects for this calculator.
542
+ */
543
+ generateDifficultyHitObjects(): void;
544
+ /**
545
+ * Calculates the aim star rating of the beatmap and stores it in this instance.
546
+ */
547
+ calculateAim(): void;
548
+ /**
549
+ * Calculates the speed star rating of the beatmap and stores it in this instance.
550
+ */
551
+ calculateTap(): void;
552
+ /**
553
+ * Calculates the rhythm star rating of the beatmap and stores it in this instance.
554
+ */
555
+ calculateRhythm(): void;
556
+ /**
557
+ * Calculates the flashlight star rating of the beatmap and stores it in this instance.
558
+ */
559
+ calculateFlashlight(): void;
560
+ /**
561
+ * Calculates the visual star rating of the beatmap and stores it in this instance.
562
+ */
563
+ calculateVisual(): void;
564
+ calculateTotal(): void;
565
+ calculateAll(): void;
566
+ /**
567
+ * Returns a string representative of the class.
568
+ */
569
+ toString(): string;
570
+ /**
571
+ * Creates skills to be calculated.
572
+ */
573
+ protected createSkills(): DroidSkill[];
574
+ /**
575
+ * Called after aim skill calculation.
576
+ *
577
+ * @param aimSkill The aim skill that considers sliders.
578
+ * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
579
+ */
580
+ private postCalculateAim;
581
+ /**
582
+ * Called after tap skill calculation.
583
+ *
584
+ * @param tapSkill The tap skill.
585
+ */
586
+ private postCalculateTap;
587
+ /**
588
+ * Calculates speed-related attributes.
589
+ */
590
+ private calculateSpeedAttributes;
591
+ /**
592
+ * Called after rhythm skill calculation.
593
+ *
594
+ * @param rhythmSkill The rhythm skill.
595
+ */
596
+ private postCalculateRhythm;
597
+ /**
598
+ * Called after flashlight skill calculation.
599
+ *
600
+ * @param flashlightSkill The flashlight skill.
601
+ */
602
+ private postCalculateFlashlight;
603
+ /**
604
+ * Called after visual skill calculation.
605
+ *
606
+ * @param visualSkill The visual skill.
607
+ */
608
+ private postCalculateVisual;
609
+ }
1094
610
 
1095
- /**
1096
- * Determines how quickly strain decays for the given skill.
1097
- *
1098
- * For example, a value of 0.15 indicates that strain decays to 15% of its original value in one second.
1099
- */
1100
- protected abstract readonly strainDecayBase: number;
611
+ /**
612
+ * The base class of performance calculators.
613
+ */
614
+ declare abstract class PerformanceCalculator {
615
+ /**
616
+ * The overall performance value.
617
+ */
618
+ total: number;
619
+ /**
620
+ * The calculated accuracy.
621
+ */
622
+ computedAccuracy: Accuracy;
623
+ /**
624
+ * The calculated beatmap.
625
+ */
626
+ abstract stars: StarRating;
627
+ /**
628
+ * The map statistics after applying modifications.
629
+ */
630
+ protected mapStatistics: MapStats;
631
+ /**
632
+ * Penalty for combo breaks.
633
+ */
634
+ protected comboPenalty: number;
635
+ /**
636
+ * The global multiplier to be applied to the final performance value.
637
+ *
638
+ * This is being adjusted to keep the final value scaled around what it used to be when changing things.
639
+ */
640
+ protected abstract finalMultiplier: number;
641
+ /**
642
+ * The amount of misses that are filtered out from sliderbreaks.
643
+ */
644
+ protected effectiveMissCount: number;
645
+ /**
646
+ * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
647
+ */
648
+ protected sliderNerfFactor: number;
649
+ /**
650
+ * Calculates the performance points of a beatmap.
651
+ */
652
+ abstract calculate(params: {
653
+ /**
654
+ * The star rating instance to calculate.
655
+ */
656
+ stars: StarRating;
657
+ /**
658
+ * The maximum combo achieved in the score.
659
+ */
660
+ combo?: number;
661
+ /**
662
+ * The accuracy achieved in the score.
663
+ */
664
+ accPercent?: Accuracy | number;
665
+ /**
666
+ * The amount of misses achieved in the score.
667
+ */
668
+ miss?: number;
669
+ /**
670
+ * The tap penalty to apply for penalized scores. Only applies to droid gamemode.
671
+ */
672
+ tapPenalty?: number;
673
+ /**
674
+ * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
675
+ */
676
+ stats?: MapStats;
677
+ }): this;
678
+ /**
679
+ * Returns a string representative of the class.
680
+ */
681
+ abstract toString(): string;
682
+ /**
683
+ * Internal calculation method, used to process calculation from implementations.
684
+ */
685
+ protected calculateInternal(params: {
686
+ /**
687
+ * The star rating instance to calculate.
688
+ */
689
+ stars: StarRating;
690
+ /**
691
+ * The maximum combo achieved in the score.
692
+ */
693
+ combo?: number;
694
+ /**
695
+ * The accuracy achieved in the score.
696
+ */
697
+ accPercent?: Accuracy | number;
698
+ /**
699
+ * The amount of misses achieved in the score.
700
+ */
701
+ miss?: number;
702
+ /**
703
+ * The tap penalty to apply for penalized scores. Only applies to droid gamemode.
704
+ */
705
+ tapPenalty?: number;
706
+ /**
707
+ * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
708
+ */
709
+ stats?: MapStats;
710
+ }, mode: modes): this;
711
+ /**
712
+ * Calculates values that will be used for calculating the total performance value of the beatmap.
713
+ */
714
+ protected abstract calculateValues(): void;
715
+ /**
716
+ * Calculates the total performance value of the beatmap.
717
+ */
718
+ protected abstract calculateTotalValue(): number;
719
+ /**
720
+ * Calculates the base performance value of a star rating.
721
+ */
722
+ protected baseValue(stars: number): number;
723
+ /**
724
+ * Processes given parameters for usage in performance calculation.
725
+ */
726
+ private handleParams;
727
+ /**
728
+ * Calculates the amount of misses + sliderbreaks from combo.
729
+ */
730
+ private calculateEffectiveMissCount;
731
+ }
1101
732
 
1102
- protected readonly sectionLength: number;
733
+ /**
734
+ * A performance points calculator that calculates performance points for osu!droid gamemode.
735
+ */
736
+ declare class DroidPerformanceCalculator extends PerformanceCalculator {
737
+ stars: DroidStarRating;
738
+ protected finalMultiplier: number;
739
+ /**
740
+ * The aim performance value.
741
+ */
742
+ aim: number;
743
+ /**
744
+ * The tap performance value.
745
+ */
746
+ tap: number;
747
+ /**
748
+ * The accuracy performance value.
749
+ */
750
+ accuracy: number;
751
+ /**
752
+ * The flashlight performance value.
753
+ */
754
+ flashlight: number;
755
+ /**
756
+ * The visual performance value.
757
+ */
758
+ visual: number;
759
+ private tapPenalty;
760
+ calculate(params: {
761
+ /**
762
+ * The star rating instance to calculate.
763
+ */
764
+ stars: DroidStarRating;
765
+ /**
766
+ * The maximum combo achieved in the score.
767
+ */
768
+ combo?: number;
769
+ /**
770
+ * The accuracy achieved in the score.
771
+ */
772
+ accPercent?: Accuracy | number;
773
+ /**
774
+ * The amount of misses achieved in the score.
775
+ */
776
+ miss?: number;
777
+ /**
778
+ * The tap penalty to apply for penalized scores.
779
+ */
780
+ tapPenalty?: number;
781
+ /**
782
+ * Custom map statistics to apply custom tap multiplier and force AR values as well as old statistics.
783
+ */
784
+ stats?: MapStats;
785
+ }): this;
786
+ protected calculateValues(): void;
787
+ protected calculateTotalValue(): number;
788
+ /**
789
+ * Calculates the aim performance value of the beatmap.
790
+ */
791
+ private calculateAimValue;
792
+ /**
793
+ * Calculates the tap performance value of the beatmap.
794
+ */
795
+ private calculateTapValue;
796
+ /**
797
+ * Calculates the accuracy performance value of the beatmap.
798
+ */
799
+ private calculateAccuracyValue;
800
+ /**
801
+ * Calculates the flashlight performance value of the beatmap.
802
+ */
803
+ private calculateFlashlightValue;
804
+ /**
805
+ * Calculates the visual performance value of the beatmap.
806
+ */
807
+ private calculateVisualValue;
808
+ toString(): string;
809
+ }
1103
810
 
1104
- protected currentSectionEnd: number;
811
+ /**
812
+ * Represents the skill required to properly follow a beatmap's rhythm.
813
+ */
814
+ declare class DroidRhythm extends DroidSkill {
815
+ protected readonly historyLength: number;
816
+ protected readonly skillMultiplier: number;
817
+ protected readonly reducedSectionCount: number;
818
+ protected readonly reducedSectionBaseline: number;
819
+ protected readonly strainDecayBase: number;
820
+ protected readonly starsPerDouble: number;
821
+ private readonly rhythmMultiplier;
822
+ private readonly historyTimeMax;
823
+ private currentRhythm;
824
+ private readonly hitWindow;
825
+ constructor(mods: Mod[], overallDifficulty: number);
826
+ /**
827
+ * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
828
+ */
829
+ private calculateRhythmBonus;
830
+ protected strainValueAt(current: DifficultyHitObject): number;
831
+ protected saveToHitObject(current: DifficultyHitObject): void;
832
+ }
1105
833
 
1106
- /**
1107
- * Calculates the strain value of a hitobject and stores the value in it. This value is affected by previously processed objects.
1108
- *
1109
- * @param current The hitobject to process.
1110
- */
1111
- protected override process(current: DifficultyHitObject): void;
834
+ /**
835
+ * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
836
+ */
837
+ declare class DroidTap extends DroidSkill {
838
+ protected readonly skillMultiplier: number;
839
+ protected readonly reducedSectionCount: number;
840
+ protected readonly reducedSectionBaseline: number;
841
+ protected readonly strainDecayBase: number;
842
+ protected readonly starsPerDouble: number;
843
+ private readonly minSpeedBonus;
844
+ private currentTapStrain;
845
+ private currentOriginalTapStrain;
846
+ private readonly hitWindow;
847
+ constructor(mods: Mod[], overallDifficulty: number);
848
+ /**
849
+ * @param current The hitobject to calculate.
850
+ */
851
+ protected strainValueOf(current: DifficultyHitObject): number;
852
+ /**
853
+ * Calculates the tap strain of a hitobject given a specific speed bonus and strain time.
854
+ */
855
+ private tapStrainOf;
856
+ /**
857
+ * @param current The hitobject to calculate.
858
+ */
859
+ protected strainValueAt(current: DifficultyHitObject): number;
860
+ /**
861
+ * @param current The hitobject to save to.
862
+ */
863
+ protected saveToHitObject(current: DifficultyHitObject): void;
864
+ }
1112
865
 
1113
- /**
1114
- * Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty.
1115
- */
1116
- saveCurrentPeak(): void;
866
+ /**
867
+ * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
868
+ * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
869
+ */
870
+ declare abstract class OsuSkill extends StrainSkill {
871
+ /**
872
+ * The final multiplier to be applied to the final difficulty value after all other calculations.
873
+ */
874
+ protected abstract readonly difficultyMultiplier: number;
875
+ /**
876
+ * The weight by which each strain value decays.
877
+ */
878
+ protected abstract readonly decayWeight: number;
879
+ difficultyValue(): number;
880
+ }
1117
881
 
1118
- /**
1119
- * Sets the initial strain level for a new section.
1120
- *
1121
- * @param offset The beginning of the new section in milliseconds, adjusted by speed multiplier.
1122
- */
1123
- protected startNewSectionFrom(offset: number): void;
882
+ /**
883
+ * Difficulty calculator for osu!standard gamemode.
884
+ */
885
+ declare class OsuStarRating extends StarRating {
886
+ /**
887
+ * The aim star rating of the beatmap.
888
+ */
889
+ aim: number;
890
+ /**
891
+ * The speed star rating of the beatmap.
892
+ */
893
+ speed: number;
894
+ /**
895
+ * The flashlight star rating of the beatmap.
896
+ */
897
+ flashlight: number;
898
+ protected readonly difficultyMultiplier: number;
899
+ calculate(params: {
900
+ /**
901
+ * The beatmap to calculate.
902
+ */
903
+ map: Beatmap;
904
+ /**
905
+ * Applied modifications.
906
+ */
907
+ mods?: Mod[];
908
+ /**
909
+ * Custom map statistics to apply custom speed multiplier as well as old statistics.
910
+ */
911
+ stats?: MapStats;
912
+ }): this;
913
+ /**
914
+ * Generates difficulty hitobjects for this calculator.
915
+ */
916
+ generateDifficultyHitObjects(): void;
917
+ /**
918
+ * Calculates the aim star rating of the beatmap and stores it in this instance.
919
+ */
920
+ calculateAim(): void;
921
+ /**
922
+ * Calculates the speed star rating of the beatmap and stores it in this instance.
923
+ */
924
+ calculateSpeed(): void;
925
+ /**
926
+ * Calculates the flashlight star rating of the beatmap and stores it in this instance.
927
+ */
928
+ calculateFlashlight(): void;
929
+ calculateTotal(): void;
930
+ calculateAll(): void;
931
+ /**
932
+ * Returns a string representative of the class.
933
+ */
934
+ toString(): string;
935
+ /**
936
+ * Creates skills to be calculated.
937
+ */
938
+ protected createSkills(): OsuSkill[];
939
+ /**
940
+ * Called after aim skill calculation.
941
+ *
942
+ * @param aimSkill The aim skill that considers sliders.
943
+ * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
944
+ */
945
+ private postCalculateAim;
946
+ /**
947
+ * Called after speed skill calculation.
948
+ *
949
+ * @param speedSkill The speed skill.
950
+ */
951
+ private postCalculateSpeed;
952
+ /**
953
+ * Called after flashlight skill calculation.
954
+ *
955
+ * @param flashlightSkill The flashlight skill.
956
+ */
957
+ private postCalculateFlashlight;
958
+ }
1124
959
 
1125
- /**
1126
- * Calculates strain decay for a specified time frame.
1127
- *
1128
- * @param ms The time frame to calculate.
1129
- */
1130
- protected strainDecay(ms: number): number;
960
+ /**
961
+ * A star rating calculator that configures which mode to calculate difficulty for and what mods are applied.
962
+ */
963
+ declare class MapStars {
964
+ /**
965
+ * The osu!droid star rating of the beatmap.
966
+ */
967
+ readonly droidStars: DroidStarRating;
968
+ /**
969
+ * The osu!standard star rating of the beatmap.
970
+ */
971
+ readonly pcStars: OsuStarRating;
972
+ /**
973
+ * Calculates the star rating of a beatmap.
974
+ */
975
+ calculate(params: {
976
+ /**
977
+ * The beatmap to calculate.
978
+ */
979
+ map: Beatmap;
980
+ /**
981
+ * Applied modifications.
982
+ */
983
+ mods?: Mod[];
984
+ /**
985
+ * Custom map statistics to apply speed multiplier and force AR values as well as old statistics.
986
+ */
987
+ stats?: MapStats;
988
+ }): MapStars;
989
+ /**
990
+ * Returns a string representative of the class.
991
+ */
992
+ toString(): string;
993
+ }
1131
994
 
1132
- /**
1133
- * Calculates the strain value at a hitobject.
1134
- */
1135
- protected abstract strainValueAt(current: DifficultyHitObject): number;
995
+ /**
996
+ * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
997
+ */
998
+ declare class OsuAim extends OsuSkill {
999
+ protected readonly skillMultiplier: number;
1000
+ protected readonly strainDecayBase: number;
1001
+ protected readonly reducedSectionCount: number;
1002
+ protected readonly reducedSectionBaseline: number;
1003
+ protected readonly difficultyMultiplier: number;
1004
+ protected readonly decayWeight: number;
1005
+ private readonly wideAngleMultiplier;
1006
+ private readonly acuteAngleMultiplier;
1007
+ private readonly sliderMultiplier;
1008
+ private readonly velocityChangeMultiplier;
1009
+ private readonly withSliders;
1010
+ constructor(mods: Mod[], withSliders: boolean);
1011
+ /**
1012
+ * @param current The hitobject to calculate.
1013
+ */
1014
+ protected strainValueOf(current: DifficultyHitObject): number;
1015
+ /**
1016
+ * @param current The hitobject to calculate.
1017
+ */
1018
+ protected strainValueAt(current: DifficultyHitObject): number;
1019
+ /**
1020
+ * @param current The hitobject to save to.
1021
+ */
1022
+ protected saveToHitObject(current: DifficultyHitObject): void;
1023
+ /**
1024
+ * Calculates the bonus of wide angles.
1025
+ */
1026
+ private calculateWideAngleBonus;
1027
+ /**
1028
+ * Calculates the bonus of acute angles.
1029
+ */
1030
+ private calculateAcuteAngleBonus;
1031
+ }
1136
1032
 
1137
- /**
1138
- * Saves the current strain to a hitobject.
1139
- */
1140
- protected abstract saveToHitObject(current: DifficultyHitObject): void;
1141
- }
1033
+ /**
1034
+ * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
1035
+ */
1036
+ declare class OsuFlashlight extends OsuSkill {
1037
+ protected readonly historyLength: number;
1038
+ protected readonly skillMultiplier: number;
1039
+ protected readonly strainDecayBase: number;
1040
+ protected readonly reducedSectionCount: number;
1041
+ protected readonly reducedSectionBaseline: number;
1042
+ protected readonly difficultyMultiplier: number;
1043
+ protected readonly decayWeight: number;
1044
+ protected strainValueOf(current: DifficultyHitObject): number;
1045
+ /**
1046
+ * @param current The hitobject to calculate.
1047
+ */
1048
+ protected strainValueAt(current: DifficultyHitObject): number;
1049
+ protected saveToHitObject(current: DifficultyHitObject): void;
1050
+ }
1142
1051
 
1143
- /**
1144
- * The base of difficulty calculation.
1145
- */
1146
- abstract class StarRating {
1147
- /**
1148
- * The calculated beatmap.
1149
- */
1150
- map: Beatmap;
1151
- /**
1152
- * The difficulty objects of the beatmap.
1153
- */
1154
- readonly objects: DifficultyHitObject[];
1155
- /**
1156
- * The modifications applied.
1157
- */
1158
- mods: Mod[];
1159
- /**
1160
- * The total star rating of the beatmap.
1161
- */
1162
- total: number;
1163
- /**
1164
- * The map statistics of the beatmap after modifications are applied.
1165
- */
1166
- stats: MapStats;
1167
- /**
1168
- * The strain peaks of various calculated difficulties.
1169
- */
1170
- readonly strainPeaks: StrainPeaks;
1171
- /**
1172
- * Additional data that is used in performance calculation.
1173
- */
1174
- readonly attributes: DifficultyAttributes;
1175
- protected readonly sectionLength: number;
1176
- protected abstract readonly difficultyMultiplier: number;
1177
- /**
1178
- * Calculates the star rating of the specified beatmap.
1179
- *
1180
- * The beatmap is analyzed in chunks of `sectionLength` duration.
1181
- * For each chunk the highest hitobject strains are added to
1182
- * a list which is then collapsed into a weighted sum, much
1183
- * like scores are weighted on a user's profile.
1184
- *
1185
- * For subsequent chunks, the initial max strain is calculated
1186
- * by decaying the previous hitobject's strain until the
1187
- * beginning of the new chunk.
1188
- *
1189
- * The first object doesn't generate a strain
1190
- * so we begin calculating from the second object.
1191
- *
1192
- * Also don't forget to manually add the peak strain for the last
1193
- * section which would otherwise be ignored.
1194
- */
1195
- protected calculate(
1196
- params: {
1197
- /**
1198
- * The beatmap to calculate.
1199
- */
1200
- map: Beatmap;
1201
- /**
1202
- * Applied modifications.
1203
- */
1204
- mods?: Mod[];
1205
- /**
1206
- * Custom map statistics to apply custom speed multiplier as well as old statistics.
1207
- */
1208
- stats?: MapStats;
1209
- },
1210
- mode: modes
1211
- ): this;
1212
- /**
1213
- * Generates difficulty hitobjects for this calculator.
1214
- *
1215
- * @param mode The gamemode to generate difficulty hitobjects for.
1216
- */
1217
- generateDifficultyHitObjects(mode: modes): void;
1218
- /**
1219
- * Calculates the skills provided.
1220
- *
1221
- * @param skills The skills to calculate.
1222
- */
1223
- protected calculateSkills(...skills: Skill[]): void;
1224
- /**
1225
- * Calculates the total star rating of the beatmap and stores it in this instance.
1226
- */
1227
- abstract calculateTotal(): void;
1228
- /**
1229
- * Calculates every star rating of the beatmap and stores it in this instance.
1230
- */
1231
- abstract calculateAll(): void;
1232
- /**
1233
- * Returns a string representative of the class.
1234
- */
1235
- abstract toString(): string;
1236
- /**
1237
- * Creates skills to be calculated.
1238
- */
1239
- protected abstract createSkills(): Skill[];
1240
- /**
1241
- * Calculates the star rating value of a difficulty.
1242
- *
1243
- * @param difficulty The difficulty to calculate.
1244
- */
1245
- protected starValue(difficulty: number): number;
1246
- /**
1247
- * Calculates the base performance value of a difficulty rating.
1248
- *
1249
- * @param rating The difficulty rating.
1250
- */
1251
- protected basePerformanceValue(rating: number): number;
1252
- }
1052
+ /**
1053
+ * A performance points calculator that calculates performance points for osu!standard gamemode.
1054
+ */
1055
+ declare class OsuPerformanceCalculator extends PerformanceCalculator {
1056
+ stars: OsuStarRating;
1057
+ protected finalMultiplier: number;
1058
+ /**
1059
+ * The aim performance value.
1060
+ */
1061
+ aim: number;
1062
+ /**
1063
+ * The speed performance value.
1064
+ */
1065
+ speed: number;
1066
+ /**
1067
+ * The accuracy performance value.
1068
+ */
1069
+ accuracy: number;
1070
+ /**
1071
+ * The flashlight performance value.
1072
+ */
1073
+ flashlight: number;
1074
+ calculate(params: {
1075
+ /**
1076
+ * The star rating instance to calculate.
1077
+ */
1078
+ stars: OsuStarRating;
1079
+ /**
1080
+ * The maximum combo achieved in the score.
1081
+ */
1082
+ combo?: number;
1083
+ /**
1084
+ * The accuracy achieved in the score.
1085
+ */
1086
+ accPercent?: Accuracy | number;
1087
+ /**
1088
+ * The amount of misses achieved in the score.
1089
+ */
1090
+ miss?: number;
1091
+ /**
1092
+ * Custom map statistics to apply custom speed multiplier and force AR values as well as old statistics.
1093
+ */
1094
+ stats?: MapStats;
1095
+ }): this;
1096
+ protected calculateValues(): void;
1097
+ protected calculateTotalValue(): number;
1098
+ /**
1099
+ * Calculates the aim performance value of the beatmap.
1100
+ */
1101
+ private calculateAimValue;
1102
+ /**
1103
+ * Calculates the speed performance value of the beatmap.
1104
+ */
1105
+ private calculateSpeedValue;
1106
+ /**
1107
+ * Calculates the accuracy performance value of the beatmap.
1108
+ */
1109
+ private calculateAccuracyValue;
1110
+ /**
1111
+ * Calculates the flashlight performance value of the beatmap.
1112
+ */
1113
+ private calculateFlashlightValue;
1114
+ toString(): string;
1115
+ }
1253
1116
 
1254
- //#endregion
1117
+ /**
1118
+ * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
1119
+ */
1120
+ declare class OsuSpeed extends OsuSkill {
1121
+ /**
1122
+ * Spacing threshold for a single hitobject spacing.
1123
+ */
1124
+ private readonly SINGLE_SPACING_THRESHOLD;
1125
+ protected readonly historyLength: number;
1126
+ protected readonly skillMultiplier: number;
1127
+ protected readonly strainDecayBase: number;
1128
+ protected readonly reducedSectionCount: number;
1129
+ protected readonly reducedSectionBaseline: number;
1130
+ protected readonly difficultyMultiplier: number;
1131
+ protected readonly decayWeight: number;
1132
+ private readonly rhythmMultiplier;
1133
+ private readonly historyTimeMax;
1134
+ private currentSpeedStrain;
1135
+ private currentRhythm;
1136
+ private readonly minSpeedBonus;
1137
+ private readonly greatWindow;
1138
+ constructor(mods: Mod[], greatWindow: number);
1139
+ /**
1140
+ * @param current The hitobject to calculate.
1141
+ */
1142
+ protected strainValueOf(current: DifficultyHitObject): number;
1143
+ /**
1144
+ * @param current The hitobject to calculate.
1145
+ */
1146
+ protected strainValueAt(current: DifficultyHitObject): number;
1147
+ /**
1148
+ * Calculates a rhythm multiplier for the difficulty of the tap associated with historic data of the current object.
1149
+ */
1150
+ private calculateRhythmBonus;
1151
+ /**
1152
+ * @param current The hitobject to save to.
1153
+ */
1154
+ protected saveToHitObject(current: DifficultyHitObject): void;
1255
1155
  }
1156
+
1157
+ export { DifficultyHitObject, DifficultyHitObjectCreator, DroidAim, DroidFlashlight, DroidPerformanceCalculator, DroidRhythm, DroidStarRating, DroidTap, MapStars, OsuAim, OsuFlashlight, OsuPerformanceCalculator, OsuSpeed, OsuStarRating, PerformanceCalculator, StarRating };