@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.17 → 4.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,10 +8,6 @@ var osuBase = require('@rian8337/osu-base');
8
8
  * This class should be considered an "evaluating" class and not persisted.
9
9
  */
10
10
  class AimEvaluator {
11
- static wideAngleMultiplier = 1.5;
12
- static acuteAngleMultiplier = 1.95;
13
- static sliderMultiplier = 1.35;
14
- static velocityChangeMultiplier = 0.75;
15
11
  /**
16
12
  * Calculates the bonus of wide angles.
17
13
  */
@@ -27,52 +23,49 @@ class AimEvaluator {
27
23
  return 1 - this.calculateWideAngleBonus(angle);
28
24
  }
29
25
  }
26
+ AimEvaluator.wideAngleMultiplier = 1.5;
27
+ AimEvaluator.acuteAngleMultiplier = 1.95;
28
+ AimEvaluator.sliderMultiplier = 1.35;
29
+ AimEvaluator.velocityChangeMultiplier = 0.75;
30
30
 
31
31
  /**
32
32
  * The base of a difficulty calculator.
33
33
  */
34
34
  class DifficultyCalculator {
35
- /**
36
- * The calculated beatmap.
37
- */
38
- beatmap;
39
- /**
40
- * The difficulty objects of the beatmap.
41
- */
42
- objects = [];
43
- /**
44
- * The modifications applied.
45
- */
46
- mods = [];
47
35
  /**
48
36
  * The total star rating of the beatmap.
49
37
  */
50
38
  get total() {
51
39
  return this.attributes.starRating;
52
40
  }
53
- /**
54
- * The difficulty statistics of the beatmap after modifications are applied.
55
- */
56
- difficultyStatistics;
57
- /**
58
- * The strain peaks of various calculated difficulties.
59
- */
60
- strainPeaks = {
61
- aimWithSliders: [],
62
- aimWithoutSliders: [],
63
- speed: [],
64
- flashlight: [],
65
- };
66
41
  /**
67
42
  * Constructs a new instance of the calculator.
68
43
  *
69
44
  * @param beatmap The beatmap to calculate. This beatmap will be deep-cloned to prevent reference changes.
70
45
  */
71
46
  constructor(beatmap) {
47
+ var _a;
48
+ /**
49
+ * The difficulty objects of the beatmap.
50
+ */
51
+ this.objects = [];
52
+ /**
53
+ * The modifications applied.
54
+ */
55
+ this.mods = [];
56
+ /**
57
+ * The strain peaks of various calculated difficulties.
58
+ */
59
+ this.strainPeaks = {
60
+ aimWithSliders: [],
61
+ aimWithoutSliders: [],
62
+ speed: [],
63
+ flashlight: [],
64
+ };
72
65
  this.beatmap = beatmap;
73
66
  this.difficultyStatistics = {
74
67
  circleSize: beatmap.difficulty.cs,
75
- approachRate: beatmap.difficulty.ar ?? beatmap.difficulty.od,
68
+ approachRate: (_a = beatmap.difficulty.ar) !== null && _a !== void 0 ? _a : beatmap.difficulty.od,
76
69
  overallDifficulty: beatmap.difficulty.od,
77
70
  healthDrain: beatmap.difficulty.hp,
78
71
  overallSpeedMultiplier: 1,
@@ -94,11 +87,12 @@ class DifficultyCalculator {
94
87
  * @returns The current instance.
95
88
  */
96
89
  calculate(options) {
97
- this.mods = options?.mods ?? [];
90
+ var _a;
91
+ this.mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
98
92
  const converted = new osuBase.BeatmapConverter(this.beatmap).convert({
99
93
  mode: this.mode,
100
94
  mods: this.mods,
101
- customSpeedMultiplier: options?.customSpeedMultiplier,
95
+ customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
102
96
  });
103
97
  this.difficultyStatistics = Object.seal(this.computeDifficultyStatistics(options));
104
98
  this.populateDifficultyAttributes();
@@ -156,91 +150,6 @@ class DifficultyCalculator {
156
150
  * Represents a hit object with difficulty calculation values.
157
151
  */
158
152
  class DifficultyHitObject {
159
- /**
160
- * The underlying hitobject.
161
- */
162
- object;
163
- /**
164
- * The index of this hitobject in the list of all hitobjects.
165
- *
166
- * This is one less than the actual index of the hitobject in the beatmap.
167
- */
168
- index;
169
- /**
170
- * The aim strain generated by the hitobject if sliders are considered.
171
- */
172
- aimStrainWithSliders = 0;
173
- /**
174
- * The aim strain generated by the hitobject if sliders are not considered.
175
- */
176
- aimStrainWithoutSliders = 0;
177
- /**
178
- * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
179
- */
180
- rhythmMultiplier = 0;
181
- /**
182
- * The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
183
- *
184
- * 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).
185
- */
186
- lazyJumpDistance = 0;
187
- /**
188
- * The normalized shortest distance to consider for a jump between the previous hitobject and this hitobject.
189
- *
190
- * 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.
191
- *
192
- * 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.
193
- * 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,
194
- * such that the jump is felt as only starting from the slider's true end position.
195
- *
196
- * Now consider a slider - circle pattern where the circle is stacked along the path inside the slider.
197
- * In this case, the lazy end position correctly estimates the true end position of the slider and provides the more natural movement path.
198
- */
199
- minimumJumpDistance = 0;
200
- /**
201
- * The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
202
- */
203
- minimumJumpTime = 0;
204
- /**
205
- * The normalized distance between the start and end position of this hitobject.
206
- */
207
- travelDistance = 0;
208
- /**
209
- * The time taken to travel through `travelDistance`, with a minimum value of 25ms for sliders.
210
- */
211
- travelTime = 0;
212
- /**
213
- * Angle the player has to take to hit this hitobject.
214
- *
215
- * Calculated as the angle between the circles (current-2, current-1, current).
216
- */
217
- angle = null;
218
- /**
219
- * The amount of milliseconds elapsed between this hitobject and the last hitobject.
220
- */
221
- deltaTime;
222
- /**
223
- * The amount of milliseconds elapsed since the start time of the previous hitobject, with a minimum of 25ms.
224
- */
225
- strainTime;
226
- /**
227
- * Adjusted start time of the hitobject, taking speed multiplier into account.
228
- */
229
- startTime;
230
- /**
231
- * Adjusted end time of the hitobject, taking speed multiplier into account.
232
- */
233
- endTime;
234
- /**
235
- * Other hitobjects in the beatmap, including this hitobject.
236
- */
237
- hitObjects;
238
- normalizedRadius = 50;
239
- maximumSliderRadius = this.normalizedRadius * 2.4;
240
- assumedSliderRadius = this.normalizedRadius * 1.8;
241
- minDeltaTime = 25;
242
- lastObject;
243
- lastLastObject;
244
153
  /**
245
154
  * Note: You **must** call `computeProperties` at some point due to how TypeScript handles
246
155
  * overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
@@ -252,6 +161,59 @@ class DifficultyHitObject {
252
161
  * @param clockRate The clock rate of the beatmap.
253
162
  */
254
163
  constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
164
+ /**
165
+ * The aim strain generated by the hitobject if sliders are considered.
166
+ */
167
+ this.aimStrainWithSliders = 0;
168
+ /**
169
+ * The aim strain generated by the hitobject if sliders are not considered.
170
+ */
171
+ this.aimStrainWithoutSliders = 0;
172
+ /**
173
+ * The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
174
+ */
175
+ this.rhythmMultiplier = 0;
176
+ /**
177
+ * The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
178
+ *
179
+ * 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).
180
+ */
181
+ this.lazyJumpDistance = 0;
182
+ /**
183
+ * The normalized shortest distance to consider for a jump between the previous hitobject and this hitobject.
184
+ *
185
+ * 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.
186
+ *
187
+ * 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.
188
+ * 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,
189
+ * such that the jump is felt as only starting from the slider's true end position.
190
+ *
191
+ * Now consider a slider - circle pattern where the circle is stacked along the path inside the slider.
192
+ * In this case, the lazy end position correctly estimates the true end position of the slider and provides the more natural movement path.
193
+ */
194
+ this.minimumJumpDistance = 0;
195
+ /**
196
+ * The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
197
+ */
198
+ this.minimumJumpTime = 0;
199
+ /**
200
+ * The normalized distance between the start and end position of this hitobject.
201
+ */
202
+ this.travelDistance = 0;
203
+ /**
204
+ * The time taken to travel through `travelDistance`, with a minimum value of 25ms for sliders.
205
+ */
206
+ this.travelTime = 0;
207
+ /**
208
+ * Angle the player has to take to hit this hitobject.
209
+ *
210
+ * Calculated as the angle between the circles (current-2, current-1, current).
211
+ */
212
+ this.angle = null;
213
+ this.normalizedRadius = 50;
214
+ this.maximumSliderRadius = this.normalizedRadius * 2.4;
215
+ this.assumedSliderRadius = this.normalizedRadius * 1.8;
216
+ this.minDeltaTime = 25;
255
217
  this.object = object;
256
218
  this.lastObject = lastObject;
257
219
  this.lastLastObject = lastLastObject;
@@ -292,7 +254,8 @@ class DifficultyHitObject {
292
254
  * difficulty hitobject's index, `null` if the index is out of range.
293
255
  */
294
256
  previous(backwardsIndex) {
295
- return this.hitObjects[this.index - backwardsIndex] ?? null;
257
+ var _a;
258
+ return (_a = this.hitObjects[this.index - backwardsIndex]) !== null && _a !== void 0 ? _a : null;
296
259
  }
297
260
  /**
298
261
  * Gets the difficulty hitobject at a specific index with respect to the current
@@ -305,7 +268,8 @@ class DifficultyHitObject {
305
268
  * difficulty hitobject's index, `null` if the index is out of range.
306
269
  */
307
270
  next(forwardsIndex) {
308
- return (this.hitObjects[this.index + forwardsIndex + 2] ?? null);
271
+ var _a;
272
+ return ((_a = this.hitObjects[this.index + forwardsIndex + 2]) !== null && _a !== void 0 ? _a : null);
309
273
  }
310
274
  /**
311
275
  * Calculates the opacity of the hitobject at a given time.
@@ -458,10 +422,11 @@ class DifficultyHitObject {
458
422
  }
459
423
  }
460
424
  getEndCursorPosition(object) {
425
+ var _a;
461
426
  let pos = object.getStackedPosition(this.mode);
462
427
  if (object instanceof osuBase.Slider) {
463
428
  this.calculateSliderCursorPosition(object);
464
- pos = object.lazyEndPosition ?? pos;
429
+ pos = (_a = object.lazyEndPosition) !== null && _a !== void 0 ? _a : pos;
465
430
  }
466
431
  return pos;
467
432
  }
@@ -471,12 +436,6 @@ class DifficultyHitObject {
471
436
  * An evaluator for calculating osu!droid Aim skill.
472
437
  */
473
438
  class DroidAimEvaluator extends AimEvaluator {
474
- static wideAngleMultiplier = 1.65;
475
- static sliderMultiplier = 1.5;
476
- static velocityChangeMultiplier = 0.85;
477
- static singleSpacingThreshold = 100;
478
- // 200 1/4 BPM delta time
479
- static minSpeedBonus = 75;
480
439
  /**
481
440
  * Evaluates the difficulty of aiming the current object, based on:
482
441
  *
@@ -501,8 +460,9 @@ class DroidAimEvaluator extends AimEvaluator {
501
460
  * Calculates the snap aim strain of a hitobject.
502
461
  */
503
462
  static snapAimStrainOf(current, withSliders) {
463
+ var _a;
504
464
  if (current.index <= 1 ||
505
- current.previous(0)?.object instanceof osuBase.Spinner) {
465
+ ((_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
506
466
  return 0;
507
467
  }
508
468
  const last = current.previous(0);
@@ -613,26 +573,29 @@ class DroidAimEvaluator extends AimEvaluator {
613
573
  * Calculates the flow aim strain of a hitobject.
614
574
  */
615
575
  static flowAimStrainOf(current) {
576
+ var _a, _b;
616
577
  let speedBonus = 1;
617
578
  if (current.strainTime < this.minSpeedBonus) {
618
579
  speedBonus +=
619
580
  0.75 *
620
581
  Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
621
582
  }
622
- const travelDistance = current.previous(0)?.travelDistance ?? 0;
583
+ const travelDistance = (_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.travelDistance) !== null && _b !== void 0 ? _b : 0;
623
584
  const shortDistancePenalty = Math.pow(Math.min(this.singleSpacingThreshold, travelDistance + current.minimumJumpDistance) / this.singleSpacingThreshold, 3.5);
624
585
  return (200 * speedBonus * shortDistancePenalty) / current.strainTime;
625
586
  }
626
587
  }
588
+ DroidAimEvaluator.wideAngleMultiplier = 1.65;
589
+ DroidAimEvaluator.sliderMultiplier = 1.5;
590
+ DroidAimEvaluator.velocityChangeMultiplier = 0.85;
591
+ DroidAimEvaluator.singleSpacingThreshold = 100;
592
+ // 200 1/4 BPM delta time
593
+ DroidAimEvaluator.minSpeedBonus = 75;
627
594
 
628
595
  /**
629
596
  * A bare minimal abstract skill for fully custom skill implementations.
630
597
  */
631
598
  class Skill {
632
- /**
633
- * The mods that this skill processes.
634
- */
635
- mods;
636
599
  constructor(mods) {
637
600
  this.mods = mods;
638
601
  }
@@ -643,14 +606,17 @@ class Skill {
643
606
  * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
644
607
  */
645
608
  class StrainSkill extends Skill {
646
- /**
647
- * Strain peaks are stored here.
648
- */
649
- strainPeaks = [];
650
- sectionLength = 400;
651
- currentStrain = 0;
652
- currentSectionPeak = 0;
653
- currentSectionEnd = 0;
609
+ constructor() {
610
+ super(...arguments);
611
+ /**
612
+ * Strain peaks are stored here.
613
+ */
614
+ this.strainPeaks = [];
615
+ this.sectionLength = 400;
616
+ this.currentStrain = 0;
617
+ this.currentSectionPeak = 0;
618
+ this.currentSectionEnd = 0;
619
+ }
654
620
  process(current) {
655
621
  // The first object doesn't generate a strain, so we begin with an incremented section end
656
622
  if (current.index === 0) {
@@ -712,7 +678,10 @@ class StrainSkill extends Skill {
712
678
  * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
713
679
  */
714
680
  class DroidSkill extends StrainSkill {
715
- _objectStrains = [];
681
+ constructor() {
682
+ super(...arguments);
683
+ this._objectStrains = [];
684
+ }
716
685
  /**
717
686
  * The strains of hitobjects.
718
687
  */
@@ -766,15 +735,14 @@ class DroidSkill extends StrainSkill {
766
735
  * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
767
736
  */
768
737
  class DroidAim extends DroidSkill {
769
- strainDecayBase = 0.15;
770
- reducedSectionCount = 10;
771
- reducedSectionBaseline = 0.75;
772
- starsPerDouble = 1.05;
773
- skillMultiplier = 24.55;
774
- withSliders;
775
- currentAimStrain = 0;
776
738
  constructor(mods, withSliders) {
777
739
  super(mods);
740
+ this.strainDecayBase = 0.15;
741
+ this.reducedSectionCount = 10;
742
+ this.reducedSectionBaseline = 0.75;
743
+ this.starsPerDouble = 1.05;
744
+ this.skillMultiplier = 24.55;
745
+ this.currentAimStrain = 0;
778
746
  this.withSliders = withSliders;
779
747
  }
780
748
  strainValueAt(current) {
@@ -785,8 +753,9 @@ class DroidAim extends DroidSkill {
785
753
  return this.currentAimStrain;
786
754
  }
787
755
  calculateInitialStrain(time, current) {
756
+ var _a, _b;
788
757
  return (this.currentAimStrain *
789
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
758
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
790
759
  }
791
760
  getObjectStrain() {
792
761
  return this.currentAimStrain;
@@ -810,9 +779,9 @@ class DroidAim extends DroidSkill {
810
779
  * This class should be considered an "evaluating" class and not persisted.
811
780
  */
812
781
  class SpeedEvaluator {
813
- // ~200 1/4 BPM streams
814
- static minSpeedBonus = 75;
815
782
  }
783
+ // ~200 1/4 BPM streams
784
+ SpeedEvaluator.minSpeedBonus = 75;
816
785
 
817
786
  /**
818
787
  * An evaluator for calculating osu!droid tap skill.
@@ -870,17 +839,6 @@ class DroidTapEvaluator extends SpeedEvaluator {
870
839
  * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
871
840
  */
872
841
  class DroidTap extends DroidSkill {
873
- reducedSectionCount = 10;
874
- reducedSectionBaseline = 0.75;
875
- strainDecayBase = 0.3;
876
- starsPerDouble = 1.1;
877
- currentTapStrain = 0;
878
- currentRhythmMultiplier = 0;
879
- skillMultiplier = 1375;
880
- greatWindow;
881
- considerCheesability;
882
- strainTimeCap;
883
- _objectDeltaTimes = [];
884
842
  /**
885
843
  * The delta time of hitobjects.
886
844
  */
@@ -889,6 +847,14 @@ class DroidTap extends DroidSkill {
889
847
  }
890
848
  constructor(mods, overallDifficulty, considerCheesability, strainTimeCap) {
891
849
  super(mods);
850
+ this.reducedSectionCount = 10;
851
+ this.reducedSectionBaseline = 0.75;
852
+ this.strainDecayBase = 0.3;
853
+ this.starsPerDouble = 1.1;
854
+ this.currentTapStrain = 0;
855
+ this.currentRhythmMultiplier = 0;
856
+ this.skillMultiplier = 1375;
857
+ this._objectDeltaTimes = [];
892
858
  this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
893
859
  this.considerCheesability = considerCheesability;
894
860
  this.strainTimeCap = strainTimeCap;
@@ -935,9 +901,10 @@ class DroidTap extends DroidSkill {
935
901
  return this.currentTapStrain * current.rhythmMultiplier;
936
902
  }
937
903
  calculateInitialStrain(time, current) {
904
+ var _a, _b;
938
905
  return (this.currentTapStrain *
939
906
  this.currentRhythmMultiplier *
940
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
907
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
941
908
  }
942
909
  getObjectStrain() {
943
910
  return this.currentTapStrain * this.currentRhythmMultiplier;
@@ -965,12 +932,12 @@ class DroidTap extends DroidSkill {
965
932
  * This class should be considered an "evaluating" class and not persisted.
966
933
  */
967
934
  class FlashlightEvaluator {
968
- static maxOpacityBonus = 0.4;
969
- static hiddenBonus = 0.2;
970
- static minVelocity = 0.5;
971
- static sliderMultiplier = 1.3;
972
- static minAngleMultiplier = 0.2;
973
935
  }
936
+ FlashlightEvaluator.maxOpacityBonus = 0.4;
937
+ FlashlightEvaluator.hiddenBonus = 0.2;
938
+ FlashlightEvaluator.minVelocity = 0.5;
939
+ FlashlightEvaluator.sliderMultiplier = 1.3;
940
+ FlashlightEvaluator.minAngleMultiplier = 0.2;
974
941
 
975
942
  /**
976
943
  * An evaluator for calculating osu!droid Flashlight skill.
@@ -1063,16 +1030,14 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
1063
1030
  * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
1064
1031
  */
1065
1032
  class DroidFlashlight extends DroidSkill {
1066
- strainDecayBase = 0.15;
1067
- reducedSectionCount = 0;
1068
- reducedSectionBaseline = 1;
1069
- starsPerDouble = 1.06;
1070
- skillMultiplier = 0.052;
1071
- isHidden;
1072
- withSliders;
1073
- currentFlashlightStrain = 0;
1074
1033
  constructor(mods, withSliders) {
1075
1034
  super(mods);
1035
+ this.strainDecayBase = 0.15;
1036
+ this.reducedSectionCount = 0;
1037
+ this.reducedSectionBaseline = 1;
1038
+ this.starsPerDouble = 1.06;
1039
+ this.skillMultiplier = 0.052;
1040
+ this.currentFlashlightStrain = 0;
1076
1041
  this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
1077
1042
  this.withSliders = withSliders;
1078
1043
  }
@@ -1083,8 +1048,9 @@ class DroidFlashlight extends DroidSkill {
1083
1048
  return this.currentFlashlightStrain;
1084
1049
  }
1085
1050
  calculateInitialStrain(time, current) {
1051
+ var _a, _b;
1086
1052
  return (this.currentFlashlightStrain *
1087
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
1053
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
1088
1054
  }
1089
1055
  getObjectStrain() {
1090
1056
  return this.currentFlashlightStrain;
@@ -1109,9 +1075,9 @@ class DroidFlashlight extends DroidSkill {
1109
1075
  * This class should be considered an "evaluating" class and not persisted.
1110
1076
  */
1111
1077
  class RhythmEvaluator {
1112
- static rhythmMultiplier = 0.75;
1113
- static historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
1114
1078
  }
1079
+ RhythmEvaluator.rhythmMultiplier = 0.75;
1080
+ RhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
1115
1081
 
1116
1082
  /**
1117
1083
  * An evaluator for calculating osu!droid Rhythm skill.
@@ -1247,15 +1213,14 @@ class DroidRhythmEvaluator extends RhythmEvaluator {
1247
1213
  * Represents the skill required to properly follow a beatmap's rhythm.
1248
1214
  */
1249
1215
  class DroidRhythm extends DroidSkill {
1250
- reducedSectionCount = 5;
1251
- reducedSectionBaseline = 0.75;
1252
- strainDecayBase = 0.3;
1253
- starsPerDouble = 1.75;
1254
- currentRhythmStrain = 0;
1255
- currentRhythmMultiplier = 1;
1256
- hitWindow;
1257
1216
  constructor(mods, overallDifficulty) {
1258
1217
  super(mods);
1218
+ this.reducedSectionCount = 5;
1219
+ this.reducedSectionBaseline = 0.75;
1220
+ this.strainDecayBase = 0.3;
1221
+ this.starsPerDouble = 1.75;
1222
+ this.currentRhythmStrain = 0;
1223
+ this.currentRhythmMultiplier = 1;
1259
1224
  this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
1260
1225
  }
1261
1226
  strainValueAt(current) {
@@ -1266,8 +1231,9 @@ class DroidRhythm extends DroidSkill {
1266
1231
  return this.currentRhythmStrain;
1267
1232
  }
1268
1233
  calculateInitialStrain(time, current) {
1234
+ var _a, _b;
1269
1235
  return (this.currentRhythmStrain *
1270
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
1236
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
1271
1237
  }
1272
1238
  getObjectStrain() {
1273
1239
  return this.currentRhythmStrain;
@@ -1279,7 +1245,7 @@ class DroidRhythm extends DroidSkill {
1279
1245
  }
1280
1246
 
1281
1247
  /**
1282
- * An evaluator for calculating osu!droid Visual skill.
1248
+ * An evaluator for calculating osu!droid visual skill.
1283
1249
  */
1284
1250
  class DroidVisualEvaluator {
1285
1251
  /**
@@ -1333,7 +1299,7 @@ class DroidVisualEvaluator {
1333
1299
  }
1334
1300
  if (current.timePreempt < 400) {
1335
1301
  // Give bonus for AR higher than 10.33.
1336
- strain += Math.pow(400 - current.timePreempt, 1.3) / 100;
1302
+ strain += Math.pow(400 - current.timePreempt, 1.35) / 100;
1337
1303
  }
1338
1304
  // Scale the value with overlapping factor.
1339
1305
  strain /= 10 * (1 + current.overlappingFactor);
@@ -1378,17 +1344,15 @@ class DroidVisualEvaluator {
1378
1344
  * Represents the skill required to read every object in the map.
1379
1345
  */
1380
1346
  class DroidVisual extends DroidSkill {
1381
- starsPerDouble = 1.025;
1382
- reducedSectionCount = 10;
1383
- reducedSectionBaseline = 0.75;
1384
- strainDecayBase = 0.1;
1385
- isHidden;
1386
- withSliders;
1387
- currentVisualStrain = 0;
1388
- currentRhythmMultiplier = 1;
1389
- skillMultiplier = 10;
1390
1347
  constructor(mods, withSliders) {
1391
1348
  super(mods);
1349
+ this.starsPerDouble = 1.025;
1350
+ this.reducedSectionCount = 10;
1351
+ this.reducedSectionBaseline = 0.75;
1352
+ this.strainDecayBase = 0.1;
1353
+ this.currentVisualStrain = 0;
1354
+ this.currentRhythmMultiplier = 1;
1355
+ this.skillMultiplier = 10;
1392
1356
  this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
1393
1357
  this.withSliders = withSliders;
1394
1358
  }
@@ -1400,9 +1364,10 @@ class DroidVisual extends DroidSkill {
1400
1364
  return this.currentVisualStrain * this.currentRhythmMultiplier;
1401
1365
  }
1402
1366
  calculateInitialStrain(time, current) {
1367
+ var _a, _b;
1403
1368
  return (this.currentVisualStrain *
1404
1369
  this.currentRhythmMultiplier *
1405
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
1370
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
1406
1371
  }
1407
1372
  getObjectStrain() {
1408
1373
  return this.currentVisualStrain * this.currentRhythmMultiplier;
@@ -1422,52 +1387,6 @@ class DroidVisual extends DroidSkill {
1422
1387
  * Represents an osu!droid hit object with difficulty calculation values.
1423
1388
  */
1424
1389
  class DroidDifficultyHitObject extends DifficultyHitObject {
1425
- /**
1426
- * The tap strain generated by the hitobject.
1427
- */
1428
- tapStrain = 0;
1429
- /**
1430
- * The tap strain generated by the hitobject if `strainTime` isn't modified by
1431
- * OD. This is used in three-finger detection.
1432
- */
1433
- originalTapStrain = 0;
1434
- /**
1435
- * The rhythm strain generated by the hitobject.
1436
- */
1437
- rhythmStrain = 0;
1438
- /**
1439
- * The flashlight strain generated by the hitobject if sliders are considered.
1440
- */
1441
- flashlightStrainWithSliders = 0;
1442
- /**
1443
- * The flashlight strain generated by the hitobject if sliders are not considered.
1444
- */
1445
- flashlightStrainWithoutSliders = 0;
1446
- /**
1447
- * The visual strain generated by the hitobject if sliders are considered.
1448
- */
1449
- visualStrainWithSliders = 0;
1450
- /**
1451
- * The visual strain generated by the hitobject if sliders are not considered.
1452
- */
1453
- visualStrainWithoutSliders = 0;
1454
- /**
1455
- * The note density of the hitobject.
1456
- */
1457
- noteDensity = 1;
1458
- /**
1459
- * The overlapping factor of the hitobject.
1460
- *
1461
- * This is used to scale visual skill.
1462
- */
1463
- overlappingFactor = 0;
1464
- /**
1465
- * Adjusted preempt time of the hitobject, taking speed multiplier into account.
1466
- */
1467
- timePreempt;
1468
- radiusBuffThreshold = 70;
1469
- mode = osuBase.Modes.droid;
1470
- maximumSliderRadius = this.normalizedRadius * 2;
1471
1390
  get scalingFactor() {
1472
1391
  const radius = this.object.radius;
1473
1392
  // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
@@ -1492,6 +1411,48 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
1492
1411
  */
1493
1412
  constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, isForceAR) {
1494
1413
  super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
1414
+ /**
1415
+ * The tap strain generated by the hitobject.
1416
+ */
1417
+ this.tapStrain = 0;
1418
+ /**
1419
+ * The tap strain generated by the hitobject if `strainTime` isn't modified by
1420
+ * OD. This is used in three-finger detection.
1421
+ */
1422
+ this.originalTapStrain = 0;
1423
+ /**
1424
+ * The rhythm strain generated by the hitobject.
1425
+ */
1426
+ this.rhythmStrain = 0;
1427
+ /**
1428
+ * The flashlight strain generated by the hitobject if sliders are considered.
1429
+ */
1430
+ this.flashlightStrainWithSliders = 0;
1431
+ /**
1432
+ * The flashlight strain generated by the hitobject if sliders are not considered.
1433
+ */
1434
+ this.flashlightStrainWithoutSliders = 0;
1435
+ /**
1436
+ * The visual strain generated by the hitobject if sliders are considered.
1437
+ */
1438
+ this.visualStrainWithSliders = 0;
1439
+ /**
1440
+ * The visual strain generated by the hitobject if sliders are not considered.
1441
+ */
1442
+ this.visualStrainWithoutSliders = 0;
1443
+ /**
1444
+ * The note density of the hitobject.
1445
+ */
1446
+ this.noteDensity = 1;
1447
+ /**
1448
+ * The overlapping factor of the hitobject.
1449
+ *
1450
+ * This is used to scale visual skill.
1451
+ */
1452
+ this.overlappingFactor = 0;
1453
+ this.radiusBuffThreshold = 70;
1454
+ this.mode = osuBase.Modes.droid;
1455
+ this.maximumSliderRadius = this.normalizedRadius * 2;
1495
1456
  this.timePreempt = this.object.timePreempt;
1496
1457
  if (!isForceAR) {
1497
1458
  this.timePreempt /= clockRate;
@@ -1585,7 +1546,7 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
1585
1546
  // Penalize objects that are too close to the object in both distance
1586
1547
  // and delta time to prevent stream maps from being overweighted.
1587
1548
  this.overlappingFactor +=
1588
- Math.max(0, 1 - distance / (3 * this.object.radius)) *
1549
+ Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
1589
1550
  (7.5 /
1590
1551
  (1 +
1591
1552
  Math.exp(0.15 * (Math.max(deltaTime, this.minDeltaTime) - 75))));
@@ -1596,6 +1557,41 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
1596
1557
  * A difficulty calculator for osu!droid gamemode.
1597
1558
  */
1598
1559
  class DroidDifficultyCalculator extends DifficultyCalculator {
1560
+ constructor() {
1561
+ super(...arguments);
1562
+ this.attributes = {
1563
+ mode: "rebalance",
1564
+ tapDifficulty: 0,
1565
+ rhythmDifficulty: 0,
1566
+ visualDifficulty: 0,
1567
+ aimNoteCount: 0,
1568
+ mods: [],
1569
+ starRating: 0,
1570
+ maxCombo: 0,
1571
+ aimDifficulty: 0,
1572
+ flashlightDifficulty: 0,
1573
+ speedNoteCount: 0,
1574
+ sliderFactor: 0,
1575
+ clockRate: 1,
1576
+ approachRate: 0,
1577
+ overallDifficulty: 0,
1578
+ hitCircleCount: 0,
1579
+ sliderCount: 0,
1580
+ spinnerCount: 0,
1581
+ aimDifficultStrainCount: 0,
1582
+ tapDifficultStrainCount: 0,
1583
+ flashlightDifficultStrainCount: 0,
1584
+ visualDifficultStrainCount: 0,
1585
+ flashlightSliderFactor: 0,
1586
+ visualSliderFactor: 0,
1587
+ possibleThreeFingeredSections: [],
1588
+ difficultSliders: [],
1589
+ averageSpeedDeltaTime: 0,
1590
+ vibroFactor: 1,
1591
+ };
1592
+ this.difficultyMultiplier = 0.18;
1593
+ this.mode = osuBase.Modes.droid;
1594
+ }
1599
1595
  /**
1600
1596
  * The aim star rating of the beatmap.
1601
1597
  */
@@ -1626,42 +1622,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1626
1622
  get visual() {
1627
1623
  return this.attributes.visualDifficulty;
1628
1624
  }
1629
- /**
1630
- * The strain threshold to start detecting for possible three-fingered section.
1631
- *
1632
- * Increasing this number will result in less sections being flagged.
1633
- */
1634
- static threeFingerStrainThreshold = 175;
1635
- attributes = {
1636
- mode: "rebalance",
1637
- tapDifficulty: 0,
1638
- rhythmDifficulty: 0,
1639
- visualDifficulty: 0,
1640
- aimNoteCount: 0,
1641
- mods: [],
1642
- starRating: 0,
1643
- maxCombo: 0,
1644
- aimDifficulty: 0,
1645
- flashlightDifficulty: 0,
1646
- speedNoteCount: 0,
1647
- sliderFactor: 0,
1648
- clockRate: 1,
1649
- approachRate: 0,
1650
- overallDifficulty: 0,
1651
- hitCircleCount: 0,
1652
- sliderCount: 0,
1653
- spinnerCount: 0,
1654
- aimDifficultStrainCount: 0,
1655
- tapDifficultStrainCount: 0,
1656
- flashlightDifficultStrainCount: 0,
1657
- visualDifficultStrainCount: 0,
1658
- flashlightSliderFactor: 0,
1659
- visualSliderFactor: 0,
1660
- possibleThreeFingeredSections: [],
1661
- difficultSliders: [],
1662
- averageSpeedDeltaTime: 0,
1663
- vibroFactor: 1,
1664
- };
1665
1625
  get cacheableAttributes() {
1666
1626
  return {
1667
1627
  tapDifficulty: this.tap,
@@ -1688,8 +1648,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1688
1648
  vibroFactor: this.attributes.vibroFactor,
1689
1649
  };
1690
1650
  }
1691
- difficultyMultiplier = 0.18;
1692
- mode = osuBase.Modes.droid;
1693
1651
  /**
1694
1652
  * Calculates the aim star rating of the beatmap and stores it in this instance.
1695
1653
  */
@@ -1799,26 +1757,28 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1799
1757
  " visual)");
1800
1758
  }
1801
1759
  generateDifficultyHitObjects(beatmap) {
1760
+ var _a, _b;
1802
1761
  const difficultyObjects = [];
1803
1762
  const { objects } = beatmap.hitObjects;
1804
1763
  const difficultyAdjustMod = this.mods.find((m) => m instanceof osuBase.ModDifficultyAdjust);
1805
1764
  for (let i = 0; i < objects.length; ++i) {
1806
- const difficultyObject = new DroidDifficultyHitObject(objects[i], objects[i - 1] ?? null, objects[i - 2] ?? null, difficultyObjects, this.difficultyStatistics.overallSpeedMultiplier, difficultyAdjustMod?.ar !== undefined);
1765
+ const difficultyObject = new DroidDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, this.difficultyStatistics.overallSpeedMultiplier, (difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) !== undefined);
1807
1766
  difficultyObject.computeProperties(this.difficultyStatistics.overallSpeedMultiplier, objects);
1808
1767
  difficultyObjects.push(difficultyObject);
1809
1768
  }
1810
1769
  return difficultyObjects;
1811
1770
  }
1812
1771
  computeDifficultyStatistics(options) {
1772
+ var _a;
1813
1773
  const { difficulty } = this.beatmap;
1814
1774
  return osuBase.calculateDroidDifficultyStatistics({
1815
1775
  circleSize: difficulty.cs,
1816
- approachRate: difficulty.ar ?? difficulty.od,
1776
+ approachRate: (_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od,
1817
1777
  overallDifficulty: difficulty.od,
1818
1778
  healthDrain: difficulty.hp,
1819
1779
  mods: this.mods,
1820
- customSpeedMultiplier: options?.customSpeedMultiplier,
1821
- oldStatistics: options?.oldStatistics,
1780
+ customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
1781
+ oldStatistics: options === null || options === void 0 ? void 0 : options.oldStatistics,
1822
1782
  });
1823
1783
  }
1824
1784
  createSkills() {
@@ -2010,44 +1970,43 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
2010
1970
  visualSkillWithSliders.countDifficultStrains();
2011
1971
  }
2012
1972
  }
1973
+ /**
1974
+ * The strain threshold to start detecting for possible three-fingered section.
1975
+ *
1976
+ * Increasing this number will result in less sections being flagged.
1977
+ */
1978
+ DroidDifficultyCalculator.threeFingerStrainThreshold = 175;
2013
1979
 
2014
1980
  /**
2015
1981
  * The base class of performance calculators.
2016
1982
  */
2017
1983
  class PerformanceCalculator {
2018
- /**
2019
- * The overall performance value.
2020
- */
2021
- total = 0;
2022
- /**
2023
- * The calculated accuracy.
2024
- */
2025
- computedAccuracy = new osuBase.Accuracy({});
2026
- /**
2027
- * The difficulty attributes that is being calculated.
2028
- */
2029
- difficultyAttributes;
2030
- /**
2031
- * Penalty for combo breaks.
2032
- */
2033
- comboPenalty = 0;
2034
- /**
2035
- * The amount of misses that are filtered out from sliderbreaks.
2036
- */
2037
- effectiveMissCount = 0;
2038
- /**
2039
- * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
2040
- */
2041
- sliderNerfFactor = 1;
2042
1984
  /**
2043
1985
  * @param difficultyAttributes The difficulty attributes to calculate.
2044
1986
  */
2045
1987
  constructor(difficultyAttributes) {
1988
+ /**
1989
+ * The overall performance value.
1990
+ */
1991
+ this.total = 0;
1992
+ /**
1993
+ * The calculated accuracy.
1994
+ */
1995
+ this.computedAccuracy = new osuBase.Accuracy({});
1996
+ /**
1997
+ * Penalty for combo breaks.
1998
+ */
1999
+ this.comboPenalty = 0;
2000
+ /**
2001
+ * The amount of misses that are filtered out from sliderbreaks.
2002
+ */
2003
+ this.effectiveMissCount = 0;
2004
+ /**
2005
+ * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
2006
+ */
2007
+ this.sliderNerfFactor = 1;
2046
2008
  if (this.isCacheableAttribute(difficultyAttributes)) {
2047
- this.difficultyAttributes = {
2048
- ...difficultyAttributes,
2049
- mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods),
2050
- };
2009
+ this.difficultyAttributes = Object.assign(Object.assign({}, difficultyAttributes), { mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods) });
2051
2010
  }
2052
2011
  else {
2053
2012
  this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
@@ -2093,11 +2052,12 @@ class PerformanceCalculator {
2093
2052
  * @param options Options for performance calculation.
2094
2053
  */
2095
2054
  handleOptions(options) {
2055
+ var _a;
2096
2056
  const maxCombo = this.difficultyAttributes.maxCombo;
2097
2057
  const miss = this.computedAccuracy.nmiss;
2098
- const combo = options?.combo ?? maxCombo - miss;
2058
+ const combo = (_a = options === null || options === void 0 ? void 0 : options.combo) !== null && _a !== void 0 ? _a : maxCombo - miss;
2099
2059
  this.comboPenalty = Math.min(Math.pow(combo / maxCombo, 0.8), 1);
2100
- if (options?.accPercent instanceof osuBase.Accuracy) {
2060
+ if ((options === null || options === void 0 ? void 0 : options.accPercent) instanceof osuBase.Accuracy) {
2101
2061
  // Copy into new instance to not modify the original
2102
2062
  this.computedAccuracy = new osuBase.Accuracy(options.accPercent);
2103
2063
  if (this.computedAccuracy.n300 <= 0) {
@@ -2112,9 +2072,9 @@ class PerformanceCalculator {
2112
2072
  }
2113
2073
  else {
2114
2074
  this.computedAccuracy = new osuBase.Accuracy({
2115
- percent: options?.accPercent,
2075
+ percent: options === null || options === void 0 ? void 0 : options.accPercent,
2116
2076
  nobjects: this.totalHits,
2117
- nmiss: options?.miss || 0,
2077
+ nmiss: (options === null || options === void 0 ? void 0 : options.miss) || 0,
2118
2078
  });
2119
2079
  }
2120
2080
  this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
@@ -2191,26 +2151,37 @@ class PerformanceCalculator {
2191
2151
  * A performance points calculator that calculates performance points for osu!droid gamemode.
2192
2152
  */
2193
2153
  class DroidPerformanceCalculator extends PerformanceCalculator {
2194
- /**
2195
- * The aim performance value.
2196
- */
2197
- aim = 0;
2198
- /**
2199
- * The tap performance value.
2200
- */
2201
- tap = 0;
2202
- /**
2203
- * The accuracy performance value.
2204
- */
2205
- accuracy = 0;
2206
- /**
2207
- * The flashlight performance value.
2208
- */
2209
- flashlight = 0;
2210
- /**
2211
- * The visual performance value.
2212
- */
2213
- visual = 0;
2154
+ constructor() {
2155
+ super(...arguments);
2156
+ /**
2157
+ * The aim performance value.
2158
+ */
2159
+ this.aim = 0;
2160
+ /**
2161
+ * The tap performance value.
2162
+ */
2163
+ this.tap = 0;
2164
+ /**
2165
+ * The accuracy performance value.
2166
+ */
2167
+ this.accuracy = 0;
2168
+ /**
2169
+ * The flashlight performance value.
2170
+ */
2171
+ this.flashlight = 0;
2172
+ /**
2173
+ * The visual performance value.
2174
+ */
2175
+ this.visual = 0;
2176
+ this.finalMultiplier = 1.24;
2177
+ this.mode = osuBase.Modes.droid;
2178
+ this._aimSliderCheesePenalty = 1;
2179
+ this._flashlightSliderCheesePenalty = 1;
2180
+ this._visualSliderCheesePenalty = 1;
2181
+ this._tapPenalty = 1;
2182
+ this._deviation = 0;
2183
+ this._tapDeviation = 0;
2184
+ }
2214
2185
  /**
2215
2186
  * The penalty used to penalize the tap performance value.
2216
2187
  *
@@ -2255,14 +2226,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2255
2226
  get visualSliderCheesePenalty() {
2256
2227
  return this._visualSliderCheesePenalty;
2257
2228
  }
2258
- finalMultiplier = 1.24;
2259
- mode = osuBase.Modes.droid;
2260
- _aimSliderCheesePenalty = 1;
2261
- _flashlightSliderCheesePenalty = 1;
2262
- _visualSliderCheesePenalty = 1;
2263
- _tapPenalty = 1;
2264
- _deviation = 0;
2265
- _tapDeviation = 0;
2266
2229
  /**
2267
2230
  * Applies a tap penalty value to this calculator.
2268
2231
  *
@@ -2361,12 +2324,13 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2361
2324
  Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier);
2362
2325
  }
2363
2326
  handleOptions(options) {
2364
- this._tapPenalty = options?.tapPenalty ?? 1;
2365
- this._aimSliderCheesePenalty = options?.aimSliderCheesePenalty ?? 1;
2327
+ var _a, _b, _c, _d;
2328
+ this._tapPenalty = (_a = options === null || options === void 0 ? void 0 : options.tapPenalty) !== null && _a !== void 0 ? _a : 1;
2329
+ this._aimSliderCheesePenalty = (_b = options === null || options === void 0 ? void 0 : options.aimSliderCheesePenalty) !== null && _b !== void 0 ? _b : 1;
2366
2330
  this._flashlightSliderCheesePenalty =
2367
- options?.flashlightSliderCheesePenalty ?? 1;
2331
+ (_c = options === null || options === void 0 ? void 0 : options.flashlightSliderCheesePenalty) !== null && _c !== void 0 ? _c : 1;
2368
2332
  this._visualSliderCheesePenalty =
2369
- options?.visualSliderCheesePenalty ?? 1;
2333
+ (_d = options === null || options === void 0 ? void 0 : options.visualSliderCheesePenalty) !== null && _d !== void 0 ? _d : 1;
2370
2334
  super.handleOptions(options);
2371
2335
  }
2372
2336
  /**
@@ -2722,16 +2686,13 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2722
2686
  * and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
2723
2687
  */
2724
2688
  class OsuSkill extends StrainSkill {
2725
- /**
2726
- * The default multiplier applied to the final difficulty value after all other calculations.
2727
- *
2728
- * May be overridden via {@link difficultyMultiplier}.
2729
- */
2730
- static defaultDifficultyMultiplier = 1.06;
2731
- /**
2732
- * The final multiplier to be applied to the final difficulty value after all other calculations.
2733
- */
2734
- difficultyMultiplier = OsuSkill.defaultDifficultyMultiplier;
2689
+ constructor() {
2690
+ super(...arguments);
2691
+ /**
2692
+ * The final multiplier to be applied to the final difficulty value after all other calculations.
2693
+ */
2694
+ this.difficultyMultiplier = OsuSkill.defaultDifficultyMultiplier;
2695
+ }
2735
2696
  difficultyValue() {
2736
2697
  const strains = this.strainPeaks
2737
2698
  .slice()
@@ -2759,6 +2720,12 @@ class OsuSkill extends StrainSkill {
2759
2720
  return difficulty * this.difficultyMultiplier;
2760
2721
  }
2761
2722
  }
2723
+ /**
2724
+ * The default multiplier applied to the final difficulty value after all other calculations.
2725
+ *
2726
+ * May be overridden via {@link difficultyMultiplier}.
2727
+ */
2728
+ OsuSkill.defaultDifficultyMultiplier = 1.06;
2762
2729
 
2763
2730
  /**
2764
2731
  * An evaluator for calculating osu!standard Aim skill.
@@ -2779,7 +2746,7 @@ class OsuAimEvaluator extends AimEvaluator {
2779
2746
  const last = current.previous(0);
2780
2747
  if (current.object instanceof osuBase.Spinner ||
2781
2748
  current.index <= 1 ||
2782
- last?.object instanceof osuBase.Spinner) {
2749
+ (last === null || last === void 0 ? void 0 : last.object) instanceof osuBase.Spinner) {
2783
2750
  return 0;
2784
2751
  }
2785
2752
  const lastLast = current.previous(1);
@@ -2886,15 +2853,14 @@ class OsuAimEvaluator extends AimEvaluator {
2886
2853
  * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
2887
2854
  */
2888
2855
  class OsuAim extends OsuSkill {
2889
- strainDecayBase = 0.15;
2890
- reducedSectionCount = 10;
2891
- reducedSectionBaseline = 0.75;
2892
- decayWeight = 0.9;
2893
- currentAimStrain = 0;
2894
- skillMultiplier = 23.55;
2895
- withSliders;
2896
2856
  constructor(mods, withSliders) {
2897
2857
  super(mods);
2858
+ this.strainDecayBase = 0.15;
2859
+ this.reducedSectionCount = 10;
2860
+ this.reducedSectionBaseline = 0.75;
2861
+ this.decayWeight = 0.9;
2862
+ this.currentAimStrain = 0;
2863
+ this.skillMultiplier = 23.55;
2898
2864
  this.withSliders = withSliders;
2899
2865
  }
2900
2866
  strainValueAt(current) {
@@ -2905,8 +2871,9 @@ class OsuAim extends OsuSkill {
2905
2871
  return this.currentAimStrain;
2906
2872
  }
2907
2873
  calculateInitialStrain(time, current) {
2874
+ var _a, _b;
2908
2875
  return (this.currentAimStrain *
2909
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
2876
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
2910
2877
  }
2911
2878
  /**
2912
2879
  * @param current The hitobject to save to.
@@ -2925,10 +2892,6 @@ class OsuAim extends OsuSkill {
2925
2892
  * An evaluator for calculating osu!standard speed skill.
2926
2893
  */
2927
2894
  class OsuSpeedEvaluator extends SpeedEvaluator {
2928
- /**
2929
- * Spacing threshold for a single hitobject spacing.
2930
- */
2931
- static SINGLE_SPACING_THRESHOLD = 125;
2932
2895
  /**
2933
2896
  * Evaluates the difficulty of tapping the current object, based on:
2934
2897
  *
@@ -2940,6 +2903,7 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
2940
2903
  * @param greatWindow The great hit window of the current object.
2941
2904
  */
2942
2905
  static evaluateDifficultyOf(current, greatWindow) {
2906
+ var _a;
2943
2907
  if (current.object instanceof osuBase.Spinner) {
2944
2908
  return 0;
2945
2909
  }
@@ -2965,7 +2929,7 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
2965
2929
  speedBonus +=
2966
2930
  0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
2967
2931
  }
2968
- const travelDistance = prev?.travelDistance ?? 0;
2932
+ const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
2969
2933
  const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
2970
2934
  return (((speedBonus +
2971
2935
  speedBonus *
@@ -2974,6 +2938,10 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
2974
2938
  strainTime);
2975
2939
  }
2976
2940
  }
2941
+ /**
2942
+ * Spacing threshold for a single hitobject spacing.
2943
+ */
2944
+ OsuSpeedEvaluator.SINGLE_SPACING_THRESHOLD = 125;
2977
2945
 
2978
2946
  /**
2979
2947
  * An evaluator for calculating osu!standard Rhythm skill.
@@ -3088,17 +3056,16 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
3088
3056
  * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
3089
3057
  */
3090
3058
  class OsuSpeed extends OsuSkill {
3091
- strainDecayBase = 0.3;
3092
- reducedSectionCount = 5;
3093
- reducedSectionBaseline = 0.75;
3094
- difficultyMultiplier = 1.04;
3095
- decayWeight = 0.9;
3096
- currentSpeedStrain = 0;
3097
- currentRhythm = 0;
3098
- skillMultiplier = 1375;
3099
- greatWindow;
3100
3059
  constructor(mods, overallDifficulty) {
3101
3060
  super(mods);
3061
+ this.strainDecayBase = 0.3;
3062
+ this.reducedSectionCount = 5;
3063
+ this.reducedSectionBaseline = 0.75;
3064
+ this.difficultyMultiplier = 1.04;
3065
+ this.decayWeight = 0.9;
3066
+ this.currentSpeedStrain = 0;
3067
+ this.currentRhythm = 0;
3068
+ this.skillMultiplier = 1375;
3102
3069
  this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
3103
3070
  }
3104
3071
  /**
@@ -3113,9 +3080,10 @@ class OsuSpeed extends OsuSkill {
3113
3080
  return this.currentSpeedStrain * this.currentRhythm;
3114
3081
  }
3115
3082
  calculateInitialStrain(time, current) {
3083
+ var _a, _b;
3116
3084
  return (this.currentSpeedStrain *
3117
3085
  this.currentRhythm *
3118
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
3086
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
3119
3087
  }
3120
3088
  /**
3121
3089
  * @param current The hitobject to save to.
@@ -3212,15 +3180,14 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
3212
3180
  * Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
3213
3181
  */
3214
3182
  class OsuFlashlight extends OsuSkill {
3215
- strainDecayBase = 0.15;
3216
- reducedSectionCount = 0;
3217
- reducedSectionBaseline = 1;
3218
- decayWeight = 1;
3219
- currentFlashlightStrain = 0;
3220
- skillMultiplier = 0.052;
3221
- isHidden;
3222
3183
  constructor(mods) {
3223
3184
  super(mods);
3185
+ this.strainDecayBase = 0.15;
3186
+ this.reducedSectionCount = 0;
3187
+ this.reducedSectionBaseline = 1;
3188
+ this.decayWeight = 1;
3189
+ this.currentFlashlightStrain = 0;
3190
+ this.skillMultiplier = 0.052;
3224
3191
  this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
3225
3192
  }
3226
3193
  strainValueAt(current) {
@@ -3230,8 +3197,9 @@ class OsuFlashlight extends OsuSkill {
3230
3197
  return this.currentFlashlightStrain;
3231
3198
  }
3232
3199
  calculateInitialStrain(time, current) {
3200
+ var _a, _b;
3233
3201
  return (this.currentFlashlightStrain *
3234
- this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
3202
+ this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
3235
3203
  }
3236
3204
  saveToHitObject(current) {
3237
3205
  current.flashlightStrain = this.currentFlashlightStrain;
@@ -3242,16 +3210,6 @@ class OsuFlashlight extends OsuSkill {
3242
3210
  * Represents an osu!standard hit object with difficulty calculation values.
3243
3211
  */
3244
3212
  class OsuDifficultyHitObject extends DifficultyHitObject {
3245
- /**
3246
- * The speed strain generated by the hitobject.
3247
- */
3248
- speedStrain = 0;
3249
- /**
3250
- * The flashlight strain generated by this hitobject.
3251
- */
3252
- flashlightStrain = 0;
3253
- radiusBuffThreshold = 30;
3254
- mode = osuBase.Modes.osu;
3255
3213
  get scalingFactor() {
3256
3214
  const radius = this.object.radius;
3257
3215
  // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
@@ -3275,6 +3233,16 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
3275
3233
  */
3276
3234
  constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
3277
3235
  super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
3236
+ /**
3237
+ * The speed strain generated by the hitobject.
3238
+ */
3239
+ this.speedStrain = 0;
3240
+ /**
3241
+ * The flashlight strain generated by this hitobject.
3242
+ */
3243
+ this.flashlightStrain = 0;
3244
+ this.radiusBuffThreshold = 30;
3245
+ this.mode = osuBase.Modes.osu;
3278
3246
  }
3279
3247
  }
3280
3248
 
@@ -3282,6 +3250,27 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
3282
3250
  * A difficulty calculator for osu!standard gamemode.
3283
3251
  */
3284
3252
  class OsuDifficultyCalculator extends DifficultyCalculator {
3253
+ constructor() {
3254
+ super(...arguments);
3255
+ this.attributes = {
3256
+ speedDifficulty: 0,
3257
+ mods: [],
3258
+ starRating: 0,
3259
+ maxCombo: 0,
3260
+ aimDifficulty: 0,
3261
+ flashlightDifficulty: 0,
3262
+ speedNoteCount: 0,
3263
+ sliderFactor: 0,
3264
+ clockRate: 1,
3265
+ approachRate: 0,
3266
+ overallDifficulty: 0,
3267
+ hitCircleCount: 0,
3268
+ sliderCount: 0,
3269
+ spinnerCount: 0,
3270
+ };
3271
+ this.difficultyMultiplier = 0.0675;
3272
+ this.mode = osuBase.Modes.osu;
3273
+ }
3285
3274
  /**
3286
3275
  * The aim star rating of the beatmap.
3287
3276
  */
@@ -3300,30 +3289,9 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
3300
3289
  get flashlight() {
3301
3290
  return this.attributes.flashlightDifficulty;
3302
3291
  }
3303
- attributes = {
3304
- speedDifficulty: 0,
3305
- mods: [],
3306
- starRating: 0,
3307
- maxCombo: 0,
3308
- aimDifficulty: 0,
3309
- flashlightDifficulty: 0,
3310
- speedNoteCount: 0,
3311
- sliderFactor: 0,
3312
- clockRate: 1,
3313
- approachRate: 0,
3314
- overallDifficulty: 0,
3315
- hitCircleCount: 0,
3316
- sliderCount: 0,
3317
- spinnerCount: 0,
3318
- };
3319
3292
  get cacheableAttributes() {
3320
- return {
3321
- ...this.attributes,
3322
- mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
3323
- };
3293
+ return Object.assign(Object.assign({}, this.attributes), { mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods) });
3324
3294
  }
3325
- difficultyMultiplier = 0.0675;
3326
- mode = osuBase.Modes.osu;
3327
3295
  /**
3328
3296
  * Calculates the aim star rating of the beatmap and stores it in this instance.
3329
3297
  */
@@ -3396,24 +3364,26 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
3396
3364
  " flashlight)");
3397
3365
  }
3398
3366
  generateDifficultyHitObjects(beatmap) {
3367
+ var _a, _b;
3399
3368
  const difficultyObjects = [];
3400
3369
  const { objects } = beatmap.hitObjects;
3401
3370
  for (let i = 0; i < objects.length; ++i) {
3402
- const difficultyObject = new OsuDifficultyHitObject(objects[i], objects[i - 1] ?? null, objects[i - 2] ?? null, difficultyObjects, this.difficultyStatistics.overallSpeedMultiplier);
3371
+ const difficultyObject = new OsuDifficultyHitObject(objects[i], (_a = objects[i - 1]) !== null && _a !== void 0 ? _a : null, (_b = objects[i - 2]) !== null && _b !== void 0 ? _b : null, difficultyObjects, this.difficultyStatistics.overallSpeedMultiplier);
3403
3372
  difficultyObject.computeProperties(this.difficultyStatistics.overallSpeedMultiplier, objects);
3404
3373
  difficultyObjects.push(difficultyObject);
3405
3374
  }
3406
3375
  return difficultyObjects;
3407
3376
  }
3408
3377
  computeDifficultyStatistics(options) {
3378
+ var _a;
3409
3379
  const { difficulty } = this.beatmap;
3410
3380
  return osuBase.calculateOsuDifficultyStatistics({
3411
3381
  circleSize: difficulty.cs,
3412
- approachRate: difficulty.ar ?? difficulty.od,
3382
+ approachRate: (_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od,
3413
3383
  overallDifficulty: difficulty.od,
3414
3384
  healthDrain: difficulty.hp,
3415
- mods: options?.mods,
3416
- customSpeedMultiplier: options?.customSpeedMultiplier,
3385
+ mods: options === null || options === void 0 ? void 0 : options.mods,
3386
+ customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
3417
3387
  });
3418
3388
  }
3419
3389
  createSkills() {
@@ -3489,24 +3459,27 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
3489
3459
  * A performance points calculator that calculates performance points for osu!standard gamemode.
3490
3460
  */
3491
3461
  class OsuPerformanceCalculator extends PerformanceCalculator {
3492
- /**
3493
- * The aim performance value.
3494
- */
3495
- aim = 0;
3496
- /**
3497
- * The speed performance value.
3498
- */
3499
- speed = 0;
3500
- /**
3501
- * The accuracy performance value.
3502
- */
3503
- accuracy = 0;
3504
- /**
3505
- * The flashlight performance value.
3506
- */
3507
- flashlight = 0;
3508
- finalMultiplier = 1.14;
3509
- mode = osuBase.Modes.osu;
3462
+ constructor() {
3463
+ super(...arguments);
3464
+ /**
3465
+ * The aim performance value.
3466
+ */
3467
+ this.aim = 0;
3468
+ /**
3469
+ * The speed performance value.
3470
+ */
3471
+ this.speed = 0;
3472
+ /**
3473
+ * The accuracy performance value.
3474
+ */
3475
+ this.accuracy = 0;
3476
+ /**
3477
+ * The flashlight performance value.
3478
+ */
3479
+ this.flashlight = 0;
3480
+ this.finalMultiplier = 1.14;
3481
+ this.mode = osuBase.Modes.osu;
3482
+ }
3510
3483
  calculateValues() {
3511
3484
  this.aim = this.calculateAimValue();
3512
3485
  this.speed = this.calculateSpeedValue();
@@ -3640,10 +3613,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3640
3613
  if (ncircles === 0) {
3641
3614
  return 0;
3642
3615
  }
3643
- const realAccuracy = new osuBase.Accuracy({
3644
- ...this.computedAccuracy,
3645
- n300: this.computedAccuracy.n300 - (this.totalHits - ncircles),
3646
- });
3616
+ const realAccuracy = new osuBase.Accuracy(Object.assign(Object.assign({}, this.computedAccuracy), { n300: this.computedAccuracy.n300 - (this.totalHits - ncircles) }));
3647
3617
  // Lots of arbitrary values from testing.
3648
3618
  // Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
3649
3619
  let accuracyValue = Math.pow(1.52163, this.difficultyAttributes.overallDifficulty) *