@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.24 → 4.0.0-beta.26
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 +512 -408
- package/package.json +3 -3
- package/typings/index.d.ts +104 -117
package/dist/index.js
CHANGED
|
@@ -32,6 +32,12 @@ AimEvaluator.velocityChangeMultiplier = 0.75;
|
|
|
32
32
|
* The base of a difficulty calculator.
|
|
33
33
|
*/
|
|
34
34
|
class DifficultyCalculator {
|
|
35
|
+
/**
|
|
36
|
+
* The difficulty objects of the beatmap.
|
|
37
|
+
*/
|
|
38
|
+
get objects() {
|
|
39
|
+
return this._objects;
|
|
40
|
+
}
|
|
35
41
|
/**
|
|
36
42
|
* The total star rating of the beatmap.
|
|
37
43
|
*/
|
|
@@ -41,14 +47,13 @@ class DifficultyCalculator {
|
|
|
41
47
|
/**
|
|
42
48
|
* Constructs a new instance of the calculator.
|
|
43
49
|
*
|
|
44
|
-
* @param beatmap The beatmap to calculate.
|
|
50
|
+
* @param beatmap The beatmap to calculate.
|
|
45
51
|
*/
|
|
46
52
|
constructor(beatmap) {
|
|
47
|
-
var _a;
|
|
48
53
|
/**
|
|
49
54
|
* The difficulty objects of the beatmap.
|
|
50
55
|
*/
|
|
51
|
-
this.
|
|
56
|
+
this._objects = [];
|
|
52
57
|
/**
|
|
53
58
|
* The modifications applied.
|
|
54
59
|
*/
|
|
@@ -63,13 +68,6 @@ class DifficultyCalculator {
|
|
|
63
68
|
flashlight: [],
|
|
64
69
|
};
|
|
65
70
|
this.beatmap = beatmap;
|
|
66
|
-
this.difficultyStatistics = {
|
|
67
|
-
circleSize: beatmap.difficulty.cs,
|
|
68
|
-
approachRate: (_a = beatmap.difficulty.ar) !== null && _a !== void 0 ? _a : beatmap.difficulty.od,
|
|
69
|
-
overallDifficulty: beatmap.difficulty.od,
|
|
70
|
-
healthDrain: beatmap.difficulty.hp,
|
|
71
|
-
overallSpeedMultiplier: 1,
|
|
72
|
-
};
|
|
73
71
|
}
|
|
74
72
|
/**
|
|
75
73
|
* Calculates the star rating of the specified beatmap.
|
|
@@ -87,16 +85,17 @@ class DifficultyCalculator {
|
|
|
87
85
|
* @returns The current instance.
|
|
88
86
|
*/
|
|
89
87
|
calculate(options) {
|
|
90
|
-
var _a;
|
|
88
|
+
var _a, _b;
|
|
91
89
|
this.mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
|
|
92
|
-
const
|
|
90
|
+
const playableBeatmap = this.beatmap.createPlayableBeatmap({
|
|
93
91
|
mode: this.mode,
|
|
94
92
|
mods: this.mods,
|
|
95
93
|
customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
|
|
96
94
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.
|
|
95
|
+
const clockRate = osuBase.ModUtil.calculateRateWithMods(this.mods) *
|
|
96
|
+
((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1);
|
|
97
|
+
this.populateDifficultyAttributes(playableBeatmap, clockRate);
|
|
98
|
+
this._objects = this.generateDifficultyHitObjects(playableBeatmap, clockRate);
|
|
100
99
|
this.calculateAll();
|
|
101
100
|
return this;
|
|
102
101
|
}
|
|
@@ -115,18 +114,27 @@ class DifficultyCalculator {
|
|
|
115
114
|
}
|
|
116
115
|
/**
|
|
117
116
|
* Populates the stored difficulty attributes with necessary data.
|
|
117
|
+
*
|
|
118
|
+
* @param beatmap The beatmap to populate the attributes with.
|
|
119
|
+
* @param clockRate The clock rate of the beatmap.
|
|
118
120
|
*/
|
|
119
|
-
populateDifficultyAttributes() {
|
|
120
|
-
this.attributes.approachRate = this.difficultyStatistics.approachRate;
|
|
121
|
+
populateDifficultyAttributes(beatmap, clockRate) {
|
|
121
122
|
this.attributes.hitCircleCount = this.beatmap.hitObjects.circles;
|
|
122
123
|
this.attributes.maxCombo = this.beatmap.maxCombo;
|
|
123
124
|
this.attributes.mods = this.mods.slice();
|
|
124
|
-
this.attributes.overallDifficulty =
|
|
125
|
-
this.difficultyStatistics.overallDifficulty;
|
|
126
125
|
this.attributes.sliderCount = this.beatmap.hitObjects.sliders;
|
|
127
126
|
this.attributes.spinnerCount = this.beatmap.hitObjects.spinners;
|
|
128
|
-
this.attributes.clockRate =
|
|
129
|
-
|
|
127
|
+
this.attributes.clockRate = clockRate;
|
|
128
|
+
let greatWindow;
|
|
129
|
+
switch (this.mode) {
|
|
130
|
+
case osuBase.Modes.droid:
|
|
131
|
+
greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(this.mods.some((m) => m instanceof osuBase.ModPrecise));
|
|
132
|
+
break;
|
|
133
|
+
case osuBase.Modes.osu:
|
|
134
|
+
greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300();
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
this.attributes.overallDifficulty = osuBase.OsuHitWindow.hitWindow300ToOD(greatWindow / clockRate);
|
|
130
138
|
}
|
|
131
139
|
/**
|
|
132
140
|
* Calculates the star rating value of a difficulty.
|
|
@@ -159,8 +167,9 @@ class DifficultyHitObject {
|
|
|
159
167
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
160
168
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
161
169
|
* @param clockRate The clock rate of the beatmap.
|
|
170
|
+
* @param greatWindow The great window of the hitobject.
|
|
162
171
|
*/
|
|
163
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
172
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow) {
|
|
164
173
|
/**
|
|
165
174
|
* The aim strain generated by the hitobject if sliders are considered.
|
|
166
175
|
*/
|
|
@@ -213,18 +222,18 @@ class DifficultyHitObject {
|
|
|
213
222
|
this.normalizedRadius = 50;
|
|
214
223
|
this.maximumSliderRadius = this.normalizedRadius * 2.4;
|
|
215
224
|
this.assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
216
|
-
this.minDeltaTime = 25;
|
|
217
225
|
this.object = object;
|
|
218
226
|
this.lastObject = lastObject;
|
|
219
227
|
this.lastLastObject = lastLastObject;
|
|
220
228
|
this.hitObjects = difficultyHitObjects;
|
|
229
|
+
this.fullGreatWindow = greatWindow * 2;
|
|
221
230
|
this.index = difficultyHitObjects.length - 1;
|
|
222
231
|
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
223
232
|
this.startTime = object.startTime / clockRate;
|
|
224
233
|
this.endTime = object.endTime / clockRate;
|
|
225
234
|
if (lastObject) {
|
|
226
235
|
this.deltaTime = this.startTime - lastObject.startTime / clockRate;
|
|
227
|
-
this.strainTime = Math.max(this.deltaTime,
|
|
236
|
+
this.strainTime = Math.max(this.deltaTime, DifficultyHitObject.minDeltaTime);
|
|
228
237
|
}
|
|
229
238
|
else {
|
|
230
239
|
this.deltaTime = 0;
|
|
@@ -295,6 +304,24 @@ class DifficultyHitObject {
|
|
|
295
304
|
}
|
|
296
305
|
return osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1);
|
|
297
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* How possible is it to doubletap this object together with the next one and get perfect
|
|
309
|
+
* judgement in range from 0 to 1.
|
|
310
|
+
*
|
|
311
|
+
* A value closer to 1 indicates a higher possibility.
|
|
312
|
+
*/
|
|
313
|
+
get doubletapness() {
|
|
314
|
+
const next = this.next(0);
|
|
315
|
+
if (!next) {
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
318
|
+
const currentDeltaTime = Math.max(1, this.deltaTime);
|
|
319
|
+
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
320
|
+
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
321
|
+
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
322
|
+
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / this.fullGreatWindow), 2);
|
|
323
|
+
return 1 - Math.pow(speedRatio, 1 - windowRatio);
|
|
324
|
+
}
|
|
298
325
|
setDistances(clockRate) {
|
|
299
326
|
if (this.object instanceof osuBase.Slider) {
|
|
300
327
|
this.calculateSliderCursorPosition(this.object);
|
|
@@ -306,7 +333,7 @@ class DifficultyHitObject {
|
|
|
306
333
|
else {
|
|
307
334
|
this.travelDistance *= Math.pow(1 + this.object.repeatCount / 2.5, 1 / 2.5);
|
|
308
335
|
}
|
|
309
|
-
this.travelTime = Math.max(this.object.lazyTravelTime / clockRate,
|
|
336
|
+
this.travelTime = Math.max(this.object.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
310
337
|
}
|
|
311
338
|
// We don't need to calculate either angle or distance when one of the last->curr objects is a spinner.
|
|
312
339
|
if (!this.lastObject ||
|
|
@@ -324,8 +351,8 @@ class DifficultyHitObject {
|
|
|
324
351
|
this.minimumJumpTime = this.strainTime;
|
|
325
352
|
this.minimumJumpDistance = this.lazyJumpDistance;
|
|
326
353
|
if (this.lastObject instanceof osuBase.Slider) {
|
|
327
|
-
const lastTravelTime = Math.max(this.lastObject.lazyTravelTime / clockRate,
|
|
328
|
-
this.minimumJumpTime = Math.max(this.strainTime - lastTravelTime,
|
|
354
|
+
const lastTravelTime = Math.max(this.lastObject.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
355
|
+
this.minimumJumpTime = Math.max(this.strainTime - lastTravelTime, DifficultyHitObject.minDeltaTime);
|
|
329
356
|
// There are two types of slider-to-object patterns to consider in order to better approximate the real movement a player will take to jump between the hitobjects.
|
|
330
357
|
//
|
|
331
358
|
// 1. The anti-flow pattern, where players cut the slider short in order to move to the next hitobject.
|
|
@@ -440,6 +467,10 @@ class DifficultyHitObject {
|
|
|
440
467
|
return pos;
|
|
441
468
|
}
|
|
442
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* The lowest possible delta time value.
|
|
472
|
+
*/
|
|
473
|
+
DifficultyHitObject.minDeltaTime = 25;
|
|
443
474
|
|
|
444
475
|
/**
|
|
445
476
|
* An evaluator for calculating osu!droid Aim skill.
|
|
@@ -604,10 +635,11 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
604
635
|
const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
|
|
605
636
|
let adjustedDistanceScale = 1;
|
|
606
637
|
// Reward for inconsistent angles while punishing consistent ones.
|
|
638
|
+
// Only apply the adjustment to patterns with the same delta time.
|
|
607
639
|
// Graph: https://www.desmos.com/calculator/soomupyfwp
|
|
608
640
|
if (current.angle !== null &&
|
|
609
641
|
typeof (prev === null || prev === void 0 ? void 0 : prev.angle) === "number" &&
|
|
610
|
-
current.
|
|
642
|
+
Math.abs(current.deltaTime - prev.deltaTime) < 10) {
|
|
611
643
|
const angleDiff = Math.abs(current.angle - prev.angle);
|
|
612
644
|
const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
|
|
613
645
|
const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
|
|
@@ -645,11 +677,19 @@ class StrainSkill extends Skill {
|
|
|
645
677
|
* Strain peaks are stored here.
|
|
646
678
|
*/
|
|
647
679
|
this.strainPeaks = [];
|
|
680
|
+
this._objectStrains = [];
|
|
681
|
+
this.difficulty = 0;
|
|
648
682
|
this.sectionLength = 400;
|
|
649
683
|
this.currentStrain = 0;
|
|
650
684
|
this.currentSectionPeak = 0;
|
|
651
685
|
this.currentSectionEnd = 0;
|
|
652
686
|
}
|
|
687
|
+
/**
|
|
688
|
+
* The strains of hitobjects.
|
|
689
|
+
*/
|
|
690
|
+
get objectStrains() {
|
|
691
|
+
return this._objectStrains;
|
|
692
|
+
}
|
|
653
693
|
process(current) {
|
|
654
694
|
// The first object doesn't generate a strain, so we begin with an incremented section end
|
|
655
695
|
if (current.index === 0) {
|
|
@@ -675,6 +715,21 @@ class StrainSkill extends Skill {
|
|
|
675
715
|
saveCurrentPeak() {
|
|
676
716
|
this.strainPeaks.push(this.currentSectionPeak);
|
|
677
717
|
}
|
|
718
|
+
/**
|
|
719
|
+
* Returns the number of strains weighed against the top strain.
|
|
720
|
+
*
|
|
721
|
+
* The result is scaled by clock rate as it affects the total number of strains.
|
|
722
|
+
*/
|
|
723
|
+
countDifficultStrains() {
|
|
724
|
+
if (this.difficulty === 0) {
|
|
725
|
+
return 0;
|
|
726
|
+
}
|
|
727
|
+
// This is what the top strain is if all strain values were identical.
|
|
728
|
+
const consistentTopStrain = this.difficulty / 10;
|
|
729
|
+
// Use a weighted sum of all strains.
|
|
730
|
+
return this._objectStrains.reduce((total, next) => total +
|
|
731
|
+
1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
|
|
732
|
+
}
|
|
678
733
|
/**
|
|
679
734
|
* Calculates strain decay for a specified time frame.
|
|
680
735
|
*
|
|
@@ -717,29 +772,6 @@ class DroidSkill extends StrainSkill {
|
|
|
717
772
|
* The minimum number of strains to judge when computing for retryability.
|
|
718
773
|
*/
|
|
719
774
|
this.minimumRetryabilityStrains = 500;
|
|
720
|
-
this._objectStrains = [];
|
|
721
|
-
this.difficulty = 0;
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* The strains of hitobjects.
|
|
725
|
-
*/
|
|
726
|
-
get objectStrains() {
|
|
727
|
-
return this._objectStrains;
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Returns the number of strains weighed against the top strain.
|
|
731
|
-
*
|
|
732
|
-
* The result is scaled by clock rate as it affects the total number of strains.
|
|
733
|
-
*/
|
|
734
|
-
countDifficultStrains() {
|
|
735
|
-
if (this.difficulty === 0) {
|
|
736
|
-
return 0;
|
|
737
|
-
}
|
|
738
|
-
// This is what the top strain is if all strain values were identical.
|
|
739
|
-
const consistentTopStrain = this.difficulty / 10;
|
|
740
|
-
// Use a weighted sum of all strains.
|
|
741
|
-
return this._objectStrains.reduce((total, next) => total +
|
|
742
|
-
1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
|
|
743
775
|
}
|
|
744
776
|
/**
|
|
745
777
|
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
@@ -862,31 +894,18 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
862
894
|
* - and the strain time cap.
|
|
863
895
|
*
|
|
864
896
|
* @param current The current object.
|
|
865
|
-
* @param greatWindow The great hit window of the current object.
|
|
866
897
|
* @param considerCheesability Whether to consider cheesability.
|
|
867
898
|
* @param strainTimeCap The strain time to cap the object's strain time to.
|
|
868
899
|
*/
|
|
869
|
-
static evaluateDifficultyOf(current,
|
|
900
|
+
static evaluateDifficultyOf(current, considerCheesability, strainTimeCap) {
|
|
870
901
|
if (current.object instanceof osuBase.Spinner ||
|
|
871
902
|
// Exclude overlapping objects that can be tapped at once.
|
|
872
903
|
current.isOverlapping(false)) {
|
|
873
904
|
return 0;
|
|
874
905
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
const next = current.next(0);
|
|
879
|
-
if (next) {
|
|
880
|
-
const greatWindowFull = greatWindow * 2;
|
|
881
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
882
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
883
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
884
|
-
const speedRatio = currentDeltaTime /
|
|
885
|
-
Math.max(currentDeltaTime, deltaDifference);
|
|
886
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
887
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
906
|
+
const doubletapness = considerCheesability
|
|
907
|
+
? 1 - current.doubletapness
|
|
908
|
+
: 1;
|
|
890
909
|
const strainTime = strainTimeCap !== undefined
|
|
891
910
|
? // We cap the strain time to 50 here as the chance of vibro is higher in any BPM higher than 300.
|
|
892
911
|
Math.max(50, strainTimeCap, current.strainTime)
|
|
@@ -911,7 +930,7 @@ class DroidTap extends DroidSkill {
|
|
|
911
930
|
get objectDeltaTimes() {
|
|
912
931
|
return this._objectDeltaTimes;
|
|
913
932
|
}
|
|
914
|
-
constructor(mods,
|
|
933
|
+
constructor(mods, considerCheesability, strainTimeCap) {
|
|
915
934
|
super(mods);
|
|
916
935
|
this.reducedSectionCount = 10;
|
|
917
936
|
this.reducedSectionBaseline = 0.75;
|
|
@@ -922,7 +941,6 @@ class DroidTap extends DroidSkill {
|
|
|
922
941
|
this.currentRhythmMultiplier = 0;
|
|
923
942
|
this.skillMultiplier = 1375;
|
|
924
943
|
this._objectDeltaTimes = [];
|
|
925
|
-
this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
926
944
|
this.considerCheesability = considerCheesability;
|
|
927
945
|
this.strainTimeCap = strainTimeCap;
|
|
928
946
|
}
|
|
@@ -961,7 +979,7 @@ class DroidTap extends DroidSkill {
|
|
|
961
979
|
strainValueAt(current) {
|
|
962
980
|
this.currentTapStrain *= this.strainDecay(current.strainTime);
|
|
963
981
|
this.currentTapStrain +=
|
|
964
|
-
DroidTapEvaluator.evaluateDifficultyOf(current, this.
|
|
982
|
+
DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability, this.strainTimeCap) * this.skillMultiplier;
|
|
965
983
|
this.currentRhythmMultiplier = current.rhythmMultiplier;
|
|
966
984
|
this._objectDeltaTimes.push(current.deltaTime);
|
|
967
985
|
return this.currentTapStrain * current.rhythmMultiplier;
|
|
@@ -1102,7 +1120,7 @@ class DroidFlashlight extends DroidSkill {
|
|
|
1102
1120
|
this.reducedSectionCount = 0;
|
|
1103
1121
|
this.reducedSectionBaseline = 1;
|
|
1104
1122
|
this.starsPerDouble = 1.06;
|
|
1105
|
-
this.skillMultiplier = 0.
|
|
1123
|
+
this.skillMultiplier = 0.02;
|
|
1106
1124
|
this.currentFlashlightStrain = 0;
|
|
1107
1125
|
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
1108
1126
|
this.withSliders = withSliders;
|
|
@@ -1131,45 +1149,62 @@ class DroidFlashlight extends DroidSkill {
|
|
|
1131
1149
|
}
|
|
1132
1150
|
}
|
|
1133
1151
|
difficultyValue() {
|
|
1134
|
-
return
|
|
1152
|
+
return (this.strainPeaks.reduce((a, v) => a + v, 0) * this.starsPerDouble);
|
|
1135
1153
|
}
|
|
1136
1154
|
}
|
|
1137
1155
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1156
|
+
let Island$1 = class Island {
|
|
1157
|
+
constructor(delta, deltaDifferenceEpsilon) {
|
|
1158
|
+
this.delta = Number.MAX_SAFE_INTEGER;
|
|
1159
|
+
this.deltaCount = 0;
|
|
1160
|
+
if (deltaDifferenceEpsilon === undefined) {
|
|
1161
|
+
this.deltaDifferenceEpsilon = delta;
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
this.deltaDifferenceEpsilon = deltaDifferenceEpsilon;
|
|
1165
|
+
this.addDelta(delta);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
addDelta(delta) {
|
|
1169
|
+
if (this.delta === Number.MAX_SAFE_INTEGER) {
|
|
1170
|
+
this.delta = Math.max(Math.trunc(delta), DifficultyHitObject.minDeltaTime);
|
|
1171
|
+
}
|
|
1172
|
+
++this.deltaCount;
|
|
1173
|
+
}
|
|
1174
|
+
isSimilarPolarity(other) {
|
|
1175
|
+
// TODO: consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple)
|
|
1176
|
+
// naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
|
|
1177
|
+
return this.deltaCount % 2 == other.deltaCount % 2;
|
|
1178
|
+
}
|
|
1179
|
+
equals(other) {
|
|
1180
|
+
return (Math.abs(this.delta - other.delta) < this.deltaDifferenceEpsilon &&
|
|
1181
|
+
this.deltaCount === other.deltaCount);
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1148
1184
|
/**
|
|
1149
1185
|
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1150
1186
|
*/
|
|
1151
|
-
class DroidRhythmEvaluator
|
|
1187
|
+
class DroidRhythmEvaluator {
|
|
1152
1188
|
/**
|
|
1153
1189
|
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
1154
1190
|
* with historic data of the current object.
|
|
1155
1191
|
*
|
|
1156
1192
|
* @param current The current object.
|
|
1157
|
-
* @param greatWindow The great hit window of the current object.
|
|
1158
1193
|
*/
|
|
1159
|
-
static evaluateDifficultyOf(current
|
|
1160
|
-
if (current.object instanceof osuBase.Spinner
|
|
1161
|
-
// Exclude overlapping objects that can be tapped at once.
|
|
1162
|
-
current.isOverlapping(false)) {
|
|
1194
|
+
static evaluateDifficultyOf(current) {
|
|
1195
|
+
if (current.object instanceof osuBase.Spinner) {
|
|
1163
1196
|
return 1;
|
|
1164
1197
|
}
|
|
1165
|
-
|
|
1198
|
+
const deltaDifferenceEpsilon = current.fullGreatWindow * 0.3;
|
|
1166
1199
|
let rhythmComplexitySum = 0;
|
|
1167
|
-
let
|
|
1200
|
+
let island = new Island$1(deltaDifferenceEpsilon);
|
|
1201
|
+
let previousIsland = new Island$1(deltaDifferenceEpsilon);
|
|
1202
|
+
const islandCounts = new Map();
|
|
1168
1203
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
1169
1204
|
let startRatio = 0;
|
|
1170
1205
|
let firstDeltaSwitch = false;
|
|
1171
1206
|
let rhythmStart = 0;
|
|
1172
|
-
const historicalNoteCount = Math.min(current.index,
|
|
1207
|
+
const historicalNoteCount = Math.min(current.index, this.historyObjectsMax);
|
|
1173
1208
|
// Exclude overlapping objects that can be tapped at once.
|
|
1174
1209
|
const validPrevious = [];
|
|
1175
1210
|
for (let i = 0; i < historicalNoteCount; ++i) {
|
|
@@ -1187,111 +1222,140 @@ class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
|
1187
1222
|
++rhythmStart;
|
|
1188
1223
|
}
|
|
1189
1224
|
for (let i = rhythmStart; i > 0; --i) {
|
|
1225
|
+
const currentObject = validPrevious[i - 1];
|
|
1226
|
+
const prevObject = validPrevious[i];
|
|
1227
|
+
const lastObject = validPrevious[i + 1];
|
|
1190
1228
|
// Scale note 0 to 1 from history to now.
|
|
1191
|
-
|
|
1192
|
-
(current.startTime -
|
|
1229
|
+
const timeDecay = (this.historyTimeMax -
|
|
1230
|
+
(current.startTime - currentObject.startTime)) /
|
|
1193
1231
|
this.historyTimeMax;
|
|
1232
|
+
const noteDecay = (validPrevious.length - i) / validPrevious.length;
|
|
1194
1233
|
// Either we're limited by time or limited by object count.
|
|
1195
|
-
currentHistoricalDecay = Math.min(
|
|
1196
|
-
const currentDelta =
|
|
1197
|
-
const prevDelta =
|
|
1198
|
-
const lastDelta =
|
|
1234
|
+
const currentHistoricalDecay = Math.min(timeDecay, noteDecay);
|
|
1235
|
+
const currentDelta = currentObject.strainTime;
|
|
1236
|
+
const prevDelta = prevObject.strainTime;
|
|
1237
|
+
const lastDelta = lastObject.strainTime;
|
|
1238
|
+
// Calculate how much current delta difference deserves a rhythm bonus
|
|
1239
|
+
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200)
|
|
1240
|
+
const deltaDifferenceRatio = Math.min(prevDelta, currentDelta) /
|
|
1241
|
+
Math.max(prevDelta, currentDelta);
|
|
1199
1242
|
const currentRatio = 1 +
|
|
1200
|
-
|
|
1201
|
-
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1206
|
-
let effectiveRatio = windowPenalty * currentRatio;
|
|
1243
|
+
this.rhythmRatioMultiplier *
|
|
1244
|
+
Math.min(0.5, Math.pow(Math.sin(Math.PI / deltaDifferenceRatio), 2));
|
|
1245
|
+
// Reduce ratio bonus if delta difference is too big
|
|
1246
|
+
const fraction = Math.max(prevDelta / currentDelta, currentDelta / prevDelta);
|
|
1247
|
+
const fractionMultiplier = osuBase.MathUtils.clamp(2 - fraction / 8, 0, 1);
|
|
1248
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon);
|
|
1249
|
+
let effectiveRatio = windowPenalty * currentRatio * fractionMultiplier;
|
|
1207
1250
|
if (firstDeltaSwitch) {
|
|
1208
|
-
if (prevDelta
|
|
1209
|
-
prevDelta * 1.25 >= currentDelta) {
|
|
1251
|
+
if (Math.abs(prevDelta - currentDelta) < deltaDifferenceEpsilon) {
|
|
1210
1252
|
// Island is still progressing, count size.
|
|
1211
|
-
|
|
1212
|
-
++islandSize;
|
|
1213
|
-
}
|
|
1253
|
+
island.addDelta(currentDelta);
|
|
1214
1254
|
}
|
|
1215
1255
|
else {
|
|
1216
|
-
|
|
1217
|
-
|
|
1256
|
+
// BPM change is into slider, this is easy acc window.
|
|
1257
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
1218
1258
|
effectiveRatio /= 8;
|
|
1219
1259
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
// Repeated island size (ex: triplet -> triplet).
|
|
1226
|
-
effectiveRatio /= 4;
|
|
1260
|
+
// BPM change was from a slider, this is easier typically than circle -> circle.
|
|
1261
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
1262
|
+
// than bursts without sliders.
|
|
1263
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1264
|
+
effectiveRatio *= 0.3;
|
|
1227
1265
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1266
|
+
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
1267
|
+
if (island.isSimilarPolarity(previousIsland)) {
|
|
1230
1268
|
effectiveRatio /= 2;
|
|
1231
1269
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1270
|
+
// Previous increase happened a note ago.
|
|
1271
|
+
// Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
|
|
1272
|
+
if (lastDelta > prevDelta + deltaDifferenceEpsilon &&
|
|
1273
|
+
prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
1236
1274
|
effectiveRatio /= 8;
|
|
1237
1275
|
}
|
|
1276
|
+
// Repeated island size (ex: triplet -> triplet).
|
|
1277
|
+
// TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation
|
|
1278
|
+
if (previousIsland.deltaCount == island.deltaCount) {
|
|
1279
|
+
effectiveRatio /= 2;
|
|
1280
|
+
}
|
|
1281
|
+
let islandFound = false;
|
|
1282
|
+
for (const [currentIsland, count] of islandCounts) {
|
|
1283
|
+
if (!island.equals(currentIsland)) {
|
|
1284
|
+
continue;
|
|
1285
|
+
}
|
|
1286
|
+
islandFound = true;
|
|
1287
|
+
let islandCount = count;
|
|
1288
|
+
if (previousIsland.equals(island)) {
|
|
1289
|
+
// Only add island to island counts if they're going one after another.
|
|
1290
|
+
++islandCount;
|
|
1291
|
+
islandCounts.set(currentIsland, islandCount);
|
|
1292
|
+
}
|
|
1293
|
+
// Repeated island (ex: triplet -> triplet).
|
|
1294
|
+
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
1295
|
+
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount, 2.75 / (1 + Math.exp(14 - 0.24 * island.delta))));
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
if (!islandFound) {
|
|
1299
|
+
islandCounts.set(island, 1);
|
|
1300
|
+
}
|
|
1301
|
+
// Scale down the difficulty if the object is doubletappable.
|
|
1302
|
+
effectiveRatio *= 1 - prevObject.doubletapness * 0.75;
|
|
1238
1303
|
rhythmComplexitySum +=
|
|
1239
|
-
|
|
1240
|
-
currentHistoricalDecay
|
|
1241
|
-
Math.sqrt(4 + islandSize)) /
|
|
1242
|
-
2) *
|
|
1243
|
-
Math.sqrt(4 + previousIslandSize)) /
|
|
1244
|
-
2;
|
|
1304
|
+
Math.sqrt(effectiveRatio * startRatio) *
|
|
1305
|
+
currentHistoricalDecay;
|
|
1245
1306
|
startRatio = effectiveRatio;
|
|
1246
|
-
|
|
1247
|
-
if (prevDelta
|
|
1307
|
+
previousIsland = island;
|
|
1308
|
+
if (prevDelta + deltaDifferenceEpsilon < currentDelta) {
|
|
1248
1309
|
// We're slowing down, stop counting.
|
|
1249
1310
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
1250
1311
|
firstDeltaSwitch = false;
|
|
1251
1312
|
}
|
|
1252
|
-
|
|
1313
|
+
island = new Island$1(currentDelta, deltaDifferenceEpsilon);
|
|
1253
1314
|
}
|
|
1254
1315
|
}
|
|
1255
|
-
else if (prevDelta >
|
|
1256
|
-
// We
|
|
1316
|
+
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
1317
|
+
// We are speeding up.
|
|
1257
1318
|
// Begin counting island until we change speed again.
|
|
1258
1319
|
firstDeltaSwitch = true;
|
|
1320
|
+
// BPM change is into slider, this is easy acc window.
|
|
1321
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
1322
|
+
effectiveRatio *= 0.6;
|
|
1323
|
+
}
|
|
1324
|
+
// BPM change was from a slider, this is easier typically than circle -> circle
|
|
1325
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
1326
|
+
// than bursts without sliders
|
|
1327
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1328
|
+
effectiveRatio *= 0.6;
|
|
1329
|
+
}
|
|
1259
1330
|
startRatio = effectiveRatio;
|
|
1260
|
-
|
|
1331
|
+
island = new Island$1(currentDelta, deltaDifferenceEpsilon);
|
|
1261
1332
|
}
|
|
1262
1333
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
let doubletapness = 1;
|
|
1266
|
-
if (next) {
|
|
1267
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
1268
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
1269
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
1270
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
1271
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / (greatWindow * 2)), 2);
|
|
1272
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1273
|
-
}
|
|
1274
|
-
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier * doubletapness) / 2);
|
|
1334
|
+
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmOverallMultiplier) /
|
|
1335
|
+
2);
|
|
1275
1336
|
}
|
|
1276
1337
|
}
|
|
1338
|
+
DroidRhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
1339
|
+
DroidRhythmEvaluator.historyObjectsMax = 32;
|
|
1340
|
+
DroidRhythmEvaluator.rhythmOverallMultiplier = 0.95;
|
|
1341
|
+
DroidRhythmEvaluator.rhythmRatioMultiplier = 12;
|
|
1277
1342
|
|
|
1278
1343
|
/**
|
|
1279
1344
|
* Represents the skill required to properly follow a beatmap's rhythm.
|
|
1280
1345
|
*/
|
|
1281
1346
|
class DroidRhythm extends DroidSkill {
|
|
1282
|
-
constructor(
|
|
1283
|
-
super(
|
|
1347
|
+
constructor() {
|
|
1348
|
+
super(...arguments);
|
|
1284
1349
|
this.reducedSectionCount = 5;
|
|
1285
1350
|
this.reducedSectionBaseline = 0.75;
|
|
1286
1351
|
this.strainDecayBase = 0.3;
|
|
1287
1352
|
this.starsPerDouble = 1.75;
|
|
1288
1353
|
this.currentRhythmStrain = 0;
|
|
1289
1354
|
this.currentRhythmMultiplier = 1;
|
|
1290
|
-
this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
|
|
1291
1355
|
}
|
|
1292
1356
|
strainValueAt(current) {
|
|
1293
1357
|
this.currentRhythmMultiplier =
|
|
1294
|
-
DroidRhythmEvaluator.evaluateDifficultyOf(current
|
|
1358
|
+
DroidRhythmEvaluator.evaluateDifficultyOf(current);
|
|
1295
1359
|
this.currentRhythmStrain *= this.strainDecay(current.deltaTime);
|
|
1296
1360
|
this.currentRhythmStrain += this.currentRhythmMultiplier - 1;
|
|
1297
1361
|
return this.currentRhythmStrain;
|
|
@@ -1475,10 +1539,10 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1475
1539
|
* @param lastLastObject The hitobject before the last hitobject.
|
|
1476
1540
|
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1477
1541
|
* @param clockRate The clock rate of the beatmap.
|
|
1478
|
-
* @param
|
|
1542
|
+
* @param greatWindow The great window of the hitobject.
|
|
1479
1543
|
*/
|
|
1480
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate,
|
|
1481
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
1544
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow) {
|
|
1545
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow);
|
|
1482
1546
|
/**
|
|
1483
1547
|
* The tap strain generated by the hitobject.
|
|
1484
1548
|
*/
|
|
@@ -1521,10 +1585,7 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1521
1585
|
this.radiusBuffThreshold = 70;
|
|
1522
1586
|
this.mode = osuBase.Modes.droid;
|
|
1523
1587
|
this.maximumSliderRadius = this.normalizedRadius * 2;
|
|
1524
|
-
this.timePreempt = object.timePreempt;
|
|
1525
|
-
if (!isForceAR) {
|
|
1526
|
-
this.timePreempt /= clockRate;
|
|
1527
|
-
}
|
|
1588
|
+
this.timePreempt = object.timePreempt / clockRate;
|
|
1528
1589
|
}
|
|
1529
1590
|
computeProperties(clockRate, hitObjects) {
|
|
1530
1591
|
super.computeProperties(clockRate, hitObjects);
|
|
@@ -1536,6 +1597,9 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1536
1597
|
* Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
|
|
1537
1598
|
* can be hit with just a single tap in osu!droid.
|
|
1538
1599
|
*
|
|
1600
|
+
* In the case of sliders, it is considered overlapping if all nested hitobjects can be hit with
|
|
1601
|
+
* one aim motion.
|
|
1602
|
+
*
|
|
1539
1603
|
* @param considerDistance Whether to consider the distance between both hitobjects.
|
|
1540
1604
|
* @returns Whether the hitobject is considered overlapping.
|
|
1541
1605
|
*/
|
|
@@ -1543,23 +1607,48 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1543
1607
|
if (this.object instanceof osuBase.Spinner) {
|
|
1544
1608
|
return false;
|
|
1545
1609
|
}
|
|
1546
|
-
const
|
|
1547
|
-
if (!
|
|
1610
|
+
const prev = this.previous(0);
|
|
1611
|
+
if (!prev || prev.object instanceof osuBase.Spinner) {
|
|
1612
|
+
return false;
|
|
1613
|
+
}
|
|
1614
|
+
if (this.object.startTime !== prev.object.startTime) {
|
|
1548
1615
|
return false;
|
|
1549
1616
|
}
|
|
1550
|
-
if (
|
|
1617
|
+
if (!considerDistance) {
|
|
1618
|
+
return true;
|
|
1619
|
+
}
|
|
1620
|
+
const distanceThreshold = 2 * this.object.radius;
|
|
1621
|
+
const startPosition = this.object.getStackedPosition(osuBase.Modes.droid);
|
|
1622
|
+
const prevStartPosition = prev.object.getStackedPosition(osuBase.Modes.droid);
|
|
1623
|
+
// We need to consider two cases:
|
|
1624
|
+
//
|
|
1625
|
+
// Case 1: Current object is a circle, or previous object is a circle.
|
|
1626
|
+
// In this case, we only need to check if their positions are close enough to be tapped together.
|
|
1627
|
+
//
|
|
1628
|
+
// Case 2: Both objects are sliders.
|
|
1629
|
+
// In this case, we need to check if all nested hitobjects can be hit together.
|
|
1630
|
+
// To start with, check if the starting positions can be tapped together.
|
|
1631
|
+
if (startPosition.getDistance(prevStartPosition) > distanceThreshold) {
|
|
1551
1632
|
return false;
|
|
1552
1633
|
}
|
|
1553
|
-
if (
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1634
|
+
if (this.object instanceof osuBase.Circle || prev.object instanceof osuBase.Circle) {
|
|
1635
|
+
return true;
|
|
1636
|
+
}
|
|
1637
|
+
// Check if all nested hitobjects can be hit together.
|
|
1638
|
+
for (let i = 1; i < this.object.nestedHitObjects.length; ++i) {
|
|
1639
|
+
const position = this.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1640
|
+
const prevPosition = prevStartPosition.add(prev.object.curvePositionAt(i / (this.object.nestedHitObjects.length - 1)));
|
|
1641
|
+
if (position.getDistance(prevPosition) > distanceThreshold) {
|
|
1642
|
+
return false;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
// Do the same for the previous slider as well.
|
|
1646
|
+
for (let i = 1; i < prev.object.nestedHitObjects.length; ++i) {
|
|
1647
|
+
const prevPosition = prev.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1648
|
+
const position = startPosition.add(this.object.curvePositionAt(i / (prev.object.nestedHitObjects.length - 1)));
|
|
1649
|
+
if (prevPosition.getDistance(position) > distanceThreshold) {
|
|
1650
|
+
return false;
|
|
1561
1651
|
}
|
|
1562
|
-
return distance <= 2 * this.object.radius;
|
|
1563
1652
|
}
|
|
1564
1653
|
return true;
|
|
1565
1654
|
}
|
|
@@ -1617,7 +1706,9 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
|
1617
1706
|
Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
|
|
1618
1707
|
(7.5 /
|
|
1619
1708
|
(1 +
|
|
1620
|
-
Math.exp(0.15 *
|
|
1709
|
+
Math.exp(0.15 *
|
|
1710
|
+
(Math.max(deltaTime, DifficultyHitObject.minDeltaTime) -
|
|
1711
|
+
75))));
|
|
1621
1712
|
}
|
|
1622
1713
|
}
|
|
1623
1714
|
|
|
@@ -1641,7 +1732,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1641
1732
|
speedNoteCount: 0,
|
|
1642
1733
|
sliderFactor: 0,
|
|
1643
1734
|
clockRate: 1,
|
|
1644
|
-
approachRate: 0,
|
|
1645
1735
|
overallDifficulty: 0,
|
|
1646
1736
|
hitCircleCount: 0,
|
|
1647
1737
|
sliderCount: 0,
|
|
@@ -1691,30 +1781,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1691
1781
|
return this.attributes.visualDifficulty;
|
|
1692
1782
|
}
|
|
1693
1783
|
get cacheableAttributes() {
|
|
1694
|
-
return {
|
|
1695
|
-
tapDifficulty: this.tap,
|
|
1696
|
-
rhythmDifficulty: this.rhythm,
|
|
1697
|
-
visualDifficulty: this.visual,
|
|
1698
|
-
mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
|
|
1699
|
-
starRating: this.total,
|
|
1700
|
-
maxCombo: this.attributes.maxCombo,
|
|
1701
|
-
aimDifficulty: this.aim,
|
|
1702
|
-
flashlightDifficulty: this.flashlight,
|
|
1703
|
-
speedNoteCount: this.attributes.speedNoteCount,
|
|
1704
|
-
sliderFactor: this.attributes.sliderFactor,
|
|
1705
|
-
clockRate: this.attributes.clockRate,
|
|
1706
|
-
approachRate: this.attributes.approachRate,
|
|
1707
|
-
overallDifficulty: this.attributes.overallDifficulty,
|
|
1708
|
-
hitCircleCount: this.attributes.hitCircleCount,
|
|
1709
|
-
sliderCount: this.attributes.sliderCount,
|
|
1710
|
-
spinnerCount: this.attributes.spinnerCount,
|
|
1711
|
-
aimDifficultStrainCount: this.attributes.aimDifficultStrainCount,
|
|
1712
|
-
tapDifficultStrainCount: this.attributes.tapDifficultStrainCount,
|
|
1713
|
-
flashlightDifficultStrainCount: this.attributes.flashlightDifficultStrainCount,
|
|
1714
|
-
visualDifficultStrainCount: this.attributes.visualDifficultStrainCount,
|
|
1715
|
-
averageSpeedDeltaTime: this.attributes.averageSpeedDeltaTime,
|
|
1716
|
-
vibroFactor: this.attributes.vibroFactor,
|
|
1717
|
-
};
|
|
1784
|
+
return Object.assign(Object.assign({}, this.attributes), { mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods) });
|
|
1718
1785
|
}
|
|
1719
1786
|
/**
|
|
1720
1787
|
* Calculates the aim star rating of the beatmap and stores it in this instance.
|
|
@@ -1729,11 +1796,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1729
1796
|
* Calculates the tap star rating of the beatmap and stores it in this instance.
|
|
1730
1797
|
*/
|
|
1731
1798
|
calculateTap() {
|
|
1732
|
-
const
|
|
1733
|
-
const
|
|
1734
|
-
const tapSkillNoCheese = new DroidTap(this.mods, od, false);
|
|
1799
|
+
const tapSkillCheese = new DroidTap(this.mods, true);
|
|
1800
|
+
const tapSkillNoCheese = new DroidTap(this.mods, false);
|
|
1735
1801
|
this.calculateSkills(tapSkillCheese, tapSkillNoCheese);
|
|
1736
|
-
const tapSkillVibro = new DroidTap(this.mods,
|
|
1802
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1737
1803
|
this.calculateSkills(tapSkillVibro);
|
|
1738
1804
|
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
1739
1805
|
}
|
|
@@ -1741,7 +1807,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1741
1807
|
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
1742
1808
|
*/
|
|
1743
1809
|
calculateRhythm() {
|
|
1744
|
-
const rhythmSkill = new DroidRhythm(this.mods
|
|
1810
|
+
const rhythmSkill = new DroidRhythm(this.mods);
|
|
1745
1811
|
this.calculateSkills(rhythmSkill);
|
|
1746
1812
|
this.postCalculateRhythm(rhythmSkill);
|
|
1747
1813
|
}
|
|
@@ -1801,7 +1867,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1801
1867
|
const flashlightSkillWithoutSliders = skills[6];
|
|
1802
1868
|
const visualSkill = skills[7];
|
|
1803
1869
|
const visualSkillWithoutSliders = skills[8];
|
|
1804
|
-
const tapSkillVibro = new DroidTap(this.mods,
|
|
1870
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1805
1871
|
this.calculateSkills(tapSkillVibro);
|
|
1806
1872
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1807
1873
|
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
@@ -1824,42 +1890,29 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1824
1890
|
this.visual.toFixed(2) +
|
|
1825
1891
|
" visual)");
|
|
1826
1892
|
}
|
|
1827
|
-
generateDifficultyHitObjects(
|
|
1893
|
+
generateDifficultyHitObjects(beatmap, clockRate) {
|
|
1828
1894
|
var _a, _b;
|
|
1829
1895
|
const difficultyObjects = [];
|
|
1830
|
-
const { objects } =
|
|
1831
|
-
const
|
|
1896
|
+
const { objects } = beatmap.hitObjects;
|
|
1897
|
+
const isPrecise = this.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
1898
|
+
const greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(isPrecise) / clockRate;
|
|
1832
1899
|
for (let i = 0; i < objects.length; ++i) {
|
|
1833
|
-
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,
|
|
1834
|
-
difficultyObject.computeProperties(
|
|
1900
|
+
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, clockRate, greatWindow);
|
|
1901
|
+
difficultyObject.computeProperties(clockRate, objects);
|
|
1835
1902
|
difficultyObjects.push(difficultyObject);
|
|
1836
1903
|
}
|
|
1837
1904
|
return difficultyObjects;
|
|
1838
1905
|
}
|
|
1839
|
-
computeDifficultyStatistics(options) {
|
|
1840
|
-
var _a;
|
|
1841
|
-
const { difficulty } = this.beatmap;
|
|
1842
|
-
return osuBase.calculateDroidDifficultyStatistics({
|
|
1843
|
-
circleSize: difficulty.cs,
|
|
1844
|
-
approachRate: (_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od,
|
|
1845
|
-
overallDifficulty: difficulty.od,
|
|
1846
|
-
healthDrain: difficulty.hp,
|
|
1847
|
-
mods: this.mods,
|
|
1848
|
-
customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
|
|
1849
|
-
oldStatistics: options === null || options === void 0 ? void 0 : options.oldStatistics,
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
1906
|
createSkills() {
|
|
1853
|
-
const od = this.difficultyStatistics.overallDifficulty;
|
|
1854
1907
|
return [
|
|
1855
1908
|
new DroidAim(this.mods, true),
|
|
1856
1909
|
new DroidAim(this.mods, false),
|
|
1857
1910
|
// Tap skill depends on rhythm skill, so we put it first
|
|
1858
|
-
new DroidRhythm(this.mods
|
|
1911
|
+
new DroidRhythm(this.mods),
|
|
1859
1912
|
// Cheesability tap
|
|
1860
|
-
new DroidTap(this.mods,
|
|
1913
|
+
new DroidTap(this.mods, true),
|
|
1861
1914
|
// Non-cheesability tap
|
|
1862
|
-
new DroidTap(this.mods,
|
|
1915
|
+
new DroidTap(this.mods, false),
|
|
1863
1916
|
new DroidFlashlight(this.mods, true),
|
|
1864
1917
|
new DroidFlashlight(this.mods, false),
|
|
1865
1918
|
new DroidVisual(this.mods, true),
|
|
@@ -1876,8 +1929,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1876
1929
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
1877
1930
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
1878
1931
|
const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
|
|
1879
|
-
this.attributes.aimDifficulty =
|
|
1880
|
-
|
|
1932
|
+
this.attributes.aimDifficulty = this.mods.some((m) => m instanceof osuBase.ModAutopilot)
|
|
1933
|
+
? 0
|
|
1934
|
+
: this.starValue(aimSkill.difficultyValue()) * retryabilityScaling;
|
|
1881
1935
|
if (this.aim) {
|
|
1882
1936
|
this.attributes.sliderFactor =
|
|
1883
1937
|
(this.starValue(aimSkillWithoutSliders.difficultyValue()) *
|
|
@@ -1895,6 +1949,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1895
1949
|
* Calculates aim-related attributes.
|
|
1896
1950
|
*/
|
|
1897
1951
|
calculateAimAttributes() {
|
|
1952
|
+
this.attributes.difficultSliders = [];
|
|
1898
1953
|
const topDifficultSliders = [];
|
|
1899
1954
|
for (let i = 0; i < this.objects.length; ++i) {
|
|
1900
1955
|
const object = this.objects[i];
|
|
@@ -2019,10 +2074,12 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2019
2074
|
this.attributes.flashlightSliderFactor =
|
|
2020
2075
|
this.starValue(flashlightSkillWithoutSliders.difficultyValue()) / this.flashlight;
|
|
2021
2076
|
}
|
|
2077
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2078
|
+
this.attributes.flashlightDifficulty *= 0.3;
|
|
2079
|
+
}
|
|
2022
2080
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
2023
2081
|
this.attributes.flashlightDifficulty *= 0.7;
|
|
2024
2082
|
}
|
|
2025
|
-
this.attributes.flashlightDifficulty = this.flashlight;
|
|
2026
2083
|
this.attributes.flashlightDifficultStrainCount =
|
|
2027
2084
|
flashlightSkill.countDifficultStrains();
|
|
2028
2085
|
}
|
|
@@ -2041,6 +2098,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
2041
2098
|
this.starValue(visualSkillWithoutSliders.difficultyValue()) /
|
|
2042
2099
|
this.visual;
|
|
2043
2100
|
}
|
|
2101
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2102
|
+
this.attributes.visualDifficulty *= 0.8;
|
|
2103
|
+
}
|
|
2044
2104
|
this.attributes.visualDifficultStrainCount =
|
|
2045
2105
|
visualSkillWithSliders.countDifficultStrains();
|
|
2046
2106
|
}
|
|
@@ -2071,10 +2131,6 @@ class PerformanceCalculator {
|
|
|
2071
2131
|
* The calculated accuracy.
|
|
2072
2132
|
*/
|
|
2073
2133
|
this.computedAccuracy = new osuBase.Accuracy({});
|
|
2074
|
-
/**
|
|
2075
|
-
* Penalty for combo breaks.
|
|
2076
|
-
*/
|
|
2077
|
-
this.comboPenalty = 0;
|
|
2078
2134
|
/**
|
|
2079
2135
|
* The amount of misses that are filtered out from sliderbreaks.
|
|
2080
2136
|
*/
|
|
@@ -2134,7 +2190,6 @@ class PerformanceCalculator {
|
|
|
2134
2190
|
const maxCombo = this.difficultyAttributes.maxCombo;
|
|
2135
2191
|
const miss = this.computedAccuracy.nmiss;
|
|
2136
2192
|
const combo = (_a = options === null || options === void 0 ? void 0 : options.combo) !== null && _a !== void 0 ? _a : maxCombo - miss;
|
|
2137
|
-
this.comboPenalty = Math.min(Math.pow(combo / maxCombo, 0.8), 1);
|
|
2138
2193
|
if ((options === null || options === void 0 ? void 0 : options.accPercent) instanceof osuBase.Accuracy) {
|
|
2139
2194
|
// Copy into new instance to not modify the original
|
|
2140
2195
|
this.computedAccuracy = new osuBase.Accuracy(options.accPercent);
|
|
@@ -2197,6 +2252,22 @@ class PerformanceCalculator {
|
|
|
2197
2252
|
this.difficultyAttributes.sliderFactor;
|
|
2198
2253
|
}
|
|
2199
2254
|
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Calculates a strain-based miss penalty.
|
|
2257
|
+
*
|
|
2258
|
+
* Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
|
|
2259
|
+
* so we use the amount of relatively difficult sections to adjust miss penalty
|
|
2260
|
+
* to make it more punishing on maps with lower amount of hard sections.
|
|
2261
|
+
*/
|
|
2262
|
+
calculateStrainBasedMissPenalty(difficultStrainCount) {
|
|
2263
|
+
if (this.effectiveMissCount === 0) {
|
|
2264
|
+
return 1;
|
|
2265
|
+
}
|
|
2266
|
+
return (0.96 /
|
|
2267
|
+
(this.effectiveMissCount /
|
|
2268
|
+
(4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
|
|
2269
|
+
1));
|
|
2270
|
+
}
|
|
2200
2271
|
/**
|
|
2201
2272
|
* Calculates the amount of misses + sliderbreaks from combo.
|
|
2202
2273
|
*/
|
|
@@ -2540,22 +2611,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2540
2611
|
visualValue *= 0.98 + Math.pow(5, 2) / 2500;
|
|
2541
2612
|
return visualValue;
|
|
2542
2613
|
}
|
|
2543
|
-
/**
|
|
2544
|
-
* Calculates a strain-based miss penalty.
|
|
2545
|
-
*
|
|
2546
|
-
* Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
|
|
2547
|
-
* so we use the amount of relatively difficult sections to adjust miss penalty
|
|
2548
|
-
* to make it more punishing on maps with lower amount of hard sections.
|
|
2549
|
-
*/
|
|
2550
|
-
calculateStrainBasedMissPenalty(difficultStrainCount) {
|
|
2551
|
-
if (this.effectiveMissCount === 0) {
|
|
2552
|
-
return 1;
|
|
2553
|
-
}
|
|
2554
|
-
return (0.96 /
|
|
2555
|
-
(this.effectiveMissCount /
|
|
2556
|
-
(4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
|
|
2557
|
-
1));
|
|
2558
|
-
}
|
|
2559
2614
|
/**
|
|
2560
2615
|
* The object-based proportional miss penalty.
|
|
2561
2616
|
*/
|
|
@@ -2766,13 +2821,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2766
2821
|
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
2767
2822
|
*/
|
|
2768
2823
|
class OsuSkill extends StrainSkill {
|
|
2769
|
-
constructor() {
|
|
2770
|
-
super(...arguments);
|
|
2771
|
-
/**
|
|
2772
|
-
* The final multiplier to be applied to the final difficulty value after all other calculations.
|
|
2773
|
-
*/
|
|
2774
|
-
this.difficultyMultiplier = OsuSkill.defaultDifficultyMultiplier;
|
|
2775
|
-
}
|
|
2776
2824
|
difficultyValue() {
|
|
2777
2825
|
const strains = this.strainPeaks
|
|
2778
2826
|
.slice()
|
|
@@ -2787,25 +2835,19 @@ class OsuSkill extends StrainSkill {
|
|
|
2787
2835
|
}
|
|
2788
2836
|
// Difficulty is the weighted sum of the highest strains from every section.
|
|
2789
2837
|
// We're sorting from highest to lowest strain.
|
|
2790
|
-
|
|
2838
|
+
this.difficulty = 0;
|
|
2791
2839
|
let weight = 1;
|
|
2792
2840
|
for (const strain of strains) {
|
|
2793
2841
|
const addition = strain * weight;
|
|
2794
|
-
if (difficulty + addition === difficulty) {
|
|
2842
|
+
if (this.difficulty + addition === this.difficulty) {
|
|
2795
2843
|
break;
|
|
2796
2844
|
}
|
|
2797
|
-
difficulty += addition;
|
|
2845
|
+
this.difficulty += addition;
|
|
2798
2846
|
weight *= this.decayWeight;
|
|
2799
2847
|
}
|
|
2800
|
-
return
|
|
2848
|
+
return this.difficulty;
|
|
2801
2849
|
}
|
|
2802
2850
|
}
|
|
2803
|
-
/**
|
|
2804
|
-
* The default multiplier applied to the final difficulty value after all other calculations.
|
|
2805
|
-
*
|
|
2806
|
-
* May be overridden via {@link difficultyMultiplier}.
|
|
2807
|
-
*/
|
|
2808
|
-
OsuSkill.defaultDifficultyMultiplier = 1.06;
|
|
2809
2851
|
|
|
2810
2852
|
/**
|
|
2811
2853
|
* An evaluator for calculating osu!standard Aim skill.
|
|
@@ -2940,7 +2982,7 @@ class OsuAim extends OsuSkill {
|
|
|
2940
2982
|
this.reducedSectionBaseline = 0.75;
|
|
2941
2983
|
this.decayWeight = 0.9;
|
|
2942
2984
|
this.currentAimStrain = 0;
|
|
2943
|
-
this.skillMultiplier =
|
|
2985
|
+
this.skillMultiplier = 25.18;
|
|
2944
2986
|
this.withSliders = withSliders;
|
|
2945
2987
|
}
|
|
2946
2988
|
strainValueAt(current) {
|
|
@@ -2948,6 +2990,7 @@ class OsuAim extends OsuSkill {
|
|
|
2948
2990
|
this.currentAimStrain +=
|
|
2949
2991
|
OsuAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
2950
2992
|
this.skillMultiplier;
|
|
2993
|
+
this._objectStrains.push(this.currentAimStrain);
|
|
2951
2994
|
return this.currentAimStrain;
|
|
2952
2995
|
}
|
|
2953
2996
|
calculateInitialStrain(time, current) {
|
|
@@ -2980,72 +3023,98 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
2980
3023
|
* - and how easily they can be cheesed.
|
|
2981
3024
|
*
|
|
2982
3025
|
* @param current The current object.
|
|
2983
|
-
* @param greatWindow The great hit window of the current object.
|
|
2984
3026
|
*/
|
|
2985
|
-
static evaluateDifficultyOf(current
|
|
3027
|
+
static evaluateDifficultyOf(current) {
|
|
2986
3028
|
var _a;
|
|
2987
3029
|
if (current.object instanceof osuBase.Spinner) {
|
|
2988
3030
|
return 0;
|
|
2989
3031
|
}
|
|
2990
3032
|
const prev = current.previous(0);
|
|
2991
3033
|
let strainTime = current.strainTime;
|
|
2992
|
-
const greatWindowFull = greatWindow * 2;
|
|
2993
3034
|
// Nerf doubletappable doubles.
|
|
2994
|
-
const
|
|
2995
|
-
let doubletapness = 1;
|
|
2996
|
-
if (next) {
|
|
2997
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
2998
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
2999
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
3000
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
3001
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
3002
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
3003
|
-
}
|
|
3035
|
+
const doubletapness = 1 - current.doubletapness;
|
|
3004
3036
|
// Cap deltatime to the OD 300 hitwindow.
|
|
3005
3037
|
// 0.93 is derived from making sure 260 BPM 1/4 OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
|
3006
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime /
|
|
3007
|
-
|
|
3038
|
+
strainTime /= osuBase.MathUtils.clamp(strainTime / current.fullGreatWindow / 0.93, 0.92, 1);
|
|
3039
|
+
// speedBonus will be 0.0 for BPM < 200
|
|
3040
|
+
let speedBonus = 0;
|
|
3041
|
+
// Add additional scaling bonus for streams/bursts higher than 200bpm
|
|
3008
3042
|
if (strainTime < this.minSpeedBonus) {
|
|
3009
|
-
speedBonus
|
|
3043
|
+
speedBonus =
|
|
3010
3044
|
0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
|
|
3011
3045
|
}
|
|
3012
3046
|
const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
|
|
3047
|
+
// Cap distance at spacing threshold
|
|
3013
3048
|
const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3049
|
+
// Max distance bonus is 1 * `distance_multiplier` at single_spacing_threshold
|
|
3050
|
+
const distanceBonus = Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 3.95) *
|
|
3051
|
+
this.DISTANCE_MULTIPLIER;
|
|
3052
|
+
// Base difficulty with all bonuses
|
|
3053
|
+
const difficulty = ((1 + speedBonus + distanceBonus) * 1000) / strainTime;
|
|
3054
|
+
// Apply penalty if there's doubletappable doubles
|
|
3055
|
+
return difficulty * doubletapness;
|
|
3019
3056
|
}
|
|
3020
3057
|
}
|
|
3021
3058
|
/**
|
|
3022
3059
|
* Spacing threshold for a single hitobject spacing.
|
|
3060
|
+
*
|
|
3061
|
+
* About 1.25 circles distance between hitobject centers.
|
|
3023
3062
|
*/
|
|
3024
3063
|
OsuSpeedEvaluator.SINGLE_SPACING_THRESHOLD = 125;
|
|
3064
|
+
OsuSpeedEvaluator.DISTANCE_MULTIPLIER = 0.94;
|
|
3025
3065
|
|
|
3066
|
+
class Island {
|
|
3067
|
+
constructor(delta, deltaDifferenceEpsilon) {
|
|
3068
|
+
this.delta = Number.MAX_SAFE_INTEGER;
|
|
3069
|
+
this.deltaCount = 0;
|
|
3070
|
+
if (deltaDifferenceEpsilon === undefined) {
|
|
3071
|
+
this.deltaDifferenceEpsilon = delta;
|
|
3072
|
+
}
|
|
3073
|
+
else {
|
|
3074
|
+
this.deltaDifferenceEpsilon = deltaDifferenceEpsilon;
|
|
3075
|
+
this.addDelta(delta);
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
addDelta(delta) {
|
|
3079
|
+
if (this.delta === Number.MAX_SAFE_INTEGER) {
|
|
3080
|
+
this.delta = Math.max(Math.trunc(delta), DifficultyHitObject.minDeltaTime);
|
|
3081
|
+
}
|
|
3082
|
+
++this.deltaCount;
|
|
3083
|
+
}
|
|
3084
|
+
isSimilarPolarity(other) {
|
|
3085
|
+
// TODO: consider islands to be of similar polarity only if they're having the same average delta (we don't want to consider 3 singletaps similar to a triple)
|
|
3086
|
+
// naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
|
|
3087
|
+
return this.deltaCount % 2 == other.deltaCount % 2;
|
|
3088
|
+
}
|
|
3089
|
+
equals(other) {
|
|
3090
|
+
return (Math.abs(this.delta - other.delta) < this.deltaDifferenceEpsilon &&
|
|
3091
|
+
this.deltaCount === other.deltaCount);
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3026
3094
|
/**
|
|
3027
3095
|
* An evaluator for calculating osu!standard Rhythm skill.
|
|
3028
3096
|
*/
|
|
3029
|
-
class OsuRhythmEvaluator
|
|
3097
|
+
class OsuRhythmEvaluator {
|
|
3030
3098
|
/**
|
|
3031
3099
|
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
3032
3100
|
* with historic data of the current object.
|
|
3033
3101
|
*
|
|
3034
3102
|
* @param current The current object.
|
|
3035
|
-
* @param greatWindow The great hit window of the current object.
|
|
3036
3103
|
*/
|
|
3037
|
-
static evaluateDifficultyOf(current
|
|
3104
|
+
static evaluateDifficultyOf(current) {
|
|
3038
3105
|
if (current.object instanceof osuBase.Spinner) {
|
|
3039
3106
|
return 0;
|
|
3040
3107
|
}
|
|
3041
|
-
|
|
3108
|
+
const deltaDifferenceEpsilon = current.fullGreatWindow * 0.3;
|
|
3042
3109
|
let rhythmComplexitySum = 0;
|
|
3043
|
-
let
|
|
3110
|
+
let island = new Island(deltaDifferenceEpsilon);
|
|
3111
|
+
let previousIsland = new Island(deltaDifferenceEpsilon);
|
|
3112
|
+
const islandCounts = new Map();
|
|
3044
3113
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
3045
3114
|
let startRatio = 0;
|
|
3046
3115
|
let firstDeltaSwitch = false;
|
|
3047
|
-
const historicalNoteCount = Math.min(current.index, 32);
|
|
3048
3116
|
let rhythmStart = 0;
|
|
3117
|
+
const historicalNoteCount = Math.min(current.index, this.historyObjectsMax);
|
|
3049
3118
|
while (rhythmStart < historicalNoteCount - 2 &&
|
|
3050
3119
|
current.startTime - current.previous(rhythmStart).startTime <
|
|
3051
3120
|
this.historyTimeMax) {
|
|
@@ -3056,97 +3125,133 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
3056
3125
|
const prevObject = current.previous(i);
|
|
3057
3126
|
const lastObject = current.previous(i + 1);
|
|
3058
3127
|
// Scale note 0 to 1 from history to now.
|
|
3059
|
-
|
|
3128
|
+
const timeDecay = (this.historyTimeMax -
|
|
3060
3129
|
(current.startTime - currentObject.startTime)) /
|
|
3061
3130
|
this.historyTimeMax;
|
|
3131
|
+
const noteDecay = (historicalNoteCount - i) / historicalNoteCount;
|
|
3062
3132
|
// Either we're limited by time or limited by object count.
|
|
3063
|
-
currentHistoricalDecay = Math.min(
|
|
3133
|
+
const currentHistoricalDecay = Math.min(timeDecay, noteDecay);
|
|
3064
3134
|
const currentDelta = currentObject.strainTime;
|
|
3065
3135
|
const prevDelta = prevObject.strainTime;
|
|
3066
3136
|
const lastDelta = lastObject.strainTime;
|
|
3137
|
+
// Calculate how much current delta difference deserves a rhythm bonus
|
|
3138
|
+
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200)
|
|
3139
|
+
const deltaDifferenceRatio = Math.min(prevDelta, currentDelta) /
|
|
3140
|
+
Math.max(prevDelta, currentDelta);
|
|
3067
3141
|
const currentRatio = 1 +
|
|
3068
|
-
|
|
3069
|
-
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
const
|
|
3073
|
-
|
|
3074
|
-
let effectiveRatio = windowPenalty * currentRatio;
|
|
3142
|
+
this.rhythmRatioMultiplier *
|
|
3143
|
+
Math.min(0.5, Math.pow(Math.sin(Math.PI / deltaDifferenceRatio), 2));
|
|
3144
|
+
// Reduce ratio bonus if delta difference is too big
|
|
3145
|
+
const fraction = Math.max(prevDelta / currentDelta, currentDelta / prevDelta);
|
|
3146
|
+
const fractionMultiplier = osuBase.MathUtils.clamp(2 - fraction / 8, 0, 1);
|
|
3147
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon);
|
|
3148
|
+
let effectiveRatio = windowPenalty * currentRatio * fractionMultiplier;
|
|
3075
3149
|
if (firstDeltaSwitch) {
|
|
3076
|
-
if (prevDelta
|
|
3077
|
-
prevDelta * 1.25 >= currentDelta) {
|
|
3150
|
+
if (Math.abs(prevDelta - currentDelta) < deltaDifferenceEpsilon) {
|
|
3078
3151
|
// Island is still progressing, count size.
|
|
3079
|
-
|
|
3080
|
-
++islandSize;
|
|
3081
|
-
}
|
|
3152
|
+
island.addDelta(currentDelta);
|
|
3082
3153
|
}
|
|
3083
3154
|
else {
|
|
3155
|
+
// BPM change is into slider, this is easy acc window.
|
|
3084
3156
|
if (currentObject.object instanceof osuBase.Slider) {
|
|
3085
|
-
// BPM change is into slider, this is easy acc window.
|
|
3086
3157
|
effectiveRatio /= 8;
|
|
3087
3158
|
}
|
|
3159
|
+
// BPM change was from a slider, this is easier typically than circle -> circle.
|
|
3160
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
3161
|
+
// than bursts without sliders.
|
|
3088
3162
|
if (prevObject.object instanceof osuBase.Slider) {
|
|
3089
|
-
|
|
3090
|
-
effectiveRatio /= 4;
|
|
3163
|
+
effectiveRatio *= 0.3;
|
|
3091
3164
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
effectiveRatio /= 4;
|
|
3095
|
-
}
|
|
3096
|
-
if (previousIslandSize % 2 === islandSize % 2) {
|
|
3097
|
-
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
3165
|
+
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
3166
|
+
if (island.isSimilarPolarity(previousIsland)) {
|
|
3098
3167
|
effectiveRatio /= 2;
|
|
3099
3168
|
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3169
|
+
// Previous increase happened a note ago.
|
|
3170
|
+
// Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
|
|
3171
|
+
if (lastDelta > prevDelta + deltaDifferenceEpsilon &&
|
|
3172
|
+
prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
3104
3173
|
effectiveRatio /= 8;
|
|
3105
3174
|
}
|
|
3175
|
+
// Repeated island size (ex: triplet -> triplet).
|
|
3176
|
+
// TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation
|
|
3177
|
+
if (previousIsland.deltaCount == island.deltaCount) {
|
|
3178
|
+
effectiveRatio /= 2;
|
|
3179
|
+
}
|
|
3180
|
+
let islandFound = false;
|
|
3181
|
+
for (const [currentIsland, count] of islandCounts) {
|
|
3182
|
+
if (!island.equals(currentIsland)) {
|
|
3183
|
+
continue;
|
|
3184
|
+
}
|
|
3185
|
+
islandFound = true;
|
|
3186
|
+
let islandCount = count;
|
|
3187
|
+
if (previousIsland.equals(island)) {
|
|
3188
|
+
// Only add island to island counts if they're going one after another.
|
|
3189
|
+
++islandCount;
|
|
3190
|
+
islandCounts.set(currentIsland, islandCount);
|
|
3191
|
+
}
|
|
3192
|
+
// Repeated island (ex: triplet -> triplet).
|
|
3193
|
+
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
3194
|
+
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount, 2.75 / (1 + Math.exp(14 - 0.24 * island.delta))));
|
|
3195
|
+
break;
|
|
3196
|
+
}
|
|
3197
|
+
if (!islandFound) {
|
|
3198
|
+
islandCounts.set(island, 1);
|
|
3199
|
+
}
|
|
3200
|
+
// Scale down the difficulty if the object is doubletappable.
|
|
3201
|
+
effectiveRatio *= 1 - prevObject.doubletapness * 0.75;
|
|
3106
3202
|
rhythmComplexitySum +=
|
|
3107
|
-
|
|
3108
|
-
currentHistoricalDecay
|
|
3109
|
-
Math.sqrt(4 + islandSize)) /
|
|
3110
|
-
2) *
|
|
3111
|
-
Math.sqrt(4 + previousIslandSize)) /
|
|
3112
|
-
2;
|
|
3203
|
+
Math.sqrt(effectiveRatio * startRatio) *
|
|
3204
|
+
currentHistoricalDecay;
|
|
3113
3205
|
startRatio = effectiveRatio;
|
|
3114
|
-
|
|
3115
|
-
if (prevDelta
|
|
3206
|
+
previousIsland = island;
|
|
3207
|
+
if (prevDelta + deltaDifferenceEpsilon < currentDelta) {
|
|
3116
3208
|
// We're slowing down, stop counting.
|
|
3117
3209
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
3118
3210
|
firstDeltaSwitch = false;
|
|
3119
3211
|
}
|
|
3120
|
-
|
|
3212
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
3121
3213
|
}
|
|
3122
3214
|
}
|
|
3123
|
-
else if (prevDelta >
|
|
3124
|
-
// We
|
|
3215
|
+
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
3216
|
+
// We are speeding up.
|
|
3125
3217
|
// Begin counting island until we change speed again.
|
|
3126
3218
|
firstDeltaSwitch = true;
|
|
3219
|
+
// BPM change is into slider, this is easy acc window.
|
|
3220
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
3221
|
+
effectiveRatio *= 0.6;
|
|
3222
|
+
}
|
|
3223
|
+
// BPM change was from a slider, this is easier typically than circle -> circle
|
|
3224
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
3225
|
+
// than bursts without sliders
|
|
3226
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
3227
|
+
effectiveRatio *= 0.6;
|
|
3228
|
+
}
|
|
3127
3229
|
startRatio = effectiveRatio;
|
|
3128
|
-
|
|
3230
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
3129
3231
|
}
|
|
3130
3232
|
}
|
|
3131
|
-
return Math.sqrt(4 + rhythmComplexitySum * this.
|
|
3233
|
+
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmOverallMultiplier) /
|
|
3234
|
+
2);
|
|
3132
3235
|
}
|
|
3133
3236
|
}
|
|
3237
|
+
OsuRhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
3238
|
+
OsuRhythmEvaluator.historyObjectsMax = 32;
|
|
3239
|
+
OsuRhythmEvaluator.rhythmOverallMultiplier = 0.95;
|
|
3240
|
+
OsuRhythmEvaluator.rhythmRatioMultiplier = 12;
|
|
3134
3241
|
|
|
3135
3242
|
/**
|
|
3136
3243
|
* Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
|
|
3137
3244
|
*/
|
|
3138
3245
|
class OsuSpeed extends OsuSkill {
|
|
3139
|
-
constructor(
|
|
3140
|
-
super(
|
|
3246
|
+
constructor() {
|
|
3247
|
+
super(...arguments);
|
|
3141
3248
|
this.strainDecayBase = 0.3;
|
|
3142
3249
|
this.reducedSectionCount = 5;
|
|
3143
3250
|
this.reducedSectionBaseline = 0.75;
|
|
3144
|
-
this.difficultyMultiplier = 1.04;
|
|
3145
3251
|
this.decayWeight = 0.9;
|
|
3146
3252
|
this.currentSpeedStrain = 0;
|
|
3147
3253
|
this.currentRhythm = 0;
|
|
3148
|
-
this.skillMultiplier =
|
|
3149
|
-
this.greatWindow = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
3254
|
+
this.skillMultiplier = 1.43;
|
|
3150
3255
|
}
|
|
3151
3256
|
/**
|
|
3152
3257
|
* @param current The hitobject to calculate.
|
|
@@ -3154,10 +3259,12 @@ class OsuSpeed extends OsuSkill {
|
|
|
3154
3259
|
strainValueAt(current) {
|
|
3155
3260
|
this.currentSpeedStrain *= this.strainDecay(current.strainTime);
|
|
3156
3261
|
this.currentSpeedStrain +=
|
|
3157
|
-
OsuSpeedEvaluator.evaluateDifficultyOf(current
|
|
3262
|
+
OsuSpeedEvaluator.evaluateDifficultyOf(current) *
|
|
3158
3263
|
this.skillMultiplier;
|
|
3159
|
-
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current
|
|
3160
|
-
|
|
3264
|
+
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current);
|
|
3265
|
+
const strain = this.currentSpeedStrain * this.currentRhythm;
|
|
3266
|
+
this._objectStrains.push(strain);
|
|
3267
|
+
return strain;
|
|
3161
3268
|
}
|
|
3162
3269
|
calculateInitialStrain(time, current) {
|
|
3163
3270
|
var _a, _b;
|
|
@@ -3267,9 +3374,12 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3267
3374
|
this.reducedSectionBaseline = 1;
|
|
3268
3375
|
this.decayWeight = 1;
|
|
3269
3376
|
this.currentFlashlightStrain = 0;
|
|
3270
|
-
this.skillMultiplier = 0.
|
|
3377
|
+
this.skillMultiplier = 0.05512;
|
|
3271
3378
|
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
3272
3379
|
}
|
|
3380
|
+
difficultyValue() {
|
|
3381
|
+
return this.strainPeaks.reduce((a, b) => a + b, 0);
|
|
3382
|
+
}
|
|
3273
3383
|
strainValueAt(current) {
|
|
3274
3384
|
this.currentFlashlightStrain *= this.strainDecay(current.deltaTime);
|
|
3275
3385
|
this.currentFlashlightStrain +=
|
|
@@ -3290,29 +3400,8 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3290
3400
|
* Represents an osu!standard hit object with difficulty calculation values.
|
|
3291
3401
|
*/
|
|
3292
3402
|
class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3296
|
-
let scalingFactor = this.normalizedRadius / radius;
|
|
3297
|
-
// High circle size (small CS) bonus
|
|
3298
|
-
if (radius < this.radiusBuffThreshold) {
|
|
3299
|
-
scalingFactor *=
|
|
3300
|
-
1 + Math.min(this.radiusBuffThreshold - radius, 5) / 50;
|
|
3301
|
-
}
|
|
3302
|
-
return scalingFactor;
|
|
3303
|
-
}
|
|
3304
|
-
/**
|
|
3305
|
-
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
3306
|
-
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
3307
|
-
*
|
|
3308
|
-
* @param object The underlying hitobject.
|
|
3309
|
-
* @param lastObject The hitobject before this hitobject.
|
|
3310
|
-
* @param lastLastObject The hitobject before the last hitobject.
|
|
3311
|
-
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
3312
|
-
* @param clockRate The clock rate of the beatmap.
|
|
3313
|
-
*/
|
|
3314
|
-
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate) {
|
|
3315
|
-
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate);
|
|
3403
|
+
constructor() {
|
|
3404
|
+
super(...arguments);
|
|
3316
3405
|
/**
|
|
3317
3406
|
* The speed strain generated by the hitobject.
|
|
3318
3407
|
*/
|
|
@@ -3324,6 +3413,17 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
|
3324
3413
|
this.radiusBuffThreshold = 30;
|
|
3325
3414
|
this.mode = osuBase.Modes.osu;
|
|
3326
3415
|
}
|
|
3416
|
+
get scalingFactor() {
|
|
3417
|
+
const radius = this.object.radius;
|
|
3418
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3419
|
+
let scalingFactor = this.normalizedRadius / radius;
|
|
3420
|
+
// High circle size (small CS) bonus
|
|
3421
|
+
if (radius < this.radiusBuffThreshold) {
|
|
3422
|
+
scalingFactor *=
|
|
3423
|
+
1 + Math.min(this.radiusBuffThreshold - radius, 5) / 50;
|
|
3424
|
+
}
|
|
3425
|
+
return scalingFactor;
|
|
3426
|
+
}
|
|
3327
3427
|
}
|
|
3328
3428
|
|
|
3329
3429
|
/**
|
|
@@ -3347,6 +3447,8 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3347
3447
|
hitCircleCount: 0,
|
|
3348
3448
|
sliderCount: 0,
|
|
3349
3449
|
spinnerCount: 0,
|
|
3450
|
+
aimDifficultStrainCount: 0,
|
|
3451
|
+
speedDifficultStrainCount: 0,
|
|
3350
3452
|
};
|
|
3351
3453
|
this.difficultyMultiplier = 0.0675;
|
|
3352
3454
|
this.mode = osuBase.Modes.osu;
|
|
@@ -3385,7 +3487,11 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3385
3487
|
* Calculates the speed star rating of the beatmap and stores it in this instance.
|
|
3386
3488
|
*/
|
|
3387
3489
|
calculateSpeed() {
|
|
3388
|
-
|
|
3490
|
+
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3491
|
+
this.attributes.speedDifficulty = 0;
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
const speedSkill = new OsuSpeed(this.mods);
|
|
3389
3495
|
this.calculateSkills(speedSkill);
|
|
3390
3496
|
this.postCalculateSpeed(speedSkill);
|
|
3391
3497
|
}
|
|
@@ -3411,7 +3517,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3411
3517
|
// Document for formula derivation:
|
|
3412
3518
|
// https://docs.google.com/document/d/10DZGYYSsT_yjz2Mtp6yIJld0Rqx4E-vVHupCqiM4TNI/edit
|
|
3413
3519
|
this.attributes.starRating =
|
|
3414
|
-
Math.cbrt(1.
|
|
3520
|
+
Math.cbrt(1.15) *
|
|
3415
3521
|
0.027 *
|
|
3416
3522
|
(Math.cbrt((100000 / Math.pow(2, 1 / 1.1)) * basePerformanceValue) +
|
|
3417
3523
|
4);
|
|
@@ -3422,13 +3528,19 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3422
3528
|
}
|
|
3423
3529
|
calculateAll() {
|
|
3424
3530
|
const skills = this.createSkills();
|
|
3531
|
+
const isRelax = this.mods.some((m) => m instanceof osuBase.ModRelax);
|
|
3425
3532
|
this.calculateSkills(...skills);
|
|
3426
3533
|
const aimSkill = skills[0];
|
|
3427
3534
|
const aimSkillWithoutSliders = skills[1];
|
|
3428
3535
|
const speedSkill = skills[2];
|
|
3429
3536
|
const flashlightSkill = skills[3];
|
|
3430
3537
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
3431
|
-
|
|
3538
|
+
if (isRelax) {
|
|
3539
|
+
this.attributes.speedDifficulty = 0;
|
|
3540
|
+
}
|
|
3541
|
+
else {
|
|
3542
|
+
this.postCalculateSpeed(speedSkill);
|
|
3543
|
+
}
|
|
3432
3544
|
this.calculateSpeedAttributes();
|
|
3433
3545
|
this.postCalculateFlashlight(flashlightSkill);
|
|
3434
3546
|
this.calculateTotal();
|
|
@@ -3443,37 +3555,32 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3443
3555
|
this.flashlight.toFixed(2) +
|
|
3444
3556
|
" flashlight)");
|
|
3445
3557
|
}
|
|
3446
|
-
generateDifficultyHitObjects(
|
|
3558
|
+
generateDifficultyHitObjects(beatmap, clockRate) {
|
|
3447
3559
|
var _a, _b;
|
|
3448
3560
|
const difficultyObjects = [];
|
|
3449
|
-
const { objects } =
|
|
3561
|
+
const { objects } = beatmap.hitObjects;
|
|
3562
|
+
const greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300() /
|
|
3563
|
+
clockRate;
|
|
3450
3564
|
for (let i = 0; i < objects.length; ++i) {
|
|
3451
|
-
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,
|
|
3452
|
-
difficultyObject.computeProperties(
|
|
3565
|
+
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, clockRate, greatWindow);
|
|
3566
|
+
difficultyObject.computeProperties(clockRate, objects);
|
|
3453
3567
|
difficultyObjects.push(difficultyObject);
|
|
3454
3568
|
}
|
|
3455
3569
|
return difficultyObjects;
|
|
3456
3570
|
}
|
|
3457
|
-
computeDifficultyStatistics(options) {
|
|
3458
|
-
var _a;
|
|
3459
|
-
const { difficulty } = this.beatmap;
|
|
3460
|
-
return osuBase.calculateOsuDifficultyStatistics({
|
|
3461
|
-
circleSize: difficulty.cs,
|
|
3462
|
-
approachRate: (_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od,
|
|
3463
|
-
overallDifficulty: difficulty.od,
|
|
3464
|
-
healthDrain: difficulty.hp,
|
|
3465
|
-
mods: options === null || options === void 0 ? void 0 : options.mods,
|
|
3466
|
-
customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
|
|
3467
|
-
});
|
|
3468
|
-
}
|
|
3469
3571
|
createSkills() {
|
|
3470
3572
|
return [
|
|
3471
3573
|
new OsuAim(this.mods, true),
|
|
3472
3574
|
new OsuAim(this.mods, false),
|
|
3473
|
-
new OsuSpeed(this.mods
|
|
3575
|
+
new OsuSpeed(this.mods),
|
|
3474
3576
|
new OsuFlashlight(this.mods),
|
|
3475
3577
|
];
|
|
3476
3578
|
}
|
|
3579
|
+
populateDifficultyAttributes(beatmap, clockRate) {
|
|
3580
|
+
super.populateDifficultyAttributes(beatmap, clockRate);
|
|
3581
|
+
const preempt = osuBase.BeatmapDifficulty.difficultyRange(beatmap.difficulty.ar, osuBase.HitObject.preemptMax, osuBase.HitObject.preemptMid, osuBase.HitObject.preemptMin) / clockRate;
|
|
3582
|
+
this.attributes.approachRate = osuBase.BeatmapDifficulty.inverseDifficultyRange(preempt, osuBase.HitObject.preemptMax, osuBase.HitObject.preemptMid, osuBase.HitObject.preemptMin);
|
|
3583
|
+
}
|
|
3477
3584
|
/**
|
|
3478
3585
|
* Called after aim skill calculation.
|
|
3479
3586
|
*
|
|
@@ -3495,6 +3602,8 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3495
3602
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3496
3603
|
this.attributes.aimDifficulty *= 0.9;
|
|
3497
3604
|
}
|
|
3605
|
+
this.attributes.aimDifficultStrainCount =
|
|
3606
|
+
aimSkill.countDifficultStrains();
|
|
3498
3607
|
}
|
|
3499
3608
|
/**
|
|
3500
3609
|
* Called after speed skill calculation.
|
|
@@ -3503,10 +3612,9 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3503
3612
|
*/
|
|
3504
3613
|
postCalculateSpeed(speedSkill) {
|
|
3505
3614
|
this.strainPeaks.speed = speedSkill.strainPeaks;
|
|
3506
|
-
this.attributes.speedDifficulty = this.
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
this.calculateSpeedAttributes();
|
|
3615
|
+
this.attributes.speedDifficulty = this.starValue(speedSkill.difficultyValue());
|
|
3616
|
+
this.attributes.speedDifficultStrainCount =
|
|
3617
|
+
speedSkill.countDifficultStrains();
|
|
3510
3618
|
}
|
|
3511
3619
|
/**
|
|
3512
3620
|
* Calculates speed-related attributes.
|
|
@@ -3557,8 +3665,9 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3557
3665
|
* The flashlight performance value.
|
|
3558
3666
|
*/
|
|
3559
3667
|
this.flashlight = 0;
|
|
3560
|
-
this.finalMultiplier = 1.
|
|
3668
|
+
this.finalMultiplier = 1.15;
|
|
3561
3669
|
this.mode = osuBase.Modes.osu;
|
|
3670
|
+
this.comboPenalty = 1;
|
|
3562
3671
|
}
|
|
3563
3672
|
calculateValues() {
|
|
3564
3673
|
this.aim = this.calculateAimValue();
|
|
@@ -3572,6 +3681,14 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3572
3681
|
Math.pow(this.accuracy, 1.1) +
|
|
3573
3682
|
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
3574
3683
|
}
|
|
3684
|
+
handleOptions(options) {
|
|
3685
|
+
var _a;
|
|
3686
|
+
super.handleOptions(options);
|
|
3687
|
+
const maxCombo = this.difficultyAttributes.maxCombo;
|
|
3688
|
+
const miss = this.computedAccuracy.nmiss;
|
|
3689
|
+
const combo = (_a = options === null || options === void 0 ? void 0 : options.combo) !== null && _a !== void 0 ? _a : maxCombo - miss;
|
|
3690
|
+
this.comboPenalty = Math.min(Math.pow(combo / maxCombo, 0.8), 1);
|
|
3691
|
+
}
|
|
3575
3692
|
/**
|
|
3576
3693
|
* Calculates the aim performance value of the beatmap.
|
|
3577
3694
|
*/
|
|
@@ -3591,8 +3708,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3591
3708
|
Math.pow(1 -
|
|
3592
3709
|
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
3593
3710
|
}
|
|
3594
|
-
|
|
3595
|
-
aimValue *= this.comboPenalty;
|
|
3711
|
+
aimValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.aimDifficultStrainCount);
|
|
3596
3712
|
const calculatedAR = this.difficultyAttributes.approachRate;
|
|
3597
3713
|
if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3598
3714
|
// AR scaling
|
|
@@ -3633,16 +3749,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3633
3749
|
lengthBonus += Math.log10(this.totalHits / 2000) * 0.5;
|
|
3634
3750
|
}
|
|
3635
3751
|
speedValue *= lengthBonus;
|
|
3636
|
-
|
|
3637
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
3638
|
-
// Default a 3% reduction for any # of misses.
|
|
3639
|
-
speedValue *=
|
|
3640
|
-
0.97 *
|
|
3641
|
-
Math.pow(1 -
|
|
3642
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
3643
|
-
}
|
|
3644
|
-
// Combo scaling
|
|
3645
|
-
speedValue *= this.comboPenalty;
|
|
3752
|
+
speedValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.speedDifficultStrainCount);
|
|
3646
3753
|
// AR scaling
|
|
3647
3754
|
const calculatedAR = this.difficultyAttributes.approachRate;
|
|
3648
3755
|
if (calculatedAR > 10.33) {
|
|
@@ -3673,9 +3780,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3673
3780
|
750) *
|
|
3674
3781
|
Math.pow((this.computedAccuracy.value() +
|
|
3675
3782
|
relevantAccuracy.value(this.difficultyAttributes.speedNoteCount)) /
|
|
3676
|
-
2, (14.5 -
|
|
3677
|
-
Math.max(this.difficultyAttributes.overallDifficulty, 8)) /
|
|
3678
|
-
2);
|
|
3783
|
+
2, (14.5 - this.difficultyAttributes.overallDifficulty) / 2);
|
|
3679
3784
|
// Scale the speed value with # of 50s to punish doubletapping.
|
|
3680
3785
|
speedValue *= Math.pow(0.99, Math.max(0, this.computedAccuracy.n50 - this.totalHits / 500));
|
|
3681
3786
|
return speedValue;
|
|
@@ -3783,6 +3888,5 @@ exports.OsuRhythmEvaluator = OsuRhythmEvaluator;
|
|
|
3783
3888
|
exports.OsuSpeed = OsuSpeed;
|
|
3784
3889
|
exports.OsuSpeedEvaluator = OsuSpeedEvaluator;
|
|
3785
3890
|
exports.PerformanceCalculator = PerformanceCalculator;
|
|
3786
|
-
exports.RhythmEvaluator = RhythmEvaluator;
|
|
3787
3891
|
exports.SpeedEvaluator = SpeedEvaluator;
|
|
3788
3892
|
//# sourceMappingURL=index.js.map
|