@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.13 → 4.0.0-beta.15
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 +228 -148
- 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);
|
|
@@ -620,14 +649,22 @@ class DifficultyCalculator {
|
|
|
620
649
|
*/
|
|
621
650
|
calculate(options) {
|
|
622
651
|
this.mods = options?.mods ?? [];
|
|
652
|
+
const { difficulty } = this.beatmap;
|
|
623
653
|
this.stats = new osuBase.MapStats({
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
654
|
+
...options?.stats,
|
|
655
|
+
cs: options?.stats?.forceCS
|
|
656
|
+
? options.stats.cs ?? difficulty.cs
|
|
657
|
+
: difficulty.cs,
|
|
658
|
+
ar: options?.stats?.forceAR
|
|
659
|
+
? options.stats.ar ?? difficulty.ar
|
|
660
|
+
: difficulty.ar,
|
|
661
|
+
od: options?.stats?.forceOD
|
|
662
|
+
? options.stats.od ?? difficulty.od
|
|
663
|
+
: difficulty.od,
|
|
664
|
+
hp: options?.stats?.forceHP
|
|
665
|
+
? options.stats.hp ?? difficulty.hp
|
|
666
|
+
: difficulty.hp,
|
|
628
667
|
mods: options?.mods,
|
|
629
|
-
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
630
|
-
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
631
668
|
}).calculate({ mode: this.mode });
|
|
632
669
|
this.preProcess();
|
|
633
670
|
this.populateDifficultyAttributes();
|
|
@@ -642,7 +679,7 @@ class DifficultyCalculator {
|
|
|
642
679
|
this.objects.length = 0;
|
|
643
680
|
this.objects.push(...new DifficultyHitObjectCreator().generateDifficultyObjects({
|
|
644
681
|
objects: this.beatmap.hitObjects.objects,
|
|
645
|
-
circleSize: this.
|
|
682
|
+
circleSize: this.stats.cs,
|
|
646
683
|
mods: this.mods,
|
|
647
684
|
speedMultiplier: this.stats.speedMultiplier,
|
|
648
685
|
mode: this.mode,
|
|
@@ -1604,6 +1641,31 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1604
1641
|
difficultSliders: [],
|
|
1605
1642
|
averageSpeedDeltaTime: 0,
|
|
1606
1643
|
};
|
|
1644
|
+
get cacheableAttributes() {
|
|
1645
|
+
return {
|
|
1646
|
+
tapDifficulty: this.tap,
|
|
1647
|
+
rhythmDifficulty: this.rhythm,
|
|
1648
|
+
visualDifficulty: this.visual,
|
|
1649
|
+
mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
|
|
1650
|
+
starRating: this.total,
|
|
1651
|
+
maxCombo: this.attributes.maxCombo,
|
|
1652
|
+
aimDifficulty: this.aim,
|
|
1653
|
+
flashlightDifficulty: this.flashlight,
|
|
1654
|
+
speedNoteCount: this.attributes.speedNoteCount,
|
|
1655
|
+
sliderFactor: this.attributes.sliderFactor,
|
|
1656
|
+
clockRate: this.attributes.clockRate,
|
|
1657
|
+
approachRate: this.attributes.approachRate,
|
|
1658
|
+
overallDifficulty: this.attributes.overallDifficulty,
|
|
1659
|
+
hitCircleCount: this.attributes.hitCircleCount,
|
|
1660
|
+
sliderCount: this.attributes.sliderCount,
|
|
1661
|
+
spinnerCount: this.attributes.spinnerCount,
|
|
1662
|
+
aimDifficultStrainCount: this.attributes.aimDifficultStrainCount,
|
|
1663
|
+
tapDifficultStrainCount: this.attributes.tapDifficultStrainCount,
|
|
1664
|
+
flashlightDifficultStrainCount: this.attributes.flashlightDifficultStrainCount,
|
|
1665
|
+
visualDifficultStrainCount: this.attributes.visualDifficultStrainCount,
|
|
1666
|
+
averageSpeedDeltaTime: this.attributes.averageSpeedDeltaTime,
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1607
1669
|
difficultyMultiplier = 0.18;
|
|
1608
1670
|
mode = osuBase.Modes.droid;
|
|
1609
1671
|
/**
|
|
@@ -1691,7 +1753,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1691
1753
|
const visualSkillWithoutSliders = skills[8];
|
|
1692
1754
|
this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
|
|
1693
1755
|
this.postCalculateTap(tapSkillCheese);
|
|
1694
|
-
this.calculateTapAttributes();
|
|
1695
1756
|
this.postCalculateRhythm(rhythmSkill);
|
|
1696
1757
|
this.postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders);
|
|
1697
1758
|
this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
|
|
@@ -1990,6 +2051,10 @@ class PerformanceCalculator {
|
|
|
1990
2051
|
* The calculated accuracy.
|
|
1991
2052
|
*/
|
|
1992
2053
|
computedAccuracy = new osuBase.Accuracy({});
|
|
2054
|
+
/**
|
|
2055
|
+
* The difficulty attributes that is being calculated.
|
|
2056
|
+
*/
|
|
2057
|
+
difficultyAttributes;
|
|
1993
2058
|
/**
|
|
1994
2059
|
* Penalty for combo breaks.
|
|
1995
2060
|
*/
|
|
@@ -2002,6 +2067,20 @@ class PerformanceCalculator {
|
|
|
2002
2067
|
* Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
|
|
2003
2068
|
*/
|
|
2004
2069
|
sliderNerfFactor = 1;
|
|
2070
|
+
/**
|
|
2071
|
+
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
2072
|
+
*/
|
|
2073
|
+
constructor(difficultyAttributes) {
|
|
2074
|
+
if (this.isCacheableAttribute(difficultyAttributes)) {
|
|
2075
|
+
this.difficultyAttributes = {
|
|
2076
|
+
...difficultyAttributes,
|
|
2077
|
+
mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods),
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
else {
|
|
2081
|
+
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2005
2084
|
/**
|
|
2006
2085
|
* Calculates the performance points of the beatmap.
|
|
2007
2086
|
*
|
|
@@ -2125,6 +2204,15 @@ class PerformanceCalculator {
|
|
|
2125
2204
|
}
|
|
2126
2205
|
return Math.max(this.computedAccuracy.nmiss, comboBasedMissCount);
|
|
2127
2206
|
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Determines whether an attribute is a cacheable attribute.
|
|
2209
|
+
*
|
|
2210
|
+
* @param attributes The attributes to check.
|
|
2211
|
+
* @returns Whether the attributes are cacheable.
|
|
2212
|
+
*/
|
|
2213
|
+
isCacheableAttribute(attributes) {
|
|
2214
|
+
return typeof attributes.mods === "string";
|
|
2215
|
+
}
|
|
2128
2216
|
}
|
|
2129
2217
|
|
|
2130
2218
|
/**
|
|
@@ -2195,7 +2283,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2195
2283
|
get visualSliderCheesePenalty() {
|
|
2196
2284
|
return this._visualSliderCheesePenalty;
|
|
2197
2285
|
}
|
|
2198
|
-
difficultyAttributes;
|
|
2199
2286
|
finalMultiplier = 1.24;
|
|
2200
2287
|
mode = osuBase.Modes.droid;
|
|
2201
2288
|
_aimSliderCheesePenalty = 1;
|
|
@@ -2204,13 +2291,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2204
2291
|
_tapPenalty = 1;
|
|
2205
2292
|
_deviation = 0;
|
|
2206
2293
|
_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
2294
|
/**
|
|
2215
2295
|
* Applies a tap penalty value to this calculator.
|
|
2216
2296
|
*
|
|
@@ -2352,16 +2432,16 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2352
2432
|
// We expect the player to get 7500/x deviation when doubletapping x BPM.
|
|
2353
2433
|
// Using this expectation, we penalize scores with deviation above 25.
|
|
2354
2434
|
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
2435
|
// Scale the tap value with tap deviation.
|
|
2362
2436
|
tapValue *=
|
|
2363
2437
|
1.1 *
|
|
2364
|
-
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 *
|
|
2438
|
+
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * normalizedDeviation)), 0.625);
|
|
2439
|
+
// Scale the tap value with doubletap deviation threshold.
|
|
2440
|
+
tapValue *=
|
|
2441
|
+
1 /
|
|
2442
|
+
(1 +
|
|
2443
|
+
Math.exp((this.tapDeviation - 7500 / averageBPM) /
|
|
2444
|
+
((4 * 300) / averageBPM)));
|
|
2365
2445
|
// Scale the tap value with three-fingered penalty.
|
|
2366
2446
|
tapValue /= this._tapPenalty;
|
|
2367
2447
|
// OD 8 SS stays the same.
|
|
@@ -2533,28 +2613,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2533
2613
|
if (greatCountCircles > 0) {
|
|
2534
2614
|
// The probability that a player hits a circle is unknown, but we can estimate it to be
|
|
2535
2615
|
// 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 =
|
|
2616
|
+
// to the number of circles as a bias correction.
|
|
2617
|
+
const greatProbabilityCircle = greatCountCircles /
|
|
2618
|
+
(circleCount - missCountCircles - mehCountCircles + 1);
|
|
2538
2619
|
// Compute the deviation assuming 300s and 100s are normally distributed, and 50s are uniformly distributed.
|
|
2539
2620
|
// Begin with the normal distribution first.
|
|
2540
|
-
|
|
2621
|
+
let deviationOnCircles = hitWindow300 /
|
|
2541
2622
|
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbabilityCircle));
|
|
2542
|
-
|
|
2543
|
-
const truncatedVariance = Math.pow(deviationOnCircles, 2) -
|
|
2623
|
+
deviationOnCircles *= Math.sqrt(1 -
|
|
2544
2624
|
(Math.sqrt(2 / Math.PI) *
|
|
2545
2625
|
hitWindow100 *
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2626
|
+
Math.exp(-0.5 *
|
|
2627
|
+
Math.pow(hitWindow100 / deviationOnCircles, 2))) /
|
|
2628
|
+
(deviationOnCircles *
|
|
2629
|
+
osuBase.ErrorFunction.erf(hitWindow100 /
|
|
2630
|
+
(Math.SQRT2 * deviationOnCircles))));
|
|
2549
2631
|
// Then compute the variance for 50s.
|
|
2550
|
-
const mehVariance = (
|
|
2632
|
+
const mehVariance = (hitWindow50 * hitWindow50 +
|
|
2551
2633
|
hitWindow100 * hitWindow50 +
|
|
2552
|
-
|
|
2634
|
+
hitWindow100 * hitWindow100) /
|
|
2553
2635
|
3;
|
|
2554
2636
|
// Find the total deviation.
|
|
2555
|
-
|
|
2637
|
+
deviationOnCircles = Math.sqrt(((greatCountCircles + okCountCircles) *
|
|
2638
|
+
Math.pow(deviationOnCircles, 2) +
|
|
2556
2639
|
mehCountCircles * mehVariance) /
|
|
2557
2640
|
(greatCountCircles + okCountCircles + mehCountCircles));
|
|
2641
|
+
return deviationOnCircles;
|
|
2558
2642
|
}
|
|
2559
2643
|
// If there are more non-300s than there are circles, compute the deviation on sliders instead.
|
|
2560
2644
|
// Here, all that matters is whether or not the slider was missed, since it is impossible
|
|
@@ -2584,7 +2668,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2584
2668
|
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).hitWindowFor300();
|
|
2585
2669
|
const { n100, n50, nmiss } = this.computedAccuracy;
|
|
2586
2670
|
// 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/
|
|
2671
|
+
// Graph: https://www.desmos.com/calculator/iskvgjkxr4
|
|
2588
2672
|
const speedNoteRatio = this.difficultyAttributes.speedNoteCount / this.totalHits;
|
|
2589
2673
|
const nonGreatCount = n100 + n50 + nmiss;
|
|
2590
2674
|
const nonGreatRatio = 1 -
|
|
@@ -2765,7 +2849,7 @@ class OsuAimEvaluator extends AimEvaluator {
|
|
|
2765
2849
|
velocityChangeBonus *= Math.pow(Math.min(current.strainTime, last.strainTime) /
|
|
2766
2850
|
Math.max(current.strainTime, last.strainTime), 2);
|
|
2767
2851
|
}
|
|
2768
|
-
if (last.
|
|
2852
|
+
if (last.travelTime) {
|
|
2769
2853
|
// Reward sliders based on velocity.
|
|
2770
2854
|
sliderBonus = last.travelDistance / last.travelTime;
|
|
2771
2855
|
}
|
|
@@ -3019,7 +3103,7 @@ class OsuSpeed extends OsuSkill {
|
|
|
3019
3103
|
* @param current The hitobject to save to.
|
|
3020
3104
|
*/
|
|
3021
3105
|
saveToHitObject(current) {
|
|
3022
|
-
current.
|
|
3106
|
+
current.speedStrain = this.currentSpeedStrain * this.currentRhythm;
|
|
3023
3107
|
current.rhythmMultiplier = this.currentRhythm;
|
|
3024
3108
|
}
|
|
3025
3109
|
}
|
|
@@ -3132,7 +3216,7 @@ class OsuFlashlight extends OsuSkill {
|
|
|
3132
3216
|
this.strainDecay(time - (current.previous(0)?.startTime ?? 0)));
|
|
3133
3217
|
}
|
|
3134
3218
|
saveToHitObject(current) {
|
|
3135
|
-
current.
|
|
3219
|
+
current.flashlightStrain = this.currentFlashlightStrain;
|
|
3136
3220
|
}
|
|
3137
3221
|
}
|
|
3138
3222
|
|
|
@@ -3168,6 +3252,12 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3168
3252
|
sliderCount: 0,
|
|
3169
3253
|
spinnerCount: 0,
|
|
3170
3254
|
};
|
|
3255
|
+
get cacheableAttributes() {
|
|
3256
|
+
return {
|
|
3257
|
+
...this.attributes,
|
|
3258
|
+
mods: osuBase.ModUtil.modsToOsuString(this.attributes.mods),
|
|
3259
|
+
};
|
|
3260
|
+
}
|
|
3171
3261
|
difficultyMultiplier = 0.0675;
|
|
3172
3262
|
mode = osuBase.Modes.osu;
|
|
3173
3263
|
/**
|
|
@@ -3299,7 +3389,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3299
3389
|
* Calculates speed-related attributes.
|
|
3300
3390
|
*/
|
|
3301
3391
|
calculateSpeedAttributes() {
|
|
3302
|
-
const objectStrains = this.objects.map((v) => v.
|
|
3392
|
+
const objectStrains = this.objects.map((v) => v.speedStrain);
|
|
3303
3393
|
const maxStrain = Math.max(...objectStrains);
|
|
3304
3394
|
if (maxStrain) {
|
|
3305
3395
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
@@ -3342,11 +3432,7 @@ class MapStars {
|
|
|
3342
3432
|
* @param options Options for the difficulty calculation.
|
|
3343
3433
|
*/
|
|
3344
3434
|
constructor(beatmap, options) {
|
|
3345
|
-
const stats = new osuBase.MapStats(
|
|
3346
|
-
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
3347
|
-
isForceAR: options?.stats?.isForceAR ?? false,
|
|
3348
|
-
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
3349
|
-
});
|
|
3435
|
+
const stats = new osuBase.MapStats(options?.stats);
|
|
3350
3436
|
this.droid = new DroidDifficultyCalculator(beatmap).calculate({
|
|
3351
3437
|
...options,
|
|
3352
3438
|
stats,
|
|
@@ -3384,7 +3470,6 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3384
3470
|
* The flashlight performance value.
|
|
3385
3471
|
*/
|
|
3386
3472
|
flashlight = 0;
|
|
3387
|
-
difficultyAttributes;
|
|
3388
3473
|
finalMultiplier = 1.14;
|
|
3389
3474
|
mode = osuBase.Modes.osu;
|
|
3390
3475
|
calculateValues() {
|
|
@@ -3399,13 +3484,6 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3399
3484
|
Math.pow(this.accuracy, 1.1) +
|
|
3400
3485
|
Math.pow(this.flashlight, 1.1), 1 / 1.1) * this.finalMultiplier);
|
|
3401
3486
|
}
|
|
3402
|
-
/**
|
|
3403
|
-
* @param difficultyAttributes The difficulty attributes to calculate.
|
|
3404
|
-
*/
|
|
3405
|
-
constructor(difficultyAttributes) {
|
|
3406
|
-
super();
|
|
3407
|
-
this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
|
|
3408
|
-
}
|
|
3409
3487
|
/**
|
|
3410
3488
|
* Calculates the aim performance value of the beatmap.
|
|
3411
3489
|
*/
|
|
@@ -3599,6 +3677,7 @@ exports.DifficultyHitObjectCreator = DifficultyHitObjectCreator;
|
|
|
3599
3677
|
exports.DroidAim = DroidAim;
|
|
3600
3678
|
exports.DroidAimEvaluator = DroidAimEvaluator;
|
|
3601
3679
|
exports.DroidDifficultyCalculator = DroidDifficultyCalculator;
|
|
3680
|
+
exports.DroidDifficultyHitObject = DroidDifficultyHitObject;
|
|
3602
3681
|
exports.DroidFlashlight = DroidFlashlight;
|
|
3603
3682
|
exports.DroidFlashlightEvaluator = DroidFlashlightEvaluator;
|
|
3604
3683
|
exports.DroidPerformanceCalculator = DroidPerformanceCalculator;
|
|
@@ -3613,6 +3692,7 @@ exports.MapStars = MapStars;
|
|
|
3613
3692
|
exports.OsuAim = OsuAim;
|
|
3614
3693
|
exports.OsuAimEvaluator = OsuAimEvaluator;
|
|
3615
3694
|
exports.OsuDifficultyCalculator = OsuDifficultyCalculator;
|
|
3695
|
+
exports.OsuDifficultyHitObject = OsuDifficultyHitObject;
|
|
3616
3696
|
exports.OsuFlashlight = OsuFlashlight;
|
|
3617
3697
|
exports.OsuFlashlightEvaluator = OsuFlashlightEvaluator;
|
|
3618
3698
|
exports.OsuPerformanceCalculator = OsuPerformanceCalculator;
|