@rian8337/osu-difficulty-calculator 4.0.0-beta.53 → 4.0.0-beta.55

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 (3) hide show
  1. package/dist/index.js +783 -986
  2. package/package.json +3 -3
  3. package/typings/index.d.ts +256 -356
@@ -1,9 +1,9 @@
1
- import { Mod, PlaceableHitObject, Modes, Beatmap, ModHidden, ModPrecise, ModTraceable, ModScoreV2, ModDoubleTime, ModNightCore, ModDifficultyAdjust, ModHalfTime, ModEasy, ModHardRock, ModFlashlight, ModRelax, ModAutopilot, Accuracy, ModTouchDevice } from '@rian8337/osu-base';
1
+ import { Mod, SerializedMod, PlaceableHitObject, Modes, PlayableBeatmap, Beatmap, DroidPlayableBeatmap, Accuracy, OsuPlayableBeatmap } from '@rian8337/osu-base';
2
2
 
3
3
  /**
4
4
  * Holds data that can be used to calculate performance points.
5
5
  */
6
- interface DifficultyAttributes {
6
+ interface IDifficultyAttributes {
7
7
  /**
8
8
  * The mods which were applied to the beatmap.
9
9
  */
@@ -73,25 +73,42 @@ interface DifficultyAttributes {
73
73
  /**
74
74
  * Represents difficulty attributes that can be cached.
75
75
  */
76
- type CacheableDifficultyAttributes<T extends DifficultyAttributes> = Omit<T, "mods"> & {
76
+ type CacheableDifficultyAttributes<T extends IDifficultyAttributes> = Omit<T, "mods"> & {
77
77
  /**
78
78
  * The mods which were applied to the beatmap.
79
79
  */
80
- mods: string;
80
+ mods: SerializedMod[];
81
81
  };
82
82
 
83
83
  /**
84
- * Represents options for difficulty calculation.
84
+ * Holds data that can be used to calculate performance points.
85
85
  */
86
- interface DifficultyCalculationOptions {
86
+ declare abstract class DifficultyAttributes implements IDifficultyAttributes {
87
+ mods: Mod[];
88
+ starRating: number;
89
+ maxCombo: number;
90
+ aimDifficulty: number;
91
+ flashlightDifficulty: number;
92
+ speedNoteCount: number;
93
+ sliderFactor: number;
94
+ clockRate: number;
95
+ overallDifficulty: number;
96
+ hitCircleCount: number;
97
+ sliderCount: number;
98
+ spinnerCount: number;
99
+ aimDifficultSliderCount: number;
100
+ aimDifficultStrainCount: number;
101
+ constructor(cacheableAttributes?: CacheableDifficultyAttributes<IDifficultyAttributes>);
87
102
  /**
88
- * The modifications to apply.
103
+ * Converts this `DifficultyAttributes` instance to an attribute structure that can be cached.
104
+ *
105
+ * @returns The cacheable attributes.
89
106
  */
90
- readonly mods?: Mod[];
107
+ toCacheableAttributes(): CacheableDifficultyAttributes<IDifficultyAttributes>;
91
108
  /**
92
- * The custom speed multiplier to apply. Defaults to 1.
109
+ * Returns a string representation of the difficulty attributes.
93
110
  */
94
- readonly customSpeedMultiplier?: number;
111
+ toString(): string;
95
112
  }
96
113
 
97
114
  /**
@@ -208,7 +225,7 @@ declare abstract class DifficultyHitObject {
208
225
  * @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
209
226
  * @param clockRate The clock rate of the beatmap.
210
227
  */
211
- constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
228
+ constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, index: number);
212
229
  /**
213
230
  * Computes the properties of this hitobject.
214
231
  *
@@ -245,7 +262,7 @@ declare abstract class DifficultyHitObject {
245
262
  * @param mods The mods used.
246
263
  * @returns The opacity of the hitobject at the given time.
247
264
  */
248
- opacityAt(time: number, mods: Mod[]): number;
265
+ opacityAt(time: number, mods: readonly Mod[]): number;
249
266
  /**
250
267
  * How possible is it to doubletap this object together with the next one and get perfect
251
268
  * judgement in range from 0 to 1.
@@ -259,28 +276,6 @@ declare abstract class DifficultyHitObject {
259
276
  private getEndCursorPosition;
260
277
  }
261
278
 
262
- /**
263
- * Represents the strain peaks of various calculated difficulties.
264
- */
265
- interface StrainPeaks {
266
- /**
267
- * The strain peaks of aim difficulty if sliders are considered.
268
- */
269
- aimWithSliders: number[];
270
- /**
271
- * The strain peaks of aim difficulty if sliders are not considered.
272
- */
273
- aimWithoutSliders: number[];
274
- /**
275
- * The strain peaks of speed difficulty.
276
- */
277
- speed: number[];
278
- /**
279
- * The strain peaks of flashlight difficulty.
280
- */
281
- flashlight: number[];
282
- }
283
-
284
279
  /**
285
280
  * A bare minimal abstract skill for fully custom skill implementations.
286
281
  *
@@ -290,8 +285,8 @@ declare abstract class Skill {
290
285
  /**
291
286
  * The mods that this skill processes.
292
287
  */
293
- protected readonly mods: Mod[];
294
- constructor(mods: Mod[]);
288
+ protected readonly mods: readonly Mod[];
289
+ constructor(mods: readonly Mod[]);
295
290
  /**
296
291
  * Processes a hitobject.
297
292
  *
@@ -305,151 +300,25 @@ declare abstract class Skill {
305
300
  }
306
301
 
307
302
  /**
308
- * The base of a difficulty calculator.
303
+ * Represents the strain peaks of various calculated difficulties.
309
304
  */
310
- declare abstract class DifficultyCalculator<THitObject extends DifficultyHitObject, TAttributes extends DifficultyAttributes> {
311
- /**
312
- * The calculated beatmap.
313
- */
314
- readonly beatmap: Beatmap;
315
- /**
316
- * The difficulty objects of the beatmap.
317
- */
318
- private _objects;
319
- /**
320
- * The difficulty objects of the beatmap.
321
- */
322
- get objects(): readonly THitObject[];
323
- /**
324
- * The modifications applied.
325
- */
326
- mods: Mod[];
327
- /**
328
- * The total star rating of the beatmap.
329
- */
330
- get total(): number;
331
- /**
332
- * The strain peaks of various calculated difficulties.
333
- */
334
- readonly strainPeaks: StrainPeaks;
335
- /**
336
- * The difficulty attributes that can be used to calculate performance points.
337
- */
338
- abstract readonly attributes: TAttributes;
339
- /**
340
- * The difficulty attributes that can be cached. It can also be used to calculate performance points.
341
- */
342
- abstract get cacheableAttributes(): CacheableDifficultyAttributes<TAttributes>;
343
- /**
344
- * `Mod`s that adjust the difficulty of a beatmap.
345
- */
346
- protected static readonly difficultyAdjustmentMods: Set<typeof Mod>;
347
- protected abstract readonly difficultyMultiplier: number;
348
- protected abstract readonly mode: Modes;
349
- /**
350
- * Constructs a new instance of the calculator.
351
- *
352
- * @param beatmap The beatmap to calculate.
353
- */
354
- constructor(beatmap: Beatmap);
355
- /**
356
- * Retains `Mod`s that adjust a beatmap's difficulty from the specified mods.
357
- *
358
- * @param mods The mods to retain the difficulty adjustment mods from.
359
- * @returns The retained difficulty adjustment mods.
360
- */
361
- static retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
362
- /**
363
- * Calculates the star rating of the specified beatmap.
364
- *
365
- * The beatmap is analyzed in chunks of `sectionLength` duration.
366
- * For each chunk the highest hitobject strains are added to
367
- * a list which is then collapsed into a weighted sum, much
368
- * like scores are weighted on a user's profile.
369
- *
370
- * For subsequent chunks, the initial max strain is calculated
371
- * by decaying the previous hitobject's strain until the
372
- * beginning of the new chunk.
373
- *
374
- * @param options Options for the difficulty calculation.
375
- * @returns The current instance.
376
- */
377
- calculate(options?: DifficultyCalculationOptions): this;
378
- /**
379
- * Generates difficulty hitobjects for this calculator.
380
- *
381
- * @param beatmap The beatmap to generate difficulty hitobjects from.
382
- * @param clockRate The clock rate of the beatmap.
383
- */
384
- protected abstract generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): THitObject[];
385
- /**
386
- * Calculates the skills provided.
387
- *
388
- * @param skills The skills to calculate.
389
- */
390
- protected calculateSkills(...skills: Skill[]): void;
391
- /**
392
- * Calculates the total star rating of the beatmap and stores it in this instance.
393
- */
394
- abstract calculateTotal(): void;
395
- /**
396
- * Calculates every star rating of the beatmap and stores it in this instance.
397
- */
398
- abstract calculateAll(): void;
399
- /**
400
- * Returns a string representative of the class.
401
- */
402
- abstract toString(): string;
403
- /**
404
- * Creates skills to be calculated.
405
- */
406
- protected abstract createSkills(): Skill[];
407
- /**
408
- * Obtains the clock rate of the beatmap.
409
- *
410
- * @param options The options to obtain the clock rate with.
411
- * @returns The clock rate of the beatmap.
412
- */
413
- protected calculateClockRate(options?: DifficultyCalculationOptions): number;
414
- /**
415
- * Populates the stored difficulty attributes with necessary data.
416
- *
417
- * @param beatmap The beatmap to populate the attributes with.
418
- * @param clockRate The clock rate of the beatmap.
419
- */
420
- protected populateDifficultyAttributes(beatmap: Beatmap, clockRate: number): void;
305
+ interface StrainPeaks {
421
306
  /**
422
- * Calculates the star rating value of a difficulty.
423
- *
424
- * @param difficulty The difficulty to calculate.
307
+ * The strain peaks of aim difficulty if sliders are considered.
425
308
  */
426
- protected starValue(difficulty: number): number;
309
+ aimWithSliders: number[];
427
310
  /**
428
- * Calculates the base performance value of a difficulty rating.
429
- *
430
- * @param rating The difficulty rating.
311
+ * The strain peaks of aim difficulty if sliders are not considered.
431
312
  */
432
- protected basePerformanceValue(rating: number): number;
433
- }
434
-
435
- /**
436
- * Represents a slider that is considered difficult.
437
- *
438
- * This structure is a part of difficulty attributes and can be cached.
439
- */
440
- interface DifficultSlider {
313
+ aimWithoutSliders: number[];
441
314
  /**
442
- * The index of the slider in the beatmap.
315
+ * The strain peaks of speed difficulty.
443
316
  */
444
- readonly index: number;
317
+ speed: number[];
445
318
  /**
446
- * The difficulty rating of this slider compared to other sliders, based on the velocity of the slider.
447
- *
448
- * A value closer to 1 indicates that this slider is more difficult compared to most sliders.
449
- *
450
- * A value closer to 0 indicates that this slider is easier compared to most sliders.
319
+ * The strain peaks of flashlight difficulty.
451
320
  */
452
- readonly difficultyRating: number;
321
+ flashlight: number[];
453
322
  }
454
323
 
455
324
  /**
@@ -537,6 +406,124 @@ declare abstract class StrainSkill extends Skill {
537
406
  private startNewSectionFrom;
538
407
  }
539
408
 
409
+ /**
410
+ * The base of a difficulty calculator.
411
+ */
412
+ declare abstract class DifficultyCalculator<TBeatmap extends PlayableBeatmap, THitObject extends DifficultyHitObject, TAttributes extends DifficultyAttributes> {
413
+ protected abstract readonly difficultyMultiplier: number;
414
+ /**
415
+ * `Mod`s that adjust the difficulty of a beatmap.
416
+ */
417
+ protected readonly difficultyAdjustmentMods: Set<typeof Mod>;
418
+ /**
419
+ * Retains `Mod`s that adjust a beatmap's difficulty from the specified mods.
420
+ *
421
+ * @param mods The mods to retain the difficulty adjustment mods from.
422
+ * @returns The retained difficulty adjustment mods.
423
+ */
424
+ abstract retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
425
+ /**
426
+ * Calculates the difficulty of a `PlayableBeatmap`.
427
+ *
428
+ * @param beatmap The `PlayableBeatmap` whose difficulty is to be calculated.
429
+ * @returns A `DifficultyAttributes` object describing the difficulty of the `Beatmap`.
430
+ */
431
+ calculate(beatmap: TBeatmap): TAttributes;
432
+ /**
433
+ * Calculates the difficulty of a `Beatmap` with specific `Mod`s.
434
+ *
435
+ * @param beatmap The `Beatmap` whose difficulty is to be calculated.
436
+ * @param mods The `Mod`s to apply to the beatmap. Defaults to No Mod.
437
+ * @returns A `DifficultyAttributes` object describing the difficulty of the `Beatmap`.
438
+ */
439
+ calculate(beatmap: Beatmap, mods?: Mod[]): TAttributes;
440
+ /**
441
+ * Obtains the strain peaks of a `PlayableBeatmap`.
442
+ *
443
+ * @param beatmap The `PlayableBeatmap` whose strain peaks are to be calculated.
444
+ * @returns The strain peaks of the `PlayableBeatmap`.
445
+ */
446
+ calculateStrainPeaks(beatmap: TBeatmap): StrainPeaks;
447
+ /**
448
+ * Obtains the strain peaks of a `Beatmap` with specific `Mod`s.
449
+ *
450
+ * @param beatmap The `Beatmap` whose strain peaks are to be calculated.
451
+ * @param mods The `Mod`s to apply to the beatmap. Defaults to No Mod.
452
+ * @returns The strain peaks of the `Beatmap`.
453
+ */
454
+ calculateStrainPeaks(beatmap: Beatmap, mods: Mod[]): StrainPeaks;
455
+ /**
456
+ * Creates the `Skill`s to calculate the difficulty of a `PlayableBeatmap`.
457
+ *
458
+ * @param beatmap The `PlayableBeatmap` whose difficulty will be calculated.
459
+ * @return The `Skill`s.
460
+ */
461
+ protected abstract createSkills(beatmap: TBeatmap): Skill[];
462
+ /**
463
+ * Creates the `Skill`s to obtain the strain peaks of a `PlayableBeatmap`.
464
+ *
465
+ * @param beatmap
466
+ */
467
+ protected abstract createStrainPeakSkills(beatmap: TBeatmap): StrainSkill[];
468
+ /**
469
+ * Creates difficulty hitobjects for this calculator.
470
+ *
471
+ * @param beatmap The beatmap to generate difficulty hitobjects from.
472
+ * @returns The generated difficulty hitobjects.
473
+ */
474
+ protected abstract createDifficultyHitObjects(beatmap: TBeatmap): THitObject[];
475
+ /**
476
+ * Creates a `DifficultyAttributes` object to describe a `PlayableBeatmap`'s difficulty.
477
+ *
478
+ * @param beatmap The `PlayableBeatmap` whose difficulty was calculated.
479
+ * @param skills The `Skill`s which processed the `PlayableBeatmap`.
480
+ * @param objects The `DifficultyHitObject`s which were processed.
481
+ * @returns The `DifficultyAttributes` object.
482
+ */
483
+ protected abstract createDifficultyAttributes(beatmap: TBeatmap, skills: Skill[], objects: THitObject[]): TAttributes;
484
+ /**
485
+ * Constructs a `PlayableBeatmap` from a `Beatmap` with specific `Mod`s.
486
+ *
487
+ * @param beatmap The `Beatmap` to create a `PlayableBeatmap` from.
488
+ * @param mods The `Mod`s to apply to the `Beatmap`.
489
+ * @returns The `PlayableBeatmap`.
490
+ */
491
+ protected abstract createPlayableBeatmap(beatmap: Beatmap, mods: Mod[]): TBeatmap;
492
+ /**
493
+ * Calculates the base rating of a `Skill`.
494
+ *
495
+ * @param skill The `Skill` to calculate the rating of.
496
+ * @returns The rating of the `Skill`.
497
+ */
498
+ protected calculateRating(skill: Skill): number;
499
+ /**
500
+ * Calculates the base performance value of a difficulty rating.
501
+ *
502
+ * @param rating The difficulty rating.
503
+ */
504
+ protected basePerformanceValue(rating: number): number;
505
+ }
506
+
507
+ /**
508
+ * Represents a slider that is considered difficult.
509
+ *
510
+ * This structure is a part of difficulty attributes and can be cached.
511
+ */
512
+ interface DifficultSlider {
513
+ /**
514
+ * The index of the slider in the beatmap.
515
+ */
516
+ readonly index: number;
517
+ /**
518
+ * The difficulty rating of this slider compared to other sliders, based on the velocity of the slider.
519
+ *
520
+ * A value closer to 1 indicates that this slider is more difficult compared to most sliders.
521
+ *
522
+ * A value closer to 0 indicates that this slider is easier compared to most sliders.
523
+ */
524
+ readonly difficultyRating: number;
525
+ }
526
+
540
527
  /**
541
528
  * Used to processes strain values of difficulty hitobjects, keep track of strain levels caused by the processed objects
542
529
  * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
@@ -619,9 +606,11 @@ declare class DroidDifficultyHitObject extends DifficultyHitObject {
619
606
  * @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
620
607
  * @param clockRate The clock rate of the beatmap.
621
608
  */
622
- constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number);
609
+ constructor(object: PlaceableHitObject, lastObject: PlaceableHitObject | null, lastLastObject: PlaceableHitObject | null, difficultyHitObjects: readonly DifficultyHitObject[], clockRate: number, index: number);
623
610
  computeProperties(clockRate: number, hitObjects: readonly PlaceableHitObject[]): void;
624
- opacityAt(time: number, mods: Mod[]): number;
611
+ opacityAt(time: number, mods: readonly Mod[]): number;
612
+ previous(backwardsIndex: number): this | null;
613
+ next(forwardsIndex: number): this | null;
625
614
  /**
626
615
  * Determines whether this hitobject is considered overlapping with the hitobject before it.
627
616
  *
@@ -651,7 +640,7 @@ declare class DroidAim extends DroidSkill {
651
640
  private currentAimStrain;
652
641
  private readonly sliderStrains;
653
642
  readonly withSliders: boolean;
654
- constructor(mods: Mod[], withSliders: boolean);
643
+ constructor(mods: readonly Mod[], withSliders: boolean);
655
644
  /**
656
645
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
657
646
  */
@@ -703,7 +692,7 @@ declare abstract class DroidAimEvaluator {
703
692
  /**
704
693
  * Holds data that can be used to calculate osu!droid performance points.
705
694
  */
706
- interface DroidDifficultyAttributes extends DifficultyAttributes {
695
+ interface IDroidDifficultyAttributes extends IDifficultyAttributes {
707
696
  /**
708
697
  * The difficulty corresponding to the tap skill.
709
698
  */
@@ -743,13 +732,19 @@ interface DroidDifficultyAttributes extends DifficultyAttributes {
743
732
  }
744
733
 
745
734
  /**
746
- * Represents options for osu!droid difficulty calculation.
735
+ * Holds data that can be used to calculate osu!droid performance points.
747
736
  */
748
- interface DroidDifficultyCalculationOptions extends DifficultyCalculationOptions {
749
- /**
750
- * Whether to calculate for old statistics (1.6.7 and older). Defaults to `false`.
751
- */
752
- readonly oldStatistics?: boolean;
737
+ declare class DroidDifficultyAttributes extends DifficultyAttributes implements IDroidDifficultyAttributes {
738
+ tapDifficulty: number;
739
+ rhythmDifficulty: number;
740
+ visualDifficulty: number;
741
+ tapDifficultStrainCount: number;
742
+ flashlightDifficultStrainCount: number;
743
+ visualDifficultStrainCount: number;
744
+ averageSpeedDeltaTime: number;
745
+ vibroFactor: number;
746
+ constructor(cacheableAttributes?: CacheableDifficultyAttributes<IDroidDifficultyAttributes>);
747
+ toString(): string;
753
748
  }
754
749
 
755
750
  /**
@@ -774,7 +769,7 @@ interface HighStrainSection {
774
769
  * Holds data that can be used to calculate osu!droid performance points as well
775
770
  * as doing some analysis using the replay of a score.
776
771
  */
777
- interface ExtendedDroidDifficultyAttributes extends DroidDifficultyAttributes {
772
+ interface IExtendedDroidDifficultyAttributes extends IDroidDifficultyAttributes {
778
773
  /**
779
774
  * The mode of the difficulty calculation.
780
775
  */
@@ -811,110 +806,43 @@ interface ExtendedDroidDifficultyAttributes extends DroidDifficultyAttributes {
811
806
  visualSliderFactor: number;
812
807
  }
813
808
 
809
+ /**
810
+ * Holds data that can be used to calculate osu!droid performance points as well
811
+ * as doing some analysis using the replay of a score.
812
+ */
813
+ declare class ExtendedDroidDifficultyAttributes extends DroidDifficultyAttributes implements IExtendedDroidDifficultyAttributes {
814
+ mode: "live";
815
+ possibleThreeFingeredSections: HighStrainSection[];
816
+ difficultSliders: DifficultSlider[];
817
+ aimNoteCount: number;
818
+ flashlightSliderFactor: number;
819
+ visualSliderFactor: number;
820
+ constructor(cacheableAttributes?: CacheableDifficultyAttributes<IExtendedDroidDifficultyAttributes>);
821
+ }
822
+
814
823
  /**
815
824
  * A difficulty calculator for osu!droid gamemode.
816
825
  */
817
- declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDifficultyHitObject, DroidDifficultyAttributes> {
818
- /**
819
- * The aim star rating of the beatmap.
820
- */
821
- get aim(): number;
822
- /**
823
- * The tap star rating of the beatmap.
824
- */
825
- get tap(): number;
826
- /**
827
- * The rhythm star rating of the beatmap.
828
- */
829
- get rhythm(): number;
830
- /**
831
- * The flashlight star rating of the beatmap.
832
- */
833
- get flashlight(): number;
834
- /**
835
- * The visual star rating of the beatmap.
836
- */
837
- get visual(): number;
826
+ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidPlayableBeatmap, DroidDifficultyHitObject, ExtendedDroidDifficultyAttributes> {
838
827
  /**
839
828
  * The strain threshold to start detecting for possible three-fingered section.
840
829
  *
841
830
  * Increasing this number will result in less sections being flagged.
842
831
  */
843
832
  static readonly threeFingerStrainThreshold = 175;
844
- readonly attributes: ExtendedDroidDifficultyAttributes;
845
- get cacheableAttributes(): CacheableDifficultyAttributes<DroidDifficultyAttributes>;
846
- protected static readonly difficultyAdjustmentMods: Set<typeof ModHidden | typeof ModPrecise | typeof ModTraceable | typeof ModScoreV2 | typeof ModDoubleTime | typeof ModNightCore | typeof ModDifficultyAdjust | typeof ModHalfTime | typeof ModEasy | typeof ModHardRock | typeof ModFlashlight | typeof ModRelax | typeof ModAutopilot>;
847
833
  protected readonly difficultyMultiplier = 0.18;
848
- protected readonly mode = Modes.droid;
849
- calculate(options?: DroidDifficultyCalculationOptions): this;
850
- /**
851
- * Calculates the aim star rating of the beatmap and stores it in this instance.
852
- */
853
- calculateAim(): void;
854
- /**
855
- * Calculates the tap star rating of the beatmap and stores it in this instance.
856
- */
857
- calculateTap(): void;
858
- /**
859
- * Calculates the rhythm star rating of the beatmap and stores it in this instance.
860
- */
861
- calculateRhythm(): void;
862
- /**
863
- * Calculates the flashlight star rating of the beatmap and stores it in this instance.
864
- */
865
- calculateFlashlight(): void;
866
- /**
867
- * Calculates the visual star rating of the beatmap and stores it in this instance.
868
- */
869
- calculateVisual(): void;
870
- calculateTotal(): void;
871
- calculateAll(): void;
872
- toString(): string;
873
- protected generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): DroidDifficultyHitObject[];
874
- protected createSkills(): DroidSkill[];
875
- protected calculateClockRate(options?: DroidDifficultyCalculationOptions): number;
876
- /**
877
- * Called after aim skill calculation.
878
- *
879
- * @param aimSkill The aim skill that considers sliders.
880
- * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
881
- */
882
- private postCalculateAim;
883
- /**
884
- * Calculates aim-related attributes.
885
- */
886
- private calculateAimAttributes;
887
- /**
888
- * Called after tap skill calculation.
889
- *
890
- * @param tapSkillCheese The tap skill that considers cheesing.
891
- * @param tapSkillVibro The tap skill that considers vibro.
892
- */
893
- private postCalculateTap;
894
- /**
895
- * Calculates tap-related attributes.
896
- */
897
- private calculateTapAttributes;
898
- /**
899
- * Called after rhythm skill calculation.
900
- *
901
- * @param rhythmSkill The rhythm skill.
902
- */
903
- private postCalculateRhythm;
904
- /**
905
- * Called after flashlight skill calculation.
906
- *
907
- * @param flashlightSkill The flashlight skill that considers sliders.
908
- * @param flashlightSkillWithoutSliders The flashlight skill that doesn't consider sliders.
909
- */
910
- private postCalculateFlashlight;
911
- /**
912
- * Called after visual skill calculation.
913
- *
914
- * @param visualSkillWithSliders The visual skill that considers sliders.
915
- * @param visualSkillWithoutSliders The visual skill that doesn't consider sliders.
916
- */
917
- private postCalculateVisual;
834
+ constructor();
835
+ retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
836
+ protected createDifficultyAttributes(beatmap: DroidPlayableBeatmap, skills: Skill[], objects: DroidDifficultyHitObject[]): ExtendedDroidDifficultyAttributes;
837
+ protected createPlayableBeatmap(beatmap: Beatmap, mods: Mod[]): DroidPlayableBeatmap;
838
+ protected createDifficultyHitObjects(beatmap: DroidPlayableBeatmap): DroidDifficultyHitObject[];
839
+ protected createSkills(beatmap: DroidPlayableBeatmap): DroidSkill[];
840
+ protected createStrainPeakSkills(beatmap: DroidPlayableBeatmap): StrainSkill[];
841
+ private populateAimAttributes;
842
+ private populateTapAttributes;
843
+ private populateRhythmAttributes;
844
+ private populateFlashlightAttributes;
845
+ private populateVisualAttributes;
918
846
  }
919
847
 
920
848
  /**
@@ -928,7 +856,7 @@ declare class DroidFlashlight extends DroidSkill {
928
856
  private readonly skillMultiplier;
929
857
  private currentFlashlightStrain;
930
858
  readonly withSliders: boolean;
931
- constructor(mods: Mod[], withSliders: boolean);
859
+ constructor(mods: readonly Mod[], withSliders: boolean);
932
860
  protected strainValueAt(current: DroidDifficultyHitObject): number;
933
861
  protected calculateInitialStrain(time: number, current: DifficultyHitObject): number;
934
862
  protected getObjectStrain(): number;
@@ -960,7 +888,7 @@ declare abstract class DroidFlashlightEvaluator {
960
888
  * @param mods The mods used.
961
889
  * @param withSliders Whether to take slider difficulty into account.
962
890
  */
963
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
891
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: readonly Mod[], withSliders: boolean): number;
964
892
  }
965
893
 
966
894
  /**
@@ -1000,7 +928,7 @@ interface PerformanceCalculationOptions {
1000
928
  /**
1001
929
  * The base class of performance calculators.
1002
930
  */
1003
- declare abstract class PerformanceCalculator<T extends DifficultyAttributes> {
931
+ declare abstract class PerformanceCalculator<T extends IDifficultyAttributes> {
1004
932
  /**
1005
933
  * The overall performance value.
1006
934
  */
@@ -1105,7 +1033,7 @@ declare abstract class PerformanceCalculator<T extends DifficultyAttributes> {
1105
1033
  /**
1106
1034
  * A performance points calculator that calculates performance points for osu!droid gamemode.
1107
1035
  */
1108
- declare class DroidPerformanceCalculator extends PerformanceCalculator<DroidDifficultyAttributes> {
1036
+ declare class DroidPerformanceCalculator extends PerformanceCalculator<IDroidDifficultyAttributes> {
1109
1037
  /**
1110
1038
  * The aim performance value.
1111
1039
  */
@@ -1271,7 +1199,7 @@ declare class DroidRhythm extends DroidSkill {
1271
1199
  private readonly useSliderAccuracy;
1272
1200
  private currentRhythmStrain;
1273
1201
  private currentRhythmMultiplier;
1274
- constructor(mods: Mod[]);
1202
+ constructor(mods: readonly Mod[]);
1275
1203
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1276
1204
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1277
1205
  protected getObjectStrain(): number;
@@ -1314,7 +1242,7 @@ declare class DroidTap extends DroidSkill {
1314
1242
  get objectDeltaTimes(): readonly number[];
1315
1243
  readonly considerCheesability: boolean;
1316
1244
  private readonly strainTimeCap?;
1317
- constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
1245
+ constructor(mods: readonly Mod[], considerCheesability: boolean, strainTimeCap?: number);
1318
1246
  /**
1319
1247
  * The amount of notes that are relevant to the difficulty.
1320
1248
  */
@@ -1365,7 +1293,7 @@ declare class DroidVisual extends DroidSkill {
1365
1293
  private currentRhythmMultiplier;
1366
1294
  private readonly skillMultiplier;
1367
1295
  readonly withSliders: boolean;
1368
- constructor(mods: Mod[], withSliders: boolean);
1296
+ constructor(mods: readonly Mod[], withSliders: boolean);
1369
1297
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1370
1298
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1371
1299
  protected getObjectStrain(): number;
@@ -1391,7 +1319,27 @@ declare abstract class DroidVisualEvaluator {
1391
1319
  * @param mods The mods used.
1392
1320
  * @param withSliders Whether to take slider difficulty into account.
1393
1321
  */
1394
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: Mod[], withSliders: boolean): number;
1322
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, mods: readonly Mod[], withSliders: boolean): number;
1323
+ }
1324
+
1325
+ /**
1326
+ * Holds data that can be used to calculate osu!standard performance points.
1327
+ */
1328
+ interface IOsuDifficultyAttributes extends IDifficultyAttributes {
1329
+ /**
1330
+ * The perceived approach rate inclusive of rate-adjusting mods (DT/HT/etc).
1331
+ *
1332
+ * Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
1333
+ */
1334
+ approachRate: number;
1335
+ /**
1336
+ * The difficulty corresponding to the speed skill.
1337
+ */
1338
+ speedDifficulty: number;
1339
+ /**
1340
+ * The amount of strains that are considered difficult with respect to the speed skill.
1341
+ */
1342
+ speedDifficultStrainCount: number;
1395
1343
  }
1396
1344
 
1397
1345
  /**
@@ -1435,7 +1383,7 @@ declare class OsuAim extends OsuSkill {
1435
1383
  private readonly skillMultiplier;
1436
1384
  private readonly sliderStrains;
1437
1385
  readonly withSliders: boolean;
1438
- constructor(mods: Mod[], withSliders: boolean);
1386
+ constructor(mods: readonly Mod[], withSliders: boolean);
1439
1387
  /**
1440
1388
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
1441
1389
  */
@@ -1476,81 +1424,29 @@ declare abstract class OsuAimEvaluator {
1476
1424
  /**
1477
1425
  * Holds data that can be used to calculate osu!standard performance points.
1478
1426
  */
1479
- interface OsuDifficultyAttributes extends DifficultyAttributes {
1480
- /**
1481
- * The perceived approach rate inclusive of rate-adjusting mods (DT/HT/etc).
1482
- *
1483
- * Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
1484
- */
1427
+ declare class OsuDifficultyAttributes extends DifficultyAttributes implements IOsuDifficultyAttributes {
1485
1428
  approachRate: number;
1486
- /**
1487
- * The difficulty corresponding to the speed skill.
1488
- */
1489
1429
  speedDifficulty: number;
1490
- /**
1491
- * The amount of strains that are considered difficult with respect to the speed skill.
1492
- */
1493
1430
  speedDifficultStrainCount: number;
1431
+ constructor(cacheableAttributes?: CacheableDifficultyAttributes<IOsuDifficultyAttributes>);
1432
+ toString(): string;
1494
1433
  }
1495
1434
 
1496
1435
  /**
1497
1436
  * A difficulty calculator for osu!standard gamemode.
1498
1437
  */
1499
- declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuDifficultyHitObject, OsuDifficultyAttributes> {
1500
- /**
1501
- * The aim star rating of the beatmap.
1502
- */
1503
- get aim(): number;
1504
- /**
1505
- * The speed star rating of the beatmap.
1506
- */
1507
- get speed(): number;
1508
- /**
1509
- * The flashlight star rating of the beatmap.
1510
- */
1511
- get flashlight(): number;
1512
- readonly attributes: OsuDifficultyAttributes;
1513
- get cacheableAttributes(): CacheableDifficultyAttributes<OsuDifficultyAttributes>;
1514
- protected static readonly difficultyAdjustmentMods: Set<typeof ModHidden | typeof ModDoubleTime | typeof ModNightCore | typeof ModDifficultyAdjust | typeof ModHalfTime | typeof ModEasy | typeof ModHardRock | typeof ModFlashlight | typeof ModRelax | typeof ModAutopilot | typeof ModTouchDevice>;
1438
+ declare class OsuDifficultyCalculator extends DifficultyCalculator<OsuPlayableBeatmap, OsuDifficultyHitObject, OsuDifficultyAttributes> {
1515
1439
  protected readonly difficultyMultiplier = 0.0675;
1516
- protected readonly mode = Modes.osu;
1517
- /**
1518
- * Calculates the aim star rating of the beatmap and stores it in this instance.
1519
- */
1520
- calculateAim(): void;
1521
- /**
1522
- * Calculates the speed star rating of the beatmap and stores it in this instance.
1523
- */
1524
- calculateSpeed(): void;
1525
- /**
1526
- * Calculates the flashlight star rating of the beatmap and stores it in this instance.
1527
- */
1528
- calculateFlashlight(): void;
1529
- calculateTotal(): void;
1530
- calculateAll(): void;
1531
- toString(): string;
1532
- protected generateDifficultyHitObjects(beatmap: Beatmap, clockRate: number): OsuDifficultyHitObject[];
1533
- protected createSkills(): OsuSkill[];
1534
- protected populateDifficultyAttributes(beatmap: Beatmap, clockRate: number): void;
1535
- /**
1536
- * Called after aim skill calculation.
1537
- *
1538
- * @param aimSkill The aim skill that considers sliders.
1539
- * @param aimSkillWithoutSliders The aim skill that doesn't consider sliders.
1540
- */
1541
- private postCalculateAim;
1542
- /**
1543
- * Called after speed skill calculation.
1544
- *
1545
- * @param speedSkill The speed skill.
1546
- */
1547
- private postCalculateSpeed;
1548
- /**
1549
- * Called after flashlight skill calculation.
1550
- *
1551
- * @param flashlightSkill The flashlight skill.
1552
- */
1553
- private postCalculateFlashlight;
1440
+ constructor();
1441
+ retainDifficultyAdjustmentMods(mods: Mod[]): Mod[];
1442
+ protected createDifficultyAttributes(beatmap: OsuPlayableBeatmap, skills: Skill[]): OsuDifficultyAttributes;
1443
+ protected createPlayableBeatmap(beatmap: Beatmap, mods: Mod[]): OsuPlayableBeatmap;
1444
+ protected createDifficultyHitObjects(beatmap: OsuPlayableBeatmap): OsuDifficultyHitObject[];
1445
+ protected createSkills(beatmap: OsuPlayableBeatmap): OsuSkill[];
1446
+ protected createStrainPeakSkills(beatmap: OsuPlayableBeatmap): StrainSkill[];
1447
+ private populateAimAttributes;
1448
+ private populateSpeedAttributes;
1449
+ private populateFlashlightAttributes;
1554
1450
  }
1555
1451
 
1556
1452
  /**
@@ -1590,13 +1486,13 @@ declare abstract class OsuFlashlightEvaluator {
1590
1486
  * @param current The current object.
1591
1487
  * @param mods The mods used.
1592
1488
  */
1593
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
1489
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: readonly Mod[]): number;
1594
1490
  }
1595
1491
 
1596
1492
  /**
1597
1493
  * A performance points calculator that calculates performance points for osu!standard gamemode.
1598
1494
  */
1599
- declare class OsuPerformanceCalculator extends PerformanceCalculator<OsuDifficultyAttributes> {
1495
+ declare class OsuPerformanceCalculator extends PerformanceCalculator<IOsuDifficultyAttributes> {
1600
1496
  /**
1601
1497
  * The aim performance value.
1602
1498
  */
@@ -1689,6 +1585,10 @@ declare class OsuSpeed extends OsuSkill {
1689
1585
  private currentSpeedStrain;
1690
1586
  private currentRhythm;
1691
1587
  private readonly skillMultiplier;
1588
+ /**
1589
+ * The amount of notes that are relevant to the difficulty.
1590
+ */
1591
+ relevantNoteCount(): number;
1692
1592
  /**
1693
1593
  * @param current The hitobject to calculate.
1694
1594
  */
@@ -1722,7 +1622,7 @@ declare abstract class OsuSpeedEvaluator {
1722
1622
  * @param current The current object.
1723
1623
  * @param mods The mods applied.
1724
1624
  */
1725
- static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: Mod[]): number;
1625
+ static evaluateDifficultyOf(current: OsuDifficultyHitObject, mods: readonly Mod[]): number;
1726
1626
  }
1727
1627
 
1728
- export { type CacheableDifficultyAttributes, type DifficultSlider, type DifficultyAttributes, type DifficultyCalculationOptions, DifficultyCalculator, DifficultyHitObject, DroidAim, DroidAimEvaluator, type DroidDifficultyAttributes, type DroidDifficultyCalculationOptions, DroidDifficultyCalculator, DroidDifficultyHitObject, DroidFlashlight, DroidFlashlightEvaluator, DroidPerformanceCalculator, DroidRhythm, DroidRhythmEvaluator, DroidTap, DroidTapEvaluator, DroidVisual, DroidVisualEvaluator, type ExtendedDroidDifficultyAttributes, type HighStrainSection, OsuAim, OsuAimEvaluator, type OsuDifficultyAttributes, OsuDifficultyCalculator, OsuDifficultyHitObject, OsuFlashlight, OsuFlashlightEvaluator, OsuPerformanceCalculator, OsuRhythmEvaluator, OsuSpeed, OsuSpeedEvaluator, type PerformanceCalculationOptions, PerformanceCalculator, type StrainPeaks };
1628
+ export { type CacheableDifficultyAttributes, type DifficultSlider, DifficultyAttributes, DifficultyCalculator, DifficultyHitObject, DroidAim, DroidAimEvaluator, DroidDifficultyAttributes, DroidDifficultyCalculator, DroidDifficultyHitObject, DroidFlashlight, DroidFlashlightEvaluator, DroidPerformanceCalculator, DroidRhythm, DroidRhythmEvaluator, DroidTap, DroidTapEvaluator, DroidVisual, DroidVisualEvaluator, ExtendedDroidDifficultyAttributes, type HighStrainSection, type IDifficultyAttributes, type IDroidDifficultyAttributes, type IExtendedDroidDifficultyAttributes, type IOsuDifficultyAttributes, OsuAim, OsuAimEvaluator, OsuDifficultyAttributes, OsuDifficultyCalculator, OsuDifficultyHitObject, OsuFlashlight, OsuFlashlightEvaluator, OsuPerformanceCalculator, OsuRhythmEvaluator, OsuSpeed, OsuSpeedEvaluator, type PerformanceCalculationOptions, PerformanceCalculator, type StrainPeaks };