@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.13 → 4.0.0-beta.14
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 +212 -136
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/typings/index.d.ts +198 -135
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ class AimEvaluator {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Represents
|
|
32
|
+
* Represents a hit object with difficulty calculation values.
|
|
33
33
|
*/
|
|
34
34
|
class DifficultyHitObject {
|
|
35
35
|
/**
|
|
@@ -62,41 +62,10 @@ class DifficultyHitObject {
|
|
|
62
62
|
* The aim strain generated by the hitobject if sliders are not considered.
|
|
63
63
|
*/
|
|
64
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
65
|
/**
|
|
77
66
|
* The rhythm multiplier generated by the hitobject. This is used to alter tap strain.
|
|
78
67
|
*/
|
|
79
68
|
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;
|
|
92
|
-
/**
|
|
93
|
-
* The visual strain generated by the hitobject if sliders are considered.
|
|
94
|
-
*/
|
|
95
|
-
visualStrainWithSliders = 0;
|
|
96
|
-
/**
|
|
97
|
-
* The visual strain generated by the hitobject if sliders are not considered.
|
|
98
|
-
*/
|
|
99
|
-
visualStrainWithoutSliders = 0;
|
|
100
69
|
/**
|
|
101
70
|
* The normalized distance from the "lazy" end position of the previous hitobject to the start position of this hitobject.
|
|
102
71
|
*
|
|
@@ -150,20 +119,6 @@ class DifficultyHitObject {
|
|
|
150
119
|
* Adjusted end time of the hitobject, taking speed multiplier into account.
|
|
151
120
|
*/
|
|
152
121
|
endTime = 0;
|
|
153
|
-
/**
|
|
154
|
-
* The note density of the hitobject.
|
|
155
|
-
*/
|
|
156
|
-
noteDensity = 1;
|
|
157
|
-
/**
|
|
158
|
-
* The overlapping factor of the hitobject.
|
|
159
|
-
*
|
|
160
|
-
* This is used to scale visual skill.
|
|
161
|
-
*/
|
|
162
|
-
overlappingFactor = 0;
|
|
163
|
-
/**
|
|
164
|
-
* Adjusted velocity of the hitobject, taking speed multiplier into account.
|
|
165
|
-
*/
|
|
166
|
-
velocity = 0;
|
|
167
122
|
/**
|
|
168
123
|
* Other hitobjects in the beatmap, including this hitobject.
|
|
169
124
|
*/
|
|
@@ -200,7 +155,7 @@ class DifficultyHitObject {
|
|
|
200
155
|
* difficulty hitobject's index, `null` if the index is out of range.
|
|
201
156
|
*/
|
|
202
157
|
next(forwardsIndex) {
|
|
203
|
-
return this.hitObjects[this.index + forwardsIndex + 2] ?? null;
|
|
158
|
+
return (this.hitObjects[this.index + forwardsIndex + 2] ?? null);
|
|
204
159
|
}
|
|
205
160
|
/**
|
|
206
161
|
* Calculates the opacity of the hitobject at a given time.
|
|
@@ -261,6 +216,79 @@ class DifficultyHitObject {
|
|
|
261
216
|
}
|
|
262
217
|
}
|
|
263
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Represents an osu!droid hit object with difficulty calculation values.
|
|
221
|
+
*/
|
|
222
|
+
class DroidDifficultyHitObject extends DifficultyHitObject {
|
|
223
|
+
/**
|
|
224
|
+
* The tap strain generated by the hitobject.
|
|
225
|
+
*/
|
|
226
|
+
tapStrain = 0;
|
|
227
|
+
/**
|
|
228
|
+
* The tap strain generated by the hitobject if `strainTime` isn't modified by
|
|
229
|
+
* OD. This is used in three-finger detection.
|
|
230
|
+
*/
|
|
231
|
+
originalTapStrain = 0;
|
|
232
|
+
/**
|
|
233
|
+
* The rhythm strain generated by the hitobject.
|
|
234
|
+
*/
|
|
235
|
+
rhythmStrain = 0;
|
|
236
|
+
/**
|
|
237
|
+
* The flashlight strain generated by the hitobject if sliders are considered.
|
|
238
|
+
*/
|
|
239
|
+
flashlightStrainWithSliders = 0;
|
|
240
|
+
/**
|
|
241
|
+
* The flashlight strain generated by the hitobject if sliders are not considered.
|
|
242
|
+
*/
|
|
243
|
+
flashlightStrainWithoutSliders = 0;
|
|
244
|
+
/**
|
|
245
|
+
* The visual strain generated by the hitobject if sliders are considered.
|
|
246
|
+
*/
|
|
247
|
+
visualStrainWithSliders = 0;
|
|
248
|
+
/**
|
|
249
|
+
* The visual strain generated by the hitobject if sliders are not considered.
|
|
250
|
+
*/
|
|
251
|
+
visualStrainWithoutSliders = 0;
|
|
252
|
+
/**
|
|
253
|
+
* The note density of the hitobject.
|
|
254
|
+
*/
|
|
255
|
+
noteDensity = 1;
|
|
256
|
+
/**
|
|
257
|
+
* The overlapping factor of the hitobject.
|
|
258
|
+
*
|
|
259
|
+
* This is used to scale visual skill.
|
|
260
|
+
*/
|
|
261
|
+
overlappingFactor = 0;
|
|
262
|
+
/**
|
|
263
|
+
* @param object The underlying hitobject.
|
|
264
|
+
* @param hitObjects All difficulty hitobjects in the processed beatmap.
|
|
265
|
+
*/
|
|
266
|
+
constructor(object, hitObjects) {
|
|
267
|
+
super(object, hitObjects);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Represents an osu!standard hit object with difficulty calculation values.
|
|
273
|
+
*/
|
|
274
|
+
class OsuDifficultyHitObject extends DifficultyHitObject {
|
|
275
|
+
/**
|
|
276
|
+
* The speed strain generated by the hitobject.
|
|
277
|
+
*/
|
|
278
|
+
speedStrain = 0;
|
|
279
|
+
/**
|
|
280
|
+
* The flashlight strain generated by this hitobject.
|
|
281
|
+
*/
|
|
282
|
+
flashlightStrain = 0;
|
|
283
|
+
/**
|
|
284
|
+
* @param object The underlying hitobject.
|
|
285
|
+
* @param hitObjects All difficulty hitobjects in the processed beatmap.
|
|
286
|
+
*/
|
|
287
|
+
constructor(object, hitObjects) {
|
|
288
|
+
super(object, hitObjects);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
264
292
|
/**
|
|
265
293
|
* A converter used to convert normal hitobjects into difficulty hitobjects.
|
|
266
294
|
*/
|
|
@@ -284,9 +312,6 @@ class DifficultyHitObjectCreator {
|
|
|
284
312
|
maximumSliderRadius = this.normalizedRadius * 2.4;
|
|
285
313
|
assumedSliderRadius = this.normalizedRadius * 1.8;
|
|
286
314
|
minDeltaTime = 25;
|
|
287
|
-
/**
|
|
288
|
-
* Generates difficulty hitobjects for difficulty calculation.
|
|
289
|
-
*/
|
|
290
315
|
generateDifficultyObjects(params) {
|
|
291
316
|
params.preempt ??= 600;
|
|
292
317
|
this.mode = params.mode;
|
|
@@ -296,13 +321,13 @@ class DifficultyHitObjectCreator {
|
|
|
296
321
|
const scalingFactor = this.getScalingFactor(params.objects[0].getRadius(this.mode));
|
|
297
322
|
const difficultyObjects = [];
|
|
298
323
|
for (let i = 0; i < params.objects.length; ++i) {
|
|
299
|
-
const object =
|
|
324
|
+
const object = this.mode === osuBase.Modes.droid
|
|
325
|
+
? new DroidDifficultyHitObject(params.objects[i], difficultyObjects)
|
|
326
|
+
: new OsuDifficultyHitObject(params.objects[i], difficultyObjects);
|
|
300
327
|
object.index = difficultyObjects.length - 1;
|
|
301
328
|
object.timePreempt = params.preempt;
|
|
302
329
|
object.baseTimePreempt = params.preempt * params.speedMultiplier;
|
|
303
330
|
if (object.object instanceof osuBase.Slider) {
|
|
304
|
-
object.velocity =
|
|
305
|
-
object.object.velocity * params.speedMultiplier;
|
|
306
331
|
this.calculateSliderCursorPosition(object.object);
|
|
307
332
|
object.travelDistance = object.object.lazyTravelDistance;
|
|
308
333
|
// Bonus for repeat sliders until a better per nested object strain system can be achieved.
|
|
@@ -331,53 +356,57 @@ class DifficultyHitObjectCreator {
|
|
|
331
356
|
difficultyObjects.push(object);
|
|
332
357
|
continue;
|
|
333
358
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
for (let j = 0; j < object.index; ++j) {
|
|
351
|
-
const prev = object.previous(j);
|
|
352
|
-
if (prev.object instanceof osuBase.Spinner) {
|
|
353
|
-
continue;
|
|
359
|
+
if (object instanceof DroidDifficultyHitObject) {
|
|
360
|
+
// We'll have two visible object arrays. The first array contains objects before the current object starts in a reversed order,
|
|
361
|
+
// while the second array contains objects after the current object ends.
|
|
362
|
+
// For overlapping factor, we also need to consider previous visible objects.
|
|
363
|
+
const prevVisibleObjects = [];
|
|
364
|
+
const nextVisibleObjects = [];
|
|
365
|
+
for (let j = i + 1; j < params.objects.length; ++j) {
|
|
366
|
+
const o = params.objects[j];
|
|
367
|
+
if (o instanceof osuBase.Spinner) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (o.startTime / params.speedMultiplier >
|
|
371
|
+
object.endTime + object.timePreempt) {
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
nextVisibleObjects.push(o);
|
|
354
375
|
}
|
|
355
|
-
|
|
356
|
-
|
|
376
|
+
for (let j = 0; j < object.index; ++j) {
|
|
377
|
+
const prev = object.previous(j);
|
|
378
|
+
if (prev.object instanceof osuBase.Spinner) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (prev.startTime >= object.startTime) {
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (prev.startTime <
|
|
385
|
+
object.startTime - object.timePreempt) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
prevVisibleObjects.push(prev.object);
|
|
357
389
|
}
|
|
358
|
-
|
|
359
|
-
|
|
390
|
+
for (const hitObject of prevVisibleObjects) {
|
|
391
|
+
const distance = object.object
|
|
392
|
+
.getStackedPosition(this.mode)
|
|
393
|
+
.getDistance(hitObject.getStackedEndPosition(this.mode));
|
|
394
|
+
const deltaTime = object.startTime -
|
|
395
|
+
hitObject.endTime / params.speedMultiplier;
|
|
396
|
+
this.applyToOverlappingFactor(object, distance, deltaTime);
|
|
360
397
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const distance = hitObject
|
|
373
|
-
.getStackedPosition(this.mode)
|
|
374
|
-
.getDistance(object.object.getStackedEndPosition(this.mode));
|
|
375
|
-
const deltaTime = hitObject.startTime / params.speedMultiplier -
|
|
376
|
-
object.endTime;
|
|
377
|
-
if (deltaTime >= 0) {
|
|
378
|
-
object.noteDensity += 1 - deltaTime / object.timePreempt;
|
|
398
|
+
for (const hitObject of nextVisibleObjects) {
|
|
399
|
+
const distance = hitObject
|
|
400
|
+
.getStackedPosition(this.mode)
|
|
401
|
+
.getDistance(object.object.getStackedEndPosition(this.mode));
|
|
402
|
+
const deltaTime = hitObject.startTime / params.speedMultiplier -
|
|
403
|
+
object.endTime;
|
|
404
|
+
if (deltaTime >= 0) {
|
|
405
|
+
object.noteDensity +=
|
|
406
|
+
1 - deltaTime / object.timePreempt;
|
|
407
|
+
}
|
|
408
|
+
this.applyToOverlappingFactor(object, distance, deltaTime);
|
|
379
409
|
}
|
|
380
|
-
this.applyToOverlappingFactor(object, distance, deltaTime);
|
|
381
410
|
}
|
|
382
411
|
if (lastObject.object instanceof osuBase.Spinner) {
|
|
383
412
|
difficultyObjects.push(object);
|
|
@@ -1604,6 +1633,31 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1604
1633
|
difficultSliders: [],
|
|
1605
1634
|
averageSpeedDeltaTime: 0,
|
|
1606
1635
|
};
|
|
1636
|
+
get cacheableAttributes() {
|
|
1637
|
+
return {
|
|
1638
|
+
tapDifficulty: this.tap,
|
|
1639
|
+
rhythmDifficulty: this.rhythm,
|
|
1640
|
+
visualDifficulty: this.visual,
|
|
1641
|
+
mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
|
|
1642
|
+
starRating: this.total,
|
|
1643
|
+
maxCombo: this.attributes.maxCombo,
|
|
1644
|
+
aimDifficulty: this.aim,
|
|
1645
|
+
flashlightDifficulty: this.flashlight,
|
|
1646
|
+
speedNoteCount: this.attributes.speedNoteCount,
|
|
1647
|
+
sliderFactor: this.attributes.sliderFactor,
|
|
1648
|
+
clockRate: this.attributes.clockRate,
|
|
1649
|
+
approachRate: this.attributes.approachRate,
|
|
1650
|
+
overallDifficulty: this.attributes.overallDifficulty,
|
|
1651
|
+
hitCircleCount: this.attributes.hitCircleCount,
|
|
1652
|
+
sliderCount: this.attributes.sliderCount,
|
|
1653
|
+
spinnerCount: this.attributes.spinnerCount,
|
|
1654
|
+
aimDifficultStrainCount: this.attributes.aimDifficultStrainCount,
|
|
1655
|
+
tapDifficultStrainCount: this.attributes.tapDifficultStrainCount,
|
|
1656
|
+
flashlightDifficultStrainCount: this.attributes.flashlightDifficultStrainCount,
|
|
1657
|
+
visualDifficultStrainCount: this.attributes.visualDifficultStrainCount,
|
|
1658
|
+
averageSpeedDeltaTime: this.attributes.averageSpeedDeltaTime,
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1607
1661
|
difficultyMultiplier = 0.18;
|
|
1608
1662
|
mode = osuBase.Modes.droid;
|
|
1609
1663
|
/**
|
|
@@ -1691,7 +1745,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1691
1745
|
const visualSkillWithoutSliders = skills[8];
|
|
1692
1746
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1693
1747
|
this.postCalculateTap(tapSkillCheese);
|
|
1694
|
-
this.calculateTapAttributes();
|
|
1695
1748
|
this.postCalculateRhythm(rhythmSkill);
|
|
1696
1749
|
this.postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders);
|
|
1697
1750
|
this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
|
|
@@ -1990,6 +2043,10 @@ class PerformanceCalculator {
|
|
|
1990
2043
|
* The calculated accuracy.
|
|
1991
2044
|
*/
|
|
1992
2045
|
computedAccuracy = new osuBase.Accuracy({});
|
|
2046
|
+
/**
|
|
2047
|
+
* The difficulty attributes that is being calculated.
|
|
2048
|
+
*/
|
|
2049
|
+
difficultyAttributes;
|
|
1993
2050
|
/**
|
|
1994
2051
|
* Penalty for combo breaks.
|
|
1995
2052
|
*/
|
|
@@ -2002,6 +2059,20 @@ class PerformanceCalculator {
|
|
|
2002
2059
|
* Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
|
|
2003
2060
|
*/
|
|
2004
2061
|
sliderNerfFactor = 1;
|
|
2062
|
+
/**
|
|
2063
|
+
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
2064
|
+
*/
|
|
2065
|
+
constructor(difficultyAttributes) {
|
|
2066
|
+
if (this.isCacheableAttribute(difficultyAttributes)) {
|
|
2067
|
+
this.difficultyAttributes = {
|
|
2068
|
+
...difficultyAttributes,
|
|
2069
|
+
mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods),
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
else {
|
|
2073
|
+
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2005
2076
|
/**
|
|
2006
2077
|
* Calculates the performance points of the beatmap.
|
|
2007
2078
|
*
|
|
@@ -2125,6 +2196,15 @@ class PerformanceCalculator {
|
|
|
2125
2196
|
}
|
|
2126
2197
|
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
2127
2198
|
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Determines whether an attribute is a cacheable attribute.
|
|
2201
|
+
*
|
|
2202
|
+
* @param attributes The attributes to check.
|
|
2203
|
+
* @returns Whether the attributes are cacheable.
|
|
2204
|
+
*/
|
|
2205
|
+
isCacheableAttribute(attributes) {
|
|
2206
|
+
return typeof attributes.mods === "string";
|
|
2207
|
+
}
|
|
2128
2208
|
}
|
|
2129
2209
|
|
|
2130
2210
|
/**
|
|
@@ -2195,7 +2275,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2195
2275
|
get visualSliderCheesePenalty() {
|
|
2196
2276
|
return this._visualSliderCheesePenalty;
|
|
2197
2277
|
}
|
|
2198
|
-
difficultyAttributes;
|
|
2199
2278
|
finalMultiplier = 1.24;
|
|
2200
2279
|
mode = osuBase.Modes.droid;
|
|
2201
2280
|
_aimSliderCheesePenalty = 1;
|
|
@@ -2204,13 +2283,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2204
2283
|
_tapPenalty = 1;
|
|
2205
2284
|
_deviation = 0;
|
|
2206
2285
|
_tapDeviation = 0;
|
|
2207
|
-
/**
|
|
2208
|
-
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
2209
|
-
*/
|
|
2210
|
-
constructor(difficultyAttributes) {
|
|
2211
|
-
super();
|
|
2212
|
-
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
2213
|
-
}
|
|
2214
2286
|
/**
|
|
2215
2287
|
* Applies a tap penalty value to this calculator.
|
|
2216
2288
|
*
|
|
@@ -2352,16 +2424,16 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2352
2424
|
// We expect the player to get 7500/x deviation when doubletapping x BPM.
|
|
2353
2425
|
// Using this expectation, we penalize scores with deviation above 25.
|
|
2354
2426
|
const averageBPM = 60000 / 4 / this.difficultyAttributes.averageSpeedDeltaTime;
|
|
2355
|
-
const adjustedDeviation = normalizedDeviation *
|
|
2356
|
-
(1 +
|
|
2357
|
-
1 /
|
|
2358
|
-
(1 +
|
|
2359
|
-
Math.exp(-(normalizedDeviation - 7500 / averageBPM) /
|
|
2360
|
-
((2 * 300) / averageBPM))));
|
|
2361
2427
|
// Scale the tap value with tap deviation.
|
|
2362
2428
|
tapValue *=
|
|
2363
2429
|
1.1 *
|
|
2364
|
-
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 *
|
|
2430
|
+
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * normalizedDeviation)), 0.625);
|
|
2431
|
+
// Scale the tap value with doubletap deviation threshold.
|
|
2432
|
+
tapValue *=
|
|
2433
|
+
1 /
|
|
2434
|
+
(1 +
|
|
2435
|
+
Math.exp((this.tapDeviation - 7500 / averageBPM) /
|
|
2436
|
+
((4 * 300) / averageBPM)));
|
|
2365
2437
|
// Scale the tap value with three-fingered penalty.
|
|
2366
2438
|
tapValue /= this._tapPenalty;
|
|
2367
2439
|
// OD 8 SS stays the same.
|
|
@@ -2533,28 +2605,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2533
2605
|
if (greatCountCircles > 0) {
|
|
2534
2606
|
// The probability that a player hits a circle is unknown, but we can estimate it to be
|
|
2535
2607
|
// the number of greats on circles divided by the number of circles, and then add one
|
|
2536
|
-
// to the number of circles as a bias correction
|
|
2537
|
-
const greatProbabilityCircle =
|
|
2608
|
+
// to the number of circles as a bias correction.
|
|
2609
|
+
const greatProbabilityCircle = greatCountCircles /
|
|
2610
|
+
(circleCount - missCountCircles - mehCountCircles + 1);
|
|
2538
2611
|
// Compute the deviation assuming 300s and 100s are normally distributed, and 50s are uniformly distributed.
|
|
2539
2612
|
// Begin with the normal distribution first.
|
|
2540
|
-
|
|
2613
|
+
let deviationOnCircles = hitWindow300 /
|
|
2541
2614
|
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilityCircle));
|
|
2542
|
-
|
|
2543
|
-
const truncatedVariance = Math.pow(deviationOnCircles, 2) -
|
|
2615
|
+
deviationOnCircles *= Math.sqrt(1 -
|
|
2544
2616
|
(Math.sqrt(2 / Math.PI) *
|
|
2545
2617
|
hitWindow100 *
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2618
|
+
Math.exp(-0.5 *
|
|
2619
|
+
Math.pow(hitWindow100 / deviationOnCircles, 2))) /
|
|
2620
|
+
(deviationOnCircles *
|
|
2621
|
+
osuBase.ErrorFunction.erf(hitWindow100 /
|
|
2622
|
+
(Math.SQRT2 * deviationOnCircles))));
|
|
2549
2623
|
// Then compute the variance for 50s.
|
|
2550
|
-
const mehVariance = (
|
|
2624
|
+
const mehVariance = (hitWindow50 * hitWindow50 +
|
|
2551
2625
|
hitWindow100 * hitWindow50 +
|
|
2552
|
-
|
|
2626
|
+
hitWindow100 * hitWindow100) /
|
|
2553
2627
|
3;
|
|
2554
2628
|
// Find the total deviation.
|
|
2555
|
-
|
|
2629
|
+
deviationOnCircles = Math.sqrt(((greatCountCircles + okCountCircles) *
|
|
2630
|
+
Math.pow(deviationOnCircles, 2) +
|
|
2556
2631
|
mehCountCircles * mehVariance) /
|
|
2557
2632
|
(greatCountCircles + okCountCircles + mehCountCircles));
|
|
2633
|
+
return deviationOnCircles;
|
|
2558
2634
|
}
|
|
2559
2635
|
// If there are more non-300s than there are circles, compute the deviation on sliders instead.
|
|
2560
2636
|
// Here, all that matters is whether or not the slider was missed, since it is impossible
|
|
@@ -2584,7 +2660,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2584
2660
|
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).hitWindowFor300();
|
|
2585
2661
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2586
2662
|
// Assume a fixed ratio of non-300s hit in speed notes based on speed note count ratio and OD.
|
|
2587
|
-
// Graph: https://www.desmos.com/calculator/
|
|
2663
|
+
// Graph: https://www.desmos.com/calculator/iskvgjkxr4
|
|
2588
2664
|
const speedNoteRatio = this.difficultyAttributes.speedNoteCount / this.totalHits;
|
|
2589
2665
|
const nonGreatCount = n100 + n50 + nmiss;
|
|
2590
2666
|
const nonGreatRatio = 1 -
|
|
@@ -2765,7 +2841,7 @@ class OsuAimEvaluator extends AimEvaluator {
|
|
|
2765
2841
|
velocityChangeBonus *= Math.pow(Math.min(current.strainTime, last.strainTime) /
|
|
2766
2842
|
Math.max(current.strainTime, last.strainTime), 2);
|
|
2767
2843
|
}
|
|
2768
|
-
if (last.
|
|
2844
|
+
if (last.travelTime) {
|
|
2769
2845
|
// Reward sliders based on velocity.
|
|
2770
2846
|
sliderBonus = last.travelDistance / last.travelTime;
|
|
2771
2847
|
}
|
|
@@ -3019,7 +3095,7 @@ class OsuSpeed extends OsuSkill {
|
|
|
3019
3095
|
* @param current The hitobject to save to.
|
|
3020
3096
|
*/
|
|
3021
3097
|
saveToHitObject(current) {
|
|
3022
|
-
current.
|
|
3098
|
+
current.speedStrain = this.currentSpeedStrain * this.currentRhythm;
|
|
3023
3099
|
current.rhythmMultiplier = this.currentRhythm;
|
|
3024
3100
|
}
|
|
3025
3101
|
}
|
|
@@ -3132,7 +3208,7 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3132
3208
|
this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
|
|
3133
3209
|
}
|
|
3134
3210
|
saveToHitObject(current) {
|
|
3135
|
-
current.
|
|
3211
|
+
current.flashlightStrain = this.currentFlashlightStrain;
|
|
3136
3212
|
}
|
|
3137
3213
|
}
|
|
3138
3214
|
|
|
@@ -3168,6 +3244,12 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3168
3244
|
sliderCount: 0,
|
|
3169
3245
|
spinnerCount: 0,
|
|
3170
3246
|
};
|
|
3247
|
+
get cacheableAttributes() {
|
|
3248
|
+
return {
|
|
3249
|
+
...this.attributes,
|
|
3250
|
+
mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
|
|
3251
|
+
};
|
|
3252
|
+
}
|
|
3171
3253
|
difficultyMultiplier = 0.0675;
|
|
3172
3254
|
mode = osuBase.Modes.osu;
|
|
3173
3255
|
/**
|
|
@@ -3299,7 +3381,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3299
3381
|
* Calculates speed-related attributes.
|
|
3300
3382
|
*/
|
|
3301
3383
|
calculateSpeedAttributes() {
|
|
3302
|
-
const objectStrains = this.objects.map((v) => v.
|
|
3384
|
+
const objectStrains = this.objects.map((v) => v.speedStrain);
|
|
3303
3385
|
const maxStrain = Math.max(...objectStrains);
|
|
3304
3386
|
if (maxStrain) {
|
|
3305
3387
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
@@ -3384,7 +3466,6 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3384
3466
|
* The flashlight performance value.
|
|
3385
3467
|
*/
|
|
3386
3468
|
flashlight = 0;
|
|
3387
|
-
difficultyAttributes;
|
|
3388
3469
|
finalMultiplier = 1.14;
|
|
3389
3470
|
mode = osuBase.Modes.osu;
|
|
3390
3471
|
calculateValues() {
|
|
@@ -3399,13 +3480,6 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3399
3480
|
Math.pow(this.accuracy, 1.1) +
|
|
3400
3481
|
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
3401
3482
|
}
|
|
3402
|
-
/**
|
|
3403
|
-
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
3404
|
-
*/
|
|
3405
|
-
constructor(difficultyAttributes) {
|
|
3406
|
-
super();
|
|
3407
|
-
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
3408
|
-
}
|
|
3409
3483
|
/**
|
|
3410
3484
|
* Calculates the aim performance value of the beatmap.
|
|
3411
3485
|
*/
|
|
@@ -3599,6 +3673,7 @@ exports.DifficultyHitObjectCreator = DifficultyHitObjectCreator;
|
|
|
3599
3673
|
exports.DroidAim = DroidAim;
|
|
3600
3674
|
exports.DroidAimEvaluator = DroidAimEvaluator;
|
|
3601
3675
|
exports.DroidDifficultyCalculator = DroidDifficultyCalculator;
|
|
3676
|
+
exports.DroidDifficultyHitObject = DroidDifficultyHitObject;
|
|
3602
3677
|
exports.DroidFlashlight = DroidFlashlight;
|
|
3603
3678
|
exports.DroidFlashlightEvaluator = DroidFlashlightEvaluator;
|
|
3604
3679
|
exports.DroidPerformanceCalculator = DroidPerformanceCalculator;
|
|
@@ -3613,6 +3688,7 @@ exports.MapStars = MapStars;
|
|
|
3613
3688
|
exports.OsuAim = OsuAim;
|
|
3614
3689
|
exports.OsuAimEvaluator = OsuAimEvaluator;
|
|
3615
3690
|
exports.OsuDifficultyCalculator = OsuDifficultyCalculator;
|
|
3691
|
+
exports.OsuDifficultyHitObject = OsuDifficultyHitObject;
|
|
3616
3692
|
exports.OsuFlashlight = OsuFlashlight;
|
|
3617
3693
|
exports.OsuFlashlightEvaluator = OsuFlashlightEvaluator;
|
|
3618
3694
|
exports.OsuPerformanceCalculator = OsuPerformanceCalculator;
|