@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.3 → 4.0.0-beta.31
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 +1888 -1576
- package/package.json +9 -6
- package/typings/index.d.ts +605 -494
- package/dist/index.js.map +0 -1
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,154 +23,244 @@ 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
|
-
class
|
|
35
|
-
/**
|
|
36
|
-
* The underlying hitobject.
|
|
37
|
-
*/
|
|
38
|
-
object;
|
|
39
|
-
/**
|
|
40
|
-
* The index of this hitobject in the list of all hitobjects.
|
|
41
|
-
*
|
|
42
|
-
* This is one less than the actual index of the hitobject in the beatmap.
|
|
43
|
-
*/
|
|
44
|
-
index = 0;
|
|
45
|
-
/**
|
|
46
|
-
* The preempt time of the hitobject.
|
|
47
|
-
*/
|
|
48
|
-
baseTimePreempt = 600;
|
|
49
|
-
/**
|
|
50
|
-
* Adjusted preempt time of the hitobject, taking speed multiplier into account.
|
|
51
|
-
*/
|
|
52
|
-
timePreempt = 600;
|
|
53
|
-
/**
|
|
54
|
-
* The fade in time of the hitobject.
|
|
55
|
-
*/
|
|
56
|
-
timeFadeIn = 400;
|
|
57
|
-
/**
|
|
58
|
-
* The aim strain generated by the hitobject if sliders are considered.
|
|
59
|
-
*/
|
|
60
|
-
aimStrainWithSliders = 0;
|
|
61
|
-
/**
|
|
62
|
-
* The aim strain generated by the hitobject if sliders are not considered.
|
|
63
|
-
*/
|
|
64
|
-
aimStrainWithoutSliders = 0;
|
|
65
|
-
/**
|
|
66
|
-
* The tap strain generated by the hitobject.
|
|
67
|
-
*
|
|
68
|
-
* This is also used for osu!standard as opposed to "speed strain".
|
|
69
|
-
*/
|
|
70
|
-
tapStrain = 0;
|
|
71
|
-
/**
|
|
72
|
-
* The tap strain generated by the hitobject if `strainTime` isn't modified by
|
|
73
|
-
* OD. This is used in three-finger detection.
|
|
74
|
-
*/
|
|
75
|
-
originalTapStrain = 0;
|
|
76
|
-
/**
|
|
77
|
-
* The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
|
|
78
|
-
*/
|
|
79
|
-
rhythmMultiplier = 0;
|
|
80
|
-
/**
|
|
81
|
-
* The rhythm strain generated by the hitobject.
|
|
82
|
-
*/
|
|
83
|
-
rhythmStrain = 0;
|
|
84
|
-
/**
|
|
85
|
-
* The flashlight strain generated by the hitobject if sliders are considered.
|
|
86
|
-
*/
|
|
87
|
-
flashlightStrainWithSliders = 0;
|
|
88
|
-
/**
|
|
89
|
-
* The flashlight strain generated by the hitobject if sliders are not considered.
|
|
90
|
-
*/
|
|
91
|
-
flashlightStrainWithoutSliders = 0;
|
|
34
|
+
class DifficultyCalculator {
|
|
92
35
|
/**
|
|
93
|
-
* The
|
|
36
|
+
* The difficulty objects of the beatmap.
|
|
94
37
|
*/
|
|
95
|
-
|
|
38
|
+
get objects() {
|
|
39
|
+
return this._objects;
|
|
40
|
+
}
|
|
96
41
|
/**
|
|
97
|
-
* The
|
|
42
|
+
* The total star rating of the beatmap.
|
|
98
43
|
*/
|
|
99
|
-
|
|
44
|
+
get total() {
|
|
45
|
+
return this.attributes.starRating;
|
|
46
|
+
}
|
|
100
47
|
/**
|
|
101
|
-
*
|
|
48
|
+
* Constructs a new instance of the calculator.
|
|
102
49
|
*
|
|
103
|
-
*
|
|
50
|
+
* @param beatmap The beatmap to calculate.
|
|
104
51
|
*/
|
|
105
|
-
|
|
52
|
+
constructor(beatmap) {
|
|
53
|
+
/**
|
|
54
|
+
* The difficulty objects of the beatmap.
|
|
55
|
+
*/
|
|
56
|
+
this._objects = [];
|
|
57
|
+
/**
|
|
58
|
+
* The modifications applied.
|
|
59
|
+
*/
|
|
60
|
+
this.mods = [];
|
|
61
|
+
/**
|
|
62
|
+
* The strain peaks of various calculated difficulties.
|
|
63
|
+
*/
|
|
64
|
+
this.strainPeaks = {
|
|
65
|
+
aimWithSliders: [],
|
|
66
|
+
aimWithoutSliders: [],
|
|
67
|
+
speed: [],
|
|
68
|
+
flashlight: [],
|
|
69
|
+
};
|
|
70
|
+
this.beatmap = beatmap;
|
|
71
|
+
}
|
|
106
72
|
/**
|
|
107
|
-
*
|
|
73
|
+
* Calculates the star rating of the specified beatmap.
|
|
108
74
|
*
|
|
109
|
-
*
|
|
75
|
+
* The beatmap is analyzed in chunks of `sectionLength` duration.
|
|
76
|
+
* For each chunk the highest hitobject strains are added to
|
|
77
|
+
* a list which is then collapsed into a weighted sum, much
|
|
78
|
+
* like scores are weighted on a user's profile.
|
|
110
79
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
80
|
+
* For subsequent chunks, the initial max strain is calculated
|
|
81
|
+
* by decaying the previous hitobject's strain until the
|
|
82
|
+
* beginning of the new chunk.
|
|
114
83
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
minimumJumpDistance = 0;
|
|
119
|
-
/**
|
|
120
|
-
* The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
|
|
121
|
-
*/
|
|
122
|
-
minimumJumpTime = 0;
|
|
123
|
-
/**
|
|
124
|
-
* The normalized distance between the start and end position of this hitobject.
|
|
125
|
-
*/
|
|
126
|
-
travelDistance = 0;
|
|
127
|
-
/**
|
|
128
|
-
* The time taken to travel through `travelDistance`, with a minimum value of 25ms for sliders.
|
|
84
|
+
* @param options Options for the difficulty calculation.
|
|
85
|
+
* @returns The current instance.
|
|
129
86
|
*/
|
|
130
|
-
|
|
87
|
+
calculate(options) {
|
|
88
|
+
var _a;
|
|
89
|
+
this.mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
|
|
90
|
+
const playableBeatmap = this.beatmap.createPlayableBeatmap({
|
|
91
|
+
mode: this.mode,
|
|
92
|
+
mods: this.mods,
|
|
93
|
+
customSpeedMultiplier: options === null || options === void 0 ? void 0 : options.customSpeedMultiplier,
|
|
94
|
+
});
|
|
95
|
+
const clockRate = this.calculateClockRate(options);
|
|
96
|
+
this.populateDifficultyAttributes(playableBeatmap, clockRate);
|
|
97
|
+
this._objects = this.generateDifficultyHitObjects(playableBeatmap, clockRate);
|
|
98
|
+
this.calculateAll();
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
131
101
|
/**
|
|
132
|
-
*
|
|
102
|
+
* Calculates the skills provided.
|
|
133
103
|
*
|
|
134
|
-
*
|
|
135
|
-
*/
|
|
136
|
-
angle = null;
|
|
137
|
-
/**
|
|
138
|
-
* The amount of milliseconds elapsed between this hitobject and the last hitobject.
|
|
139
|
-
*/
|
|
140
|
-
deltaTime = 0;
|
|
141
|
-
/**
|
|
142
|
-
* The amount of milliseconds elapsed since the start time of the previous hitobject, with a minimum of 25ms.
|
|
143
|
-
*/
|
|
144
|
-
strainTime = 0;
|
|
145
|
-
/**
|
|
146
|
-
* Adjusted start time of the hitobject, taking speed multiplier into account.
|
|
147
|
-
*/
|
|
148
|
-
startTime = 0;
|
|
149
|
-
/**
|
|
150
|
-
* Adjusted end time of the hitobject, taking speed multiplier into account.
|
|
104
|
+
* @param skills The skills to calculate.
|
|
151
105
|
*/
|
|
152
|
-
|
|
106
|
+
calculateSkills(...skills) {
|
|
107
|
+
// The first object doesn't generate a strain, so we begin calculating from the second object.
|
|
108
|
+
for (const object of this.objects.slice(1)) {
|
|
109
|
+
for (const skill of skills) {
|
|
110
|
+
skill.process(object);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
153
114
|
/**
|
|
154
|
-
*
|
|
115
|
+
* Obtains the clock rate of the beatmap.
|
|
116
|
+
*
|
|
117
|
+
* @param options The options to obtain the clock rate with.
|
|
118
|
+
* @returns The clock rate of the beatmap.
|
|
155
119
|
*/
|
|
156
|
-
|
|
120
|
+
calculateClockRate(options) {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
return (osuBase.ModUtil.calculateRateWithMods((_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : []) *
|
|
123
|
+
((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1));
|
|
124
|
+
}
|
|
157
125
|
/**
|
|
158
|
-
*
|
|
126
|
+
* Populates the stored difficulty attributes with necessary data.
|
|
159
127
|
*
|
|
160
|
-
*
|
|
128
|
+
* @param beatmap The beatmap to populate the attributes with.
|
|
129
|
+
* @param clockRate The clock rate of the beatmap.
|
|
161
130
|
*/
|
|
162
|
-
|
|
131
|
+
populateDifficultyAttributes(beatmap, clockRate) {
|
|
132
|
+
this.attributes.hitCircleCount = this.beatmap.hitObjects.circles;
|
|
133
|
+
this.attributes.maxCombo = this.beatmap.maxCombo;
|
|
134
|
+
this.attributes.mods = this.mods.slice();
|
|
135
|
+
this.attributes.sliderCount = this.beatmap.hitObjects.sliders;
|
|
136
|
+
this.attributes.spinnerCount = this.beatmap.hitObjects.spinners;
|
|
137
|
+
this.attributes.clockRate = clockRate;
|
|
138
|
+
let greatWindow;
|
|
139
|
+
switch (this.mode) {
|
|
140
|
+
case osuBase.Modes.droid:
|
|
141
|
+
greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(this.mods.some((m) => m instanceof osuBase.ModPrecise));
|
|
142
|
+
break;
|
|
143
|
+
case osuBase.Modes.osu:
|
|
144
|
+
greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300();
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
this.attributes.overallDifficulty = osuBase.OsuHitWindow.hitWindow300ToOD(greatWindow / clockRate);
|
|
148
|
+
}
|
|
163
149
|
/**
|
|
164
|
-
*
|
|
150
|
+
* Calculates the star rating value of a difficulty.
|
|
151
|
+
*
|
|
152
|
+
* @param difficulty The difficulty to calculate.
|
|
165
153
|
*/
|
|
166
|
-
|
|
154
|
+
starValue(difficulty) {
|
|
155
|
+
return Math.sqrt(difficulty) * this.difficultyMultiplier;
|
|
156
|
+
}
|
|
167
157
|
/**
|
|
168
|
-
*
|
|
158
|
+
* Calculates the base performance value of a difficulty rating.
|
|
159
|
+
*
|
|
160
|
+
* @param rating The difficulty rating.
|
|
169
161
|
*/
|
|
170
|
-
|
|
162
|
+
basePerformanceValue(rating) {
|
|
163
|
+
return Math.pow(5 * Math.max(1, rating / 0.0675) - 4, 3) / 100000;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Represents a hit object with difficulty calculation values.
|
|
169
|
+
*/
|
|
170
|
+
class DifficultyHitObject {
|
|
171
171
|
/**
|
|
172
|
+
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
173
|
+
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
174
|
+
*
|
|
172
175
|
* @param object The underlying hitobject.
|
|
173
|
-
* @param
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
* @param lastObject The hitobject before this hitobject.
|
|
177
|
+
* @param lastLastObject The hitobject before the last hitobject.
|
|
178
|
+
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
179
|
+
* @param clockRate The clock rate of the beatmap.
|
|
180
|
+
* @param greatWindow The great window of the hitobject.
|
|
181
|
+
*/
|
|
182
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow) {
|
|
183
|
+
/**
|
|
184
|
+
* The aim strain generated by the hitobject if sliders are considered.
|
|
185
|
+
*/
|
|
186
|
+
this.aimStrainWithSliders = 0;
|
|
187
|
+
/**
|
|
188
|
+
* The aim strain generated by the hitobject if sliders are not considered.
|
|
189
|
+
*/
|
|
190
|
+
this.aimStrainWithoutSliders = 0;
|
|
191
|
+
/**
|
|
192
|
+
* The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
|
|
193
|
+
*/
|
|
194
|
+
this.rhythmMultiplier = 0;
|
|
195
|
+
/**
|
|
196
|
+
* The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
|
|
197
|
+
*
|
|
198
|
+
* 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).
|
|
199
|
+
*/
|
|
200
|
+
this.lazyJumpDistance = 0;
|
|
201
|
+
/**
|
|
202
|
+
* The normalized shortest distance to consider for a jump between the previous hitobject and this hitobject.
|
|
203
|
+
*
|
|
204
|
+
* 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.
|
|
205
|
+
*
|
|
206
|
+
* 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.
|
|
207
|
+
* 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,
|
|
208
|
+
* such that the jump is felt as only starting from the slider's true end position.
|
|
209
|
+
*
|
|
210
|
+
* Now consider a slider - circle pattern where the circle is stacked along the path inside the slider.
|
|
211
|
+
* In this case, the lazy end position correctly estimates the true end position of the slider and provides the more natural movement path.
|
|
212
|
+
*/
|
|
213
|
+
this.minimumJumpDistance = 0;
|
|
214
|
+
/**
|
|
215
|
+
* The time taken to travel through `minimumJumpDistance`, with a minimum value of 25ms.
|
|
216
|
+
*/
|
|
217
|
+
this.minimumJumpTime = 0;
|
|
218
|
+
/**
|
|
219
|
+
* The normalized distance between the start and end position of this hitobject.
|
|
220
|
+
*/
|
|
221
|
+
this.travelDistance = 0;
|
|
222
|
+
/**
|
|
223
|
+
* The time taken to travel through `travelDistance`, with a minimum value of 25ms for sliders.
|
|
224
|
+
*/
|
|
225
|
+
this.travelTime = 0;
|
|
226
|
+
/**
|
|
227
|
+
* Angle the player has to take to hit this hitobject.
|
|
228
|
+
*
|
|
229
|
+
* Calculated as the angle between the circles (current-2, current-1, current).
|
|
230
|
+
*/
|
|
231
|
+
this.angle = null;
|
|
232
|
+
this.normalizedRadius = 50;
|
|
233
|
+
this.maximumSliderRadius = this.normalizedRadius * 2.4;
|
|
234
|
+
this.assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
176
235
|
this.object = object;
|
|
177
|
-
this.
|
|
236
|
+
this.lastObject = lastObject;
|
|
237
|
+
this.lastLastObject = lastLastObject;
|
|
238
|
+
this.hitObjects = difficultyHitObjects;
|
|
239
|
+
this.fullGreatWindow = greatWindow * 2;
|
|
240
|
+
this.index = difficultyHitObjects.length - 1;
|
|
241
|
+
// Capped to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
242
|
+
this.startTime = object.startTime / clockRate;
|
|
243
|
+
this.endTime = object.endTime / clockRate;
|
|
244
|
+
if (lastObject) {
|
|
245
|
+
this.deltaTime = this.startTime - lastObject.startTime / clockRate;
|
|
246
|
+
this.strainTime = Math.max(this.deltaTime, DifficultyHitObject.minDeltaTime);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.deltaTime = 0;
|
|
250
|
+
this.strainTime = 0;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Computes the properties of this hitobject.
|
|
255
|
+
*
|
|
256
|
+
* @param clockRate The clock rate of the beatmap.
|
|
257
|
+
* @param hitObjects The hitobjects in the beatmap.
|
|
258
|
+
*/
|
|
259
|
+
computeProperties(clockRate,
|
|
260
|
+
// Required for `DroidDifficultyHitObject` override.
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
262
|
+
hitObjects) {
|
|
263
|
+
this.setDistances(clockRate);
|
|
178
264
|
}
|
|
179
265
|
/**
|
|
180
266
|
* Gets the difficulty hitobject at a specific index with respect to the current
|
|
@@ -187,7 +273,8 @@ class DifficultyHitObject {
|
|
|
187
273
|
* difficulty hitobject's index, `null` if the index is out of range.
|
|
188
274
|
*/
|
|
189
275
|
previous(backwardsIndex) {
|
|
190
|
-
|
|
276
|
+
var _a;
|
|
277
|
+
return (_a = this.hitObjects[this.index - backwardsIndex]) !== null && _a !== void 0 ? _a : null;
|
|
191
278
|
}
|
|
192
279
|
/**
|
|
193
280
|
* Gets the difficulty hitobject at a specific index with respect to the current
|
|
@@ -200,285 +287,128 @@ class DifficultyHitObject {
|
|
|
200
287
|
* difficulty hitobject's index, `null` if the index is out of range.
|
|
201
288
|
*/
|
|
202
289
|
next(forwardsIndex) {
|
|
203
|
-
|
|
290
|
+
var _a;
|
|
291
|
+
return ((_a = this.hitObjects[this.index + forwardsIndex + 2]) !== null && _a !== void 0 ? _a : null);
|
|
204
292
|
}
|
|
205
293
|
/**
|
|
206
294
|
* Calculates the opacity of the hitobject at a given time.
|
|
207
295
|
*
|
|
208
296
|
* @param time The time to calculate the hitobject's opacity at.
|
|
209
297
|
* @param isHidden Whether Hidden mod is used.
|
|
210
|
-
* @param mode The gamemode to calculate the opacity for.
|
|
211
298
|
* @returns The opacity of the hitobject at the given time.
|
|
212
299
|
*/
|
|
213
|
-
opacityAt(time, isHidden
|
|
300
|
+
opacityAt(time, isHidden) {
|
|
214
301
|
if (time > this.object.startTime) {
|
|
215
302
|
// Consider a hitobject as being invisible when its start time is passed.
|
|
216
303
|
// In reality the hitobject will be visible beyond its start time up until its hittable window has passed,
|
|
217
304
|
// but this is an approximation and such a case is unlikely to be hit where this function is used.
|
|
218
305
|
return 0;
|
|
219
306
|
}
|
|
220
|
-
const fadeInStartTime = this.object.startTime - this.
|
|
221
|
-
const fadeInDuration = this.timeFadeIn;
|
|
307
|
+
const fadeInStartTime = this.object.startTime - this.object.timePreempt;
|
|
308
|
+
const fadeInDuration = this.object.timeFadeIn;
|
|
222
309
|
if (isHidden) {
|
|
223
310
|
const fadeOutStartTime = fadeInStartTime + fadeInDuration;
|
|
224
|
-
const fadeOutDuration = this.
|
|
225
|
-
(mode === osuBase.Modes.droid
|
|
226
|
-
? 0.35
|
|
227
|
-
: osuBase.ModHidden.fadeOutDurationMultiplier);
|
|
311
|
+
const fadeOutDuration = this.object.timePreempt * osuBase.ModHidden.fadeOutDurationMultiplier;
|
|
228
312
|
return Math.min(osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1), 1 -
|
|
229
313
|
osuBase.MathUtils.clamp((time - fadeOutStartTime) / fadeOutDuration, 0, 1));
|
|
230
314
|
}
|
|
231
315
|
return osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1);
|
|
232
316
|
}
|
|
233
317
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
|
|
237
|
-
* can be hit with just a single tap in osu!droid.
|
|
318
|
+
* How possible is it to doubletap this object together with the next one and get perfect
|
|
319
|
+
* judgement in range from 0 to 1.
|
|
238
320
|
*
|
|
239
|
-
*
|
|
240
|
-
* @returns Whether the hitobject is considered overlapping.
|
|
321
|
+
* A value closer to 1 indicates a higher possibility.
|
|
241
322
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const previous = this.previous(0);
|
|
247
|
-
if (!previous || previous.object instanceof osuBase.Spinner) {
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
|
-
if (this.deltaTime >= 5) {
|
|
251
|
-
return false;
|
|
323
|
+
get doubletapness() {
|
|
324
|
+
const next = this.next(0);
|
|
325
|
+
if (!next) {
|
|
326
|
+
return 0;
|
|
252
327
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
328
|
+
const currentDeltaTime = Math.max(1, this.deltaTime);
|
|
329
|
+
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
330
|
+
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
331
|
+
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
332
|
+
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / this.fullGreatWindow), 2);
|
|
333
|
+
return 1 - Math.pow(speedRatio, 1 - windowRatio);
|
|
334
|
+
}
|
|
335
|
+
setDistances(clockRate) {
|
|
336
|
+
if (this.object instanceof osuBase.Slider) {
|
|
337
|
+
this.calculateSliderCursorPosition(this.object);
|
|
338
|
+
this.travelDistance = this.object.lazyTravelDistance;
|
|
339
|
+
// Bonus for repeat sliders until a better per nested object strain system can be achieved.
|
|
340
|
+
if (this.mode === osuBase.Modes.droid) {
|
|
341
|
+
this.travelDistance *= Math.pow(1 + this.object.repeatCount / 4, 1 / 4);
|
|
261
342
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* A converter used to convert normal hitobjects into difficulty hitobjects.
|
|
270
|
-
*/
|
|
271
|
-
class DifficultyHitObjectCreator {
|
|
272
|
-
/**
|
|
273
|
-
* The threshold for small circle buff for osu!droid.
|
|
274
|
-
*/
|
|
275
|
-
DROID_CIRCLESIZE_BUFF_THRESHOLD = 70;
|
|
276
|
-
/**
|
|
277
|
-
* The threshold for small circle buff for osu!standard.
|
|
278
|
-
*/
|
|
279
|
-
PC_CIRCLESIZE_BUFF_THRESHOLD = 30;
|
|
280
|
-
/**
|
|
281
|
-
* The gamemode this creator is creating for.
|
|
282
|
-
*/
|
|
283
|
-
mode = osuBase.Modes.osu;
|
|
284
|
-
/**
|
|
285
|
-
* The base normalized radius of hitobjects.
|
|
286
|
-
*/
|
|
287
|
-
normalizedRadius = 50;
|
|
288
|
-
maximumSliderRadius = this.normalizedRadius * 2.4;
|
|
289
|
-
assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
290
|
-
minDeltaTime = 25;
|
|
291
|
-
/**
|
|
292
|
-
* Generates difficulty hitobjects for difficulty calculation.
|
|
293
|
-
*/
|
|
294
|
-
generateDifficultyObjects(params) {
|
|
295
|
-
params.preempt ??= 600;
|
|
296
|
-
this.mode = params.mode;
|
|
297
|
-
if (this.mode === osuBase.Modes.droid) {
|
|
298
|
-
this.maximumSliderRadius = this.normalizedRadius * 2;
|
|
299
|
-
}
|
|
300
|
-
const droidCircleSize = new osuBase.MapStats({
|
|
301
|
-
cs: params.circleSize,
|
|
302
|
-
mods: params.mods,
|
|
303
|
-
}).calculate({ mode: osuBase.Modes.droid }).cs;
|
|
304
|
-
const droidScale = (1 - (0.7 * (droidCircleSize - 5)) / 5) / 2;
|
|
305
|
-
const osuCircleSize = new osuBase.MapStats({
|
|
306
|
-
cs: params.circleSize,
|
|
307
|
-
mods: params.mods,
|
|
308
|
-
}).calculate({ mode: osuBase.Modes.osu }).cs;
|
|
309
|
-
const osuScale = (1 - (0.7 * (osuCircleSize - 5)) / 5) / 2;
|
|
310
|
-
params.objects[0].droidScale = droidScale;
|
|
311
|
-
params.objects[0].osuScale = osuScale;
|
|
312
|
-
const scalingFactor = this.getScalingFactor(params.objects[0].getRadius(this.mode));
|
|
313
|
-
const difficultyObjects = [];
|
|
314
|
-
for (let i = 0; i < params.objects.length; ++i) {
|
|
315
|
-
const object = new DifficultyHitObject(params.objects[i], difficultyObjects);
|
|
316
|
-
object.index = difficultyObjects.length - 1;
|
|
317
|
-
object.object.droidScale = droidScale;
|
|
318
|
-
object.object.osuScale = osuScale;
|
|
319
|
-
object.timePreempt = params.preempt;
|
|
320
|
-
object.baseTimePreempt = params.preempt * params.speedMultiplier;
|
|
321
|
-
if (object.object instanceof osuBase.Slider) {
|
|
322
|
-
object.velocity =
|
|
323
|
-
object.object.velocity * params.speedMultiplier;
|
|
324
|
-
object.object.nestedHitObjects.forEach((o) => {
|
|
325
|
-
o.droidScale = droidScale;
|
|
326
|
-
o.osuScale = osuScale;
|
|
327
|
-
});
|
|
328
|
-
this.calculateSliderCursorPosition(object.object);
|
|
329
|
-
object.travelDistance = object.object.lazyTravelDistance;
|
|
330
|
-
// Bonus for repeat sliders until a better per nested object strain system can be achieved.
|
|
331
|
-
if (this.mode === osuBase.Modes.droid) {
|
|
332
|
-
object.travelDistance *= Math.pow(1 + object.object.repeats / 4, 1 / 4);
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
object.travelDistance *= Math.pow(1 + object.object.repeats / 2.5, 1 / 2.5);
|
|
336
|
-
}
|
|
337
|
-
object.travelTime = Math.max(object.object.lazyTravelTime / params.speedMultiplier, this.minDeltaTime);
|
|
338
|
-
}
|
|
339
|
-
const lastObject = difficultyObjects[i - 1];
|
|
340
|
-
const lastLastObject = difficultyObjects[i - 2];
|
|
341
|
-
object.startTime = object.object.startTime / params.speedMultiplier;
|
|
342
|
-
object.endTime = object.object.endTime / params.speedMultiplier;
|
|
343
|
-
if (!lastObject) {
|
|
344
|
-
difficultyObjects.push(object);
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
object.deltaTime =
|
|
348
|
-
(object.object.startTime - lastObject.object.startTime) /
|
|
349
|
-
params.speedMultiplier;
|
|
350
|
-
// Cap to 25ms to prevent difficulty calculation breaking from simultaneous objects.
|
|
351
|
-
object.strainTime = Math.max(this.minDeltaTime, object.deltaTime);
|
|
352
|
-
if (object.object instanceof osuBase.Spinner) {
|
|
353
|
-
difficultyObjects.push(object);
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
// We'll have two visible object arrays. The first array contains objects before the current object starts in a reversed order,
|
|
357
|
-
// while the second array contains objects after the current object ends.
|
|
358
|
-
// For overlapping factor, we also need to consider previous visible objects.
|
|
359
|
-
const prevVisibleObjects = [];
|
|
360
|
-
const nextVisibleObjects = [];
|
|
361
|
-
for (let j = i + 1; j < params.objects.length; ++j) {
|
|
362
|
-
const o = params.objects[j];
|
|
363
|
-
if (o instanceof osuBase.Spinner) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
if (o.startTime / params.speedMultiplier >
|
|
367
|
-
object.endTime + object.timePreempt) {
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
// Future objects do not have their scales set, so we set them here.
|
|
371
|
-
o.droidScale = droidScale;
|
|
372
|
-
o.osuScale = osuScale;
|
|
373
|
-
nextVisibleObjects.push(o);
|
|
374
|
-
}
|
|
375
|
-
for (let j = 0; j < object.index; ++j) {
|
|
376
|
-
const prev = object.previous(j);
|
|
377
|
-
if (prev.object instanceof osuBase.Spinner) {
|
|
378
|
-
continue;
|
|
379
|
-
}
|
|
380
|
-
if (prev.startTime >= object.startTime) {
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
if (prev.startTime < object.startTime - object.timePreempt) {
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
prevVisibleObjects.push(prev.object);
|
|
387
|
-
}
|
|
388
|
-
for (const hitObject of prevVisibleObjects) {
|
|
389
|
-
const distance = object.object
|
|
390
|
-
.getStackedPosition(this.mode)
|
|
391
|
-
.getDistance(hitObject.getStackedEndPosition(this.mode));
|
|
392
|
-
const deltaTime = object.startTime -
|
|
393
|
-
hitObject.endTime / params.speedMultiplier;
|
|
394
|
-
this.applyToOverlappingFactor(object, distance, deltaTime);
|
|
395
|
-
}
|
|
396
|
-
for (const hitObject of nextVisibleObjects) {
|
|
397
|
-
const distance = hitObject
|
|
398
|
-
.getStackedPosition(this.mode)
|
|
399
|
-
.getDistance(object.object.getStackedEndPosition(this.mode));
|
|
400
|
-
const deltaTime = hitObject.startTime / params.speedMultiplier -
|
|
401
|
-
object.endTime;
|
|
402
|
-
if (deltaTime >= 0) {
|
|
403
|
-
object.noteDensity += 1 - deltaTime / object.timePreempt;
|
|
404
|
-
}
|
|
405
|
-
this.applyToOverlappingFactor(object, distance, deltaTime);
|
|
406
|
-
}
|
|
407
|
-
if (lastObject.object instanceof osuBase.Spinner) {
|
|
408
|
-
difficultyObjects.push(object);
|
|
409
|
-
continue;
|
|
343
|
+
else {
|
|
344
|
+
this.travelDistance *= Math.pow(1 + this.object.repeatCount / 2.5, 1 / 2.5);
|
|
410
345
|
}
|
|
411
|
-
|
|
412
|
-
|
|
346
|
+
this.travelTime = Math.max(this.object.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
347
|
+
}
|
|
348
|
+
// We don't need to calculate either angle or distance when one of the last->curr objects is a spinner.
|
|
349
|
+
if (!this.lastObject ||
|
|
350
|
+
this.object instanceof osuBase.Spinner ||
|
|
351
|
+
this.lastObject instanceof osuBase.Spinner) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
355
|
+
const { scalingFactor } = this;
|
|
356
|
+
const lastCursorPosition = this.getEndCursorPosition(this.lastObject);
|
|
357
|
+
this.lazyJumpDistance = this.object
|
|
358
|
+
.getStackedPosition(this.mode)
|
|
359
|
+
.scale(scalingFactor)
|
|
360
|
+
.subtract(lastCursorPosition.scale(scalingFactor)).length;
|
|
361
|
+
this.minimumJumpTime = this.strainTime;
|
|
362
|
+
this.minimumJumpDistance = this.lazyJumpDistance;
|
|
363
|
+
if (this.lastObject instanceof osuBase.Slider) {
|
|
364
|
+
const lastTravelTime = Math.max(this.lastObject.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
|
|
365
|
+
this.minimumJumpTime = Math.max(this.strainTime - lastTravelTime, DifficultyHitObject.minDeltaTime);
|
|
366
|
+
// 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.
|
|
367
|
+
//
|
|
368
|
+
// 1. The anti-flow pattern, where players cut the slider short in order to move to the next hitobject.
|
|
369
|
+
//
|
|
370
|
+
// <======o==> ← slider
|
|
371
|
+
// | ← most natural jump path
|
|
372
|
+
// o ← a follow-up hitcircle
|
|
373
|
+
//
|
|
374
|
+
// In this case the most natural jump path is approximated by LazyJumpDistance.
|
|
375
|
+
//
|
|
376
|
+
// 2. The flow pattern, where players follow through the slider to its visual extent into the next hitobject.
|
|
377
|
+
//
|
|
378
|
+
// <======o==>---o
|
|
379
|
+
// ↑
|
|
380
|
+
// most natural jump path
|
|
381
|
+
//
|
|
382
|
+
// In this case the most natural jump path is better approximated by a new distance called "tailJumpDistance" - the distance between the slider's tail and the next hitobject.
|
|
383
|
+
//
|
|
384
|
+
// Thus, the player is assumed to jump the minimum of these two distances in all cases.
|
|
385
|
+
const tailJumpDistance = this.lastObject.tail
|
|
413
386
|
.getStackedPosition(this.mode)
|
|
414
|
-
.
|
|
415
|
-
.
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
// In this case the most natural jump path is approximated by LazyJumpDistance.
|
|
429
|
-
//
|
|
430
|
-
// 2. The flow pattern, where players follow through the slider to its visual extent into the next hitobject.
|
|
431
|
-
//
|
|
432
|
-
// <======o==>---o
|
|
433
|
-
// ↑
|
|
434
|
-
// most natural jump path
|
|
435
|
-
//
|
|
436
|
-
// In this case the most natural jump path is better approximated by a new distance called "tailJumpDistance" - the distance between the slider's tail and the next hitobject.
|
|
437
|
-
//
|
|
438
|
-
// Thus, the player is assumed to jump the minimum of these two distances in all cases.
|
|
439
|
-
const tailJumpDistance = lastObject.object.tail
|
|
440
|
-
.getStackedPosition(this.mode)
|
|
441
|
-
.subtract(object.object.getStackedPosition(this.mode))
|
|
442
|
-
.length * scalingFactor;
|
|
443
|
-
object.minimumJumpDistance = Math.max(0, Math.min(object.lazyJumpDistance -
|
|
444
|
-
(this.maximumSliderRadius -
|
|
445
|
-
this.assumedSliderRadius), tailJumpDistance - this.maximumSliderRadius));
|
|
446
|
-
}
|
|
447
|
-
if (lastLastObject && !(lastLastObject.object instanceof osuBase.Spinner)) {
|
|
448
|
-
const lastLastCursorPosition = this.getEndCursorPosition(lastLastObject.object);
|
|
449
|
-
const v1 = lastLastCursorPosition.subtract(lastObject.object.getStackedPosition(this.mode));
|
|
450
|
-
const v2 = object.object
|
|
451
|
-
.getStackedPosition(this.mode)
|
|
452
|
-
.subtract(lastCursorPosition);
|
|
453
|
-
const dot = v1.dot(v2);
|
|
454
|
-
const det = v1.x * v2.y - v1.y * v2.x;
|
|
455
|
-
object.angle = Math.abs(Math.atan2(det, dot));
|
|
456
|
-
}
|
|
457
|
-
difficultyObjects.push(object);
|
|
387
|
+
.subtract(this.object.getStackedPosition(this.mode))
|
|
388
|
+
.length * scalingFactor;
|
|
389
|
+
this.minimumJumpDistance = Math.max(0, Math.min(this.lazyJumpDistance -
|
|
390
|
+
(this.maximumSliderRadius - this.assumedSliderRadius), tailJumpDistance - this.maximumSliderRadius));
|
|
391
|
+
}
|
|
392
|
+
if (this.lastLastObject && !(this.lastLastObject instanceof osuBase.Spinner)) {
|
|
393
|
+
const lastLastCursorPosition = this.getEndCursorPosition(this.lastLastObject);
|
|
394
|
+
const v1 = lastLastCursorPosition.subtract(this.lastObject.getStackedPosition(this.mode));
|
|
395
|
+
const v2 = this.object
|
|
396
|
+
.getStackedPosition(this.mode)
|
|
397
|
+
.subtract(lastCursorPosition);
|
|
398
|
+
const dot = v1.dot(v2);
|
|
399
|
+
const det = v1.x * v2.y - v1.y * v2.x;
|
|
400
|
+
this.angle = Math.abs(Math.atan2(det, dot));
|
|
458
401
|
}
|
|
459
|
-
return difficultyObjects;
|
|
460
402
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Calculates a slider's cursor position.
|
|
463
|
-
*/
|
|
464
403
|
calculateSliderCursorPosition(slider) {
|
|
465
404
|
if (slider.lazyEndPosition) {
|
|
466
405
|
return;
|
|
467
406
|
}
|
|
468
|
-
// Droid doesn't have a legacy slider tail. Since beatmap parser defaults slider tail
|
|
469
|
-
// to legacy slider tail, it needs to be changed to real slider tail first.
|
|
470
407
|
if (this.mode === osuBase.Modes.droid) {
|
|
471
|
-
slider.tail.startTime += osuBase.Slider.legacyLastTickOffset;
|
|
472
|
-
slider.tail.endTime += osuBase.Slider.legacyLastTickOffset;
|
|
473
|
-
slider.nestedHitObjects.sort((a, b) => a.startTime - b.startTime);
|
|
474
408
|
// Temporary lazy end position until a real result can be derived.
|
|
475
409
|
slider.lazyEndPosition = slider.getStackedPosition(this.mode);
|
|
476
|
-
// Stop here if the slider has too short duration
|
|
477
|
-
//
|
|
478
|
-
// end position heavily, which we do not want to happen.
|
|
479
|
-
//
|
|
480
|
-
// In the real game, this shouldn't happen. Perhaps we need to reinvestigate this
|
|
481
|
-
// in the future.
|
|
410
|
+
// Stop here if the slider has too short duration, allowing the player to essentially
|
|
411
|
+
// complete the slider without movement, making travel distance and time irrelevant.
|
|
482
412
|
if (osuBase.Precision.almostEqualsNumber(slider.startTime, slider.endTime)) {
|
|
483
413
|
return;
|
|
484
414
|
}
|
|
@@ -498,7 +428,7 @@ class DifficultyHitObjectCreator {
|
|
|
498
428
|
.getStackedPosition(this.mode)
|
|
499
429
|
.add(slider.path.positionAt(endTimeMin));
|
|
500
430
|
let currentCursorPosition = slider.getStackedPosition(this.mode);
|
|
501
|
-
const scalingFactor = this.normalizedRadius / slider.
|
|
431
|
+
const scalingFactor = this.normalizedRadius / slider.radius;
|
|
502
432
|
for (let i = 1; i < slider.nestedHitObjects.length; ++i) {
|
|
503
433
|
const currentMovementObject = slider.nestedHitObjects[i];
|
|
504
434
|
let currentMovement = currentMovementObject
|
|
@@ -537,202 +467,25 @@ class DifficultyHitObjectCreator {
|
|
|
537
467
|
}
|
|
538
468
|
}
|
|
539
469
|
}
|
|
540
|
-
/**
|
|
541
|
-
* Gets the scaling factor of a radius.
|
|
542
|
-
*
|
|
543
|
-
* @param radius The radius to get the scaling factor from.
|
|
544
|
-
*/
|
|
545
|
-
getScalingFactor(radius) {
|
|
546
|
-
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
547
|
-
let scalingFactor = this.normalizedRadius / radius;
|
|
548
|
-
// High circle size (small CS) bonus
|
|
549
|
-
switch (this.mode) {
|
|
550
|
-
case osuBase.Modes.droid:
|
|
551
|
-
if (radius < this.DROID_CIRCLESIZE_BUFF_THRESHOLD) {
|
|
552
|
-
scalingFactor *=
|
|
553
|
-
1 +
|
|
554
|
-
Math.pow((this.DROID_CIRCLESIZE_BUFF_THRESHOLD - radius) /
|
|
555
|
-
50, 2);
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
case osuBase.Modes.osu:
|
|
559
|
-
if (radius < this.PC_CIRCLESIZE_BUFF_THRESHOLD) {
|
|
560
|
-
scalingFactor *=
|
|
561
|
-
1 +
|
|
562
|
-
Math.min(this.PC_CIRCLESIZE_BUFF_THRESHOLD - radius, 5) /
|
|
563
|
-
50;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
return scalingFactor;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Returns the end cursor position of a hitobject.
|
|
570
|
-
*/
|
|
571
470
|
getEndCursorPosition(object) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
applyToOverlappingFactor(object, distance, deltaTime) {
|
|
580
|
-
// Penalize objects that are too close to the object in both distance
|
|
581
|
-
// and delta time to prevent stream maps from being overweighted.
|
|
582
|
-
object.overlappingFactor +=
|
|
583
|
-
Math.max(0, 1 - distance / (3 * object.object.getRadius(this.mode))) *
|
|
584
|
-
(7.5 /
|
|
585
|
-
(1 +
|
|
586
|
-
Math.exp(0.15 * (Math.max(deltaTime, this.minDeltaTime) - 75))));
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* The base of a difficulty calculator.
|
|
592
|
-
*/
|
|
593
|
-
class DifficultyCalculator {
|
|
594
|
-
/**
|
|
595
|
-
* The calculated beatmap.
|
|
596
|
-
*/
|
|
597
|
-
beatmap;
|
|
598
|
-
/**
|
|
599
|
-
* The difficulty objects of the beatmap.
|
|
600
|
-
*/
|
|
601
|
-
objects = [];
|
|
602
|
-
/**
|
|
603
|
-
* The modifications applied.
|
|
604
|
-
*/
|
|
605
|
-
mods = [];
|
|
606
|
-
/**
|
|
607
|
-
* The total star rating of the beatmap.
|
|
608
|
-
*/
|
|
609
|
-
total = 0;
|
|
610
|
-
/**
|
|
611
|
-
* The map statistics of the beatmap after modifications are applied.
|
|
612
|
-
*/
|
|
613
|
-
stats = new osuBase.MapStats();
|
|
614
|
-
/**
|
|
615
|
-
* The strain peaks of various calculated difficulties.
|
|
616
|
-
*/
|
|
617
|
-
strainPeaks = {
|
|
618
|
-
aimWithSliders: [],
|
|
619
|
-
aimWithoutSliders: [],
|
|
620
|
-
speed: [],
|
|
621
|
-
flashlight: [],
|
|
622
|
-
};
|
|
623
|
-
sectionLength = 400;
|
|
624
|
-
/**
|
|
625
|
-
* Constructs a new instance of the calculator.
|
|
626
|
-
*
|
|
627
|
-
* @param beatmap The beatmap to calculate. This beatmap will be deep-cloned to prevent reference changes.
|
|
628
|
-
*/
|
|
629
|
-
constructor(beatmap) {
|
|
630
|
-
this.beatmap = osuBase.Utils.deepCopy(beatmap);
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Calculates the star rating of the specified beatmap.
|
|
634
|
-
*
|
|
635
|
-
* The beatmap is analyzed in chunks of `sectionLength` duration.
|
|
636
|
-
* For each chunk the highest hitobject strains are added to
|
|
637
|
-
* a list which is then collapsed into a weighted sum, much
|
|
638
|
-
* like scores are weighted on a user's profile.
|
|
639
|
-
*
|
|
640
|
-
* For subsequent chunks, the initial max strain is calculated
|
|
641
|
-
* by decaying the previous hitobject's strain until the
|
|
642
|
-
* beginning of the new chunk.
|
|
643
|
-
*
|
|
644
|
-
* @param options Options for the difficulty calculation.
|
|
645
|
-
*/
|
|
646
|
-
calculate(options) {
|
|
647
|
-
this.mods = options?.mods ?? [];
|
|
648
|
-
this.stats = new osuBase.MapStats({
|
|
649
|
-
cs: this.beatmap.difficulty.cs,
|
|
650
|
-
ar: this.beatmap.difficulty.ar,
|
|
651
|
-
od: this.beatmap.difficulty.od,
|
|
652
|
-
hp: this.beatmap.difficulty.hp,
|
|
653
|
-
mods: options?.mods,
|
|
654
|
-
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
655
|
-
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
656
|
-
}).calculate({ mode: this.mode });
|
|
657
|
-
this.populateDifficultyAttributes();
|
|
658
|
-
this.generateDifficultyHitObjects();
|
|
659
|
-
this.calculateAll();
|
|
660
|
-
return this;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Generates difficulty hitobjects for this calculator.
|
|
664
|
-
*/
|
|
665
|
-
generateDifficultyHitObjects() {
|
|
666
|
-
this.objects.length = 0;
|
|
667
|
-
this.objects.push(...new DifficultyHitObjectCreator().generateDifficultyObjects({
|
|
668
|
-
objects: this.beatmap.hitObjects.objects,
|
|
669
|
-
circleSize: this.beatmap.difficulty.cs,
|
|
670
|
-
mods: this.mods,
|
|
671
|
-
speedMultiplier: this.stats.speedMultiplier,
|
|
672
|
-
mode: this.mode,
|
|
673
|
-
preempt: osuBase.MapStats.arToMS(this.stats.ar),
|
|
674
|
-
}));
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Calculates the skills provided.
|
|
678
|
-
*
|
|
679
|
-
* @param skills The skills to calculate.
|
|
680
|
-
*/
|
|
681
|
-
calculateSkills(...skills) {
|
|
682
|
-
// The first object doesn't generate a strain, so we begin calculating from the second object.
|
|
683
|
-
this.objects.slice(1).forEach((h, i) => {
|
|
684
|
-
skills.forEach((skill) => {
|
|
685
|
-
skill.process(h);
|
|
686
|
-
if (i === this.objects.length - 2) {
|
|
687
|
-
// Don't forget to save the last strain peak, which would otherwise be ignored.
|
|
688
|
-
skill.saveCurrentPeak();
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Populates the stored difficulty attributes with necessary data.
|
|
695
|
-
*/
|
|
696
|
-
populateDifficultyAttributes() {
|
|
697
|
-
this.attributes.approachRate = this.stats.ar;
|
|
698
|
-
this.attributes.hitCircleCount = this.beatmap.hitObjects.circles;
|
|
699
|
-
this.attributes.maxCombo = this.beatmap.maxCombo;
|
|
700
|
-
this.attributes.mods = this.mods.slice();
|
|
701
|
-
this.attributes.overallDifficulty = this.stats.od;
|
|
702
|
-
this.attributes.sliderCount = this.beatmap.hitObjects.sliders;
|
|
703
|
-
this.attributes.spinnerCount = this.beatmap.hitObjects.spinners;
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Calculates the star rating value of a difficulty.
|
|
707
|
-
*
|
|
708
|
-
* @param difficulty The difficulty to calculate.
|
|
709
|
-
*/
|
|
710
|
-
starValue(difficulty) {
|
|
711
|
-
return Math.sqrt(difficulty) * this.difficultyMultiplier;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Calculates the base performance value of a difficulty rating.
|
|
715
|
-
*
|
|
716
|
-
* @param rating The difficulty rating.
|
|
717
|
-
*/
|
|
718
|
-
basePerformanceValue(rating) {
|
|
719
|
-
return Math.pow(5 * Math.max(1, rating / 0.0675) - 4, 3) / 100000;
|
|
471
|
+
var _a;
|
|
472
|
+
let pos = object.getStackedPosition(this.mode);
|
|
473
|
+
if (object instanceof osuBase.Slider) {
|
|
474
|
+
this.calculateSliderCursorPosition(object);
|
|
475
|
+
pos = (_a = object.lazyEndPosition) !== null && _a !== void 0 ? _a : pos;
|
|
476
|
+
}
|
|
477
|
+
return pos;
|
|
720
478
|
}
|
|
721
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* The lowest possible delta time value.
|
|
482
|
+
*/
|
|
483
|
+
DifficultyHitObject.minDeltaTime = 25;
|
|
722
484
|
|
|
723
485
|
/**
|
|
724
486
|
* An evaluator for calculating osu!droid Aim skill.
|
|
725
487
|
*/
|
|
726
488
|
class DroidAimEvaluator extends AimEvaluator {
|
|
727
|
-
static wideAngleMultiplier = 1.65;
|
|
728
|
-
static sliderMultiplier = 1.5;
|
|
729
|
-
static velocityChangeMultiplier = 0.85;
|
|
730
|
-
/**
|
|
731
|
-
* Spacing threshold for a single hitobject spacing.
|
|
732
|
-
*/
|
|
733
|
-
static SINGLE_SPACING_THRESHOLD = 175;
|
|
734
|
-
// ~200 1/2 BPM jumps
|
|
735
|
-
static minSpeedBonus = 150;
|
|
736
489
|
/**
|
|
737
490
|
* Evaluates the difficulty of aiming the current object, based on:
|
|
738
491
|
*
|
|
@@ -750,15 +503,16 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
750
503
|
current.isOverlapping(true)) {
|
|
751
504
|
return 0;
|
|
752
505
|
}
|
|
753
|
-
return (this.
|
|
754
|
-
this.
|
|
506
|
+
return (this.snapAimStrainOf(current, withSliders) +
|
|
507
|
+
this.flowAimStrainOf(current));
|
|
755
508
|
}
|
|
756
509
|
/**
|
|
757
|
-
* Calculates the aim strain of a hitobject.
|
|
510
|
+
* Calculates the snap aim strain of a hitobject.
|
|
758
511
|
*/
|
|
759
|
-
static
|
|
512
|
+
static snapAimStrainOf(current, withSliders) {
|
|
513
|
+
var _a;
|
|
760
514
|
if (current.index <= 1 ||
|
|
761
|
-
current.previous(0)
|
|
515
|
+
((_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
|
|
762
516
|
return 0;
|
|
763
517
|
}
|
|
764
518
|
const last = current.previous(0);
|
|
@@ -855,6 +609,14 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
855
609
|
// Reward sliders based on velocity.
|
|
856
610
|
sliderBonus = last.travelDistance / last.travelTime;
|
|
857
611
|
}
|
|
612
|
+
// Reduce snap aim difficulty for low spacing as the player is more likely to perform
|
|
613
|
+
// a flowing movement instead of snapping to the object. This also prevents the weird
|
|
614
|
+
// scenario of awarding flow aim difficulty in snap aim.
|
|
615
|
+
const flowBonus = Math.pow(last.minimumJumpDistance / this.singleSpacingThreshold, 3.5);
|
|
616
|
+
if (flowBonus < 1) {
|
|
617
|
+
strain *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
618
|
+
wideAngleBonus *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
619
|
+
}
|
|
858
620
|
// Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
|
|
859
621
|
strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
|
|
860
622
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
@@ -866,32 +628,49 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
866
628
|
return strain;
|
|
867
629
|
}
|
|
868
630
|
/**
|
|
869
|
-
* Calculates the
|
|
631
|
+
* Calculates the flow aim strain of a hitobject.
|
|
870
632
|
*/
|
|
871
|
-
static
|
|
633
|
+
static flowAimStrainOf(current) {
|
|
634
|
+
var _a;
|
|
872
635
|
let speedBonus = 1;
|
|
873
636
|
if (current.strainTime < this.minSpeedBonus) {
|
|
874
637
|
speedBonus +=
|
|
875
638
|
0.75 *
|
|
876
|
-
Math.pow((this.minSpeedBonus - current.strainTime) /
|
|
639
|
+
Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
|
|
877
640
|
}
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
641
|
+
const prev = current.previous(0);
|
|
642
|
+
// Punish low spacing as it is easier to aim.
|
|
643
|
+
const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
|
|
644
|
+
const distance = travelDistance + current.minimumJumpDistance;
|
|
645
|
+
const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
|
|
646
|
+
let adjustedDistanceScale = 1;
|
|
647
|
+
// Reward for inconsistent angles while punishing consistent ones.
|
|
648
|
+
// Only apply the adjustment to patterns with the same delta time.
|
|
649
|
+
// Graph: https://www.desmos.com/calculator/soomupyfwp
|
|
650
|
+
if (current.angle !== null &&
|
|
651
|
+
typeof (prev === null || prev === void 0 ? void 0 : prev.angle) === "number" &&
|
|
652
|
+
Math.abs(current.deltaTime - prev.deltaTime) < 10) {
|
|
653
|
+
const angleDiff = Math.abs(current.angle - prev.angle);
|
|
654
|
+
const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
|
|
655
|
+
const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
|
|
656
|
+
const angularVelocityBonus = Math.max(0, Math.pow(angularVelocity, 0.4) - 1);
|
|
657
|
+
adjustedDistanceScale = 0.65 + angularVelocityBonus * 0.45;
|
|
658
|
+
}
|
|
659
|
+
return ((200 * speedBonus * shortDistancePenalty * adjustedDistanceScale) /
|
|
883
660
|
current.strainTime);
|
|
884
661
|
}
|
|
885
662
|
}
|
|
663
|
+
DroidAimEvaluator.wideAngleMultiplier = 1.65;
|
|
664
|
+
DroidAimEvaluator.sliderMultiplier = 1.5;
|
|
665
|
+
DroidAimEvaluator.velocityChangeMultiplier = 0.85;
|
|
666
|
+
DroidAimEvaluator.singleSpacingThreshold = 100;
|
|
667
|
+
// 200 1/4 BPM delta time
|
|
668
|
+
DroidAimEvaluator.minSpeedBonus = 75;
|
|
886
669
|
|
|
887
670
|
/**
|
|
888
671
|
* A bare minimal abstract skill for fully custom skill implementations.
|
|
889
672
|
*/
|
|
890
673
|
class Skill {
|
|
891
|
-
/**
|
|
892
|
-
* The mods that this skill processes.
|
|
893
|
-
*/
|
|
894
|
-
mods;
|
|
895
674
|
constructor(mods) {
|
|
896
675
|
this.mods = mods;
|
|
897
676
|
}
|
|
@@ -902,33 +681,29 @@ class Skill {
|
|
|
902
681
|
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
903
682
|
*/
|
|
904
683
|
class StrainSkill extends Skill {
|
|
684
|
+
constructor() {
|
|
685
|
+
super(...arguments);
|
|
686
|
+
/**
|
|
687
|
+
* Strain peaks are stored here.
|
|
688
|
+
*/
|
|
689
|
+
this.strainPeaks = [];
|
|
690
|
+
this._objectStrains = [];
|
|
691
|
+
this.difficulty = 0;
|
|
692
|
+
this.sectionLength = 400;
|
|
693
|
+
this.currentStrain = 0;
|
|
694
|
+
this.currentSectionPeak = 0;
|
|
695
|
+
this.currentSectionEnd = 0;
|
|
696
|
+
}
|
|
905
697
|
/**
|
|
906
|
-
* The
|
|
907
|
-
*/
|
|
908
|
-
currentStrain = 0;
|
|
909
|
-
/**
|
|
910
|
-
* The current section's strain peak.
|
|
911
|
-
*/
|
|
912
|
-
currentSectionPeak = 0;
|
|
913
|
-
/**
|
|
914
|
-
* Strain peaks are stored here.
|
|
915
|
-
*/
|
|
916
|
-
strainPeaks = [];
|
|
917
|
-
sectionLength = 400;
|
|
918
|
-
currentSectionEnd = 0;
|
|
919
|
-
isFirstObject = true;
|
|
920
|
-
/**
|
|
921
|
-
* Calculates the strain value of a hitobject and stores the value in it. This value is affected by previously processed objects.
|
|
922
|
-
*
|
|
923
|
-
* @param current The hitobject to process.
|
|
698
|
+
* The strains of hitobjects.
|
|
924
699
|
*/
|
|
700
|
+
get objectStrains() {
|
|
701
|
+
return this._objectStrains;
|
|
702
|
+
}
|
|
925
703
|
process(current) {
|
|
926
704
|
// The first object doesn't generate a strain, so we begin with an incremented section end
|
|
927
|
-
if (
|
|
928
|
-
this.currentSectionEnd =
|
|
929
|
-
Math.ceil(current.startTime / this.sectionLength) *
|
|
930
|
-
this.sectionLength;
|
|
931
|
-
this.isFirstObject = false;
|
|
705
|
+
if (current.index === 0) {
|
|
706
|
+
this.currentSectionEnd = this.calculateCurrentSectionStart(current);
|
|
932
707
|
}
|
|
933
708
|
while (current.startTime > this.currentSectionEnd) {
|
|
934
709
|
this.saveCurrentPeak();
|
|
@@ -939,6 +714,10 @@ class StrainSkill extends Skill {
|
|
|
939
714
|
this.currentStrain = this.strainValueAt(current);
|
|
940
715
|
this.saveToHitObject(current);
|
|
941
716
|
this.currentSectionPeak = Math.max(this.currentStrain, this.currentSectionPeak);
|
|
717
|
+
if (!current.next(0)) {
|
|
718
|
+
// Don't forget to save the last strain peak, which would otherwise be ignored.
|
|
719
|
+
this.saveCurrentPeak();
|
|
720
|
+
}
|
|
942
721
|
}
|
|
943
722
|
/**
|
|
944
723
|
* Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty.
|
|
@@ -946,6 +725,21 @@ class StrainSkill extends Skill {
|
|
|
946
725
|
saveCurrentPeak() {
|
|
947
726
|
this.strainPeaks.push(this.currentSectionPeak);
|
|
948
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* Returns the number of strains weighed against the top strain.
|
|
730
|
+
*
|
|
731
|
+
* The result is scaled by clock rate as it affects the total number of strains.
|
|
732
|
+
*/
|
|
733
|
+
countDifficultStrains() {
|
|
734
|
+
if (this.difficulty === 0) {
|
|
735
|
+
return 0;
|
|
736
|
+
}
|
|
737
|
+
// This is what the top strain is if all strain values were identical.
|
|
738
|
+
const consistentTopStrain = this.difficulty / 10;
|
|
739
|
+
// Use a weighted sum of all strains.
|
|
740
|
+
return this._objectStrains.reduce((total, next) => total +
|
|
741
|
+
1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
|
|
742
|
+
}
|
|
949
743
|
/**
|
|
950
744
|
* Calculates strain decay for a specified time frame.
|
|
951
745
|
*
|
|
@@ -954,18 +748,26 @@ class StrainSkill extends Skill {
|
|
|
954
748
|
strainDecay(ms) {
|
|
955
749
|
return Math.pow(this.strainDecayBase, ms / 1000);
|
|
956
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Calculates the starting time of a strain section at an object.
|
|
753
|
+
*
|
|
754
|
+
* @param current The object at which the strain section starts.
|
|
755
|
+
* @returns The start time of the strain section.
|
|
756
|
+
*/
|
|
757
|
+
calculateCurrentSectionStart(current) {
|
|
758
|
+
return (Math.ceil(current.startTime / this.sectionLength) *
|
|
759
|
+
this.sectionLength);
|
|
760
|
+
}
|
|
957
761
|
/**
|
|
958
762
|
* Sets the initial strain level for a new section.
|
|
959
763
|
*
|
|
960
|
-
* @param
|
|
764
|
+
* @param time The beginning of the new section in milliseconds.
|
|
961
765
|
* @param current The current hitobject.
|
|
962
766
|
*/
|
|
963
|
-
startNewSectionFrom(
|
|
964
|
-
// The maximum strain of the new section is not zero by default
|
|
767
|
+
startNewSectionFrom(time, current) {
|
|
768
|
+
// The maximum strain of the new section is not zero by default.
|
|
965
769
|
// This means we need to capture the strain level at the beginning of the new section, and use that as the initial peak level.
|
|
966
|
-
this.currentSectionPeak =
|
|
967
|
-
this.currentStrain *
|
|
968
|
-
this.strainDecay(offset - current.previous(0).startTime);
|
|
770
|
+
this.currentSectionPeak = this.calculateInitialStrain(time, current);
|
|
969
771
|
}
|
|
970
772
|
}
|
|
971
773
|
|
|
@@ -974,6 +776,45 @@ class StrainSkill extends Skill {
|
|
|
974
776
|
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
975
777
|
*/
|
|
976
778
|
class DroidSkill extends StrainSkill {
|
|
779
|
+
constructor() {
|
|
780
|
+
super(...arguments);
|
|
781
|
+
/**
|
|
782
|
+
* The minimum number of strains to judge when computing for retryability.
|
|
783
|
+
*/
|
|
784
|
+
this.minimumRetryabilityStrains = 500;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
788
|
+
*
|
|
789
|
+
* Earlier difficult strains indicate higher retryability.
|
|
790
|
+
*
|
|
791
|
+
* The result is scaled by clock rate as it affects the total number of strains.
|
|
792
|
+
*
|
|
793
|
+
* @returns A number between 0 and 1. A higher value indicates higher retryability.
|
|
794
|
+
*/
|
|
795
|
+
countRetryability() {
|
|
796
|
+
if (this._objectStrains.length === 0) {
|
|
797
|
+
return 0;
|
|
798
|
+
}
|
|
799
|
+
const maxStrain = Math.max(...this._objectStrains);
|
|
800
|
+
if (maxStrain === 0) {
|
|
801
|
+
return 0;
|
|
802
|
+
}
|
|
803
|
+
let weightedStrainSum = 0;
|
|
804
|
+
for (let i = 0; i < this._objectStrains.length; ++i) {
|
|
805
|
+
const strainRatio = this._objectStrains[i] / maxStrain;
|
|
806
|
+
// Give more weight to earlier strains.
|
|
807
|
+
const strainPositionWeight = 1 - Math.pow(i / this._objectStrains.length, 0.75) / 10;
|
|
808
|
+
weightedStrainSum += strainRatio * strainPositionWeight;
|
|
809
|
+
}
|
|
810
|
+
return (1 -
|
|
811
|
+
weightedStrainSum /
|
|
812
|
+
Math.max(this._objectStrains.length, this.minimumRetryabilityStrains));
|
|
813
|
+
}
|
|
814
|
+
process(current) {
|
|
815
|
+
super.process(current);
|
|
816
|
+
this._objectStrains.push(this.getObjectStrain(current));
|
|
817
|
+
}
|
|
977
818
|
difficultyValue() {
|
|
978
819
|
const strains = this.strainPeaks.slice();
|
|
979
820
|
if (this.reducedSectionCount > 0) {
|
|
@@ -986,12 +827,15 @@ class DroidSkill extends StrainSkill {
|
|
|
986
827
|
}
|
|
987
828
|
// Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
|
|
988
829
|
// This also applies to two sets of notes with equal difficulty.
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
830
|
+
this.difficulty = 0;
|
|
831
|
+
for (const strain of strains) {
|
|
832
|
+
this.difficulty += Math.pow(strain, 1 / Math.log2(this.starsPerDouble));
|
|
833
|
+
}
|
|
834
|
+
this.difficulty = Math.pow(this.difficulty, Math.log2(this.starsPerDouble));
|
|
835
|
+
return this.difficulty;
|
|
836
|
+
}
|
|
837
|
+
calculateCurrentSectionStart(current) {
|
|
838
|
+
return current.startTime;
|
|
995
839
|
}
|
|
996
840
|
}
|
|
997
841
|
|
|
@@ -999,35 +843,40 @@ class DroidSkill extends StrainSkill {
|
|
|
999
843
|
* Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
|
|
1000
844
|
*/
|
|
1001
845
|
class DroidAim extends DroidSkill {
|
|
1002
|
-
skillMultiplier = 24.55;
|
|
1003
|
-
strainDecayBase = 0.15;
|
|
1004
|
-
reducedSectionCount = 10;
|
|
1005
|
-
reducedSectionBaseline = 0.75;
|
|
1006
|
-
starsPerDouble = 1.05;
|
|
1007
|
-
withSliders;
|
|
1008
846
|
constructor(mods, withSliders) {
|
|
1009
847
|
super(mods);
|
|
848
|
+
this.strainDecayBase = 0.15;
|
|
849
|
+
this.reducedSectionCount = 10;
|
|
850
|
+
this.reducedSectionBaseline = 0.75;
|
|
851
|
+
this.starsPerDouble = 1.05;
|
|
852
|
+
this.skillMultiplier = 24.55;
|
|
853
|
+
this.currentAimStrain = 0;
|
|
1010
854
|
this.withSliders = withSliders;
|
|
1011
855
|
}
|
|
1012
|
-
/**
|
|
1013
|
-
* @param current The hitobject to calculate.
|
|
1014
|
-
*/
|
|
1015
856
|
strainValueAt(current) {
|
|
1016
|
-
this.
|
|
1017
|
-
this.
|
|
857
|
+
this.currentAimStrain *= this.strainDecay(current.deltaTime);
|
|
858
|
+
this.currentAimStrain +=
|
|
1018
859
|
DroidAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
1019
860
|
this.skillMultiplier;
|
|
1020
|
-
return this.
|
|
861
|
+
return this.currentAimStrain;
|
|
862
|
+
}
|
|
863
|
+
calculateInitialStrain(time, current) {
|
|
864
|
+
var _a, _b;
|
|
865
|
+
return (this.currentAimStrain *
|
|
866
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
867
|
+
}
|
|
868
|
+
getObjectStrain() {
|
|
869
|
+
return this.currentAimStrain;
|
|
1021
870
|
}
|
|
1022
871
|
/**
|
|
1023
872
|
* @param current The hitobject to save to.
|
|
1024
873
|
*/
|
|
1025
874
|
saveToHitObject(current) {
|
|
1026
875
|
if (this.withSliders) {
|
|
1027
|
-
current.aimStrainWithSliders = this.
|
|
876
|
+
current.aimStrainWithSliders = this.currentAimStrain;
|
|
1028
877
|
}
|
|
1029
878
|
else {
|
|
1030
|
-
current.aimStrainWithoutSliders = this.
|
|
879
|
+
current.aimStrainWithoutSliders = this.currentAimStrain;
|
|
1031
880
|
}
|
|
1032
881
|
}
|
|
1033
882
|
}
|
|
@@ -1038,9 +887,9 @@ class DroidAim extends DroidSkill {
|
|
|
1038
887
|
* This class should be considered an "evaluating" class and not persisted.
|
|
1039
888
|
*/
|
|
1040
889
|
class SpeedEvaluator {
|
|
1041
|
-
// ~200 1/4 BPM streams
|
|
1042
|
-
static minSpeedBonus = 75;
|
|
1043
890
|
}
|
|
891
|
+
// ~200 1/4 BPM streams
|
|
892
|
+
SpeedEvaluator.minSpeedBonus = 75;
|
|
1044
893
|
|
|
1045
894
|
/**
|
|
1046
895
|
* An evaluator for calculating osu!droid tap skill.
|
|
@@ -1051,44 +900,33 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
1051
900
|
*
|
|
1052
901
|
* - time between pressing the previous and current object,
|
|
1053
902
|
* - distance between those objects,
|
|
1054
|
-
* -
|
|
903
|
+
* - how easily they can be cheesed,
|
|
904
|
+
* - and the strain time cap.
|
|
1055
905
|
*
|
|
1056
906
|
* @param current The current object.
|
|
1057
|
-
* @param greatWindow The great hit window of the current object.
|
|
1058
907
|
* @param considerCheesability Whether to consider cheesability.
|
|
908
|
+
* @param strainTimeCap The strain time to cap the object's strain time to.
|
|
1059
909
|
*/
|
|
1060
|
-
static evaluateDifficultyOf(current,
|
|
910
|
+
static evaluateDifficultyOf(current, considerCheesability, strainTimeCap) {
|
|
1061
911
|
if (current.object instanceof osuBase.Spinner ||
|
|
1062
912
|
// Exclude overlapping objects that can be tapped at once.
|
|
1063
913
|
current.isOverlapping(false)) {
|
|
1064
914
|
return 0;
|
|
1065
915
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
//
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
1074
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
1075
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
1076
|
-
const speedRatio = currentDeltaTime /
|
|
1077
|
-
Math.max(currentDeltaTime, deltaDifference);
|
|
1078
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
1079
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1080
|
-
}
|
|
1081
|
-
// Cap deltatime to the OD 300 hitwindow.
|
|
1082
|
-
// 0.63 is derived from making sure 240 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.9 limits the effect of the cap.
|
|
1083
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime / greatWindowFull / 0.63, 0.9, 1);
|
|
1084
|
-
}
|
|
916
|
+
const doubletapness = considerCheesability
|
|
917
|
+
? 1 - current.doubletapness
|
|
918
|
+
: 1;
|
|
919
|
+
const strainTime = strainTimeCap !== undefined
|
|
920
|
+
? // We cap the strain time to 50 here as the chance of vibro is higher in any BPM higher than 300.
|
|
921
|
+
Math.max(50, strainTimeCap, current.strainTime)
|
|
922
|
+
: current.strainTime;
|
|
1085
923
|
let speedBonus = 1;
|
|
1086
924
|
if (strainTime < this.minSpeedBonus) {
|
|
1087
925
|
speedBonus +=
|
|
1088
926
|
0.75 *
|
|
1089
927
|
Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - strainTime) / 40), 2);
|
|
1090
928
|
}
|
|
1091
|
-
return (speedBonus * doubletapness) / strainTime;
|
|
929
|
+
return (speedBonus * Math.pow(doubletapness, 1.5)) / strainTime;
|
|
1092
930
|
}
|
|
1093
931
|
}
|
|
1094
932
|
|
|
@@ -1096,38 +934,89 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
1096
934
|
* Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
|
|
1097
935
|
*/
|
|
1098
936
|
class DroidTap extends DroidSkill {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
greatWindow;
|
|
1107
|
-
constructor(mods, overallDifficulty) {
|
|
937
|
+
/**
|
|
938
|
+
* The delta time of hitobjects.
|
|
939
|
+
*/
|
|
940
|
+
get objectDeltaTimes() {
|
|
941
|
+
return this._objectDeltaTimes;
|
|
942
|
+
}
|
|
943
|
+
constructor(mods, considerCheesability, strainTimeCap) {
|
|
1108
944
|
super(mods);
|
|
1109
|
-
this.
|
|
945
|
+
this.reducedSectionCount = 10;
|
|
946
|
+
this.reducedSectionBaseline = 0.75;
|
|
947
|
+
this.strainDecayBase = 0.3;
|
|
948
|
+
this.starsPerDouble = 1.1;
|
|
949
|
+
this.minimumRetryabilityStrains = 750;
|
|
950
|
+
this.currentTapStrain = 0;
|
|
951
|
+
this.currentRhythmMultiplier = 0;
|
|
952
|
+
this.skillMultiplier = 1375;
|
|
953
|
+
this._objectDeltaTimes = [];
|
|
954
|
+
this.considerCheesability = considerCheesability;
|
|
955
|
+
this.strainTimeCap = strainTimeCap;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* The amount of notes that are relevant to the difficulty.
|
|
959
|
+
*/
|
|
960
|
+
relevantNoteCount() {
|
|
961
|
+
if (this._objectStrains.length === 0) {
|
|
962
|
+
return 0;
|
|
963
|
+
}
|
|
964
|
+
const maxStrain = Math.max(...this._objectStrains);
|
|
965
|
+
if (maxStrain === 0) {
|
|
966
|
+
return 0;
|
|
967
|
+
}
|
|
968
|
+
return this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
1110
969
|
}
|
|
1111
970
|
/**
|
|
1112
|
-
*
|
|
971
|
+
* The delta time relevant to the difficulty.
|
|
1113
972
|
*/
|
|
973
|
+
relevantDeltaTime() {
|
|
974
|
+
if (this._objectStrains.length === 0) {
|
|
975
|
+
return 0;
|
|
976
|
+
}
|
|
977
|
+
const maxStrain = Math.max(...this._objectStrains);
|
|
978
|
+
if (maxStrain === 0) {
|
|
979
|
+
return 0;
|
|
980
|
+
}
|
|
981
|
+
return (this._objectDeltaTimes.reduce((total, next, index) => total +
|
|
982
|
+
(next * 1) /
|
|
983
|
+
(1 +
|
|
984
|
+
Math.exp(-((this._objectStrains[index] / maxStrain) *
|
|
985
|
+
25 -
|
|
986
|
+
20))), 0) /
|
|
987
|
+
this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 25 - 20))), 0));
|
|
988
|
+
}
|
|
1114
989
|
strainValueAt(current) {
|
|
1115
|
-
|
|
1116
|
-
this.currentTapStrain *= decay;
|
|
990
|
+
this.currentTapStrain *= this.strainDecay(current.strainTime);
|
|
1117
991
|
this.currentTapStrain +=
|
|
1118
|
-
DroidTapEvaluator.evaluateDifficultyOf(current, this.
|
|
1119
|
-
this.
|
|
1120
|
-
this.
|
|
1121
|
-
DroidTapEvaluator.evaluateDifficultyOf(current, this.greatWindow, false) * this.skillMultiplier;
|
|
1122
|
-
this.currentOriginalTapStrain *= current.rhythmMultiplier;
|
|
992
|
+
DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability, this.strainTimeCap) * this.skillMultiplier;
|
|
993
|
+
this.currentRhythmMultiplier = current.rhythmMultiplier;
|
|
994
|
+
this._objectDeltaTimes.push(current.deltaTime);
|
|
1123
995
|
return this.currentTapStrain * current.rhythmMultiplier;
|
|
1124
996
|
}
|
|
997
|
+
calculateInitialStrain(time, current) {
|
|
998
|
+
var _a, _b;
|
|
999
|
+
return (this.currentTapStrain *
|
|
1000
|
+
this.currentRhythmMultiplier *
|
|
1001
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
1002
|
+
}
|
|
1003
|
+
getObjectStrain() {
|
|
1004
|
+
return this.currentTapStrain * this.currentRhythmMultiplier;
|
|
1005
|
+
}
|
|
1125
1006
|
/**
|
|
1126
1007
|
* @param current The hitobject to save to.
|
|
1127
1008
|
*/
|
|
1128
1009
|
saveToHitObject(current) {
|
|
1129
|
-
|
|
1130
|
-
|
|
1010
|
+
if (this.strainTimeCap !== undefined) {
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const strain = this.currentTapStrain * this.currentRhythmMultiplier;
|
|
1014
|
+
if (this.considerCheesability) {
|
|
1015
|
+
current.tapStrain = strain;
|
|
1016
|
+
}
|
|
1017
|
+
else {
|
|
1018
|
+
current.originalTapStrain = strain;
|
|
1019
|
+
}
|
|
1131
1020
|
}
|
|
1132
1021
|
}
|
|
1133
1022
|
|
|
@@ -1137,12 +1026,12 @@ class DroidTap extends DroidSkill {
|
|
|
1137
1026
|
* This class should be considered an "evaluating" class and not persisted.
|
|
1138
1027
|
*/
|
|
1139
1028
|
class FlashlightEvaluator {
|
|
1140
|
-
static maxOpacityBonus = 0.4;
|
|
1141
|
-
static hiddenBonus = 0.2;
|
|
1142
|
-
static minVelocity = 0.5;
|
|
1143
|
-
static sliderMultiplier = 1.3;
|
|
1144
|
-
static minAngleMultiplier = 0.2;
|
|
1145
1029
|
}
|
|
1030
|
+
FlashlightEvaluator.maxOpacityBonus = 0.4;
|
|
1031
|
+
FlashlightEvaluator.hiddenBonus = 0.2;
|
|
1032
|
+
FlashlightEvaluator.minVelocity = 0.5;
|
|
1033
|
+
FlashlightEvaluator.sliderMultiplier = 1.3;
|
|
1034
|
+
FlashlightEvaluator.minAngleMultiplier = 0.2;
|
|
1146
1035
|
|
|
1147
1036
|
/**
|
|
1148
1037
|
* An evaluator for calculating osu!droid Flashlight skill.
|
|
@@ -1167,7 +1056,7 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1167
1056
|
current.isOverlapping(true)) {
|
|
1168
1057
|
return 0;
|
|
1169
1058
|
}
|
|
1170
|
-
const scalingFactor = 52 / current.object.
|
|
1059
|
+
const scalingFactor = 52 / current.object.radius;
|
|
1171
1060
|
let smallDistNerf = 1;
|
|
1172
1061
|
let cumulativeStrainTime = 0;
|
|
1173
1062
|
let result = 0;
|
|
@@ -1192,7 +1081,7 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1192
1081
|
const opacityBonus = 1 +
|
|
1193
1082
|
this.maxOpacityBonus *
|
|
1194
1083
|
(1 -
|
|
1195
|
-
current.opacityAt(currentObject.object.startTime, isHiddenMod
|
|
1084
|
+
current.opacityAt(currentObject.object.startTime, isHiddenMod));
|
|
1196
1085
|
result +=
|
|
1197
1086
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
1198
1087
|
cumulativeStrainTime;
|
|
@@ -1223,8 +1112,8 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1223
1112
|
// Longer sliders require more memorization.
|
|
1224
1113
|
sliderBonus *= pixelTravelDistance;
|
|
1225
1114
|
// Nerf sliders with repeats, as less memorization is required.
|
|
1226
|
-
if (current.object.
|
|
1227
|
-
sliderBonus /= current.object.
|
|
1115
|
+
if (current.object.repeatCount > 0)
|
|
1116
|
+
sliderBonus /= current.object.repeatCount + 1;
|
|
1228
1117
|
}
|
|
1229
1118
|
result += sliderBonus * this.sliderMultiplier;
|
|
1230
1119
|
return result;
|
|
@@ -1235,72 +1124,98 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1235
1124
|
* Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
|
|
1236
1125
|
*/
|
|
1237
1126
|
class DroidFlashlight extends DroidSkill {
|
|
1238
|
-
skillMultiplier = 0.125;
|
|
1239
|
-
strainDecayBase = 0.15;
|
|
1240
|
-
reducedSectionCount = 0;
|
|
1241
|
-
reducedSectionBaseline = 1;
|
|
1242
|
-
starsPerDouble = 1.05;
|
|
1243
|
-
isHidden;
|
|
1244
|
-
withSliders;
|
|
1245
1127
|
constructor(mods, withSliders) {
|
|
1246
1128
|
super(mods);
|
|
1129
|
+
this.strainDecayBase = 0.15;
|
|
1130
|
+
this.reducedSectionCount = 0;
|
|
1131
|
+
this.reducedSectionBaseline = 1;
|
|
1132
|
+
this.starsPerDouble = 1.06;
|
|
1133
|
+
this.skillMultiplier = 0.02;
|
|
1134
|
+
this.currentFlashlightStrain = 0;
|
|
1247
1135
|
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
1248
1136
|
this.withSliders = withSliders;
|
|
1249
1137
|
}
|
|
1250
|
-
/**
|
|
1251
|
-
* @param current The hitobject to calculate.
|
|
1252
|
-
*/
|
|
1253
1138
|
strainValueAt(current) {
|
|
1254
|
-
this.
|
|
1255
|
-
this.
|
|
1139
|
+
this.currentFlashlightStrain *= this.strainDecay(current.deltaTime);
|
|
1140
|
+
this.currentFlashlightStrain +=
|
|
1256
1141
|
DroidFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden, this.withSliders) * this.skillMultiplier;
|
|
1257
|
-
return this.
|
|
1142
|
+
return this.currentFlashlightStrain;
|
|
1143
|
+
}
|
|
1144
|
+
calculateInitialStrain(time, current) {
|
|
1145
|
+
var _a, _b;
|
|
1146
|
+
return (this.currentFlashlightStrain *
|
|
1147
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
1148
|
+
}
|
|
1149
|
+
getObjectStrain() {
|
|
1150
|
+
return this.currentFlashlightStrain;
|
|
1258
1151
|
}
|
|
1259
1152
|
saveToHitObject(current) {
|
|
1260
1153
|
if (this.withSliders) {
|
|
1261
|
-
current.flashlightStrainWithSliders = this.
|
|
1154
|
+
current.flashlightStrainWithSliders = this.currentFlashlightStrain;
|
|
1262
1155
|
}
|
|
1263
1156
|
else {
|
|
1264
|
-
current.flashlightStrainWithoutSliders =
|
|
1157
|
+
current.flashlightStrainWithoutSliders =
|
|
1158
|
+
this.currentFlashlightStrain;
|
|
1265
1159
|
}
|
|
1266
1160
|
}
|
|
1161
|
+
difficultyValue() {
|
|
1162
|
+
return (this.strainPeaks.reduce((a, v) => a + v, 0) * this.starsPerDouble);
|
|
1163
|
+
}
|
|
1267
1164
|
}
|
|
1268
1165
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1166
|
+
class Island {
|
|
1167
|
+
constructor(delta, deltaDifferenceEpsilon) {
|
|
1168
|
+
this.delta = Number.MAX_SAFE_INTEGER;
|
|
1169
|
+
this.deltaCount = 0;
|
|
1170
|
+
if (deltaDifferenceEpsilon === undefined) {
|
|
1171
|
+
this.deltaDifferenceEpsilon = delta;
|
|
1172
|
+
}
|
|
1173
|
+
else {
|
|
1174
|
+
this.deltaDifferenceEpsilon = deltaDifferenceEpsilon;
|
|
1175
|
+
this.addDelta(delta);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
addDelta(delta) {
|
|
1179
|
+
if (this.delta === Number.MAX_SAFE_INTEGER) {
|
|
1180
|
+
this.delta = Math.max(Math.trunc(delta), DifficultyHitObject.minDeltaTime);
|
|
1181
|
+
}
|
|
1182
|
+
++this.deltaCount;
|
|
1183
|
+
}
|
|
1184
|
+
isSimilarPolarity(other) {
|
|
1185
|
+
// 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)
|
|
1186
|
+
// naively adding delta check here breaks _a lot_ of maps because of the flawed ratio calculation
|
|
1187
|
+
return this.deltaCount % 2 == other.deltaCount % 2;
|
|
1188
|
+
}
|
|
1189
|
+
equals(other) {
|
|
1190
|
+
return (Math.abs(this.delta - other.delta) < this.deltaDifferenceEpsilon &&
|
|
1191
|
+
this.deltaCount === other.deltaCount);
|
|
1192
|
+
}
|
|
1277
1193
|
}
|
|
1278
1194
|
|
|
1279
1195
|
/**
|
|
1280
1196
|
* An evaluator for calculating osu!droid Rhythm skill.
|
|
1281
1197
|
*/
|
|
1282
|
-
class DroidRhythmEvaluator
|
|
1198
|
+
class DroidRhythmEvaluator {
|
|
1283
1199
|
/**
|
|
1284
1200
|
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
1285
1201
|
* with historic data of the current object.
|
|
1286
1202
|
*
|
|
1287
1203
|
* @param current The current object.
|
|
1288
|
-
* @param greatWindow The great hit window of the current object.
|
|
1289
1204
|
*/
|
|
1290
|
-
static evaluateDifficultyOf(current
|
|
1291
|
-
if (current.object instanceof osuBase.Spinner
|
|
1292
|
-
// Exclude overlapping objects that can be tapped at once.
|
|
1293
|
-
current.isOverlapping(false)) {
|
|
1205
|
+
static evaluateDifficultyOf(current) {
|
|
1206
|
+
if (current.object instanceof osuBase.Spinner) {
|
|
1294
1207
|
return 1;
|
|
1295
1208
|
}
|
|
1296
|
-
|
|
1209
|
+
const deltaDifferenceEpsilon = current.fullGreatWindow * 0.3;
|
|
1297
1210
|
let rhythmComplexitySum = 0;
|
|
1298
|
-
let
|
|
1211
|
+
let island = new Island(deltaDifferenceEpsilon);
|
|
1212
|
+
let previousIsland = new Island(deltaDifferenceEpsilon);
|
|
1213
|
+
const islandCounts = new Map();
|
|
1299
1214
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
1300
1215
|
let startRatio = 0;
|
|
1301
1216
|
let firstDeltaSwitch = false;
|
|
1302
1217
|
let rhythmStart = 0;
|
|
1303
|
-
const historicalNoteCount = Math.min(current.index,
|
|
1218
|
+
const historicalNoteCount = Math.min(current.index, this.historyObjectsMax);
|
|
1304
1219
|
// Exclude overlapping objects that can be tapped at once.
|
|
1305
1220
|
const validPrevious = [];
|
|
1306
1221
|
for (let i = 0; i < historicalNoteCount; ++i) {
|
|
@@ -1318,123 +1233,160 @@ class DroidRhythmEvaluator extends RhythmEvaluator {
|
|
|
1318
1233
|
++rhythmStart;
|
|
1319
1234
|
}
|
|
1320
1235
|
for (let i = rhythmStart; i > 0; --i) {
|
|
1236
|
+
const currentObject = validPrevious[i - 1];
|
|
1237
|
+
const prevObject = validPrevious[i];
|
|
1238
|
+
const lastObject = validPrevious[i + 1];
|
|
1321
1239
|
// Scale note 0 to 1 from history to now.
|
|
1322
|
-
|
|
1323
|
-
(current.startTime -
|
|
1240
|
+
const timeDecay = (this.historyTimeMax -
|
|
1241
|
+
(current.startTime - currentObject.startTime)) /
|
|
1324
1242
|
this.historyTimeMax;
|
|
1243
|
+
const noteDecay = (validPrevious.length - i) / validPrevious.length;
|
|
1325
1244
|
// Either we're limited by time or limited by object count.
|
|
1326
|
-
currentHistoricalDecay = Math.min(
|
|
1327
|
-
const currentDelta =
|
|
1328
|
-
const prevDelta =
|
|
1329
|
-
const lastDelta =
|
|
1245
|
+
const currentHistoricalDecay = Math.min(timeDecay, noteDecay);
|
|
1246
|
+
const currentDelta = currentObject.strainTime;
|
|
1247
|
+
const prevDelta = prevObject.strainTime;
|
|
1248
|
+
const lastDelta = lastObject.strainTime;
|
|
1249
|
+
// Calculate how much current delta difference deserves a rhythm bonus
|
|
1250
|
+
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200)
|
|
1251
|
+
const deltaDifferenceRatio = Math.min(prevDelta, currentDelta) /
|
|
1252
|
+
Math.max(prevDelta, currentDelta);
|
|
1330
1253
|
const currentRatio = 1 +
|
|
1331
|
-
|
|
1332
|
-
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
let effectiveRatio = windowPenalty * currentRatio;
|
|
1254
|
+
this.rhythmRatioMultiplier *
|
|
1255
|
+
Math.min(0.5, Math.pow(Math.sin(Math.PI / deltaDifferenceRatio), 2));
|
|
1256
|
+
// Reduce ratio bonus if delta difference is too big
|
|
1257
|
+
const fraction = Math.max(prevDelta / currentDelta, currentDelta / prevDelta);
|
|
1258
|
+
const fractionMultiplier = osuBase.MathUtils.clamp(2 - fraction / 8, 0, 1);
|
|
1259
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon);
|
|
1260
|
+
let effectiveRatio = windowPenalty * currentRatio * fractionMultiplier;
|
|
1338
1261
|
if (firstDeltaSwitch) {
|
|
1339
|
-
if (prevDelta
|
|
1340
|
-
prevDelta * 1.25 >= currentDelta) {
|
|
1262
|
+
if (Math.abs(prevDelta - currentDelta) < deltaDifferenceEpsilon) {
|
|
1341
1263
|
// Island is still progressing, count size.
|
|
1342
|
-
|
|
1343
|
-
++islandSize;
|
|
1344
|
-
}
|
|
1264
|
+
island.addDelta(currentDelta);
|
|
1345
1265
|
}
|
|
1346
1266
|
else {
|
|
1347
|
-
|
|
1348
|
-
|
|
1267
|
+
// BPM change is into slider, this is easy acc window.
|
|
1268
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
1349
1269
|
effectiveRatio /= 8;
|
|
1350
1270
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
// Repeated island size (ex: triplet -> triplet).
|
|
1357
|
-
effectiveRatio /= 4;
|
|
1271
|
+
// BPM change was from a slider, this is easier typically than circle -> circle.
|
|
1272
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
1273
|
+
// than bursts without sliders.
|
|
1274
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1275
|
+
effectiveRatio *= 0.3;
|
|
1358
1276
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1277
|
+
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
1278
|
+
if (island.isSimilarPolarity(previousIsland)) {
|
|
1361
1279
|
effectiveRatio /= 2;
|
|
1362
1280
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1281
|
+
// Previous increase happened a note ago.
|
|
1282
|
+
// Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
|
|
1283
|
+
if (lastDelta > prevDelta + deltaDifferenceEpsilon &&
|
|
1284
|
+
prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
1367
1285
|
effectiveRatio /= 8;
|
|
1368
1286
|
}
|
|
1287
|
+
// Repeated island size (ex: triplet -> triplet).
|
|
1288
|
+
// TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation
|
|
1289
|
+
if (previousIsland.deltaCount == island.deltaCount) {
|
|
1290
|
+
effectiveRatio /= 2;
|
|
1291
|
+
}
|
|
1292
|
+
let islandFound = false;
|
|
1293
|
+
for (const [currentIsland, count] of islandCounts) {
|
|
1294
|
+
if (!island.equals(currentIsland)) {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
islandFound = true;
|
|
1298
|
+
let islandCount = count;
|
|
1299
|
+
if (previousIsland.equals(island)) {
|
|
1300
|
+
// Only add island to island counts if they're going one after another.
|
|
1301
|
+
++islandCount;
|
|
1302
|
+
islandCounts.set(currentIsland, islandCount);
|
|
1303
|
+
}
|
|
1304
|
+
// Repeated island (ex: triplet -> triplet).
|
|
1305
|
+
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
1306
|
+
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount, 2.75 / (1 + Math.exp(14 - 0.24 * island.delta))));
|
|
1307
|
+
break;
|
|
1308
|
+
}
|
|
1309
|
+
if (!islandFound) {
|
|
1310
|
+
islandCounts.set(island, 1);
|
|
1311
|
+
}
|
|
1312
|
+
// Scale down the difficulty if the object is doubletappable.
|
|
1313
|
+
effectiveRatio *= 1 - prevObject.doubletapness * 0.75;
|
|
1369
1314
|
rhythmComplexitySum +=
|
|
1370
|
-
|
|
1371
|
-
currentHistoricalDecay
|
|
1372
|
-
Math.sqrt(4 + islandSize)) /
|
|
1373
|
-
2) *
|
|
1374
|
-
Math.sqrt(4 + previousIslandSize)) /
|
|
1375
|
-
2;
|
|
1315
|
+
Math.sqrt(effectiveRatio * startRatio) *
|
|
1316
|
+
currentHistoricalDecay;
|
|
1376
1317
|
startRatio = effectiveRatio;
|
|
1377
|
-
|
|
1378
|
-
if (prevDelta
|
|
1318
|
+
previousIsland = island;
|
|
1319
|
+
if (prevDelta + deltaDifferenceEpsilon < currentDelta) {
|
|
1379
1320
|
// We're slowing down, stop counting.
|
|
1380
1321
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
1381
1322
|
firstDeltaSwitch = false;
|
|
1382
1323
|
}
|
|
1383
|
-
|
|
1324
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
1384
1325
|
}
|
|
1385
1326
|
}
|
|
1386
|
-
else if (prevDelta >
|
|
1387
|
-
// We
|
|
1327
|
+
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
1328
|
+
// We are speeding up.
|
|
1388
1329
|
// Begin counting island until we change speed again.
|
|
1389
1330
|
firstDeltaSwitch = true;
|
|
1331
|
+
// BPM change is into slider, this is easy acc window.
|
|
1332
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
1333
|
+
effectiveRatio *= 0.6;
|
|
1334
|
+
}
|
|
1335
|
+
// BPM change was from a slider, this is easier typically than circle -> circle
|
|
1336
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
1337
|
+
// than bursts without sliders
|
|
1338
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
1339
|
+
effectiveRatio *= 0.6;
|
|
1340
|
+
}
|
|
1390
1341
|
startRatio = effectiveRatio;
|
|
1391
|
-
|
|
1342
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
1392
1343
|
}
|
|
1393
1344
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
let doubletapness = 1;
|
|
1397
|
-
if (next) {
|
|
1398
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
1399
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
1400
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
1401
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
1402
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / (greatWindow * 2)), 2);
|
|
1403
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1404
|
-
}
|
|
1405
|
-
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmMultiplier * doubletapness) / 2);
|
|
1345
|
+
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmOverallMultiplier) /
|
|
1346
|
+
2);
|
|
1406
1347
|
}
|
|
1407
1348
|
}
|
|
1349
|
+
DroidRhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
1350
|
+
DroidRhythmEvaluator.historyObjectsMax = 32;
|
|
1351
|
+
DroidRhythmEvaluator.rhythmOverallMultiplier = 0.95;
|
|
1352
|
+
DroidRhythmEvaluator.rhythmRatioMultiplier = 12;
|
|
1408
1353
|
|
|
1409
1354
|
/**
|
|
1410
1355
|
* Represents the skill required to properly follow a beatmap's rhythm.
|
|
1411
1356
|
*/
|
|
1412
1357
|
class DroidRhythm extends DroidSkill {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
super(mods);
|
|
1422
|
-
this.hitWindow = new osuBase.OsuHitWindow(overallDifficulty);
|
|
1358
|
+
constructor() {
|
|
1359
|
+
super(...arguments);
|
|
1360
|
+
this.reducedSectionCount = 5;
|
|
1361
|
+
this.reducedSectionBaseline = 0.75;
|
|
1362
|
+
this.strainDecayBase = 0.3;
|
|
1363
|
+
this.starsPerDouble = 1.75;
|
|
1364
|
+
this.currentRhythmStrain = 0;
|
|
1365
|
+
this.currentRhythmMultiplier = 1;
|
|
1423
1366
|
}
|
|
1424
1367
|
strainValueAt(current) {
|
|
1425
|
-
this.
|
|
1426
|
-
|
|
1427
|
-
this.
|
|
1428
|
-
|
|
1368
|
+
this.currentRhythmMultiplier =
|
|
1369
|
+
DroidRhythmEvaluator.evaluateDifficultyOf(current);
|
|
1370
|
+
this.currentRhythmStrain *= this.strainDecay(current.deltaTime);
|
|
1371
|
+
this.currentRhythmStrain += this.currentRhythmMultiplier - 1;
|
|
1372
|
+
return this.currentRhythmStrain;
|
|
1373
|
+
}
|
|
1374
|
+
calculateInitialStrain(time, current) {
|
|
1375
|
+
var _a, _b;
|
|
1376
|
+
return (this.currentRhythmStrain *
|
|
1377
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
1378
|
+
}
|
|
1379
|
+
getObjectStrain() {
|
|
1380
|
+
return this.currentRhythmStrain;
|
|
1429
1381
|
}
|
|
1430
1382
|
saveToHitObject(current) {
|
|
1431
|
-
current.rhythmStrain = this.
|
|
1432
|
-
current.rhythmMultiplier = this.
|
|
1383
|
+
current.rhythmStrain = this.currentRhythmStrain;
|
|
1384
|
+
current.rhythmMultiplier = this.currentRhythmMultiplier;
|
|
1433
1385
|
}
|
|
1434
1386
|
}
|
|
1435
1387
|
|
|
1436
1388
|
/**
|
|
1437
|
-
* An evaluator for calculating osu!droid
|
|
1389
|
+
* An evaluator for calculating osu!droid visual skill.
|
|
1438
1390
|
*/
|
|
1439
1391
|
class DroidVisualEvaluator {
|
|
1440
1392
|
/**
|
|
@@ -1455,7 +1407,8 @@ class DroidVisualEvaluator {
|
|
|
1455
1407
|
static evaluateDifficultyOf(current, isHiddenMod, withSliders) {
|
|
1456
1408
|
if (current.object instanceof osuBase.Spinner ||
|
|
1457
1409
|
// Exclude overlapping objects that can be tapped at once.
|
|
1458
|
-
current.isOverlapping(true)
|
|
1410
|
+
current.isOverlapping(true) ||
|
|
1411
|
+
current.index === 0) {
|
|
1459
1412
|
return 0;
|
|
1460
1413
|
}
|
|
1461
1414
|
// Start with base density and give global bonus for Hidden.
|
|
@@ -1477,28 +1430,31 @@ class DroidVisualEvaluator {
|
|
|
1477
1430
|
}
|
|
1478
1431
|
// Do not consider objects that don't fall under time preempt.
|
|
1479
1432
|
if (current.object.startTime - previous.object.endTime >
|
|
1480
|
-
current.
|
|
1433
|
+
current.object.timePreempt) {
|
|
1481
1434
|
break;
|
|
1482
1435
|
}
|
|
1483
1436
|
strain +=
|
|
1484
1437
|
(1 -
|
|
1485
|
-
current.opacityAt(previous.object.startTime, isHiddenMod
|
|
1438
|
+
current.opacityAt(previous.object.startTime, isHiddenMod)) /
|
|
1486
1439
|
4;
|
|
1487
1440
|
}
|
|
1488
|
-
// Scale the value with overlapping factor.
|
|
1489
|
-
strain /= 10 * (1 + current.overlappingFactor);
|
|
1490
1441
|
if (current.timePreempt < 400) {
|
|
1491
1442
|
// Give bonus for AR higher than 10.33.
|
|
1492
|
-
strain += Math.pow(400 - current.timePreempt, 1.
|
|
1443
|
+
strain += Math.pow(400 - current.timePreempt, 1.35) / 100;
|
|
1493
1444
|
}
|
|
1445
|
+
// Scale the value with overlapping factor.
|
|
1446
|
+
strain /= 10 * (1 + current.overlappingFactor);
|
|
1494
1447
|
if (current.object instanceof osuBase.Slider && withSliders) {
|
|
1495
|
-
const scalingFactor = 50 / current.object.
|
|
1496
|
-
//
|
|
1448
|
+
const scalingFactor = 50 / current.object.radius;
|
|
1449
|
+
// Invert the scaling factor to determine the true travel distance independent of circle size.
|
|
1450
|
+
const pixelTravelDistance = current.object.lazyTravelDistance / scalingFactor;
|
|
1451
|
+
const currentVelocity = pixelTravelDistance / current.travelTime;
|
|
1452
|
+
const spanTravelDistance = pixelTravelDistance / current.object.spanCount;
|
|
1497
1453
|
strain +=
|
|
1498
|
-
//
|
|
1499
|
-
Math.min(6,
|
|
1500
|
-
//
|
|
1501
|
-
|
|
1454
|
+
// Reward sliders based on velocity, while also avoiding overbuffing extremely fast sliders.
|
|
1455
|
+
Math.min(6, currentVelocity * 1.5) *
|
|
1456
|
+
// Longer sliders require more reading.
|
|
1457
|
+
(spanTravelDistance / 100);
|
|
1502
1458
|
let cumulativeStrainTime = 0;
|
|
1503
1459
|
// Reward for velocity changes based on last few sliders.
|
|
1504
1460
|
for (let i = 0; i < Math.min(current.index, 4); ++i) {
|
|
@@ -1509,52 +1465,19 @@ class DroidVisualEvaluator {
|
|
|
1509
1465
|
last.isOverlapping(true)) {
|
|
1510
1466
|
continue;
|
|
1511
1467
|
}
|
|
1468
|
+
// Invert the scaling factor to determine the true travel distance independent of circle size.
|
|
1469
|
+
const lastPixelTravelDistance = last.object.lazyTravelDistance / scalingFactor;
|
|
1470
|
+
const lastVelocity = lastPixelTravelDistance / last.travelTime;
|
|
1471
|
+
const lastSpanTravelDistance = lastPixelTravelDistance / last.object.spanCount;
|
|
1512
1472
|
strain +=
|
|
1513
|
-
//
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
// Reward for rhythm changes.
|
|
1522
|
-
if (current.rhythmMultiplier > 1) {
|
|
1523
|
-
let rhythmBonus = (current.rhythmMultiplier - 1) / 20;
|
|
1524
|
-
// Rhythm changes are harder to read in Hidden.
|
|
1525
|
-
// Add additional bonus for Hidden.
|
|
1526
|
-
if (isHiddenMod) {
|
|
1527
|
-
rhythmBonus += (current.rhythmMultiplier - 1) / 25;
|
|
1528
|
-
}
|
|
1529
|
-
// Rhythm changes are harder to read when objects are stacked together.
|
|
1530
|
-
// Scale rhythm bonus based on the stack of past objects.
|
|
1531
|
-
const diameter = 2 * current.object.getRadius(osuBase.Modes.droid);
|
|
1532
|
-
let cumulativeStrainTime = 0;
|
|
1533
|
-
for (let i = 0; i < Math.min(current.index, 5); ++i) {
|
|
1534
|
-
const previous = current.previous(i);
|
|
1535
|
-
if (previous.object instanceof osuBase.Spinner ||
|
|
1536
|
-
// Exclude overlapping objects that can be tapped at once.
|
|
1537
|
-
previous.isOverlapping(true)) {
|
|
1538
|
-
continue;
|
|
1539
|
-
}
|
|
1540
|
-
const jumpDistance = current.object
|
|
1541
|
-
.getStackedPosition(osuBase.Modes.droid)
|
|
1542
|
-
.getDistance(previous.object.getStackedEndPosition(osuBase.Modes.droid));
|
|
1543
|
-
cumulativeStrainTime += previous.strainTime;
|
|
1544
|
-
rhythmBonus +=
|
|
1545
|
-
// Scale the bonus with diameter.
|
|
1546
|
-
osuBase.MathUtils.clamp((0.5 - jumpDistance / diameter) / 10, 0, 0.05) *
|
|
1547
|
-
// Scale with cumulative strain time to avoid overbuffing past objects.
|
|
1473
|
+
// Reward past sliders based on velocity changes, while also
|
|
1474
|
+
// avoiding overbuffing extremely fast velocity changes.
|
|
1475
|
+
Math.min(10, 2.5 * Math.abs(currentVelocity - lastVelocity)) *
|
|
1476
|
+
// Longer sliders require more reading.
|
|
1477
|
+
(lastSpanTravelDistance / 125) *
|
|
1478
|
+
// Avoid overbuffing past sliders.
|
|
1548
1479
|
Math.min(1, 300 / cumulativeStrainTime);
|
|
1549
|
-
// Give a larger bonus for Hidden.
|
|
1550
|
-
if (isHiddenMod) {
|
|
1551
|
-
rhythmBonus +=
|
|
1552
|
-
(1 -
|
|
1553
|
-
current.opacityAt(previous.object.startTime, isHiddenMod, osuBase.Modes.droid)) /
|
|
1554
|
-
20;
|
|
1555
|
-
}
|
|
1556
1480
|
}
|
|
1557
|
-
strain += rhythmBonus;
|
|
1558
1481
|
}
|
|
1559
1482
|
return strain;
|
|
1560
1483
|
}
|
|
@@ -1564,88 +1487,317 @@ class DroidVisualEvaluator {
|
|
|
1564
1487
|
* Represents the skill required to read every object in the map.
|
|
1565
1488
|
*/
|
|
1566
1489
|
class DroidVisual extends DroidSkill {
|
|
1567
|
-
starsPerDouble = 1.025;
|
|
1568
|
-
reducedSectionCount = 10;
|
|
1569
|
-
reducedSectionBaseline = 0.75;
|
|
1570
|
-
skillMultiplier = 10;
|
|
1571
|
-
strainDecayBase = 0.1;
|
|
1572
|
-
isHidden;
|
|
1573
|
-
withsliders;
|
|
1574
1490
|
constructor(mods, withSliders) {
|
|
1575
1491
|
super(mods);
|
|
1492
|
+
this.starsPerDouble = 1.025;
|
|
1493
|
+
this.reducedSectionCount = 10;
|
|
1494
|
+
this.reducedSectionBaseline = 0.75;
|
|
1495
|
+
this.strainDecayBase = 0.1;
|
|
1496
|
+
this.currentVisualStrain = 0;
|
|
1497
|
+
this.currentRhythmMultiplier = 1;
|
|
1498
|
+
this.skillMultiplier = 10;
|
|
1576
1499
|
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
1577
|
-
this.
|
|
1500
|
+
this.withSliders = withSliders;
|
|
1578
1501
|
}
|
|
1579
1502
|
strainValueAt(current) {
|
|
1580
|
-
this.
|
|
1581
|
-
this.
|
|
1582
|
-
DroidVisualEvaluator.evaluateDifficultyOf(current, this.isHidden, this.
|
|
1583
|
-
|
|
1503
|
+
this.currentVisualStrain *= this.strainDecay(current.deltaTime);
|
|
1504
|
+
this.currentVisualStrain +=
|
|
1505
|
+
DroidVisualEvaluator.evaluateDifficultyOf(current, this.isHidden, this.withSliders) * this.skillMultiplier;
|
|
1506
|
+
this.currentRhythmMultiplier = current.rhythmMultiplier;
|
|
1507
|
+
return this.currentVisualStrain * this.currentRhythmMultiplier;
|
|
1508
|
+
}
|
|
1509
|
+
calculateInitialStrain(time, current) {
|
|
1510
|
+
var _a, _b;
|
|
1511
|
+
return (this.currentVisualStrain *
|
|
1512
|
+
this.currentRhythmMultiplier *
|
|
1513
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
1514
|
+
}
|
|
1515
|
+
getObjectStrain() {
|
|
1516
|
+
return this.currentVisualStrain * this.currentRhythmMultiplier;
|
|
1584
1517
|
}
|
|
1585
1518
|
saveToHitObject(current) {
|
|
1586
|
-
|
|
1587
|
-
|
|
1519
|
+
const strain = this.currentVisualStrain * this.currentRhythmMultiplier;
|
|
1520
|
+
if (this.withSliders) {
|
|
1521
|
+
current.visualStrainWithSliders = strain;
|
|
1588
1522
|
}
|
|
1589
1523
|
else {
|
|
1590
|
-
current.visualStrainWithoutSliders =
|
|
1524
|
+
current.visualStrainWithoutSliders = strain;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Represents an osu!droid hit object with difficulty calculation values.
|
|
1531
|
+
*/
|
|
1532
|
+
class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
1533
|
+
get scalingFactor() {
|
|
1534
|
+
const radius = this.object.radius;
|
|
1535
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
1536
|
+
let scalingFactor = this.normalizedRadius / radius;
|
|
1537
|
+
// High circle size (small CS) bonus
|
|
1538
|
+
if (radius < this.radiusBuffThreshold) {
|
|
1539
|
+
scalingFactor *=
|
|
1540
|
+
1 + Math.pow((this.radiusBuffThreshold - radius) / 50, 2);
|
|
1541
|
+
}
|
|
1542
|
+
return scalingFactor;
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Note: You **must** call `computeProperties` at some point due to how TypeScript handles
|
|
1546
|
+
* overridden properties (see [this](https://github.com/microsoft/TypeScript/issues/1617) GitHub issue).
|
|
1547
|
+
*
|
|
1548
|
+
* @param object The underlying hitobject.
|
|
1549
|
+
* @param lastObject The hitobject before this hitobject.
|
|
1550
|
+
* @param lastLastObject The hitobject before the last hitobject.
|
|
1551
|
+
* @param difficultyHitObjects All difficulty hitobjects in the processed beatmap.
|
|
1552
|
+
* @param clockRate The clock rate of the beatmap.
|
|
1553
|
+
* @param greatWindow The great window of the hitobject.
|
|
1554
|
+
*/
|
|
1555
|
+
constructor(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow) {
|
|
1556
|
+
super(object, lastObject, lastLastObject, difficultyHitObjects, clockRate, greatWindow);
|
|
1557
|
+
/**
|
|
1558
|
+
* The tap strain generated by the hitobject.
|
|
1559
|
+
*/
|
|
1560
|
+
this.tapStrain = 0;
|
|
1561
|
+
/**
|
|
1562
|
+
* The tap strain generated by the hitobject if `strainTime` isn't modified by
|
|
1563
|
+
* OD. This is used in three-finger detection.
|
|
1564
|
+
*/
|
|
1565
|
+
this.originalTapStrain = 0;
|
|
1566
|
+
/**
|
|
1567
|
+
* The rhythm strain generated by the hitobject.
|
|
1568
|
+
*/
|
|
1569
|
+
this.rhythmStrain = 0;
|
|
1570
|
+
/**
|
|
1571
|
+
* The flashlight strain generated by the hitobject if sliders are considered.
|
|
1572
|
+
*/
|
|
1573
|
+
this.flashlightStrainWithSliders = 0;
|
|
1574
|
+
/**
|
|
1575
|
+
* The flashlight strain generated by the hitobject if sliders are not considered.
|
|
1576
|
+
*/
|
|
1577
|
+
this.flashlightStrainWithoutSliders = 0;
|
|
1578
|
+
/**
|
|
1579
|
+
* The visual strain generated by the hitobject if sliders are considered.
|
|
1580
|
+
*/
|
|
1581
|
+
this.visualStrainWithSliders = 0;
|
|
1582
|
+
/**
|
|
1583
|
+
* The visual strain generated by the hitobject if sliders are not considered.
|
|
1584
|
+
*/
|
|
1585
|
+
this.visualStrainWithoutSliders = 0;
|
|
1586
|
+
/**
|
|
1587
|
+
* The note density of the hitobject.
|
|
1588
|
+
*/
|
|
1589
|
+
this.noteDensity = 1;
|
|
1590
|
+
/**
|
|
1591
|
+
* The overlapping factor of the hitobject.
|
|
1592
|
+
*
|
|
1593
|
+
* This is used to scale visual skill.
|
|
1594
|
+
*/
|
|
1595
|
+
this.overlappingFactor = 0;
|
|
1596
|
+
this.radiusBuffThreshold = 70;
|
|
1597
|
+
this.mode = osuBase.Modes.droid;
|
|
1598
|
+
this.maximumSliderRadius = this.normalizedRadius * 2;
|
|
1599
|
+
this.timePreempt = object.timePreempt / clockRate;
|
|
1600
|
+
}
|
|
1601
|
+
computeProperties(clockRate, hitObjects) {
|
|
1602
|
+
super.computeProperties(clockRate, hitObjects);
|
|
1603
|
+
this.setVisuals(clockRate, hitObjects);
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Determines whether this hitobject is considered overlapping with the hitobject before it.
|
|
1607
|
+
*
|
|
1608
|
+
* Keep in mind that "overlapping" in this case is overlapping to the point where both hitobjects
|
|
1609
|
+
* can be hit with just a single tap in osu!droid.
|
|
1610
|
+
*
|
|
1611
|
+
* In the case of sliders, it is considered overlapping if all nested hitobjects can be hit with
|
|
1612
|
+
* one aim motion.
|
|
1613
|
+
*
|
|
1614
|
+
* @param considerDistance Whether to consider the distance between both hitobjects.
|
|
1615
|
+
* @returns Whether the hitobject is considered overlapping.
|
|
1616
|
+
*/
|
|
1617
|
+
isOverlapping(considerDistance) {
|
|
1618
|
+
if (this.object instanceof osuBase.Spinner) {
|
|
1619
|
+
return false;
|
|
1620
|
+
}
|
|
1621
|
+
const prev = this.previous(0);
|
|
1622
|
+
if (!prev || prev.object instanceof osuBase.Spinner) {
|
|
1623
|
+
return false;
|
|
1624
|
+
}
|
|
1625
|
+
if (this.object.startTime !== prev.object.startTime) {
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
if (!considerDistance) {
|
|
1629
|
+
return true;
|
|
1630
|
+
}
|
|
1631
|
+
const distanceThreshold = 2 * this.object.radius;
|
|
1632
|
+
const startPosition = this.object.getStackedPosition(osuBase.Modes.droid);
|
|
1633
|
+
const prevStartPosition = prev.object.getStackedPosition(osuBase.Modes.droid);
|
|
1634
|
+
// We need to consider two cases:
|
|
1635
|
+
//
|
|
1636
|
+
// Case 1: Current object is a circle, or previous object is a circle.
|
|
1637
|
+
// In this case, we only need to check if their positions are close enough to be tapped together.
|
|
1638
|
+
//
|
|
1639
|
+
// Case 2: Both objects are sliders.
|
|
1640
|
+
// In this case, we need to check if all nested hitobjects can be hit together.
|
|
1641
|
+
// To start with, check if the starting positions can be tapped together.
|
|
1642
|
+
if (startPosition.getDistance(prevStartPosition) > distanceThreshold) {
|
|
1643
|
+
return false;
|
|
1644
|
+
}
|
|
1645
|
+
if (this.object instanceof osuBase.Circle || prev.object instanceof osuBase.Circle) {
|
|
1646
|
+
return true;
|
|
1647
|
+
}
|
|
1648
|
+
// Check if all nested hitobjects can be hit together.
|
|
1649
|
+
for (let i = 1; i < this.object.nestedHitObjects.length; ++i) {
|
|
1650
|
+
const position = this.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1651
|
+
const prevPosition = prevStartPosition.add(prev.object.curvePositionAt(i / (this.object.nestedHitObjects.length - 1)));
|
|
1652
|
+
if (position.getDistance(prevPosition) > distanceThreshold) {
|
|
1653
|
+
return false;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
// Do the same for the previous slider as well.
|
|
1657
|
+
for (let i = 1; i < prev.object.nestedHitObjects.length; ++i) {
|
|
1658
|
+
const prevPosition = prev.object.nestedHitObjects[i].getStackedPosition(osuBase.Modes.droid);
|
|
1659
|
+
const position = startPosition.add(this.object.curvePositionAt(i / (prev.object.nestedHitObjects.length - 1)));
|
|
1660
|
+
if (prevPosition.getDistance(position) > distanceThreshold) {
|
|
1661
|
+
return false;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
return true;
|
|
1665
|
+
}
|
|
1666
|
+
setVisuals(clockRate, hitObjects) {
|
|
1667
|
+
// We'll have two visible object arrays. The first array contains objects before the current object starts in a reversed order,
|
|
1668
|
+
// while the second array contains objects after the current object ends.
|
|
1669
|
+
// For overlapping factor, we also need to consider previous visible objects.
|
|
1670
|
+
const prevVisibleObjects = [];
|
|
1671
|
+
const nextVisibleObjects = [];
|
|
1672
|
+
for (let j = this.index + 2; j < hitObjects.length; ++j) {
|
|
1673
|
+
const o = hitObjects[j];
|
|
1674
|
+
if (o instanceof osuBase.Spinner) {
|
|
1675
|
+
continue;
|
|
1676
|
+
}
|
|
1677
|
+
if (o.startTime / clockRate > this.endTime + this.timePreempt) {
|
|
1678
|
+
break;
|
|
1679
|
+
}
|
|
1680
|
+
nextVisibleObjects.push(o);
|
|
1681
|
+
}
|
|
1682
|
+
for (let j = 0; j < this.index; ++j) {
|
|
1683
|
+
const prev = this.previous(j);
|
|
1684
|
+
if (prev.object instanceof osuBase.Spinner) {
|
|
1685
|
+
continue;
|
|
1686
|
+
}
|
|
1687
|
+
if (prev.startTime >= this.startTime) {
|
|
1688
|
+
continue;
|
|
1689
|
+
}
|
|
1690
|
+
if (prev.startTime < this.startTime - this.timePreempt) {
|
|
1691
|
+
break;
|
|
1692
|
+
}
|
|
1693
|
+
prevVisibleObjects.push(prev.object);
|
|
1694
|
+
}
|
|
1695
|
+
for (const hitObject of prevVisibleObjects) {
|
|
1696
|
+
const distance = this.object
|
|
1697
|
+
.getStackedPosition(this.mode)
|
|
1698
|
+
.getDistance(hitObject.getStackedEndPosition(this.mode));
|
|
1699
|
+
const deltaTime = this.startTime - hitObject.endTime / clockRate;
|
|
1700
|
+
this.applyToOverlappingFactor(distance, deltaTime);
|
|
1701
|
+
}
|
|
1702
|
+
for (const hitObject of nextVisibleObjects) {
|
|
1703
|
+
const distance = hitObject
|
|
1704
|
+
.getStackedPosition(this.mode)
|
|
1705
|
+
.getDistance(this.object.getStackedEndPosition(this.mode));
|
|
1706
|
+
const deltaTime = hitObject.startTime / clockRate - this.endTime;
|
|
1707
|
+
if (deltaTime >= 0) {
|
|
1708
|
+
this.noteDensity += 1 - deltaTime / this.timePreempt;
|
|
1709
|
+
}
|
|
1710
|
+
this.applyToOverlappingFactor(distance, deltaTime);
|
|
1591
1711
|
}
|
|
1592
1712
|
}
|
|
1713
|
+
applyToOverlappingFactor(distance, deltaTime) {
|
|
1714
|
+
// Penalize objects that are too close to the object in both distance
|
|
1715
|
+
// and delta time to prevent stream maps from being overweighted.
|
|
1716
|
+
this.overlappingFactor +=
|
|
1717
|
+
Math.max(0, 1 - distance / (2.5 * this.object.radius)) *
|
|
1718
|
+
(7.5 /
|
|
1719
|
+
(1 +
|
|
1720
|
+
Math.exp(0.15 *
|
|
1721
|
+
(Math.max(deltaTime, DifficultyHitObject.minDeltaTime) -
|
|
1722
|
+
75))));
|
|
1723
|
+
}
|
|
1593
1724
|
}
|
|
1594
1725
|
|
|
1595
1726
|
/**
|
|
1596
1727
|
* A difficulty calculator for osu!droid gamemode.
|
|
1597
1728
|
*/
|
|
1598
1729
|
class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
1730
|
+
constructor() {
|
|
1731
|
+
super(...arguments);
|
|
1732
|
+
this.attributes = {
|
|
1733
|
+
mode: "rebalance",
|
|
1734
|
+
tapDifficulty: 0,
|
|
1735
|
+
rhythmDifficulty: 0,
|
|
1736
|
+
visualDifficulty: 0,
|
|
1737
|
+
aimNoteCount: 0,
|
|
1738
|
+
mods: [],
|
|
1739
|
+
starRating: 0,
|
|
1740
|
+
maxCombo: 0,
|
|
1741
|
+
aimDifficulty: 0,
|
|
1742
|
+
flashlightDifficulty: 0,
|
|
1743
|
+
speedNoteCount: 0,
|
|
1744
|
+
sliderFactor: 0,
|
|
1745
|
+
clockRate: 1,
|
|
1746
|
+
overallDifficulty: 0,
|
|
1747
|
+
hitCircleCount: 0,
|
|
1748
|
+
sliderCount: 0,
|
|
1749
|
+
spinnerCount: 0,
|
|
1750
|
+
aimDifficultStrainCount: 0,
|
|
1751
|
+
tapDifficultStrainCount: 0,
|
|
1752
|
+
flashlightDifficultStrainCount: 0,
|
|
1753
|
+
visualDifficultStrainCount: 0,
|
|
1754
|
+
flashlightSliderFactor: 0,
|
|
1755
|
+
visualSliderFactor: 0,
|
|
1756
|
+
possibleThreeFingeredSections: [],
|
|
1757
|
+
difficultSliders: [],
|
|
1758
|
+
averageSpeedDeltaTime: 0,
|
|
1759
|
+
vibroFactor: 1,
|
|
1760
|
+
};
|
|
1761
|
+
this.difficultyMultiplier = 0.18;
|
|
1762
|
+
this.mode = osuBase.Modes.droid;
|
|
1763
|
+
}
|
|
1599
1764
|
/**
|
|
1600
1765
|
* The aim star rating of the beatmap.
|
|
1601
1766
|
*/
|
|
1602
|
-
aim
|
|
1767
|
+
get aim() {
|
|
1768
|
+
return this.attributes.aimDifficulty;
|
|
1769
|
+
}
|
|
1603
1770
|
/**
|
|
1604
1771
|
* The tap star rating of the beatmap.
|
|
1605
1772
|
*/
|
|
1606
|
-
tap
|
|
1773
|
+
get tap() {
|
|
1774
|
+
return this.attributes.tapDifficulty;
|
|
1775
|
+
}
|
|
1607
1776
|
/**
|
|
1608
1777
|
* The rhythm star rating of the beatmap.
|
|
1609
1778
|
*/
|
|
1610
|
-
rhythm
|
|
1779
|
+
get rhythm() {
|
|
1780
|
+
return this.attributes.rhythmDifficulty;
|
|
1781
|
+
}
|
|
1611
1782
|
/**
|
|
1612
1783
|
* The flashlight star rating of the beatmap.
|
|
1613
1784
|
*/
|
|
1614
|
-
flashlight
|
|
1785
|
+
get flashlight() {
|
|
1786
|
+
return this.attributes.flashlightDifficulty;
|
|
1787
|
+
}
|
|
1615
1788
|
/**
|
|
1616
1789
|
* The visual star rating of the beatmap.
|
|
1617
1790
|
*/
|
|
1618
|
-
visual
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
visualDifficulty: 0,
|
|
1629
|
-
aimNoteCount: 0,
|
|
1630
|
-
mods: [],
|
|
1631
|
-
starRating: 0,
|
|
1632
|
-
maxCombo: 0,
|
|
1633
|
-
aimDifficulty: 0,
|
|
1634
|
-
flashlightDifficulty: 0,
|
|
1635
|
-
speedNoteCount: 0,
|
|
1636
|
-
sliderFactor: 0,
|
|
1637
|
-
approachRate: 0,
|
|
1638
|
-
overallDifficulty: 0,
|
|
1639
|
-
hitCircleCount: 0,
|
|
1640
|
-
sliderCount: 0,
|
|
1641
|
-
spinnerCount: 0,
|
|
1642
|
-
flashlightSliderFactor: 0,
|
|
1643
|
-
visualSliderFactor: 0,
|
|
1644
|
-
possibleThreeFingeredSections: [],
|
|
1645
|
-
difficultSliders: [],
|
|
1646
|
-
};
|
|
1647
|
-
difficultyMultiplier = 0.18;
|
|
1648
|
-
mode = osuBase.Modes.droid;
|
|
1791
|
+
get visual() {
|
|
1792
|
+
return this.attributes.visualDifficulty;
|
|
1793
|
+
}
|
|
1794
|
+
get cacheableAttributes() {
|
|
1795
|
+
return Object.assign(Object.assign({}, this.attributes), { mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods) });
|
|
1796
|
+
}
|
|
1797
|
+
// Override to use DroidDifficultyCalculationOptions
|
|
1798
|
+
calculate(options) {
|
|
1799
|
+
return super.calculate(options);
|
|
1800
|
+
}
|
|
1649
1801
|
/**
|
|
1650
1802
|
* Calculates the aim star rating of the beatmap and stores it in this instance.
|
|
1651
1803
|
*/
|
|
@@ -1659,26 +1811,18 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1659
1811
|
* Calculates the tap star rating of the beatmap and stores it in this instance.
|
|
1660
1812
|
*/
|
|
1661
1813
|
calculateTap() {
|
|
1662
|
-
const
|
|
1663
|
-
this.
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
else {
|
|
1669
|
-
this.postCalculateTap(tapSkill);
|
|
1670
|
-
}
|
|
1671
|
-
this.calculateSpeedAttributes();
|
|
1814
|
+
const tapSkillCheese = new DroidTap(this.mods, true);
|
|
1815
|
+
const tapSkillNoCheese = new DroidTap(this.mods, false);
|
|
1816
|
+
this.calculateSkills(tapSkillCheese, tapSkillNoCheese);
|
|
1817
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1818
|
+
this.calculateSkills(tapSkillVibro);
|
|
1819
|
+
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
1672
1820
|
}
|
|
1673
1821
|
/**
|
|
1674
1822
|
* Calculates the rhythm star rating of the beatmap and stores it in this instance.
|
|
1675
1823
|
*/
|
|
1676
1824
|
calculateRhythm() {
|
|
1677
|
-
|
|
1678
|
-
this.rhythm = this.attributes.rhythmDifficulty = 0;
|
|
1679
|
-
return;
|
|
1680
|
-
}
|
|
1681
|
-
const rhythmSkill = new DroidRhythm(this.mods, this.stats.od);
|
|
1825
|
+
const rhythmSkill = new DroidRhythm(this.mods);
|
|
1682
1826
|
this.calculateSkills(rhythmSkill);
|
|
1683
1827
|
this.postCalculateRhythm(rhythmSkill);
|
|
1684
1828
|
}
|
|
@@ -1696,7 +1840,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1696
1840
|
*/
|
|
1697
1841
|
calculateVisual() {
|
|
1698
1842
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1699
|
-
this.
|
|
1843
|
+
this.attributes.visualDifficulty = 0;
|
|
1700
1844
|
return;
|
|
1701
1845
|
}
|
|
1702
1846
|
const visualSkill = new DroidVisual(this.mods, true);
|
|
@@ -1718,55 +1862,35 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1718
1862
|
if (basePerformanceValue > 1e-5) {
|
|
1719
1863
|
// Document for formula derivation:
|
|
1720
1864
|
// https://docs.google.com/document/d/10DZGYYSsT_yjz2Mtp6yIJld0Rqx4E-vVHupCqiM4TNI/edit
|
|
1721
|
-
this.
|
|
1865
|
+
this.attributes.starRating =
|
|
1722
1866
|
0.027 *
|
|
1723
1867
|
(Math.cbrt((100000 / Math.pow(2, 1 / 1.1)) * basePerformanceValue) +
|
|
1724
1868
|
4);
|
|
1725
1869
|
}
|
|
1726
1870
|
else {
|
|
1727
|
-
this.
|
|
1871
|
+
this.attributes.starRating = 0;
|
|
1728
1872
|
}
|
|
1729
1873
|
}
|
|
1730
1874
|
calculateAll() {
|
|
1731
1875
|
const skills = this.createSkills();
|
|
1732
|
-
const isRelax = this.mods.some((m) => m instanceof osuBase.ModRelax);
|
|
1733
|
-
if (isRelax) {
|
|
1734
|
-
// Remove visual skills to reduce overhead.
|
|
1735
|
-
skills.pop();
|
|
1736
|
-
skills.pop();
|
|
1737
|
-
}
|
|
1738
1876
|
this.calculateSkills(...skills);
|
|
1739
1877
|
const aimSkill = skills[0];
|
|
1740
1878
|
const aimSkillWithoutSliders = skills[1];
|
|
1741
1879
|
const rhythmSkill = skills[2];
|
|
1742
|
-
const
|
|
1743
|
-
const flashlightSkill = skills[
|
|
1744
|
-
const flashlightSkillWithoutSliders = skills[
|
|
1745
|
-
const visualSkill = skills[
|
|
1746
|
-
const visualSkillWithoutSliders = skills[
|
|
1880
|
+
const tapSkillCheese = skills[3];
|
|
1881
|
+
const flashlightSkill = skills[5];
|
|
1882
|
+
const flashlightSkillWithoutSliders = skills[6];
|
|
1883
|
+
const visualSkill = skills[7];
|
|
1884
|
+
const visualSkillWithoutSliders = skills[8];
|
|
1885
|
+
const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
|
|
1886
|
+
this.calculateSkills(tapSkillVibro);
|
|
1747
1887
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1751
|
-
else {
|
|
1752
|
-
this.postCalculateTap(tapSkill);
|
|
1753
|
-
}
|
|
1754
|
-
this.calculateSpeedAttributes();
|
|
1755
|
-
if (!isRelax) {
|
|
1756
|
-
this.postCalculateRhythm(rhythmSkill);
|
|
1757
|
-
}
|
|
1888
|
+
this.postCalculateTap(tapSkillCheese, tapSkillVibro);
|
|
1889
|
+
this.postCalculateRhythm(rhythmSkill);
|
|
1758
1890
|
this.postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders);
|
|
1759
|
-
|
|
1760
|
-
this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
|
|
1761
|
-
}
|
|
1762
|
-
else {
|
|
1763
|
-
this.visual = this.attributes.visualDifficulty = 0;
|
|
1764
|
-
}
|
|
1891
|
+
this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
|
|
1765
1892
|
this.calculateTotal();
|
|
1766
1893
|
}
|
|
1767
|
-
/**
|
|
1768
|
-
* Returns a string representative of the class.
|
|
1769
|
-
*/
|
|
1770
1894
|
toString() {
|
|
1771
1895
|
return (this.total.toFixed(2) +
|
|
1772
1896
|
" stars (" +
|
|
@@ -1781,22 +1905,39 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1781
1905
|
this.visual.toFixed(2) +
|
|
1782
1906
|
" visual)");
|
|
1783
1907
|
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1908
|
+
generateDifficultyHitObjects(beatmap, clockRate) {
|
|
1909
|
+
var _a, _b;
|
|
1910
|
+
const difficultyObjects = [];
|
|
1911
|
+
const { objects } = beatmap.hitObjects;
|
|
1912
|
+
const isPrecise = this.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
1913
|
+
const greatWindow = new osuBase.DroidHitWindow(beatmap.difficulty.od).hitWindowFor300(isPrecise) / clockRate;
|
|
1914
|
+
for (let i = 0; i < objects.length; ++i) {
|
|
1915
|
+
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);
|
|
1916
|
+
difficultyObject.computeProperties(clockRate, objects);
|
|
1917
|
+
difficultyObjects.push(difficultyObject);
|
|
1918
|
+
}
|
|
1919
|
+
return difficultyObjects;
|
|
1920
|
+
}
|
|
1787
1921
|
createSkills() {
|
|
1788
1922
|
return [
|
|
1789
1923
|
new DroidAim(this.mods, true),
|
|
1790
1924
|
new DroidAim(this.mods, false),
|
|
1791
1925
|
// Tap skill depends on rhythm skill, so we put it first
|
|
1792
|
-
new DroidRhythm(this.mods
|
|
1793
|
-
|
|
1926
|
+
new DroidRhythm(this.mods),
|
|
1927
|
+
// Cheesability tap
|
|
1928
|
+
new DroidTap(this.mods, true),
|
|
1929
|
+
// Non-cheesability tap
|
|
1930
|
+
new DroidTap(this.mods, false),
|
|
1794
1931
|
new DroidFlashlight(this.mods, true),
|
|
1795
1932
|
new DroidFlashlight(this.mods, false),
|
|
1796
1933
|
new DroidVisual(this.mods, true),
|
|
1797
1934
|
new DroidVisual(this.mods, false),
|
|
1798
1935
|
];
|
|
1799
1936
|
}
|
|
1937
|
+
calculateClockRate(options) {
|
|
1938
|
+
var _a, _b;
|
|
1939
|
+
return (osuBase.ModUtil.calculateRateWithMods((_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [], options === null || options === void 0 ? void 0 : options.oldStatistics) * ((_b = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1));
|
|
1940
|
+
}
|
|
1800
1941
|
/**
|
|
1801
1942
|
* Called after aim skill calculation.
|
|
1802
1943
|
*
|
|
@@ -1806,152 +1947,128 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1806
1947
|
postCalculateAim(aimSkill, aimSkillWithoutSliders) {
|
|
1807
1948
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
1808
1949
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
1809
|
-
|
|
1950
|
+
const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
|
|
1951
|
+
this.attributes.aimDifficulty = this.mods.some((m) => m instanceof osuBase.ModAutopilot)
|
|
1952
|
+
? 0
|
|
1953
|
+
: this.starValue(aimSkill.difficultyValue()) * retryabilityScaling;
|
|
1810
1954
|
if (this.aim) {
|
|
1811
1955
|
this.attributes.sliderFactor =
|
|
1812
|
-
this.starValue(aimSkillWithoutSliders.difficultyValue())
|
|
1956
|
+
(this.starValue(aimSkillWithoutSliders.difficultyValue()) *
|
|
1957
|
+
retryabilityScaling) /
|
|
1813
1958
|
this.aim;
|
|
1814
1959
|
}
|
|
1815
1960
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1816
|
-
this.
|
|
1961
|
+
this.attributes.aimDifficulty *= 0.9;
|
|
1817
1962
|
}
|
|
1818
|
-
this.attributes.
|
|
1963
|
+
this.attributes.aimDifficultStrainCount =
|
|
1964
|
+
aimSkill.countDifficultStrains();
|
|
1819
1965
|
this.calculateAimAttributes();
|
|
1820
1966
|
}
|
|
1821
1967
|
/**
|
|
1822
1968
|
* Calculates aim-related attributes.
|
|
1823
1969
|
*/
|
|
1824
1970
|
calculateAimAttributes() {
|
|
1825
|
-
|
|
1826
|
-
let maxStrain = 0;
|
|
1827
|
-
// Take the top 15% most difficult sliders based on velocity.
|
|
1971
|
+
this.attributes.difficultSliders = [];
|
|
1828
1972
|
const topDifficultSliders = [];
|
|
1829
1973
|
for (let i = 0; i < this.objects.length; ++i) {
|
|
1830
1974
|
const object = this.objects[i];
|
|
1831
|
-
objectStrains.push(object.aimStrainWithSliders);
|
|
1832
|
-
maxStrain = Math.max(maxStrain, object.aimStrainWithSliders);
|
|
1833
1975
|
const velocity = object.travelDistance / object.travelTime;
|
|
1834
1976
|
if (velocity > 0) {
|
|
1835
1977
|
topDifficultSliders.push({
|
|
1836
1978
|
index: i,
|
|
1837
1979
|
velocity: velocity,
|
|
1838
1980
|
});
|
|
1839
|
-
topDifficultSliders.sort((a, b) => b.velocity - a.velocity);
|
|
1840
|
-
while (topDifficultSliders.length >
|
|
1841
|
-
Math.ceil(0.15 * this.beatmap.hitObjects.sliders)) {
|
|
1842
|
-
topDifficultSliders.pop();
|
|
1843
|
-
}
|
|
1844
1981
|
}
|
|
1845
1982
|
}
|
|
1846
|
-
if (maxStrain) {
|
|
1847
|
-
this.attributes.aimNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
1848
|
-
}
|
|
1849
1983
|
const velocitySum = topDifficultSliders.reduce((a, v) => a + v.velocity, 0);
|
|
1850
1984
|
for (const slider of topDifficultSliders) {
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1985
|
+
const difficultyRating = slider.velocity / velocitySum;
|
|
1986
|
+
// Only consider sliders that are fast enough.
|
|
1987
|
+
if (difficultyRating > 0.02) {
|
|
1988
|
+
this.attributes.difficultSliders.push({
|
|
1989
|
+
index: slider.index,
|
|
1990
|
+
difficultyRating: slider.velocity / velocitySum,
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
this.attributes.difficultSliders.sort((a, b) => b.difficultyRating - a.difficultyRating);
|
|
1995
|
+
// Take the top 15% most difficult sliders.
|
|
1996
|
+
while (this.attributes.difficultSliders.length >
|
|
1997
|
+
Math.ceil(0.15 * this.beatmap.hitObjects.sliders)) {
|
|
1998
|
+
this.attributes.difficultSliders.pop();
|
|
1855
1999
|
}
|
|
1856
2000
|
}
|
|
1857
2001
|
/**
|
|
1858
2002
|
* Called after tap skill calculation.
|
|
1859
2003
|
*
|
|
1860
|
-
* @param
|
|
2004
|
+
* @param tapSkillCheese The tap skill that considers cheesing.
|
|
2005
|
+
* @param tapSkillVibro The tap skill that considers vibro.
|
|
1861
2006
|
*/
|
|
1862
|
-
postCalculateTap(
|
|
1863
|
-
this.strainPeaks.speed =
|
|
1864
|
-
|
|
2007
|
+
postCalculateTap(tapSkillCheese, tapSkillVibro) {
|
|
2008
|
+
this.strainPeaks.speed = tapSkillCheese.strainPeaks;
|
|
2009
|
+
const retryabilityScaling = this.calculateRetryabilityScaling(tapSkillCheese.countRetryability());
|
|
2010
|
+
this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
|
|
2011
|
+
? 0
|
|
2012
|
+
: this.starValue(tapSkillCheese.difficultyValue()) *
|
|
2013
|
+
retryabilityScaling;
|
|
2014
|
+
if (this.tap) {
|
|
2015
|
+
this.attributes.vibroFactor =
|
|
2016
|
+
(this.starValue(tapSkillVibro.difficultyValue()) *
|
|
2017
|
+
retryabilityScaling) /
|
|
2018
|
+
this.tap;
|
|
2019
|
+
}
|
|
2020
|
+
this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
|
|
2021
|
+
this.attributes.averageSpeedDeltaTime =
|
|
2022
|
+
tapSkillCheese.relevantDeltaTime();
|
|
2023
|
+
this.attributes.tapDifficultStrainCount =
|
|
2024
|
+
tapSkillCheese.countDifficultStrains();
|
|
2025
|
+
this.calculateTapAttributes();
|
|
1865
2026
|
}
|
|
1866
2027
|
/**
|
|
1867
|
-
* Calculates
|
|
2028
|
+
* Calculates tap-related attributes.
|
|
1868
2029
|
*/
|
|
1869
|
-
|
|
2030
|
+
calculateTapAttributes() {
|
|
1870
2031
|
this.attributes.possibleThreeFingeredSections = [];
|
|
1871
|
-
const
|
|
1872
|
-
const objectStrains = [];
|
|
1873
|
-
let maxStrain = 0;
|
|
1874
|
-
const maxSectionDeltaTime = 2000;
|
|
2032
|
+
const { threeFingerStrainThreshold } = DroidDifficultyCalculator;
|
|
1875
2033
|
const minSectionObjectCount = 5;
|
|
1876
|
-
let
|
|
1877
|
-
|
|
2034
|
+
let inSpeedSection = false;
|
|
2035
|
+
let firstSpeedObjectIndex = 0;
|
|
2036
|
+
for (let i = 2; i < this.objects.length; ++i) {
|
|
1878
2037
|
const current = this.objects[i];
|
|
1879
|
-
const
|
|
1880
|
-
if (
|
|
1881
|
-
|
|
2038
|
+
const prev = this.objects[i - 1];
|
|
2039
|
+
if (!inSpeedSection &&
|
|
2040
|
+
current.originalTapStrain >= threeFingerStrainThreshold) {
|
|
2041
|
+
inSpeedSection = true;
|
|
2042
|
+
firstSpeedObjectIndex = i;
|
|
2043
|
+
continue;
|
|
1882
2044
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
const
|
|
1886
|
-
|
|
2045
|
+
const currentDelta = current.deltaTime;
|
|
2046
|
+
const prevDelta = prev.deltaTime;
|
|
2047
|
+
const deltaRatio = Math.min(prevDelta, currentDelta) /
|
|
2048
|
+
Math.max(prevDelta, currentDelta);
|
|
2049
|
+
if (inSpeedSection &&
|
|
2050
|
+
(current.originalTapStrain < threeFingerStrainThreshold ||
|
|
2051
|
+
// Stop speed section on slowing down 1/2 rhythm change or anything slower.
|
|
2052
|
+
(prevDelta < currentDelta && deltaRatio <= 0.5) ||
|
|
2053
|
+
// Don't forget to manually add the last section, which would otherwise be ignored.
|
|
2054
|
+
i === this.objects.length - 1)) {
|
|
2055
|
+
const lastSpeedObjectIndex = i - (i === this.objects.length - 1 ? 0 : 1);
|
|
2056
|
+
inSpeedSection = false;
|
|
1887
2057
|
// Ignore sections that don't meet object count requirement.
|
|
1888
|
-
if (i -
|
|
1889
|
-
firstObjectIndex = i + 1;
|
|
1890
|
-
continue;
|
|
1891
|
-
}
|
|
1892
|
-
tempSections.push({
|
|
1893
|
-
firstObjectIndex,
|
|
1894
|
-
lastObjectIndex: i,
|
|
1895
|
-
});
|
|
1896
|
-
firstObjectIndex = i + 1;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
// Don't forget to manually add the last beatmap section, which would otherwise be ignored.
|
|
1900
|
-
if (this.objects.length - firstObjectIndex > minSectionObjectCount) {
|
|
1901
|
-
tempSections.push({
|
|
1902
|
-
firstObjectIndex,
|
|
1903
|
-
lastObjectIndex: this.objects.length - 1,
|
|
1904
|
-
});
|
|
1905
|
-
}
|
|
1906
|
-
// Refilter with tap strain in mind.
|
|
1907
|
-
const { threeFingerStrainThreshold } = DroidDifficultyCalculator;
|
|
1908
|
-
for (const section of tempSections) {
|
|
1909
|
-
let inSpeedSection = false;
|
|
1910
|
-
let newFirstObjectIndex = section.firstObjectIndex;
|
|
1911
|
-
for (let i = section.firstObjectIndex; i <= section.lastObjectIndex; ++i) {
|
|
1912
|
-
const current = this.objects[i];
|
|
1913
|
-
if (!inSpeedSection &&
|
|
1914
|
-
current.originalTapStrain >= threeFingerStrainThreshold) {
|
|
1915
|
-
inSpeedSection = true;
|
|
1916
|
-
newFirstObjectIndex = i;
|
|
2058
|
+
if (i - firstSpeedObjectIndex < minSectionObjectCount) {
|
|
1917
2059
|
continue;
|
|
1918
2060
|
}
|
|
1919
|
-
if (inSpeedSection &&
|
|
1920
|
-
current.originalTapStrain < threeFingerStrainThreshold) {
|
|
1921
|
-
inSpeedSection = false;
|
|
1922
|
-
this.attributes.possibleThreeFingeredSections.push({
|
|
1923
|
-
firstObjectIndex: newFirstObjectIndex,
|
|
1924
|
-
lastObjectIndex: i,
|
|
1925
|
-
sumStrain: this.calculateThreeFingerSummedStrain(newFirstObjectIndex, i),
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
// Don't forget to manually add the last beatmap section, which would otherwise be ignored.
|
|
1930
|
-
if (inSpeedSection) {
|
|
1931
2061
|
this.attributes.possibleThreeFingeredSections.push({
|
|
1932
|
-
firstObjectIndex:
|
|
1933
|
-
lastObjectIndex:
|
|
1934
|
-
sumStrain:
|
|
2062
|
+
firstObjectIndex: firstSpeedObjectIndex,
|
|
2063
|
+
lastObjectIndex: lastSpeedObjectIndex,
|
|
2064
|
+
sumStrain: Math.pow(this.objects
|
|
2065
|
+
.slice(firstSpeedObjectIndex, lastSpeedObjectIndex + 1)
|
|
2066
|
+
.reduce((a, v) => a +
|
|
2067
|
+
v.originalTapStrain /
|
|
2068
|
+
threeFingerStrainThreshold, 0), 0.75),
|
|
1935
2069
|
});
|
|
1936
2070
|
}
|
|
1937
2071
|
}
|
|
1938
|
-
if (maxStrain) {
|
|
1939
|
-
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
/**
|
|
1943
|
-
* Calculates the sum of strains for possible three-fingered sections.
|
|
1944
|
-
*
|
|
1945
|
-
* @param firstObjectIndex The index of the first object in the section.
|
|
1946
|
-
* @param lastObjectIndex The index of the last object in the section.
|
|
1947
|
-
* @returns The summed strain of the section.
|
|
1948
|
-
*/
|
|
1949
|
-
calculateThreeFingerSummedStrain(firstObjectIndex, lastObjectIndex) {
|
|
1950
|
-
return Math.pow(this.objects
|
|
1951
|
-
.slice(firstObjectIndex, lastObjectIndex)
|
|
1952
|
-
.reduce((a, v) => a +
|
|
1953
|
-
v.originalTapStrain /
|
|
1954
|
-
DroidDifficultyCalculator.threeFingerStrainThreshold, 0), 0.75);
|
|
1955
2072
|
}
|
|
1956
2073
|
/**
|
|
1957
2074
|
* Called after rhythm skill calculation.
|
|
@@ -1959,7 +2076,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1959
2076
|
* @param rhythmSkill The rhythm skill.
|
|
1960
2077
|
*/
|
|
1961
2078
|
postCalculateRhythm(rhythmSkill) {
|
|
1962
|
-
this.
|
|
2079
|
+
this.attributes.rhythmDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
|
|
1963
2080
|
? 0
|
|
1964
2081
|
: this.starValue(rhythmSkill.difficultyValue());
|
|
1965
2082
|
}
|
|
@@ -1971,15 +2088,19 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1971
2088
|
*/
|
|
1972
2089
|
postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders) {
|
|
1973
2090
|
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
1974
|
-
this.
|
|
2091
|
+
this.attributes.flashlightDifficulty = this.starValue(flashlightSkill.difficultyValue());
|
|
1975
2092
|
if (this.flashlight) {
|
|
1976
2093
|
this.attributes.flashlightSliderFactor =
|
|
1977
2094
|
this.starValue(flashlightSkillWithoutSliders.difficultyValue()) / this.flashlight;
|
|
1978
2095
|
}
|
|
2096
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2097
|
+
this.attributes.flashlightDifficulty *= 0.3;
|
|
2098
|
+
}
|
|
1979
2099
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1980
|
-
this.
|
|
2100
|
+
this.attributes.flashlightDifficulty *= 0.7;
|
|
1981
2101
|
}
|
|
1982
|
-
this.attributes.
|
|
2102
|
+
this.attributes.flashlightDifficultStrainCount =
|
|
2103
|
+
flashlightSkill.countDifficultStrains();
|
|
1983
2104
|
}
|
|
1984
2105
|
/**
|
|
1985
2106
|
* Called after visual skill calculation.
|
|
@@ -1988,7 +2109,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1988
2109
|
* @param visualSkillWithoutSliders The visual skill that doesn't consider sliders.
|
|
1989
2110
|
*/
|
|
1990
2111
|
postCalculateVisual(visualSkillWithSliders, visualSkillWithoutSliders) {
|
|
1991
|
-
this.
|
|
2112
|
+
this.attributes.visualDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
|
|
1992
2113
|
? 0
|
|
1993
2114
|
: this.starValue(visualSkillWithSliders.difficultyValue());
|
|
1994
2115
|
if (this.visual) {
|
|
@@ -1996,33 +2117,54 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1996
2117
|
this.starValue(visualSkillWithoutSliders.difficultyValue()) /
|
|
1997
2118
|
this.visual;
|
|
1998
2119
|
}
|
|
2120
|
+
if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
|
|
2121
|
+
this.attributes.visualDifficulty *= 0.8;
|
|
2122
|
+
}
|
|
2123
|
+
this.attributes.visualDifficultStrainCount =
|
|
2124
|
+
visualSkillWithSliders.countDifficultStrains();
|
|
2125
|
+
}
|
|
2126
|
+
calculateRetryabilityScaling(retryability) {
|
|
2127
|
+
return 1 - Math.pow(retryability, 4) / 10;
|
|
1999
2128
|
}
|
|
2000
2129
|
}
|
|
2130
|
+
/**
|
|
2131
|
+
* The strain threshold to start detecting for possible three-fingered section.
|
|
2132
|
+
*
|
|
2133
|
+
* Increasing this number will result in less sections being flagged.
|
|
2134
|
+
*/
|
|
2135
|
+
DroidDifficultyCalculator.threeFingerStrainThreshold = 175;
|
|
2001
2136
|
|
|
2002
2137
|
/**
|
|
2003
2138
|
* The base class of performance calculators.
|
|
2004
2139
|
*/
|
|
2005
2140
|
class PerformanceCalculator {
|
|
2006
2141
|
/**
|
|
2007
|
-
* The
|
|
2008
|
-
*/
|
|
2009
|
-
total = 0;
|
|
2010
|
-
/**
|
|
2011
|
-
* The calculated accuracy.
|
|
2012
|
-
*/
|
|
2013
|
-
computedAccuracy = new osuBase.Accuracy({});
|
|
2014
|
-
/**
|
|
2015
|
-
* Penalty for combo breaks.
|
|
2016
|
-
*/
|
|
2017
|
-
comboPenalty = 0;
|
|
2018
|
-
/**
|
|
2019
|
-
* The amount of misses that are filtered out from sliderbreaks.
|
|
2020
|
-
*/
|
|
2021
|
-
effectiveMissCount = 0;
|
|
2022
|
-
/**
|
|
2023
|
-
* Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
|
|
2142
|
+
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
2024
2143
|
*/
|
|
2025
|
-
|
|
2144
|
+
constructor(difficultyAttributes) {
|
|
2145
|
+
/**
|
|
2146
|
+
* The overall performance value.
|
|
2147
|
+
*/
|
|
2148
|
+
this.total = 0;
|
|
2149
|
+
/**
|
|
2150
|
+
* The calculated accuracy.
|
|
2151
|
+
*/
|
|
2152
|
+
this.computedAccuracy = new osuBase.Accuracy({});
|
|
2153
|
+
/**
|
|
2154
|
+
* The amount of misses that are filtered out from sliderbreaks.
|
|
2155
|
+
*/
|
|
2156
|
+
this.effectiveMissCount = 0;
|
|
2157
|
+
/**
|
|
2158
|
+
* Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
|
|
2159
|
+
*/
|
|
2160
|
+
this.sliderNerfFactor = 1;
|
|
2161
|
+
if (this.isCacheableAttribute(difficultyAttributes)) {
|
|
2162
|
+
this.difficultyAttributes = Object.assign(Object.assign({}, difficultyAttributes), { mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods) });
|
|
2163
|
+
}
|
|
2164
|
+
else {
|
|
2165
|
+
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2026
2168
|
/**
|
|
2027
2169
|
* Calculates the performance points of the beatmap.
|
|
2028
2170
|
*
|
|
@@ -2032,7 +2174,7 @@ class PerformanceCalculator {
|
|
|
2032
2174
|
calculate(options) {
|
|
2033
2175
|
this.handleOptions(options);
|
|
2034
2176
|
this.calculateValues();
|
|
2035
|
-
this.calculateTotalValue();
|
|
2177
|
+
this.total = this.calculateTotalValue();
|
|
2036
2178
|
return this;
|
|
2037
2179
|
}
|
|
2038
2180
|
/**
|
|
@@ -2063,11 +2205,11 @@ class PerformanceCalculator {
|
|
|
2063
2205
|
* @param options Options for performance calculation.
|
|
2064
2206
|
*/
|
|
2065
2207
|
handleOptions(options) {
|
|
2208
|
+
var _a;
|
|
2066
2209
|
const maxCombo = this.difficultyAttributes.maxCombo;
|
|
2067
2210
|
const miss = this.computedAccuracy.nmiss;
|
|
2068
|
-
const combo = options
|
|
2069
|
-
|
|
2070
|
-
if (options?.accPercent instanceof osuBase.Accuracy) {
|
|
2211
|
+
const combo = (_a = options === null || options === void 0 ? void 0 : options.combo) !== null && _a !== void 0 ? _a : maxCombo - miss;
|
|
2212
|
+
if ((options === null || options === void 0 ? void 0 : options.accPercent) instanceof osuBase.Accuracy) {
|
|
2071
2213
|
// Copy into new instance to not modify the original
|
|
2072
2214
|
this.computedAccuracy = new osuBase.Accuracy(options.accPercent);
|
|
2073
2215
|
if (this.computedAccuracy.n300 <= 0) {
|
|
@@ -2082,9 +2224,9 @@ class PerformanceCalculator {
|
|
|
2082
2224
|
}
|
|
2083
2225
|
else {
|
|
2084
2226
|
this.computedAccuracy = new osuBase.Accuracy({
|
|
2085
|
-
percent: options
|
|
2227
|
+
percent: options === null || options === void 0 ? void 0 : options.accPercent,
|
|
2086
2228
|
nobjects: this.totalHits,
|
|
2087
|
-
nmiss: options
|
|
2229
|
+
nmiss: (options === null || options === void 0 ? void 0 : options.miss) || 0,
|
|
2088
2230
|
});
|
|
2089
2231
|
}
|
|
2090
2232
|
this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
|
|
@@ -2118,7 +2260,7 @@ class PerformanceCalculator {
|
|
|
2118
2260
|
if (this.difficultyAttributes.sliderCount > 0) {
|
|
2119
2261
|
// We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
|
|
2120
2262
|
const estimateDifficultSliders = this.difficultyAttributes.sliderCount * 0.15;
|
|
2121
|
-
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.computedAccuracy.
|
|
2263
|
+
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.computedAccuracy.n100 +
|
|
2122
2264
|
this.computedAccuracy.n50 +
|
|
2123
2265
|
this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
|
|
2124
2266
|
this.sliderNerfFactor =
|
|
@@ -2129,6 +2271,22 @@ class PerformanceCalculator {
|
|
|
2129
2271
|
this.difficultyAttributes.sliderFactor;
|
|
2130
2272
|
}
|
|
2131
2273
|
}
|
|
2274
|
+
/**
|
|
2275
|
+
* Calculates a strain-based miss penalty.
|
|
2276
|
+
*
|
|
2277
|
+
* Strain-based miss penalty assumes that a player will miss on the hardest parts of a map,
|
|
2278
|
+
* so we use the amount of relatively difficult sections to adjust miss penalty
|
|
2279
|
+
* to make it more punishing on maps with lower amount of hard sections.
|
|
2280
|
+
*/
|
|
2281
|
+
calculateStrainBasedMissPenalty(difficultStrainCount) {
|
|
2282
|
+
if (this.effectiveMissCount === 0) {
|
|
2283
|
+
return 1;
|
|
2284
|
+
}
|
|
2285
|
+
return (0.96 /
|
|
2286
|
+
(this.effectiveMissCount /
|
|
2287
|
+
(4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
|
|
2288
|
+
1));
|
|
2289
|
+
}
|
|
2132
2290
|
/**
|
|
2133
2291
|
* Calculates the amount of misses + sliderbreaks from combo.
|
|
2134
2292
|
*/
|
|
@@ -2146,32 +2304,52 @@ class PerformanceCalculator {
|
|
|
2146
2304
|
}
|
|
2147
2305
|
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
2148
2306
|
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Determines whether an attribute is a cacheable attribute.
|
|
2309
|
+
*
|
|
2310
|
+
* @param attributes The attributes to check.
|
|
2311
|
+
* @returns Whether the attributes are cacheable.
|
|
2312
|
+
*/
|
|
2313
|
+
isCacheableAttribute(attributes) {
|
|
2314
|
+
return typeof attributes.mods === "string";
|
|
2315
|
+
}
|
|
2149
2316
|
}
|
|
2150
2317
|
|
|
2151
2318
|
/**
|
|
2152
2319
|
* A performance points calculator that calculates performance points for osu!droid gamemode.
|
|
2153
2320
|
*/
|
|
2154
2321
|
class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2322
|
+
constructor() {
|
|
2323
|
+
super(...arguments);
|
|
2324
|
+
/**
|
|
2325
|
+
* The aim performance value.
|
|
2326
|
+
*/
|
|
2327
|
+
this.aim = 0;
|
|
2328
|
+
/**
|
|
2329
|
+
* The tap performance value.
|
|
2330
|
+
*/
|
|
2331
|
+
this.tap = 0;
|
|
2332
|
+
/**
|
|
2333
|
+
* The accuracy performance value.
|
|
2334
|
+
*/
|
|
2335
|
+
this.accuracy = 0;
|
|
2336
|
+
/**
|
|
2337
|
+
* The flashlight performance value.
|
|
2338
|
+
*/
|
|
2339
|
+
this.flashlight = 0;
|
|
2340
|
+
/**
|
|
2341
|
+
* The visual performance value.
|
|
2342
|
+
*/
|
|
2343
|
+
this.visual = 0;
|
|
2344
|
+
this.finalMultiplier = 1.24;
|
|
2345
|
+
this.mode = osuBase.Modes.droid;
|
|
2346
|
+
this._aimSliderCheesePenalty = 1;
|
|
2347
|
+
this._flashlightSliderCheesePenalty = 1;
|
|
2348
|
+
this._visualSliderCheesePenalty = 1;
|
|
2349
|
+
this._tapPenalty = 1;
|
|
2350
|
+
this._deviation = 0;
|
|
2351
|
+
this._tapDeviation = 0;
|
|
2352
|
+
}
|
|
2175
2353
|
/**
|
|
2176
2354
|
* The penalty used to penalize the tap performance value.
|
|
2177
2355
|
*
|
|
@@ -2216,22 +2394,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2216
2394
|
get visualSliderCheesePenalty() {
|
|
2217
2395
|
return this._visualSliderCheesePenalty;
|
|
2218
2396
|
}
|
|
2219
|
-
difficultyAttributes;
|
|
2220
|
-
finalMultiplier = 1.24;
|
|
2221
|
-
mode = osuBase.Modes.droid;
|
|
2222
|
-
_aimSliderCheesePenalty = 1;
|
|
2223
|
-
_flashlightSliderCheesePenalty = 1;
|
|
2224
|
-
_visualSliderCheesePenalty = 1;
|
|
2225
|
-
_tapPenalty = 1;
|
|
2226
|
-
_deviation = 0;
|
|
2227
|
-
_tapDeviation = 0;
|
|
2228
|
-
/**
|
|
2229
|
-
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
2230
|
-
*/
|
|
2231
|
-
constructor(difficultyAttributes) {
|
|
2232
|
-
super();
|
|
2233
|
-
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
2234
|
-
}
|
|
2235
2397
|
/**
|
|
2236
2398
|
* Applies a tap penalty value to this calculator.
|
|
2237
2399
|
*
|
|
@@ -2246,9 +2408,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2246
2408
|
if (value === this._tapPenalty) {
|
|
2247
2409
|
return;
|
|
2248
2410
|
}
|
|
2249
|
-
this.tap *= this._tapPenalty / value;
|
|
2250
2411
|
this._tapPenalty = value;
|
|
2251
|
-
this.
|
|
2412
|
+
this.tap = this.calculateTapValue();
|
|
2413
|
+
this.total = this.calculateTotalValue();
|
|
2252
2414
|
}
|
|
2253
2415
|
/**
|
|
2254
2416
|
* Applies an aim slider cheese penalty value to this calculator.
|
|
@@ -2268,8 +2430,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2268
2430
|
return;
|
|
2269
2431
|
}
|
|
2270
2432
|
this._aimSliderCheesePenalty = value;
|
|
2271
|
-
this.calculateAimValue();
|
|
2272
|
-
this.calculateTotalValue();
|
|
2433
|
+
this.aim = this.calculateAimValue();
|
|
2434
|
+
this.total = this.calculateTotalValue();
|
|
2273
2435
|
}
|
|
2274
2436
|
/**
|
|
2275
2437
|
* Applies a flashlight slider cheese penalty value to this calculator.
|
|
@@ -2289,8 +2451,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2289
2451
|
return;
|
|
2290
2452
|
}
|
|
2291
2453
|
this._flashlightSliderCheesePenalty = value;
|
|
2292
|
-
this.calculateFlashlightValue();
|
|
2293
|
-
this.calculateTotalValue();
|
|
2454
|
+
this.flashlight = this.calculateFlashlightValue();
|
|
2455
|
+
this.total = this.calculateTotalValue();
|
|
2294
2456
|
}
|
|
2295
2457
|
/**
|
|
2296
2458
|
* Applies a visual slider cheese penalty value to this calculator.
|
|
@@ -2310,80 +2472,96 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2310
2472
|
return;
|
|
2311
2473
|
}
|
|
2312
2474
|
this._visualSliderCheesePenalty = value;
|
|
2313
|
-
this.calculateVisualValue();
|
|
2314
|
-
this.calculateTotalValue();
|
|
2475
|
+
this.visual = this.calculateVisualValue();
|
|
2476
|
+
this.total = this.calculateTotalValue();
|
|
2315
2477
|
}
|
|
2316
2478
|
calculateValues() {
|
|
2317
2479
|
this._deviation = this.calculateDeviation();
|
|
2318
2480
|
this._tapDeviation = this.calculateTapDeviation();
|
|
2319
|
-
this.calculateAimValue();
|
|
2320
|
-
this.calculateTapValue();
|
|
2321
|
-
this.calculateAccuracyValue();
|
|
2322
|
-
this.calculateFlashlightValue();
|
|
2323
|
-
this.calculateVisualValue();
|
|
2481
|
+
this.aim = this.calculateAimValue();
|
|
2482
|
+
this.tap = this.calculateTapValue();
|
|
2483
|
+
this.accuracy = this.calculateAccuracyValue();
|
|
2484
|
+
this.flashlight = this.calculateFlashlightValue();
|
|
2485
|
+
this.visual = this.calculateVisualValue();
|
|
2324
2486
|
}
|
|
2325
2487
|
calculateTotalValue() {
|
|
2326
|
-
this.
|
|
2327
|
-
Math.pow(
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier;
|
|
2488
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
2489
|
+
Math.pow(this.tap, 1.1) +
|
|
2490
|
+
Math.pow(this.accuracy, 1.1) +
|
|
2491
|
+
Math.pow(this.flashlight, 1.1) +
|
|
2492
|
+
Math.pow(this.visual, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
2332
2493
|
}
|
|
2333
2494
|
handleOptions(options) {
|
|
2334
|
-
|
|
2335
|
-
this.
|
|
2495
|
+
var _a, _b, _c, _d;
|
|
2496
|
+
this._tapPenalty = (_a = options === null || options === void 0 ? void 0 : options.tapPenalty) !== null && _a !== void 0 ? _a : 1;
|
|
2497
|
+
this._aimSliderCheesePenalty = (_b = options === null || options === void 0 ? void 0 : options.aimSliderCheesePenalty) !== null && _b !== void 0 ? _b : 1;
|
|
2336
2498
|
this._flashlightSliderCheesePenalty =
|
|
2337
|
-
options
|
|
2499
|
+
(_c = options === null || options === void 0 ? void 0 : options.flashlightSliderCheesePenalty) !== null && _c !== void 0 ? _c : 1;
|
|
2338
2500
|
this._visualSliderCheesePenalty =
|
|
2339
|
-
options
|
|
2501
|
+
(_d = options === null || options === void 0 ? void 0 : options.visualSliderCheesePenalty) !== null && _d !== void 0 ? _d : 1;
|
|
2340
2502
|
super.handleOptions(options);
|
|
2341
2503
|
}
|
|
2342
2504
|
/**
|
|
2343
2505
|
* Calculates the aim performance value of the beatmap.
|
|
2344
2506
|
*/
|
|
2345
2507
|
calculateAimValue() {
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
this.aim *=
|
|
2351
|
-
0.97 *
|
|
2352
|
-
Math.pow(1 -
|
|
2353
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
2354
|
-
}
|
|
2355
|
-
// Combo scaling
|
|
2356
|
-
this.aim *= this.comboPenalty;
|
|
2508
|
+
let aimValue = this.baseValue(Math.pow(this.difficultyAttributes.aimDifficulty, 0.8));
|
|
2509
|
+
aimValue *= Math.min(this.calculateStrainBasedMissPenalty(this.difficultyAttributes.aimDifficultStrainCount), this.proportionalMissPenalty);
|
|
2510
|
+
// Scale the aim value with estimated full combo deviation.
|
|
2511
|
+
aimValue *= this.calculateDeviationBasedLengthScaling();
|
|
2357
2512
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
2358
|
-
|
|
2513
|
+
aimValue *= this.sliderNerfFactor;
|
|
2359
2514
|
// Scale the aim value with slider cheese penalty.
|
|
2360
|
-
|
|
2515
|
+
aimValue *= this._aimSliderCheesePenalty;
|
|
2361
2516
|
// Scale the aim value with deviation.
|
|
2362
|
-
|
|
2363
|
-
1.
|
|
2364
|
-
Math.pow(osuBase.ErrorFunction.erf(
|
|
2517
|
+
aimValue *=
|
|
2518
|
+
1.025 *
|
|
2519
|
+
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.475);
|
|
2520
|
+
// OD 7 SS stays the same.
|
|
2521
|
+
aimValue *= 0.98 + Math.pow(7, 2) / 2500;
|
|
2522
|
+
return aimValue;
|
|
2365
2523
|
}
|
|
2366
2524
|
/**
|
|
2367
2525
|
* Calculates the tap performance value of the beatmap.
|
|
2368
2526
|
*/
|
|
2369
2527
|
calculateTapValue() {
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
//
|
|
2380
|
-
this
|
|
2528
|
+
let tapValue = this.baseValue(this.difficultyAttributes.tapDifficulty);
|
|
2529
|
+
tapValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.tapDifficultStrainCount);
|
|
2530
|
+
// Scale the tap value with estimated full combo deviation.
|
|
2531
|
+
// Consider notes that are difficult to tap with respect to other notes, but
|
|
2532
|
+
// also cap the note count to prevent buffing filler patterns.
|
|
2533
|
+
tapValue *= this.calculateDeviationBasedLengthScaling(Math.min(this.difficultyAttributes.speedNoteCount, this.totalHits / 1.45));
|
|
2534
|
+
// Normalize the deviation to 300 BPM.
|
|
2535
|
+
const normalizedDeviation = this.tapDeviation *
|
|
2536
|
+
Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
|
|
2537
|
+
// We expect the player to get 7500/x deviation when doubletapping x BPM.
|
|
2538
|
+
// Using this expectation, we penalize scores with deviation above 25.
|
|
2539
|
+
const averageBPM = 60000 / 4 / this.difficultyAttributes.averageSpeedDeltaTime;
|
|
2540
|
+
const adjustedDeviation = normalizedDeviation *
|
|
2541
|
+
(1 +
|
|
2542
|
+
1 /
|
|
2543
|
+
(1 +
|
|
2544
|
+
Math.exp(-(normalizedDeviation - 7500 / averageBPM) /
|
|
2545
|
+
((2 * 300) / averageBPM))));
|
|
2381
2546
|
// Scale the tap value with tap deviation.
|
|
2382
|
-
|
|
2383
|
-
1.
|
|
2384
|
-
Math.pow(osuBase.ErrorFunction.erf(
|
|
2547
|
+
tapValue *=
|
|
2548
|
+
1.05 *
|
|
2549
|
+
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.6);
|
|
2550
|
+
// Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
|
|
2551
|
+
// Higher BPMs require more precise tapping. When the deviation is too high,
|
|
2552
|
+
// it can be assumed that the player taps invariant to rhythm.
|
|
2553
|
+
// We harshen the punishment for such scenario.
|
|
2554
|
+
tapValue *=
|
|
2555
|
+
(1 - Math.pow(this.difficultyAttributes.vibroFactor, 6)) /
|
|
2556
|
+
(1 +
|
|
2557
|
+
Math.exp((this._tapDeviation - 7500 / averageBPM) /
|
|
2558
|
+
((2 * 300) / averageBPM))) +
|
|
2559
|
+
Math.pow(this.difficultyAttributes.vibroFactor, 6);
|
|
2385
2560
|
// Scale the tap value with three-fingered penalty.
|
|
2386
|
-
|
|
2561
|
+
tapValue /= this._tapPenalty;
|
|
2562
|
+
// OD 8 SS stays the same.
|
|
2563
|
+
tapValue *= 0.95 + Math.pow(8, 2) / 750;
|
|
2564
|
+
return tapValue;
|
|
2387
2565
|
}
|
|
2388
2566
|
/**
|
|
2389
2567
|
* Calculates the accuracy performance value of the beatmap.
|
|
@@ -2391,84 +2569,112 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2391
2569
|
calculateAccuracyValue() {
|
|
2392
2570
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax) ||
|
|
2393
2571
|
this.totalSuccessfulHits === 0) {
|
|
2394
|
-
|
|
2395
|
-
return;
|
|
2572
|
+
return 0;
|
|
2396
2573
|
}
|
|
2397
|
-
this.
|
|
2398
|
-
650 *
|
|
2399
|
-
Math.exp(-0.125 * this._deviation) *
|
|
2400
|
-
// The following function is to give higher reward for deviations lower than 25 (250 UR).
|
|
2401
|
-
(15 / (this._deviation + 15) + 0.65);
|
|
2402
|
-
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
|
|
2574
|
+
let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
|
|
2403
2575
|
const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
|
|
2404
2576
|
? this.totalHits - this.difficultyAttributes.spinnerCount
|
|
2405
2577
|
: this.difficultyAttributes.hitCircleCount;
|
|
2406
|
-
|
|
2578
|
+
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
|
|
2579
|
+
accuracyValue *= Math.min(1.15, Math.sqrt(Math.log(1 + ((Math.E - 1) * ncircles) / 1000)));
|
|
2407
2580
|
// Scale the accuracy value with rhythm complexity.
|
|
2408
|
-
|
|
2581
|
+
accuracyValue *=
|
|
2409
2582
|
1.5 /
|
|
2410
2583
|
(1 +
|
|
2411
2584
|
Math.exp(-(this.difficultyAttributes.rhythmDifficulty - 1) / 2));
|
|
2585
|
+
// Penalize accuracy pp after the first miss.
|
|
2586
|
+
accuracyValue *= Math.pow(0.97, Math.max(0, this.effectiveMissCount - 1));
|
|
2412
2587
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
2413
|
-
|
|
2588
|
+
accuracyValue *= 1.02;
|
|
2414
2589
|
}
|
|
2590
|
+
return accuracyValue;
|
|
2415
2591
|
}
|
|
2416
2592
|
/**
|
|
2417
2593
|
* Calculates the flashlight performance value of the beatmap.
|
|
2418
2594
|
*/
|
|
2419
2595
|
calculateFlashlightValue() {
|
|
2420
2596
|
if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
2421
|
-
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
this.flashlight =
|
|
2425
|
-
Math.pow(this.difficultyAttributes.flashlightDifficulty, 1.6) * 25;
|
|
2426
|
-
// Combo scaling
|
|
2427
|
-
this.flashlight *= this.comboPenalty;
|
|
2428
|
-
if (this.effectiveMissCount > 0) {
|
|
2429
|
-
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
2430
|
-
this.flashlight *=
|
|
2431
|
-
0.97 *
|
|
2432
|
-
Math.pow(1 -
|
|
2433
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
2597
|
+
return 0;
|
|
2434
2598
|
}
|
|
2599
|
+
let flashlightValue = Math.pow(this.difficultyAttributes.flashlightDifficulty, 1.6) * 25;
|
|
2600
|
+
flashlightValue *= Math.min(this.calculateStrainBasedMissPenalty(this.difficultyAttributes.flashlightDifficultStrainCount), this.proportionalMissPenalty);
|
|
2435
2601
|
// Account for shorter maps having a higher ratio of 0 combo/100 combo flashlight radius.
|
|
2436
|
-
|
|
2602
|
+
flashlightValue *=
|
|
2437
2603
|
0.7 +
|
|
2438
2604
|
0.1 * Math.min(1, this.totalHits / 200) +
|
|
2439
2605
|
(this.totalHits > 200
|
|
2440
2606
|
? 0.2 * Math.min(1, (this.totalHits - 200) / 200)
|
|
2441
2607
|
: 0);
|
|
2442
2608
|
// Scale the flashlight value with slider cheese penalty.
|
|
2443
|
-
|
|
2609
|
+
flashlightValue *= this._flashlightSliderCheesePenalty;
|
|
2444
2610
|
// Scale the flashlight value with deviation.
|
|
2445
|
-
|
|
2611
|
+
flashlightValue *= osuBase.ErrorFunction.erf(50 / (Math.SQRT2 * this._deviation));
|
|
2612
|
+
return flashlightValue;
|
|
2446
2613
|
}
|
|
2447
2614
|
/**
|
|
2448
2615
|
* Calculates the visual performance value of the beatmap.
|
|
2449
2616
|
*/
|
|
2450
2617
|
calculateVisualValue() {
|
|
2451
|
-
this.
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
0.97 *
|
|
2457
|
-
Math.pow(1 -
|
|
2458
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
2459
|
-
}
|
|
2460
|
-
// Combo scaling
|
|
2461
|
-
this.visual *= this.comboPenalty;
|
|
2462
|
-
// Scale the visual value with object count to penalize short maps.
|
|
2463
|
-
this.visual *= Math.min(1, 1.650668 +
|
|
2464
|
-
(0.4845796 - 1.650668) /
|
|
2465
|
-
(1 + Math.pow(this.totalHits / 817.9306, 1.147469)));
|
|
2618
|
+
let visualValue = Math.pow(this.difficultyAttributes.visualDifficulty, 1.6) * 22.5;
|
|
2619
|
+
visualValue *= Math.min(this.calculateStrainBasedMissPenalty(this.difficultyAttributes.visualDifficultStrainCount), this.proportionalMissPenalty);
|
|
2620
|
+
// Scale the visual value with estimated full combo deviation.
|
|
2621
|
+
// As visual is easily "bypassable" with memorization, punish for memorization.
|
|
2622
|
+
visualValue *= this.calculateDeviationBasedLengthScaling(undefined, true);
|
|
2466
2623
|
// Scale the visual value with slider cheese penalty.
|
|
2467
|
-
|
|
2624
|
+
visualValue *= this._visualSliderCheesePenalty;
|
|
2468
2625
|
// Scale the visual value with deviation.
|
|
2469
|
-
|
|
2470
|
-
1.
|
|
2471
|
-
Math.pow(osuBase.ErrorFunction.erf(
|
|
2626
|
+
visualValue *=
|
|
2627
|
+
1.05 *
|
|
2628
|
+
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.775);
|
|
2629
|
+
// OD 5 SS stays the same.
|
|
2630
|
+
visualValue *= 0.98 + Math.pow(5, 2) / 2500;
|
|
2631
|
+
return visualValue;
|
|
2632
|
+
}
|
|
2633
|
+
/**
|
|
2634
|
+
* The object-based proportional miss penalty.
|
|
2635
|
+
*/
|
|
2636
|
+
get proportionalMissPenalty() {
|
|
2637
|
+
if (this.effectiveMissCount === 0) {
|
|
2638
|
+
return 1;
|
|
2639
|
+
}
|
|
2640
|
+
const missProportion = (this.totalHits - this.effectiveMissCount) / (this.totalHits + 1);
|
|
2641
|
+
const noMissProportion = this.totalHits / (this.totalHits + 1);
|
|
2642
|
+
return (
|
|
2643
|
+
// Aim deviation-based scale.
|
|
2644
|
+
(osuBase.ErrorFunction.erfInv(missProportion) /
|
|
2645
|
+
osuBase.ErrorFunction.erfInv(noMissProportion)) *
|
|
2646
|
+
// Cheesing-based scale (i.e. 50% misses is deliberately only hitting each other
|
|
2647
|
+
// note, 90% misses is deliberately only hitting 1 note every 10 notes).
|
|
2648
|
+
Math.pow(missProportion, 8));
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Calculates the object-based length scaling based on the deviation of a player for a full
|
|
2652
|
+
* combo in this beatmap, taking retries into account.
|
|
2653
|
+
*
|
|
2654
|
+
* @param objectCount The amount of objects to be considered. Defaults to the amount of
|
|
2655
|
+
* objects in this beatmap.
|
|
2656
|
+
* @param punishForMemorization Whether to punish the deviation for memorization. Defaults to `false`.
|
|
2657
|
+
*/
|
|
2658
|
+
calculateDeviationBasedLengthScaling(objectCount = this.totalHits, punishForMemorization = false) {
|
|
2659
|
+
// Assume a sample proportion of hits for a full combo to be `(n - 0.5) / n` due to
|
|
2660
|
+
// continuity correction, where `n` is the object count.
|
|
2661
|
+
const calculateProportion = (notes) => (notes - 0.5) / notes;
|
|
2662
|
+
// Keeping `x` notes as the benchmark, assume that a player will retry a beatmap
|
|
2663
|
+
// `max(1, x/n)` times relative to an `x`-note beatmap.
|
|
2664
|
+
const benchmarkNotes = 700;
|
|
2665
|
+
// Calculate the proportion equivalent to the bottom half of retry count percentile of
|
|
2666
|
+
// scores and take it as the player's "real" proportion.
|
|
2667
|
+
const retryProportion = (proportion, notes, tries) => proportion +
|
|
2668
|
+
Math.sqrt((2 * proportion * (1 - proportion)) / notes) *
|
|
2669
|
+
osuBase.ErrorFunction.erfInv(1 / tries - 1);
|
|
2670
|
+
// Using the proportion, we calculate the deviation based off that proportion and again
|
|
2671
|
+
// compared to the hit deviation for proportion `(n - 0.5) / n`.
|
|
2672
|
+
let multiplier = Math.max(0, osuBase.ErrorFunction.erfInv(retryProportion(calculateProportion(objectCount), objectCount, Math.max(1, benchmarkNotes / objectCount))) / osuBase.ErrorFunction.erfInv(calculateProportion(benchmarkNotes)) || 0);
|
|
2673
|
+
// Punish for memorization if needed.
|
|
2674
|
+
if (punishForMemorization) {
|
|
2675
|
+
multiplier *= Math.min(1, Math.sqrt(objectCount / benchmarkNotes));
|
|
2676
|
+
}
|
|
2677
|
+
return multiplier;
|
|
2472
2678
|
}
|
|
2473
2679
|
/**
|
|
2474
2680
|
* Estimates the player's tap deviation based on the OD, number of circles and sliders,
|
|
@@ -2489,40 +2695,65 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2489
2695
|
return Number.POSITIVE_INFINITY;
|
|
2490
2696
|
}
|
|
2491
2697
|
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).hitWindowFor300();
|
|
2492
|
-
// Obtain the 50 hit window for droid.
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
//
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2698
|
+
// Obtain the 50 and 100 hit window for droid.
|
|
2699
|
+
const isPrecise = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
2700
|
+
const droidHitWindow = new osuBase.DroidHitWindow(osuBase.DroidHitWindow.hitWindow300ToOD(hitWindow300 * this.difficultyAttributes.clockRate, isPrecise));
|
|
2701
|
+
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) /
|
|
2702
|
+
this.difficultyAttributes.clockRate;
|
|
2703
|
+
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) /
|
|
2704
|
+
this.difficultyAttributes.clockRate;
|
|
2705
|
+
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2706
|
+
const circleCount = this.difficultyAttributes.hitCircleCount;
|
|
2707
|
+
const missCountCircles = Math.min(nmiss, circleCount);
|
|
2708
|
+
const mehCountCircles = Math.min(n50, circleCount - missCountCircles);
|
|
2709
|
+
const okCountCircles = Math.min(n100, circleCount - missCountCircles - mehCountCircles);
|
|
2710
|
+
const greatCountCircles = Math.max(0, circleCount - missCountCircles - mehCountCircles - okCountCircles);
|
|
2711
|
+
// Assume 100s, 50s, and misses happen on circles. If there are less non-300s on circles than 300s,
|
|
2712
|
+
// compute the deviation on circles.
|
|
2713
|
+
if (greatCountCircles > 0) {
|
|
2714
|
+
// The probability that a player hits a circle is unknown, but we can estimate it to be
|
|
2715
|
+
// the number of greats on circles divided by the number of circles, and then add one
|
|
2716
|
+
// to the number of circles as a bias correction.
|
|
2717
|
+
const greatProbabilityCircle = greatCountCircles /
|
|
2718
|
+
(circleCount - missCountCircles - mehCountCircles + 1);
|
|
2719
|
+
// Compute the deviation assuming 300s and 100s are normally distributed, and 50s are uniformly distributed.
|
|
2720
|
+
// Begin with the normal distribution first.
|
|
2721
|
+
let deviationOnCircles = hitWindow300 /
|
|
2722
|
+
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilityCircle));
|
|
2723
|
+
deviationOnCircles *= Math.sqrt(1 -
|
|
2724
|
+
(Math.sqrt(2 / Math.PI) *
|
|
2725
|
+
hitWindow100 *
|
|
2726
|
+
Math.exp(-0.5 *
|
|
2727
|
+
Math.pow(hitWindow100 / deviationOnCircles, 2))) /
|
|
2728
|
+
(deviationOnCircles *
|
|
2729
|
+
osuBase.ErrorFunction.erf(hitWindow100 /
|
|
2730
|
+
(Math.SQRT2 * deviationOnCircles))));
|
|
2731
|
+
// Then compute the variance for 50s.
|
|
2732
|
+
const mehVariance = (hitWindow50 * hitWindow50 +
|
|
2733
|
+
hitWindow100 * hitWindow50 +
|
|
2734
|
+
hitWindow100 * hitWindow100) /
|
|
2735
|
+
3;
|
|
2736
|
+
// Find the total deviation.
|
|
2737
|
+
deviationOnCircles = Math.sqrt(((greatCountCircles + okCountCircles) *
|
|
2738
|
+
Math.pow(deviationOnCircles, 2) +
|
|
2739
|
+
mehCountCircles * mehVariance) /
|
|
2740
|
+
(greatCountCircles + okCountCircles + mehCountCircles));
|
|
2741
|
+
return deviationOnCircles;
|
|
2742
|
+
}
|
|
2743
|
+
// If there are more non-300s than there are circles, compute the deviation on sliders instead.
|
|
2744
|
+
// Here, all that matters is whether or not the slider was missed, since it is impossible
|
|
2745
|
+
// to get a 100 or 50 on a slider by mis-tapping it.
|
|
2746
|
+
const sliderCount = this.difficultyAttributes.sliderCount;
|
|
2747
|
+
const missCountSliders = Math.min(sliderCount, nmiss - missCountCircles);
|
|
2748
|
+
const greatCountSliders = sliderCount - missCountSliders;
|
|
2749
|
+
// We only get here if nothing was hit. In this case, there is no estimate for deviation.
|
|
2750
|
+
// Note that this is never negative, so checking if this is only equal to 0 makes sense.
|
|
2751
|
+
if (greatCountSliders === 0) {
|
|
2519
2752
|
return Number.POSITIVE_INFINITY;
|
|
2520
2753
|
}
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilitySlider));
|
|
2525
|
-
return Math.min(deviationOnCircles, deviationOnSliders);
|
|
2754
|
+
const greatProbabilitySlider = greatCountSliders / (sliderCount + 1);
|
|
2755
|
+
return (hitWindow50 /
|
|
2756
|
+
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilitySlider)));
|
|
2526
2757
|
}
|
|
2527
2758
|
/**
|
|
2528
2759
|
* Does the same as {@link calculateDeviation}, but only for notes and inaccuracies that are relevant to tap difficulty.
|
|
@@ -2534,14 +2765,59 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2534
2765
|
if (this.totalSuccessfulHits === 0) {
|
|
2535
2766
|
return Number.POSITIVE_INFINITY;
|
|
2536
2767
|
}
|
|
2537
|
-
const
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2768
|
+
const { speedNoteCount, clockRate, overallDifficulty } = this.difficultyAttributes;
|
|
2769
|
+
const hitWindow300 = new osuBase.OsuHitWindow(overallDifficulty).hitWindowFor300();
|
|
2770
|
+
// Obtain the 50 and 100 hit window for droid.
|
|
2771
|
+
const isPrecise = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
2772
|
+
const droidHitWindow = new osuBase.DroidHitWindow(osuBase.DroidHitWindow.hitWindow300ToOD(hitWindow300 * clockRate, isPrecise));
|
|
2773
|
+
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) / clockRate;
|
|
2774
|
+
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) / clockRate;
|
|
2775
|
+
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2776
|
+
// Assume a fixed ratio of non-300s hit in speed notes based on speed note count ratio and OD.
|
|
2777
|
+
// Graph: https://www.desmos.com/calculator/iskvgjkxr4
|
|
2778
|
+
const speedNoteRatio = speedNoteCount / this.totalHits;
|
|
2779
|
+
const nonGreatCount = n100 + n50 + nmiss;
|
|
2780
|
+
const nonGreatRatio = 1 -
|
|
2781
|
+
(Math.pow(Math.exp(Math.sqrt(hitWindow300)) + 1, 1 - speedNoteRatio) -
|
|
2782
|
+
1) /
|
|
2783
|
+
Math.exp(Math.sqrt(hitWindow300));
|
|
2784
|
+
const relevantCountGreat = Math.max(0, speedNoteCount - nonGreatCount * nonGreatRatio);
|
|
2785
|
+
const relevantCountOk = n100 * nonGreatRatio;
|
|
2786
|
+
const relevantCountMeh = n50 * nonGreatRatio;
|
|
2787
|
+
const relevantCountMiss = nmiss * nonGreatRatio;
|
|
2788
|
+
// Assume 100s, 50s, and misses happen on circles. If there are less non-300s on circles than 300s,
|
|
2789
|
+
// compute the deviation on circles.
|
|
2790
|
+
if (relevantCountGreat > 0) {
|
|
2791
|
+
// The probability that a player hits a circle is unknown, but we can estimate it to be
|
|
2792
|
+
// the number of greats on circles divided by the number of circles, and then add one
|
|
2793
|
+
// to the number of circles as a bias correction.
|
|
2794
|
+
const greatProbabilityCircle = relevantCountGreat /
|
|
2795
|
+
(speedNoteCount - relevantCountMiss - relevantCountMeh + 1);
|
|
2796
|
+
// Compute the deviation assuming 300s and 100s are normally distributed, and 50s are uniformly distributed.
|
|
2797
|
+
// Begin with the normal distribution first.
|
|
2798
|
+
let deviationOnCircles = hitWindow300 /
|
|
2799
|
+
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilityCircle));
|
|
2800
|
+
deviationOnCircles *= Math.sqrt(1 -
|
|
2801
|
+
(Math.sqrt(2 / Math.PI) *
|
|
2802
|
+
hitWindow100 *
|
|
2803
|
+
Math.exp(-0.5 *
|
|
2804
|
+
Math.pow(hitWindow100 / deviationOnCircles, 2))) /
|
|
2805
|
+
(deviationOnCircles *
|
|
2806
|
+
osuBase.ErrorFunction.erf(hitWindow100 /
|
|
2807
|
+
(Math.SQRT2 * deviationOnCircles))));
|
|
2808
|
+
// Then compute the variance for 50s.
|
|
2809
|
+
const mehVariance = (hitWindow50 * hitWindow50 +
|
|
2810
|
+
hitWindow100 * hitWindow50 +
|
|
2811
|
+
hitWindow100 * hitWindow100) /
|
|
2812
|
+
3;
|
|
2813
|
+
// Find the total deviation.
|
|
2814
|
+
deviationOnCircles = Math.sqrt(((relevantCountGreat + relevantCountOk) *
|
|
2815
|
+
Math.pow(deviationOnCircles, 2) +
|
|
2816
|
+
relevantCountMeh * mehVariance) /
|
|
2817
|
+
(relevantCountGreat + relevantCountOk + relevantCountMeh));
|
|
2818
|
+
return deviationOnCircles;
|
|
2819
|
+
}
|
|
2820
|
+
return Number.POSITIVE_INFINITY;
|
|
2545
2821
|
}
|
|
2546
2822
|
toString() {
|
|
2547
2823
|
return (this.total.toFixed(2) +
|
|
@@ -2564,20 +2840,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2564
2840
|
* and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
|
2565
2841
|
*/
|
|
2566
2842
|
class OsuSkill extends StrainSkill {
|
|
2567
|
-
/**
|
|
2568
|
-
* The default multiplier applied to the final difficulty value after all other calculations.
|
|
2569
|
-
*
|
|
2570
|
-
* May be overridden via {@link difficultyMultiplier}.
|
|
2571
|
-
*/
|
|
2572
|
-
static defaultDifficultyMultiplier = 1.06;
|
|
2573
|
-
/**
|
|
2574
|
-
* The final multiplier to be applied to the final difficulty value after all other calculations.
|
|
2575
|
-
*/
|
|
2576
|
-
difficultyMultiplier = OsuSkill.defaultDifficultyMultiplier;
|
|
2577
2843
|
difficultyValue() {
|
|
2578
|
-
const strains = this.strainPeaks
|
|
2579
|
-
.slice()
|
|
2580
|
-
.sort((a, b) => b - a);
|
|
2844
|
+
const strains = this.strainPeaks.slice().sort((a, b) => b - a);
|
|
2581
2845
|
if (this.reducedSectionCount > 0) {
|
|
2582
2846
|
// We are reducing the highest strains first to account for extreme difficulty spikes.
|
|
2583
2847
|
for (let i = 0; i < Math.min(strains.length, this.reducedSectionCount); ++i) {
|
|
@@ -2588,17 +2852,17 @@ class OsuSkill extends StrainSkill {
|
|
|
2588
2852
|
}
|
|
2589
2853
|
// Difficulty is the weighted sum of the highest strains from every section.
|
|
2590
2854
|
// We're sorting from highest to lowest strain.
|
|
2591
|
-
|
|
2855
|
+
this.difficulty = 0;
|
|
2592
2856
|
let weight = 1;
|
|
2593
2857
|
for (const strain of strains) {
|
|
2594
2858
|
const addition = strain * weight;
|
|
2595
|
-
if (difficulty + addition === difficulty) {
|
|
2859
|
+
if (this.difficulty + addition === this.difficulty) {
|
|
2596
2860
|
break;
|
|
2597
2861
|
}
|
|
2598
|
-
difficulty += addition;
|
|
2862
|
+
this.difficulty += addition;
|
|
2599
2863
|
weight *= this.decayWeight;
|
|
2600
2864
|
}
|
|
2601
|
-
return
|
|
2865
|
+
return this.difficulty;
|
|
2602
2866
|
}
|
|
2603
2867
|
}
|
|
2604
2868
|
|
|
@@ -2621,7 +2885,7 @@ class OsuAimEvaluator extends AimEvaluator {
|
|
|
2621
2885
|
const last = current.previous(0);
|
|
2622
2886
|
if (current.object instanceof osuBase.Spinner ||
|
|
2623
2887
|
current.index <= 1 ||
|
|
2624
|
-
last
|
|
2888
|
+
(last === null || last === void 0 ? void 0 : last.object) instanceof osuBase.Spinner) {
|
|
2625
2889
|
return 0;
|
|
2626
2890
|
}
|
|
2627
2891
|
const lastLast = current.previous(1);
|
|
@@ -2709,7 +2973,7 @@ class OsuAimEvaluator extends AimEvaluator {
|
|
|
2709
2973
|
velocityChangeBonus *= Math.pow(Math.min(current.strainTime, last.strainTime) /
|
|
2710
2974
|
Math.max(current.strainTime, last.strainTime), 2);
|
|
2711
2975
|
}
|
|
2712
|
-
if (last.
|
|
2976
|
+
if (last.travelTime) {
|
|
2713
2977
|
// Reward sliders based on velocity.
|
|
2714
2978
|
sliderBonus = last.travelDistance / last.travelTime;
|
|
2715
2979
|
}
|
|
@@ -2728,35 +2992,38 @@ class OsuAimEvaluator extends AimEvaluator {
|
|
|
2728
2992
|
* Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
|
|
2729
2993
|
*/
|
|
2730
2994
|
class OsuAim extends OsuSkill {
|
|
2731
|
-
skillMultiplier = 23.55;
|
|
2732
|
-
strainDecayBase = 0.15;
|
|
2733
|
-
reducedSectionCount = 10;
|
|
2734
|
-
reducedSectionBaseline = 0.75;
|
|
2735
|
-
decayWeight = 0.9;
|
|
2736
|
-
withSliders;
|
|
2737
2995
|
constructor(mods, withSliders) {
|
|
2738
2996
|
super(mods);
|
|
2997
|
+
this.strainDecayBase = 0.15;
|
|
2998
|
+
this.reducedSectionCount = 10;
|
|
2999
|
+
this.reducedSectionBaseline = 0.75;
|
|
3000
|
+
this.decayWeight = 0.9;
|
|
3001
|
+
this.currentAimStrain = 0;
|
|
3002
|
+
this.skillMultiplier = 25.18;
|
|
2739
3003
|
this.withSliders = withSliders;
|
|
2740
3004
|
}
|
|
2741
|
-
/**
|
|
2742
|
-
* @param current The hitobject to calculate.
|
|
2743
|
-
*/
|
|
2744
3005
|
strainValueAt(current) {
|
|
2745
|
-
this.
|
|
2746
|
-
this.
|
|
3006
|
+
this.currentAimStrain *= this.strainDecay(current.deltaTime);
|
|
3007
|
+
this.currentAimStrain +=
|
|
2747
3008
|
OsuAimEvaluator.evaluateDifficultyOf(current, this.withSliders) *
|
|
2748
3009
|
this.skillMultiplier;
|
|
2749
|
-
|
|
3010
|
+
this._objectStrains.push(this.currentAimStrain);
|
|
3011
|
+
return this.currentAimStrain;
|
|
3012
|
+
}
|
|
3013
|
+
calculateInitialStrain(time, current) {
|
|
3014
|
+
var _a, _b;
|
|
3015
|
+
return (this.currentAimStrain *
|
|
3016
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
2750
3017
|
}
|
|
2751
3018
|
/**
|
|
2752
3019
|
* @param current The hitobject to save to.
|
|
2753
3020
|
*/
|
|
2754
3021
|
saveToHitObject(current) {
|
|
2755
3022
|
if (this.withSliders) {
|
|
2756
|
-
current.aimStrainWithSliders = this.
|
|
3023
|
+
current.aimStrainWithSliders = this.currentAimStrain;
|
|
2757
3024
|
}
|
|
2758
3025
|
else {
|
|
2759
|
-
current.aimStrainWithoutSliders = this.
|
|
3026
|
+
current.aimStrainWithoutSliders = this.currentAimStrain;
|
|
2760
3027
|
}
|
|
2761
3028
|
}
|
|
2762
3029
|
}
|
|
@@ -2765,10 +3032,6 @@ class OsuAim extends OsuSkill {
|
|
|
2765
3032
|
* An evaluator for calculating osu!standard speed skill.
|
|
2766
3033
|
*/
|
|
2767
3034
|
class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
2768
|
-
/**
|
|
2769
|
-
* Spacing threshold for a single hitobject spacing.
|
|
2770
|
-
*/
|
|
2771
|
-
static SINGLE_SPACING_THRESHOLD = 125;
|
|
2772
3035
|
/**
|
|
2773
3036
|
* Evaluates the difficulty of tapping the current object, based on:
|
|
2774
3037
|
*
|
|
@@ -2777,67 +3040,70 @@ class OsuSpeedEvaluator extends SpeedEvaluator {
|
|
|
2777
3040
|
* - and how easily they can be cheesed.
|
|
2778
3041
|
*
|
|
2779
3042
|
* @param current The current object.
|
|
2780
|
-
* @param greatWindow The great hit window of the current object.
|
|
2781
3043
|
*/
|
|
2782
|
-
static evaluateDifficultyOf(current
|
|
3044
|
+
static evaluateDifficultyOf(current) {
|
|
3045
|
+
var _a;
|
|
2783
3046
|
if (current.object instanceof osuBase.Spinner) {
|
|
2784
3047
|
return 0;
|
|
2785
3048
|
}
|
|
2786
3049
|
const prev = current.previous(0);
|
|
2787
3050
|
let strainTime = current.strainTime;
|
|
2788
|
-
const greatWindowFull = greatWindow * 2;
|
|
2789
3051
|
// Nerf doubletappable doubles.
|
|
2790
|
-
const
|
|
2791
|
-
let doubletapness = 1;
|
|
2792
|
-
if (next) {
|
|
2793
|
-
const currentDeltaTime = Math.max(1, current.deltaTime);
|
|
2794
|
-
const nextDeltaTime = Math.max(1, next.deltaTime);
|
|
2795
|
-
const deltaDifference = Math.abs(nextDeltaTime - currentDeltaTime);
|
|
2796
|
-
const speedRatio = currentDeltaTime / Math.max(currentDeltaTime, deltaDifference);
|
|
2797
|
-
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
2798
|
-
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
2799
|
-
}
|
|
3052
|
+
const doubletapness = 1 - current.doubletapness;
|
|
2800
3053
|
// Cap deltatime to the OD 300 hitwindow.
|
|
2801
3054
|
// 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.
|
|
2802
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime /
|
|
2803
|
-
|
|
3055
|
+
strainTime /= osuBase.MathUtils.clamp(strainTime / current.fullGreatWindow / 0.93, 0.92, 1);
|
|
3056
|
+
// speedBonus will be 0.0 for BPM < 200
|
|
3057
|
+
let speedBonus = 0;
|
|
3058
|
+
// Add additional scaling bonus for streams/bursts higher than 200bpm
|
|
2804
3059
|
if (strainTime < this.minSpeedBonus) {
|
|
2805
|
-
speedBonus
|
|
3060
|
+
speedBonus =
|
|
2806
3061
|
0.75 * Math.pow((this.minSpeedBonus - strainTime) / 40, 2);
|
|
2807
3062
|
}
|
|
2808
|
-
const travelDistance = prev
|
|
3063
|
+
const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
|
|
3064
|
+
// Cap distance at spacing threshold
|
|
2809
3065
|
const distance = Math.min(this.SINGLE_SPACING_THRESHOLD, travelDistance + current.minimumJumpDistance);
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
3066
|
+
// Max distance bonus is 1 * `distance_multiplier` at single_spacing_threshold
|
|
3067
|
+
const distanceBonus = Math.pow(distance / this.SINGLE_SPACING_THRESHOLD, 3.95) *
|
|
3068
|
+
this.DISTANCE_MULTIPLIER;
|
|
3069
|
+
// Base difficulty with all bonuses
|
|
3070
|
+
const difficulty = ((1 + speedBonus + distanceBonus) * 1000) / strainTime;
|
|
3071
|
+
// Apply penalty if there's doubletappable doubles
|
|
3072
|
+
return difficulty * doubletapness;
|
|
2815
3073
|
}
|
|
2816
3074
|
}
|
|
3075
|
+
/**
|
|
3076
|
+
* Spacing threshold for a single hitobject spacing.
|
|
3077
|
+
*
|
|
3078
|
+
* About 1.25 circles distance between hitobject centers.
|
|
3079
|
+
*/
|
|
3080
|
+
OsuSpeedEvaluator.SINGLE_SPACING_THRESHOLD = 125;
|
|
3081
|
+
OsuSpeedEvaluator.DISTANCE_MULTIPLIER = 0.94;
|
|
2817
3082
|
|
|
2818
3083
|
/**
|
|
2819
3084
|
* An evaluator for calculating osu!standard Rhythm skill.
|
|
2820
3085
|
*/
|
|
2821
|
-
class OsuRhythmEvaluator
|
|
3086
|
+
class OsuRhythmEvaluator {
|
|
2822
3087
|
/**
|
|
2823
3088
|
* Calculates a rhythm multiplier for the difficulty of the tap associated
|
|
2824
3089
|
* with historic data of the current object.
|
|
2825
3090
|
*
|
|
2826
3091
|
* @param current The current object.
|
|
2827
|
-
* @param greatWindow The great hit window of the current object.
|
|
2828
3092
|
*/
|
|
2829
|
-
static evaluateDifficultyOf(current
|
|
3093
|
+
static evaluateDifficultyOf(current) {
|
|
2830
3094
|
if (current.object instanceof osuBase.Spinner) {
|
|
2831
3095
|
return 0;
|
|
2832
3096
|
}
|
|
2833
|
-
|
|
3097
|
+
const deltaDifferenceEpsilon = current.fullGreatWindow * 0.3;
|
|
2834
3098
|
let rhythmComplexitySum = 0;
|
|
2835
|
-
let
|
|
3099
|
+
let island = new Island(deltaDifferenceEpsilon);
|
|
3100
|
+
let previousIsland = new Island(deltaDifferenceEpsilon);
|
|
3101
|
+
const islandCounts = new Map();
|
|
2836
3102
|
// Store the ratio of the current start of an island to buff for tighter rhythms.
|
|
2837
3103
|
let startRatio = 0;
|
|
2838
3104
|
let firstDeltaSwitch = false;
|
|
2839
|
-
const historicalNoteCount = Math.min(current.index, 32);
|
|
2840
3105
|
let rhythmStart = 0;
|
|
3106
|
+
const historicalNoteCount = Math.min(current.index, this.historyObjectsMax);
|
|
2841
3107
|
while (rhythmStart < historicalNoteCount - 2 &&
|
|
2842
3108
|
current.startTime - current.previous(rhythmStart).startTime <
|
|
2843
3109
|
this.historyTimeMax) {
|
|
@@ -2848,98 +3114,133 @@ class OsuRhythmEvaluator extends RhythmEvaluator {
|
|
|
2848
3114
|
const prevObject = current.previous(i);
|
|
2849
3115
|
const lastObject = current.previous(i + 1);
|
|
2850
3116
|
// Scale note 0 to 1 from history to now.
|
|
2851
|
-
|
|
3117
|
+
const timeDecay = (this.historyTimeMax -
|
|
2852
3118
|
(current.startTime - currentObject.startTime)) /
|
|
2853
3119
|
this.historyTimeMax;
|
|
3120
|
+
const noteDecay = (historicalNoteCount - i) / historicalNoteCount;
|
|
2854
3121
|
// Either we're limited by time or limited by object count.
|
|
2855
|
-
currentHistoricalDecay = Math.min(
|
|
3122
|
+
const currentHistoricalDecay = Math.min(timeDecay, noteDecay);
|
|
2856
3123
|
const currentDelta = currentObject.strainTime;
|
|
2857
3124
|
const prevDelta = prevObject.strainTime;
|
|
2858
3125
|
const lastDelta = lastObject.strainTime;
|
|
3126
|
+
// Calculate how much current delta difference deserves a rhythm bonus
|
|
3127
|
+
// This function is meant to reduce rhythm bonus for deltas that are multiples of each other (i.e. 100 and 200)
|
|
3128
|
+
const deltaDifferenceRatio = Math.min(prevDelta, currentDelta) /
|
|
3129
|
+
Math.max(prevDelta, currentDelta);
|
|
2859
3130
|
const currentRatio = 1 +
|
|
2860
|
-
|
|
2861
|
-
Math.min(0.5, Math.pow(Math.sin(Math.PI /
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
const
|
|
2865
|
-
|
|
2866
|
-
let effectiveRatio = windowPenalty * currentRatio;
|
|
3131
|
+
this.rhythmRatioMultiplier *
|
|
3132
|
+
Math.min(0.5, Math.pow(Math.sin(Math.PI / deltaDifferenceRatio), 2));
|
|
3133
|
+
// Reduce ratio bonus if delta difference is too big
|
|
3134
|
+
const fraction = Math.max(prevDelta / currentDelta, currentDelta / prevDelta);
|
|
3135
|
+
const fractionMultiplier = osuBase.MathUtils.clamp(2 - fraction / 8, 0, 1);
|
|
3136
|
+
const windowPenalty = Math.min(1, Math.max(0, Math.abs(prevDelta - currentDelta) - deltaDifferenceEpsilon) / deltaDifferenceEpsilon);
|
|
3137
|
+
let effectiveRatio = windowPenalty * currentRatio * fractionMultiplier;
|
|
2867
3138
|
if (firstDeltaSwitch) {
|
|
2868
|
-
if (prevDelta
|
|
2869
|
-
prevDelta * 1.25 >= currentDelta) {
|
|
3139
|
+
if (Math.abs(prevDelta - currentDelta) < deltaDifferenceEpsilon) {
|
|
2870
3140
|
// Island is still progressing, count size.
|
|
2871
|
-
|
|
2872
|
-
++islandSize;
|
|
2873
|
-
}
|
|
3141
|
+
island.addDelta(currentDelta);
|
|
2874
3142
|
}
|
|
2875
3143
|
else {
|
|
3144
|
+
// BPM change is into slider, this is easy acc window.
|
|
2876
3145
|
if (currentObject.object instanceof osuBase.Slider) {
|
|
2877
|
-
// BPM change is into slider, this is easy acc window.
|
|
2878
3146
|
effectiveRatio /= 8;
|
|
2879
3147
|
}
|
|
3148
|
+
// BPM change was from a slider, this is easier typically than circle -> circle.
|
|
3149
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
3150
|
+
// than bursts without sliders.
|
|
2880
3151
|
if (prevObject.object instanceof osuBase.Slider) {
|
|
2881
|
-
|
|
2882
|
-
effectiveRatio /= 4;
|
|
3152
|
+
effectiveRatio *= 0.3;
|
|
2883
3153
|
}
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
effectiveRatio /= 4;
|
|
2887
|
-
}
|
|
2888
|
-
if (previousIslandSize % 2 === islandSize % 2) {
|
|
2889
|
-
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
3154
|
+
// Repeated island polarity (2 -> 4, 3 -> 5).
|
|
3155
|
+
if (island.isSimilarPolarity(previousIsland)) {
|
|
2890
3156
|
effectiveRatio /= 2;
|
|
2891
3157
|
}
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
3158
|
+
// Previous increase happened a note ago.
|
|
3159
|
+
// Albeit this is a 1/1 -> 1/2-1/4 type of transition, we don't want to buff this.
|
|
3160
|
+
if (lastDelta > prevDelta + deltaDifferenceEpsilon &&
|
|
3161
|
+
prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
2896
3162
|
effectiveRatio /= 8;
|
|
2897
3163
|
}
|
|
3164
|
+
// Repeated island size (ex: triplet -> triplet).
|
|
3165
|
+
// TODO: remove this nerf since its staying here only for balancing purposes because of the flawed ratio calculation
|
|
3166
|
+
if (previousIsland.deltaCount == island.deltaCount) {
|
|
3167
|
+
effectiveRatio /= 2;
|
|
3168
|
+
}
|
|
3169
|
+
let islandFound = false;
|
|
3170
|
+
for (const [currentIsland, count] of islandCounts) {
|
|
3171
|
+
if (!island.equals(currentIsland)) {
|
|
3172
|
+
continue;
|
|
3173
|
+
}
|
|
3174
|
+
islandFound = true;
|
|
3175
|
+
let islandCount = count;
|
|
3176
|
+
if (previousIsland.equals(island)) {
|
|
3177
|
+
// Only add island to island counts if they're going one after another.
|
|
3178
|
+
++islandCount;
|
|
3179
|
+
islandCounts.set(currentIsland, islandCount);
|
|
3180
|
+
}
|
|
3181
|
+
// Repeated island (ex: triplet -> triplet).
|
|
3182
|
+
// Graph: https://www.desmos.com/calculator/pj7an56zwf
|
|
3183
|
+
effectiveRatio *= Math.min(3 / islandCount, Math.pow(1 / islandCount, 2.75 / (1 + Math.exp(14 - 0.24 * island.delta))));
|
|
3184
|
+
break;
|
|
3185
|
+
}
|
|
3186
|
+
if (!islandFound) {
|
|
3187
|
+
islandCounts.set(island, 1);
|
|
3188
|
+
}
|
|
3189
|
+
// Scale down the difficulty if the object is doubletappable.
|
|
3190
|
+
effectiveRatio *= 1 - prevObject.doubletapness * 0.75;
|
|
2898
3191
|
rhythmComplexitySum +=
|
|
2899
|
-
|
|
2900
|
-
currentHistoricalDecay
|
|
2901
|
-
Math.sqrt(4 + islandSize)) /
|
|
2902
|
-
2) *
|
|
2903
|
-
Math.sqrt(4 + previousIslandSize)) /
|
|
2904
|
-
2;
|
|
3192
|
+
Math.sqrt(effectiveRatio * startRatio) *
|
|
3193
|
+
currentHistoricalDecay;
|
|
2905
3194
|
startRatio = effectiveRatio;
|
|
2906
|
-
|
|
2907
|
-
if (prevDelta
|
|
3195
|
+
previousIsland = island;
|
|
3196
|
+
if (prevDelta + deltaDifferenceEpsilon < currentDelta) {
|
|
2908
3197
|
// We're slowing down, stop counting.
|
|
2909
3198
|
// If we're speeding up, this stays as is and we keep counting island size.
|
|
2910
3199
|
firstDeltaSwitch = false;
|
|
2911
3200
|
}
|
|
2912
|
-
|
|
3201
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
2913
3202
|
}
|
|
2914
3203
|
}
|
|
2915
|
-
else if (prevDelta >
|
|
2916
|
-
// We
|
|
3204
|
+
else if (prevDelta > currentDelta + deltaDifferenceEpsilon) {
|
|
3205
|
+
// We are speeding up.
|
|
2917
3206
|
// Begin counting island until we change speed again.
|
|
2918
3207
|
firstDeltaSwitch = true;
|
|
3208
|
+
// BPM change is into slider, this is easy acc window.
|
|
3209
|
+
if (currentObject.object instanceof osuBase.Slider) {
|
|
3210
|
+
effectiveRatio *= 0.6;
|
|
3211
|
+
}
|
|
3212
|
+
// BPM change was from a slider, this is easier typically than circle -> circle
|
|
3213
|
+
// Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
|
|
3214
|
+
// than bursts without sliders
|
|
3215
|
+
if (prevObject.object instanceof osuBase.Slider) {
|
|
3216
|
+
effectiveRatio *= 0.6;
|
|
3217
|
+
}
|
|
2919
3218
|
startRatio = effectiveRatio;
|
|
2920
|
-
|
|
3219
|
+
island = new Island(currentDelta, deltaDifferenceEpsilon);
|
|
2921
3220
|
}
|
|
2922
3221
|
}
|
|
2923
|
-
return Math.sqrt(4 + rhythmComplexitySum * this.
|
|
3222
|
+
return (Math.sqrt(4 + rhythmComplexitySum * this.rhythmOverallMultiplier) /
|
|
3223
|
+
2);
|
|
2924
3224
|
}
|
|
2925
3225
|
}
|
|
3226
|
+
OsuRhythmEvaluator.historyTimeMax = 5000; // 5 seconds of calculateRhythmBonus max.
|
|
3227
|
+
OsuRhythmEvaluator.historyObjectsMax = 32;
|
|
3228
|
+
OsuRhythmEvaluator.rhythmOverallMultiplier = 0.95;
|
|
3229
|
+
OsuRhythmEvaluator.rhythmRatioMultiplier = 12;
|
|
2926
3230
|
|
|
2927
3231
|
/**
|
|
2928
3232
|
* Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
|
|
2929
3233
|
*/
|
|
2930
3234
|
class OsuSpeed extends OsuSkill {
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
constructor(mods, greatWindow) {
|
|
2941
|
-
super(mods);
|
|
2942
|
-
this.greatWindow = greatWindow;
|
|
3235
|
+
constructor() {
|
|
3236
|
+
super(...arguments);
|
|
3237
|
+
this.strainDecayBase = 0.3;
|
|
3238
|
+
this.reducedSectionCount = 5;
|
|
3239
|
+
this.reducedSectionBaseline = 0.75;
|
|
3240
|
+
this.decayWeight = 0.9;
|
|
3241
|
+
this.currentSpeedStrain = 0;
|
|
3242
|
+
this.currentRhythm = 0;
|
|
3243
|
+
this.skillMultiplier = 1.43;
|
|
2943
3244
|
}
|
|
2944
3245
|
/**
|
|
2945
3246
|
* @param current The hitobject to calculate.
|
|
@@ -2947,16 +3248,24 @@ class OsuSpeed extends OsuSkill {
|
|
|
2947
3248
|
strainValueAt(current) {
|
|
2948
3249
|
this.currentSpeedStrain *= this.strainDecay(current.strainTime);
|
|
2949
3250
|
this.currentSpeedStrain +=
|
|
2950
|
-
OsuSpeedEvaluator.evaluateDifficultyOf(current
|
|
3251
|
+
OsuSpeedEvaluator.evaluateDifficultyOf(current) *
|
|
2951
3252
|
this.skillMultiplier;
|
|
2952
|
-
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current
|
|
2953
|
-
|
|
3253
|
+
this.currentRhythm = OsuRhythmEvaluator.evaluateDifficultyOf(current);
|
|
3254
|
+
const strain = this.currentSpeedStrain * this.currentRhythm;
|
|
3255
|
+
this._objectStrains.push(strain);
|
|
3256
|
+
return strain;
|
|
3257
|
+
}
|
|
3258
|
+
calculateInitialStrain(time, current) {
|
|
3259
|
+
var _a, _b;
|
|
3260
|
+
return (this.currentSpeedStrain *
|
|
3261
|
+
this.currentRhythm *
|
|
3262
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
2954
3263
|
}
|
|
2955
3264
|
/**
|
|
2956
3265
|
* @param current The hitobject to save to.
|
|
2957
3266
|
*/
|
|
2958
3267
|
saveToHitObject(current) {
|
|
2959
|
-
current.
|
|
3268
|
+
current.speedStrain = this.currentSpeedStrain * this.currentRhythm;
|
|
2960
3269
|
current.rhythmMultiplier = this.currentRhythm;
|
|
2961
3270
|
}
|
|
2962
3271
|
}
|
|
@@ -2981,7 +3290,7 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
2981
3290
|
if (current.object instanceof osuBase.Spinner) {
|
|
2982
3291
|
return 0;
|
|
2983
3292
|
}
|
|
2984
|
-
const scalingFactor = 52 / current.object.
|
|
3293
|
+
const scalingFactor = 52 / current.object.radius;
|
|
2985
3294
|
let smallDistNerf = 1;
|
|
2986
3295
|
let cumulativeStrainTime = 0;
|
|
2987
3296
|
let result = 0;
|
|
@@ -3004,7 +3313,7 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
3004
3313
|
const opacityBonus = 1 +
|
|
3005
3314
|
this.maxOpacityBonus *
|
|
3006
3315
|
(1 -
|
|
3007
|
-
current.opacityAt(currentObject.object.startTime, isHiddenMod
|
|
3316
|
+
current.opacityAt(currentObject.object.startTime, isHiddenMod));
|
|
3008
3317
|
result +=
|
|
3009
3318
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
3010
3319
|
cumulativeStrainTime;
|
|
@@ -3035,8 +3344,8 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
3035
3344
|
// Longer sliders require more memorization.
|
|
3036
3345
|
sliderBonus *= pixelTravelDistance;
|
|
3037
3346
|
// Nerf sliders with repeats, as less memorization is required.
|
|
3038
|
-
if (current.object.
|
|
3039
|
-
sliderBonus /= current.object.
|
|
3347
|
+
if (current.object.repeatCount > 0)
|
|
3348
|
+
sliderBonus /= current.object.repeatCount + 1;
|
|
3040
3349
|
}
|
|
3041
3350
|
result += sliderBonus * this.sliderMultiplier;
|
|
3042
3351
|
return result;
|
|
@@ -3047,27 +3356,62 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
3047
3356
|
* Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
|
|
3048
3357
|
*/
|
|
3049
3358
|
class OsuFlashlight extends OsuSkill {
|
|
3050
|
-
skillMultiplier = 0.052;
|
|
3051
|
-
strainDecayBase = 0.15;
|
|
3052
|
-
reducedSectionCount = 0;
|
|
3053
|
-
reducedSectionBaseline = 1;
|
|
3054
|
-
decayWeight = 1;
|
|
3055
|
-
isHidden;
|
|
3056
3359
|
constructor(mods) {
|
|
3057
3360
|
super(mods);
|
|
3361
|
+
this.strainDecayBase = 0.15;
|
|
3362
|
+
this.reducedSectionCount = 0;
|
|
3363
|
+
this.reducedSectionBaseline = 1;
|
|
3364
|
+
this.decayWeight = 1;
|
|
3365
|
+
this.currentFlashlightStrain = 0;
|
|
3366
|
+
this.skillMultiplier = 0.05512;
|
|
3058
3367
|
this.isHidden = mods.some((m) => m instanceof osuBase.ModHidden);
|
|
3059
3368
|
}
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3369
|
+
difficultyValue() {
|
|
3370
|
+
return this.strainPeaks.reduce((a, b) => a + b, 0);
|
|
3371
|
+
}
|
|
3063
3372
|
strainValueAt(current) {
|
|
3064
|
-
this.
|
|
3065
|
-
this.
|
|
3373
|
+
this.currentFlashlightStrain *= this.strainDecay(current.deltaTime);
|
|
3374
|
+
this.currentFlashlightStrain +=
|
|
3066
3375
|
OsuFlashlightEvaluator.evaluateDifficultyOf(current, this.isHidden) * this.skillMultiplier;
|
|
3067
|
-
return this.
|
|
3376
|
+
return this.currentFlashlightStrain;
|
|
3377
|
+
}
|
|
3378
|
+
calculateInitialStrain(time, current) {
|
|
3379
|
+
var _a, _b;
|
|
3380
|
+
return (this.currentFlashlightStrain *
|
|
3381
|
+
this.strainDecay(time - ((_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : 0)));
|
|
3068
3382
|
}
|
|
3069
3383
|
saveToHitObject(current) {
|
|
3070
|
-
current.
|
|
3384
|
+
current.flashlightStrain = this.currentFlashlightStrain;
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
/**
|
|
3389
|
+
* Represents an osu!standard hit object with difficulty calculation values.
|
|
3390
|
+
*/
|
|
3391
|
+
class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
3392
|
+
constructor() {
|
|
3393
|
+
super(...arguments);
|
|
3394
|
+
/**
|
|
3395
|
+
* The speed strain generated by the hitobject.
|
|
3396
|
+
*/
|
|
3397
|
+
this.speedStrain = 0;
|
|
3398
|
+
/**
|
|
3399
|
+
* The flashlight strain generated by this hitobject.
|
|
3400
|
+
*/
|
|
3401
|
+
this.flashlightStrain = 0;
|
|
3402
|
+
this.radiusBuffThreshold = 30;
|
|
3403
|
+
this.mode = osuBase.Modes.osu;
|
|
3404
|
+
}
|
|
3405
|
+
get scalingFactor() {
|
|
3406
|
+
const radius = this.object.radius;
|
|
3407
|
+
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
|
|
3408
|
+
let scalingFactor = this.normalizedRadius / radius;
|
|
3409
|
+
// High circle size (small CS) bonus
|
|
3410
|
+
if (radius < this.radiusBuffThreshold) {
|
|
3411
|
+
scalingFactor *=
|
|
3412
|
+
1 + Math.min(this.radiusBuffThreshold - radius, 5) / 50;
|
|
3413
|
+
}
|
|
3414
|
+
return scalingFactor;
|
|
3071
3415
|
}
|
|
3072
3416
|
}
|
|
3073
3417
|
|
|
@@ -3075,35 +3419,50 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3075
3419
|
* A difficulty calculator for osu!standard gamemode.
|
|
3076
3420
|
*/
|
|
3077
3421
|
class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
3422
|
+
constructor() {
|
|
3423
|
+
super(...arguments);
|
|
3424
|
+
this.attributes = {
|
|
3425
|
+
speedDifficulty: 0,
|
|
3426
|
+
mods: [],
|
|
3427
|
+
starRating: 0,
|
|
3428
|
+
maxCombo: 0,
|
|
3429
|
+
aimDifficulty: 0,
|
|
3430
|
+
flashlightDifficulty: 0,
|
|
3431
|
+
speedNoteCount: 0,
|
|
3432
|
+
sliderFactor: 0,
|
|
3433
|
+
clockRate: 1,
|
|
3434
|
+
approachRate: 0,
|
|
3435
|
+
overallDifficulty: 0,
|
|
3436
|
+
hitCircleCount: 0,
|
|
3437
|
+
sliderCount: 0,
|
|
3438
|
+
spinnerCount: 0,
|
|
3439
|
+
aimDifficultStrainCount: 0,
|
|
3440
|
+
speedDifficultStrainCount: 0,
|
|
3441
|
+
};
|
|
3442
|
+
this.difficultyMultiplier = 0.0675;
|
|
3443
|
+
this.mode = osuBase.Modes.osu;
|
|
3444
|
+
}
|
|
3078
3445
|
/**
|
|
3079
3446
|
* The aim star rating of the beatmap.
|
|
3080
3447
|
*/
|
|
3081
|
-
aim
|
|
3448
|
+
get aim() {
|
|
3449
|
+
return this.attributes.aimDifficulty;
|
|
3450
|
+
}
|
|
3082
3451
|
/**
|
|
3083
3452
|
* The speed star rating of the beatmap.
|
|
3084
3453
|
*/
|
|
3085
|
-
speed
|
|
3454
|
+
get speed() {
|
|
3455
|
+
return this.attributes.speedDifficulty;
|
|
3456
|
+
}
|
|
3086
3457
|
/**
|
|
3087
3458
|
* The flashlight star rating of the beatmap.
|
|
3088
3459
|
*/
|
|
3089
|
-
flashlight
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
aimDifficulty: 0,
|
|
3096
|
-
flashlightDifficulty: 0,
|
|
3097
|
-
speedNoteCount: 0,
|
|
3098
|
-
sliderFactor: 0,
|
|
3099
|
-
approachRate: 0,
|
|
3100
|
-
overallDifficulty: 0,
|
|
3101
|
-
hitCircleCount: 0,
|
|
3102
|
-
sliderCount: 0,
|
|
3103
|
-
spinnerCount: 0,
|
|
3104
|
-
};
|
|
3105
|
-
difficultyMultiplier = 0.0675;
|
|
3106
|
-
mode = osuBase.Modes.osu;
|
|
3460
|
+
get flashlight() {
|
|
3461
|
+
return this.attributes.flashlightDifficulty;
|
|
3462
|
+
}
|
|
3463
|
+
get cacheableAttributes() {
|
|
3464
|
+
return Object.assign(Object.assign({}, this.attributes), { mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods) });
|
|
3465
|
+
}
|
|
3107
3466
|
/**
|
|
3108
3467
|
* Calculates the aim star rating of the beatmap and stores it in this instance.
|
|
3109
3468
|
*/
|
|
@@ -3118,19 +3477,12 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3118
3477
|
*/
|
|
3119
3478
|
calculateSpeed() {
|
|
3120
3479
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3121
|
-
this.
|
|
3480
|
+
this.attributes.speedDifficulty = 0;
|
|
3122
3481
|
return;
|
|
3123
3482
|
}
|
|
3124
|
-
const speedSkill = new OsuSpeed(this.mods
|
|
3483
|
+
const speedSkill = new OsuSpeed(this.mods);
|
|
3125
3484
|
this.calculateSkills(speedSkill);
|
|
3126
|
-
|
|
3127
|
-
this.speed = 0;
|
|
3128
|
-
this.attributes.speedDifficulty = 0;
|
|
3129
|
-
}
|
|
3130
|
-
else {
|
|
3131
|
-
this.postCalculateSpeed(speedSkill);
|
|
3132
|
-
}
|
|
3133
|
-
this.calculateSpeedAttributes();
|
|
3485
|
+
this.postCalculateSpeed(speedSkill);
|
|
3134
3486
|
}
|
|
3135
3487
|
/**
|
|
3136
3488
|
* Calculates the flashlight star rating of the beatmap and stores it in this instance.
|
|
@@ -3153,14 +3505,14 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3153
3505
|
if (basePerformanceValue > 1e-5) {
|
|
3154
3506
|
// Document for formula derivation:
|
|
3155
3507
|
// https://docs.google.com/document/d/10DZGYYSsT_yjz2Mtp6yIJld0Rqx4E-vVHupCqiM4TNI/edit
|
|
3156
|
-
this.
|
|
3157
|
-
Math.cbrt(1.
|
|
3508
|
+
this.attributes.starRating =
|
|
3509
|
+
Math.cbrt(1.15) *
|
|
3158
3510
|
0.027 *
|
|
3159
3511
|
(Math.cbrt((100000 / Math.pow(2, 1 / 1.1)) * basePerformanceValue) +
|
|
3160
3512
|
4);
|
|
3161
3513
|
}
|
|
3162
3514
|
else {
|
|
3163
|
-
this.
|
|
3515
|
+
this.attributes.starRating = 0;
|
|
3164
3516
|
}
|
|
3165
3517
|
}
|
|
3166
3518
|
calculateAll() {
|
|
@@ -3173,7 +3525,6 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3173
3525
|
const flashlightSkill = skills[3];
|
|
3174
3526
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
3175
3527
|
if (isRelax) {
|
|
3176
|
-
this.speed = 0;
|
|
3177
3528
|
this.attributes.speedDifficulty = 0;
|
|
3178
3529
|
}
|
|
3179
3530
|
else {
|
|
@@ -3183,9 +3534,6 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3183
3534
|
this.postCalculateFlashlight(flashlightSkill);
|
|
3184
3535
|
this.calculateTotal();
|
|
3185
3536
|
}
|
|
3186
|
-
/**
|
|
3187
|
-
* Returns a string representative of the class.
|
|
3188
|
-
*/
|
|
3189
3537
|
toString() {
|
|
3190
3538
|
return (this.total.toFixed(2) +
|
|
3191
3539
|
" stars (" +
|
|
@@ -3196,17 +3544,32 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3196
3544
|
this.flashlight.toFixed(2) +
|
|
3197
3545
|
" flashlight)");
|
|
3198
3546
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3547
|
+
generateDifficultyHitObjects(beatmap, clockRate) {
|
|
3548
|
+
var _a, _b;
|
|
3549
|
+
const difficultyObjects = [];
|
|
3550
|
+
const { objects } = beatmap.hitObjects;
|
|
3551
|
+
const greatWindow = new osuBase.OsuHitWindow(beatmap.difficulty.od).hitWindowFor300() /
|
|
3552
|
+
clockRate;
|
|
3553
|
+
for (let i = 0; i < objects.length; ++i) {
|
|
3554
|
+
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);
|
|
3555
|
+
difficultyObject.computeProperties(clockRate, objects);
|
|
3556
|
+
difficultyObjects.push(difficultyObject);
|
|
3557
|
+
}
|
|
3558
|
+
return difficultyObjects;
|
|
3559
|
+
}
|
|
3202
3560
|
createSkills() {
|
|
3203
3561
|
return [
|
|
3204
3562
|
new OsuAim(this.mods, true),
|
|
3205
3563
|
new OsuAim(this.mods, false),
|
|
3206
|
-
new OsuSpeed(this.mods
|
|
3564
|
+
new OsuSpeed(this.mods),
|
|
3207
3565
|
new OsuFlashlight(this.mods),
|
|
3208
3566
|
];
|
|
3209
3567
|
}
|
|
3568
|
+
populateDifficultyAttributes(beatmap, clockRate) {
|
|
3569
|
+
super.populateDifficultyAttributes(beatmap, clockRate);
|
|
3570
|
+
const preempt = osuBase.BeatmapDifficulty.difficultyRange(beatmap.difficulty.ar, osuBase.HitObject.preemptMax, osuBase.HitObject.preemptMid, osuBase.HitObject.preemptMin) / clockRate;
|
|
3571
|
+
this.attributes.approachRate = osuBase.BeatmapDifficulty.inverseDifficultyRange(preempt, osuBase.HitObject.preemptMax, osuBase.HitObject.preemptMid, osuBase.HitObject.preemptMin);
|
|
3572
|
+
}
|
|
3210
3573
|
/**
|
|
3211
3574
|
* Called after aim skill calculation.
|
|
3212
3575
|
*
|
|
@@ -3216,19 +3579,20 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3216
3579
|
postCalculateAim(aimSkill, aimSkillWithoutSliders) {
|
|
3217
3580
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
3218
3581
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
3219
|
-
this.
|
|
3582
|
+
this.attributes.aimDifficulty = this.starValue(aimSkill.difficultyValue());
|
|
3220
3583
|
if (this.aim) {
|
|
3221
3584
|
this.attributes.sliderFactor =
|
|
3222
3585
|
this.starValue(aimSkillWithoutSliders.difficultyValue()) /
|
|
3223
3586
|
this.aim;
|
|
3224
3587
|
}
|
|
3225
3588
|
if (this.mods.some((m) => m instanceof osuBase.ModTouchDevice)) {
|
|
3226
|
-
this.
|
|
3589
|
+
this.attributes.aimDifficulty = Math.pow(this.aim, 0.8);
|
|
3227
3590
|
}
|
|
3228
3591
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3229
|
-
this.
|
|
3592
|
+
this.attributes.aimDifficulty *= 0.9;
|
|
3230
3593
|
}
|
|
3231
|
-
this.attributes.
|
|
3594
|
+
this.attributes.aimDifficultStrainCount =
|
|
3595
|
+
aimSkill.countDifficultStrains();
|
|
3232
3596
|
}
|
|
3233
3597
|
/**
|
|
3234
3598
|
* Called after speed skill calculation.
|
|
@@ -3237,13 +3601,15 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3237
3601
|
*/
|
|
3238
3602
|
postCalculateSpeed(speedSkill) {
|
|
3239
3603
|
this.strainPeaks.speed = speedSkill.strainPeaks;
|
|
3240
|
-
this.
|
|
3604
|
+
this.attributes.speedDifficulty = this.starValue(speedSkill.difficultyValue());
|
|
3605
|
+
this.attributes.speedDifficultStrainCount =
|
|
3606
|
+
speedSkill.countDifficultStrains();
|
|
3241
3607
|
}
|
|
3242
3608
|
/**
|
|
3243
3609
|
* Calculates speed-related attributes.
|
|
3244
3610
|
*/
|
|
3245
3611
|
calculateSpeedAttributes() {
|
|
3246
|
-
const objectStrains = this.objects.map((v) => v.
|
|
3612
|
+
const objectStrains = this.objects.map((v) => v.speedStrain);
|
|
3247
3613
|
const maxStrain = Math.max(...objectStrains);
|
|
3248
3614
|
if (maxStrain) {
|
|
3249
3615
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
@@ -3256,55 +3622,13 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3256
3622
|
*/
|
|
3257
3623
|
postCalculateFlashlight(flashlightSkill) {
|
|
3258
3624
|
this.strainPeaks.flashlight = flashlightSkill.strainPeaks;
|
|
3259
|
-
this.
|
|
3625
|
+
this.attributes.flashlightDifficulty = this.starValue(flashlightSkill.difficultyValue());
|
|
3260
3626
|
if (this.mods.some((m) => m instanceof osuBase.ModTouchDevice)) {
|
|
3261
|
-
this.
|
|
3627
|
+
this.attributes.flashlightDifficulty = Math.pow(this.flashlight, 0.8);
|
|
3262
3628
|
}
|
|
3263
3629
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3264
|
-
this.
|
|
3630
|
+
this.attributes.flashlightDifficulty *= 0.7;
|
|
3265
3631
|
}
|
|
3266
|
-
this.attributes.flashlightDifficulty = this.flashlight;
|
|
3267
|
-
}
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
|
-
/**
|
|
3271
|
-
* A difficulty calculator that calculates for both osu!droid and osu!standard gamemode.
|
|
3272
|
-
*/
|
|
3273
|
-
class MapStars {
|
|
3274
|
-
/**
|
|
3275
|
-
* The osu!droid difficulty calculator of the beatmap.
|
|
3276
|
-
*/
|
|
3277
|
-
droid;
|
|
3278
|
-
/**
|
|
3279
|
-
* The osu!standard difficulty calculator of the beatmap.
|
|
3280
|
-
*/
|
|
3281
|
-
osu;
|
|
3282
|
-
/**
|
|
3283
|
-
* Constructs this instance and calculates the given beatmap's osu!droid and osu!standard difficulty.
|
|
3284
|
-
*
|
|
3285
|
-
* @param beatmap The beatmap to calculate.
|
|
3286
|
-
* @param options Options for the difficulty calculation.
|
|
3287
|
-
*/
|
|
3288
|
-
constructor(beatmap, options) {
|
|
3289
|
-
const stats = new osuBase.MapStats({
|
|
3290
|
-
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
3291
|
-
isForceAR: options?.stats?.isForceAR ?? false,
|
|
3292
|
-
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
3293
|
-
});
|
|
3294
|
-
this.droid = new DroidDifficultyCalculator(beatmap).calculate({
|
|
3295
|
-
...options,
|
|
3296
|
-
stats,
|
|
3297
|
-
});
|
|
3298
|
-
this.osu = new OsuDifficultyCalculator(beatmap).calculate({
|
|
3299
|
-
...options,
|
|
3300
|
-
stats,
|
|
3301
|
-
});
|
|
3302
|
-
}
|
|
3303
|
-
/**
|
|
3304
|
-
* Returns a string representative of the class.
|
|
3305
|
-
*/
|
|
3306
|
-
toString() {
|
|
3307
|
-
return `${this.droid.toString()}\n${this.osu.toString()}`;
|
|
3308
3632
|
}
|
|
3309
3633
|
}
|
|
3310
3634
|
|
|
@@ -3312,66 +3636,68 @@ class MapStars {
|
|
|
3312
3636
|
* A performance points calculator that calculates performance points for osu!standard gamemode.
|
|
3313
3637
|
*/
|
|
3314
3638
|
class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3639
|
+
constructor() {
|
|
3640
|
+
super(...arguments);
|
|
3641
|
+
/**
|
|
3642
|
+
* The aim performance value.
|
|
3643
|
+
*/
|
|
3644
|
+
this.aim = 0;
|
|
3645
|
+
/**
|
|
3646
|
+
* The speed performance value.
|
|
3647
|
+
*/
|
|
3648
|
+
this.speed = 0;
|
|
3649
|
+
/**
|
|
3650
|
+
* The accuracy performance value.
|
|
3651
|
+
*/
|
|
3652
|
+
this.accuracy = 0;
|
|
3653
|
+
/**
|
|
3654
|
+
* The flashlight performance value.
|
|
3655
|
+
*/
|
|
3656
|
+
this.flashlight = 0;
|
|
3657
|
+
this.finalMultiplier = 1.15;
|
|
3658
|
+
this.mode = osuBase.Modes.osu;
|
|
3659
|
+
this.comboPenalty = 1;
|
|
3660
|
+
}
|
|
3334
3661
|
calculateValues() {
|
|
3335
|
-
this.calculateAimValue();
|
|
3336
|
-
this.calculateSpeedValue();
|
|
3337
|
-
this.calculateAccuracyValue();
|
|
3338
|
-
this.calculateFlashlightValue();
|
|
3662
|
+
this.aim = this.calculateAimValue();
|
|
3663
|
+
this.speed = this.calculateSpeedValue();
|
|
3664
|
+
this.accuracy = this.calculateAccuracyValue();
|
|
3665
|
+
this.flashlight = this.calculateFlashlightValue();
|
|
3339
3666
|
}
|
|
3340
3667
|
calculateTotalValue() {
|
|
3341
|
-
this.
|
|
3342
|
-
Math.pow(
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier;
|
|
3668
|
+
return (Math.pow(Math.pow(this.aim, 1.1) +
|
|
3669
|
+
Math.pow(this.speed, 1.1) +
|
|
3670
|
+
Math.pow(this.accuracy, 1.1) +
|
|
3671
|
+
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
3346
3672
|
}
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3673
|
+
handleOptions(options) {
|
|
3674
|
+
var _a;
|
|
3675
|
+
super.handleOptions(options);
|
|
3676
|
+
const maxCombo = this.difficultyAttributes.maxCombo;
|
|
3677
|
+
const miss = this.computedAccuracy.nmiss;
|
|
3678
|
+
const combo = (_a = options === null || options === void 0 ? void 0 : options.combo) !== null && _a !== void 0 ? _a : maxCombo - miss;
|
|
3679
|
+
this.comboPenalty = Math.min(Math.pow(combo / maxCombo, 0.8), 1);
|
|
3353
3680
|
}
|
|
3354
3681
|
/**
|
|
3355
3682
|
* Calculates the aim performance value of the beatmap.
|
|
3356
3683
|
*/
|
|
3357
3684
|
calculateAimValue() {
|
|
3358
|
-
|
|
3685
|
+
let aimValue = this.baseValue(this.difficultyAttributes.aimDifficulty);
|
|
3359
3686
|
// Longer maps are worth more
|
|
3360
3687
|
let lengthBonus = 0.95 + 0.4 * Math.min(1, this.totalHits / 2000);
|
|
3361
3688
|
if (this.totalHits > 2000) {
|
|
3362
3689
|
lengthBonus += Math.log10(this.totalHits / 2000) * 0.5;
|
|
3363
3690
|
}
|
|
3364
|
-
|
|
3691
|
+
aimValue *= lengthBonus;
|
|
3365
3692
|
if (this.effectiveMissCount > 0) {
|
|
3366
3693
|
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
3367
3694
|
// Default a 3% reduction for any # of misses.
|
|
3368
|
-
|
|
3695
|
+
aimValue *=
|
|
3369
3696
|
0.97 *
|
|
3370
3697
|
Math.pow(1 -
|
|
3371
3698
|
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
3372
3699
|
}
|
|
3373
|
-
|
|
3374
|
-
this.aim *= this.comboPenalty;
|
|
3700
|
+
aimValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.aimDifficultStrainCount);
|
|
3375
3701
|
const calculatedAR = this.difficultyAttributes.approachRate;
|
|
3376
3702
|
if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3377
3703
|
// AR scaling
|
|
@@ -3383,144 +3709,131 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3383
3709
|
arFactor += 0.05 * (8 - calculatedAR);
|
|
3384
3710
|
}
|
|
3385
3711
|
// Buff for longer maps with high AR.
|
|
3386
|
-
|
|
3712
|
+
aimValue *= 1 + arFactor * lengthBonus;
|
|
3387
3713
|
}
|
|
3388
3714
|
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
|
3389
3715
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
3390
|
-
|
|
3716
|
+
aimValue *= 1 + 0.04 * (12 - calculatedAR);
|
|
3391
3717
|
}
|
|
3392
3718
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
3393
|
-
|
|
3719
|
+
aimValue *= this.sliderNerfFactor;
|
|
3394
3720
|
// Scale the aim value with accuracy.
|
|
3395
|
-
|
|
3721
|
+
aimValue *= this.computedAccuracy.value();
|
|
3396
3722
|
// It is also important to consider accuracy difficulty when doing that.
|
|
3397
3723
|
const odScaling = Math.pow(this.difficultyAttributes.overallDifficulty, 2) / 2500;
|
|
3398
|
-
|
|
3724
|
+
aimValue *= 0.98 + odScaling;
|
|
3725
|
+
return aimValue;
|
|
3399
3726
|
}
|
|
3400
3727
|
/**
|
|
3401
3728
|
* Calculates the speed performance value of the beatmap.
|
|
3402
3729
|
*/
|
|
3403
3730
|
calculateSpeedValue() {
|
|
3404
3731
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3405
|
-
|
|
3406
|
-
return;
|
|
3732
|
+
return 0;
|
|
3407
3733
|
}
|
|
3408
|
-
|
|
3734
|
+
let speedValue = this.baseValue(this.difficultyAttributes.speedDifficulty);
|
|
3409
3735
|
// Longer maps are worth more
|
|
3410
3736
|
let lengthBonus = 0.95 + 0.4 * Math.min(1, this.totalHits / 2000);
|
|
3411
3737
|
if (this.totalHits > 2000) {
|
|
3412
3738
|
lengthBonus += Math.log10(this.totalHits / 2000) * 0.5;
|
|
3413
3739
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
3417
|
-
// Default a 3% reduction for any # of misses.
|
|
3418
|
-
this.speed *=
|
|
3419
|
-
0.97 *
|
|
3420
|
-
Math.pow(1 -
|
|
3421
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
3422
|
-
}
|
|
3423
|
-
// Combo scaling
|
|
3424
|
-
this.speed *= this.comboPenalty;
|
|
3740
|
+
speedValue *= lengthBonus;
|
|
3741
|
+
speedValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.speedDifficultStrainCount);
|
|
3425
3742
|
// AR scaling
|
|
3426
3743
|
const calculatedAR = this.difficultyAttributes.approachRate;
|
|
3427
3744
|
if (calculatedAR > 10.33) {
|
|
3428
3745
|
// Buff for longer maps with high AR.
|
|
3429
|
-
|
|
3746
|
+
speedValue *= 1 + 0.3 * (calculatedAR - 10.33) * lengthBonus;
|
|
3430
3747
|
}
|
|
3431
3748
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
3432
|
-
|
|
3749
|
+
speedValue *= 1 + 0.04 * (12 - calculatedAR);
|
|
3433
3750
|
}
|
|
3434
3751
|
// Calculate accuracy assuming the worst case scenario.
|
|
3435
3752
|
const countGreat = this.computedAccuracy.n300;
|
|
3436
3753
|
const countOk = this.computedAccuracy.n100;
|
|
3437
3754
|
const countMeh = this.computedAccuracy.n50;
|
|
3438
3755
|
const relevantTotalDiff = this.totalHits - this.difficultyAttributes.speedNoteCount;
|
|
3439
|
-
const relevantAccuracy = new osuBase.Accuracy(
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3756
|
+
const relevantAccuracy = new osuBase.Accuracy(this.difficultyAttributes.speedNoteCount > 0
|
|
3757
|
+
? {
|
|
3758
|
+
n300: Math.max(0, countGreat - relevantTotalDiff),
|
|
3759
|
+
n100: Math.max(0, countOk - Math.max(0, relevantTotalDiff - countGreat)),
|
|
3760
|
+
n50: Math.max(0, countMeh -
|
|
3761
|
+
Math.max(0, relevantTotalDiff - countGreat - countOk)),
|
|
3762
|
+
}
|
|
3763
|
+
: // Set accuracy to 0.
|
|
3764
|
+
{ n300: 0, nobjects: 1 });
|
|
3445
3765
|
// Scale the speed value with accuracy and OD.
|
|
3446
|
-
|
|
3766
|
+
speedValue *=
|
|
3447
3767
|
(0.95 +
|
|
3448
3768
|
Math.pow(this.difficultyAttributes.overallDifficulty, 2) /
|
|
3449
3769
|
750) *
|
|
3450
|
-
Math.pow((this.computedAccuracy.value(
|
|
3451
|
-
relevantAccuracy.value()) /
|
|
3452
|
-
2, (14.5 -
|
|
3453
|
-
Math.max(this.difficultyAttributes.overallDifficulty, 8)) /
|
|
3454
|
-
2);
|
|
3770
|
+
Math.pow((this.computedAccuracy.value() +
|
|
3771
|
+
relevantAccuracy.value(this.difficultyAttributes.speedNoteCount)) /
|
|
3772
|
+
2, (14.5 - this.difficultyAttributes.overallDifficulty) / 2);
|
|
3455
3773
|
// Scale the speed value with # of 50s to punish doubletapping.
|
|
3456
|
-
|
|
3774
|
+
speedValue *= Math.pow(0.99, Math.max(0, this.computedAccuracy.n50 - this.totalHits / 500));
|
|
3775
|
+
return speedValue;
|
|
3457
3776
|
}
|
|
3458
3777
|
/**
|
|
3459
3778
|
* Calculates the accuracy performance value of the beatmap.
|
|
3460
3779
|
*/
|
|
3461
3780
|
calculateAccuracyValue() {
|
|
3462
3781
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
3463
|
-
|
|
3464
|
-
return;
|
|
3782
|
+
return 0;
|
|
3465
3783
|
}
|
|
3466
3784
|
const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
|
|
3467
3785
|
? this.totalHits - this.difficultyAttributes.spinnerCount
|
|
3468
3786
|
: this.difficultyAttributes.hitCircleCount;
|
|
3469
3787
|
if (ncircles === 0) {
|
|
3470
|
-
|
|
3471
|
-
return;
|
|
3788
|
+
return 0;
|
|
3472
3789
|
}
|
|
3473
|
-
const realAccuracy = new osuBase.Accuracy({
|
|
3474
|
-
...this.computedAccuracy,
|
|
3475
|
-
n300: this.computedAccuracy.n300 - (this.totalHits - ncircles),
|
|
3476
|
-
});
|
|
3790
|
+
const realAccuracy = new osuBase.Accuracy(Object.assign(Object.assign({}, this.computedAccuracy), { n300: this.computedAccuracy.n300 - (this.totalHits - ncircles) }));
|
|
3477
3791
|
// Lots of arbitrary values from testing.
|
|
3478
3792
|
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
|
|
3479
|
-
this.
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3793
|
+
let accuracyValue = Math.pow(1.52163, this.difficultyAttributes.overallDifficulty) *
|
|
3794
|
+
// It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points.
|
|
3795
|
+
Math.pow(realAccuracy.n300 < 0 ? 0 : realAccuracy.value(), 24) *
|
|
3796
|
+
2.83;
|
|
3483
3797
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
|
3484
|
-
|
|
3798
|
+
accuracyValue *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
|
|
3485
3799
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
|
|
3486
|
-
|
|
3800
|
+
accuracyValue *= 1.08;
|
|
3487
3801
|
}
|
|
3488
3802
|
if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
3489
|
-
|
|
3803
|
+
accuracyValue *= 1.02;
|
|
3490
3804
|
}
|
|
3805
|
+
return accuracyValue;
|
|
3491
3806
|
}
|
|
3492
3807
|
/**
|
|
3493
3808
|
* Calculates the flashlight performance value of the beatmap.
|
|
3494
3809
|
*/
|
|
3495
3810
|
calculateFlashlightValue() {
|
|
3496
3811
|
if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
|
|
3497
|
-
|
|
3498
|
-
return;
|
|
3812
|
+
return 0;
|
|
3499
3813
|
}
|
|
3500
|
-
this.
|
|
3501
|
-
Math.pow(this.difficultyAttributes.flashlightDifficulty, 2) * 25;
|
|
3814
|
+
let flashlightValue = Math.pow(this.difficultyAttributes.flashlightDifficulty, 2) * 25;
|
|
3502
3815
|
// Combo scaling
|
|
3503
|
-
|
|
3816
|
+
flashlightValue *= this.comboPenalty;
|
|
3504
3817
|
if (this.effectiveMissCount > 0) {
|
|
3505
3818
|
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
3506
|
-
|
|
3819
|
+
flashlightValue *=
|
|
3507
3820
|
0.97 *
|
|
3508
3821
|
Math.pow(1 -
|
|
3509
3822
|
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
3510
3823
|
}
|
|
3511
3824
|
// Account for shorter maps having a higher ratio of 0 combo/100 combo flashlight radius.
|
|
3512
|
-
|
|
3825
|
+
flashlightValue *=
|
|
3513
3826
|
0.7 +
|
|
3514
3827
|
0.1 * Math.min(1, this.totalHits / 200) +
|
|
3515
3828
|
(this.totalHits > 200
|
|
3516
3829
|
? 0.2 * Math.min(1, (this.totalHits - 200) / 200)
|
|
3517
3830
|
: 0);
|
|
3518
3831
|
// Scale the flashlight value with accuracy slightly.
|
|
3519
|
-
this.
|
|
3520
|
-
0.5 + this.computedAccuracy.value(this.totalHits) / 2;
|
|
3832
|
+
flashlightValue *= 0.5 + this.computedAccuracy.value() / 2;
|
|
3521
3833
|
// It is also important to consider accuracy difficulty when doing that.
|
|
3522
3834
|
const odScaling = Math.pow(this.difficultyAttributes.overallDifficulty, 2) / 2500;
|
|
3523
|
-
|
|
3835
|
+
flashlightValue *= 0.98 + odScaling;
|
|
3836
|
+
return flashlightValue;
|
|
3524
3837
|
}
|
|
3525
3838
|
toString() {
|
|
3526
3839
|
return (this.total.toFixed(2) +
|
|
@@ -3539,10 +3852,10 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3539
3852
|
exports.AimEvaluator = AimEvaluator;
|
|
3540
3853
|
exports.DifficultyCalculator = DifficultyCalculator;
|
|
3541
3854
|
exports.DifficultyHitObject = DifficultyHitObject;
|
|
3542
|
-
exports.DifficultyHitObjectCreator = DifficultyHitObjectCreator;
|
|
3543
3855
|
exports.DroidAim = DroidAim;
|
|
3544
3856
|
exports.DroidAimEvaluator = DroidAimEvaluator;
|
|
3545
3857
|
exports.DroidDifficultyCalculator = DroidDifficultyCalculator;
|
|
3858
|
+
exports.DroidDifficultyHitObject = DroidDifficultyHitObject;
|
|
3546
3859
|
exports.DroidFlashlight = DroidFlashlight;
|
|
3547
3860
|
exports.DroidFlashlightEvaluator = DroidFlashlightEvaluator;
|
|
3548
3861
|
exports.DroidPerformanceCalculator = DroidPerformanceCalculator;
|
|
@@ -3553,10 +3866,10 @@ exports.DroidTapEvaluator = DroidTapEvaluator;
|
|
|
3553
3866
|
exports.DroidVisual = DroidVisual;
|
|
3554
3867
|
exports.DroidVisualEvaluator = DroidVisualEvaluator;
|
|
3555
3868
|
exports.FlashlightEvaluator = FlashlightEvaluator;
|
|
3556
|
-
exports.MapStars = MapStars;
|
|
3557
3869
|
exports.OsuAim = OsuAim;
|
|
3558
3870
|
exports.OsuAimEvaluator = OsuAimEvaluator;
|
|
3559
3871
|
exports.OsuDifficultyCalculator = OsuDifficultyCalculator;
|
|
3872
|
+
exports.OsuDifficultyHitObject = OsuDifficultyHitObject;
|
|
3560
3873
|
exports.OsuFlashlight = OsuFlashlight;
|
|
3561
3874
|
exports.OsuFlashlightEvaluator = OsuFlashlightEvaluator;
|
|
3562
3875
|
exports.OsuPerformanceCalculator = OsuPerformanceCalculator;
|
|
@@ -3564,6 +3877,5 @@ exports.OsuRhythmEvaluator = OsuRhythmEvaluator;
|
|
|
3564
3877
|
exports.OsuSpeed = OsuSpeed;
|
|
3565
3878
|
exports.OsuSpeedEvaluator = OsuSpeedEvaluator;
|
|
3566
3879
|
exports.PerformanceCalculator = PerformanceCalculator;
|
|
3567
|
-
exports.RhythmEvaluator = RhythmEvaluator;
|
|
3568
3880
|
exports.SpeedEvaluator = SpeedEvaluator;
|
|
3569
3881
|
//# sourceMappingURL=index.js.map
|