@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.1 → 4.0.0-beta.10
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 +224 -184
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/typings/index.d.ts +44 -20
package/dist/index.js
CHANGED
|
@@ -207,10 +207,9 @@ class DifficultyHitObject {
|
|
|
207
207
|
*
|
|
208
208
|
* @param time The time to calculate the hitobject's opacity at.
|
|
209
209
|
* @param isHidden Whether Hidden mod is used.
|
|
210
|
-
* @param mode The gamemode to calculate the opacity for.
|
|
211
210
|
* @returns The opacity of the hitobject at the given time.
|
|
212
211
|
*/
|
|
213
|
-
opacityAt(time, isHidden
|
|
212
|
+
opacityAt(time, isHidden) {
|
|
214
213
|
if (time > this.object.startTime) {
|
|
215
214
|
// Consider a hitobject as being invisible when its start time is passed.
|
|
216
215
|
// In reality the hitobject will be visible beyond its start time up until its hittable window has passed,
|
|
@@ -221,10 +220,7 @@ class DifficultyHitObject {
|
|
|
221
220
|
const fadeInDuration = this.timeFadeIn;
|
|
222
221
|
if (isHidden) {
|
|
223
222
|
const fadeOutStartTime = fadeInStartTime + fadeInDuration;
|
|
224
|
-
const fadeOutDuration = this.baseTimePreempt *
|
|
225
|
-
(mode === osuBase.Modes.droid
|
|
226
|
-
? 0.35
|
|
227
|
-
: osuBase.ModHidden.fadeOutDurationMultiplier);
|
|
223
|
+
const fadeOutDuration = this.baseTimePreempt * osuBase.ModHidden.fadeOutDurationMultiplier;
|
|
228
224
|
return Math.min(osuBase.MathUtils.clamp((time - fadeInStartTime) / fadeInDuration, 0, 1), 1 -
|
|
229
225
|
osuBase.MathUtils.clamp((time - fadeOutStartTime) / fadeOutDuration, 0, 1));
|
|
230
226
|
}
|
|
@@ -297,34 +293,16 @@ class DifficultyHitObjectCreator {
|
|
|
297
293
|
if (this.mode === osuBase.Modes.droid) {
|
|
298
294
|
this.maximumSliderRadius = this.normalizedRadius * 2;
|
|
299
295
|
}
|
|
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
296
|
const scalingFactor = this.getScalingFactor(params.objects[0].getRadius(this.mode));
|
|
313
297
|
const difficultyObjects = [];
|
|
314
298
|
for (let i = 0; i < params.objects.length; ++i) {
|
|
315
299
|
const object = new DifficultyHitObject(params.objects[i], difficultyObjects);
|
|
316
300
|
object.index = difficultyObjects.length - 1;
|
|
317
|
-
object.object.droidScale = droidScale;
|
|
318
|
-
object.object.osuScale = osuScale;
|
|
319
301
|
object.timePreempt = params.preempt;
|
|
320
302
|
object.baseTimePreempt = params.preempt * params.speedMultiplier;
|
|
321
303
|
if (object.object instanceof osuBase.Slider) {
|
|
322
304
|
object.velocity =
|
|
323
305
|
object.object.velocity * params.speedMultiplier;
|
|
324
|
-
object.object.nestedHitObjects.forEach((o) => {
|
|
325
|
-
o.droidScale = droidScale;
|
|
326
|
-
o.osuScale = osuScale;
|
|
327
|
-
});
|
|
328
306
|
this.calculateSliderCursorPosition(object.object);
|
|
329
307
|
object.travelDistance = object.object.lazyTravelDistance;
|
|
330
308
|
// Bonus for repeat sliders until a better per nested object strain system can be achieved.
|
|
@@ -367,9 +345,6 @@ class DifficultyHitObjectCreator {
|
|
|
367
345
|
object.endTime + object.timePreempt) {
|
|
368
346
|
break;
|
|
369
347
|
}
|
|
370
|
-
// Future objects do not have their scales set, so we set them here.
|
|
371
|
-
o.droidScale = droidScale;
|
|
372
|
-
o.osuScale = osuScale;
|
|
373
348
|
nextVisibleObjects.push(o);
|
|
374
349
|
}
|
|
375
350
|
for (let j = 0; j < object.index; ++j) {
|
|
@@ -620,7 +595,6 @@ class DifficultyCalculator {
|
|
|
620
595
|
speed: [],
|
|
621
596
|
flashlight: [],
|
|
622
597
|
};
|
|
623
|
-
sectionLength = 400;
|
|
624
598
|
/**
|
|
625
599
|
* Constructs a new instance of the calculator.
|
|
626
600
|
*
|
|
@@ -654,6 +628,7 @@ class DifficultyCalculator {
|
|
|
654
628
|
speedMultiplier: options?.stats?.speedMultiplier ?? 1,
|
|
655
629
|
oldStatistics: options?.stats?.oldStatistics ?? false,
|
|
656
630
|
}).calculate({ mode: this.mode });
|
|
631
|
+
this.preProcess();
|
|
657
632
|
this.populateDifficultyAttributes();
|
|
658
633
|
this.generateDifficultyHitObjects();
|
|
659
634
|
this.calculateAll();
|
|
@@ -673,6 +648,11 @@ class DifficultyCalculator {
|
|
|
673
648
|
preempt: osuBase.MapStats.arToMS(this.stats.ar),
|
|
674
649
|
}));
|
|
675
650
|
}
|
|
651
|
+
/**
|
|
652
|
+
* Performs some pre-processing before proceeding with difficulty calculation.
|
|
653
|
+
*/
|
|
654
|
+
preProcess() {
|
|
655
|
+
}
|
|
676
656
|
/**
|
|
677
657
|
* Calculates the skills provided.
|
|
678
658
|
*
|
|
@@ -701,6 +681,7 @@ class DifficultyCalculator {
|
|
|
701
681
|
this.attributes.overallDifficulty = this.stats.od;
|
|
702
682
|
this.attributes.sliderCount = this.beatmap.hitObjects.sliders;
|
|
703
683
|
this.attributes.spinnerCount = this.beatmap.hitObjects.spinners;
|
|
684
|
+
this.attributes.clockRate = this.stats.speedMultiplier;
|
|
704
685
|
}
|
|
705
686
|
/**
|
|
706
687
|
* Calculates the star rating value of a difficulty.
|
|
@@ -860,7 +841,8 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
860
841
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
861
842
|
// Add in additional slider velocity bonus.
|
|
862
843
|
if (withSliders) {
|
|
863
|
-
strain +=
|
|
844
|
+
strain +=
|
|
845
|
+
Math.pow(1 + sliderBonus * this.sliderMultiplier, 1.25) - 1;
|
|
864
846
|
}
|
|
865
847
|
return strain;
|
|
866
848
|
}
|
|
@@ -915,7 +897,6 @@ class StrainSkill extends Skill {
|
|
|
915
897
|
strainPeaks = [];
|
|
916
898
|
sectionLength = 400;
|
|
917
899
|
currentSectionEnd = 0;
|
|
918
|
-
isFirstObject = true;
|
|
919
900
|
/**
|
|
920
901
|
* Calculates the strain value of a hitobject and stores the value in it. This value is affected by previously processed objects.
|
|
921
902
|
*
|
|
@@ -923,11 +904,10 @@ class StrainSkill extends Skill {
|
|
|
923
904
|
*/
|
|
924
905
|
process(current) {
|
|
925
906
|
// The first object doesn't generate a strain, so we begin with an incremented section end
|
|
926
|
-
if (
|
|
907
|
+
if (current.index === 0) {
|
|
927
908
|
this.currentSectionEnd =
|
|
928
909
|
Math.ceil(current.startTime / this.sectionLength) *
|
|
929
910
|
this.sectionLength;
|
|
930
|
-
this.isFirstObject = false;
|
|
931
911
|
}
|
|
932
912
|
while (current.startTime > this.currentSectionEnd) {
|
|
933
913
|
this.saveCurrentPeak();
|
|
@@ -1062,7 +1042,6 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
1062
1042
|
current.isOverlapping(false)) {
|
|
1063
1043
|
return 0;
|
|
1064
1044
|
}
|
|
1065
|
-
let strainTime = current.strainTime;
|
|
1066
1045
|
let doubletapness = 1;
|
|
1067
1046
|
if (considerCheesability) {
|
|
1068
1047
|
const greatWindowFull = greatWindow * 2;
|
|
@@ -1077,16 +1056,14 @@ class DroidTapEvaluator extends SpeedEvaluator {
|
|
|
1077
1056
|
const windowRatio = Math.pow(Math.min(1, currentDeltaTime / greatWindowFull), 2);
|
|
1078
1057
|
doubletapness = Math.pow(speedRatio, 1 - windowRatio);
|
|
1079
1058
|
}
|
|
1080
|
-
// Cap deltatime to the OD 300 hitwindow.
|
|
1081
|
-
// 0.58 is derived from making sure 260 BPM 1/4 OD5 streams aren't nerfed harshly, whilst 0.91 limits the effect of the cap.
|
|
1082
|
-
strainTime /= osuBase.MathUtils.clamp(strainTime / greatWindowFull / 0.58, 0.91, 1);
|
|
1083
1059
|
}
|
|
1084
1060
|
let speedBonus = 1;
|
|
1085
|
-
if (strainTime < this.minSpeedBonus) {
|
|
1061
|
+
if (current.strainTime < this.minSpeedBonus) {
|
|
1086
1062
|
speedBonus +=
|
|
1087
|
-
0.75 *
|
|
1063
|
+
0.75 *
|
|
1064
|
+
Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - current.strainTime) / 40), 2);
|
|
1088
1065
|
}
|
|
1089
|
-
return (speedBonus * doubletapness) / strainTime;
|
|
1066
|
+
return (speedBonus * Math.pow(doubletapness, 1.5)) / current.strainTime;
|
|
1090
1067
|
}
|
|
1091
1068
|
}
|
|
1092
1069
|
|
|
@@ -1190,7 +1167,7 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1190
1167
|
const opacityBonus = 1 +
|
|
1191
1168
|
this.maxOpacityBonus *
|
|
1192
1169
|
(1 -
|
|
1193
|
-
current.opacityAt(currentObject.object.startTime, isHiddenMod
|
|
1170
|
+
current.opacityAt(currentObject.object.startTime, isHiddenMod));
|
|
1194
1171
|
result +=
|
|
1195
1172
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
1196
1173
|
cumulativeStrainTime;
|
|
@@ -1233,11 +1210,11 @@ class DroidFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
1233
1210
|
* Represents the skill required to memorize and hit every object in a beatmap with the Flashlight mod enabled.
|
|
1234
1211
|
*/
|
|
1235
1212
|
class DroidFlashlight extends DroidSkill {
|
|
1236
|
-
skillMultiplier = 0.
|
|
1213
|
+
skillMultiplier = 0.052;
|
|
1237
1214
|
strainDecayBase = 0.15;
|
|
1238
1215
|
reducedSectionCount = 0;
|
|
1239
1216
|
reducedSectionBaseline = 1;
|
|
1240
|
-
starsPerDouble = 1.
|
|
1217
|
+
starsPerDouble = 1.06;
|
|
1241
1218
|
isHidden;
|
|
1242
1219
|
withSliders;
|
|
1243
1220
|
constructor(mods, withSliders) {
|
|
@@ -1262,6 +1239,9 @@ class DroidFlashlight extends DroidSkill {
|
|
|
1262
1239
|
current.flashlightStrainWithoutSliders = this.currentStrain;
|
|
1263
1240
|
}
|
|
1264
1241
|
}
|
|
1242
|
+
difficultyValue() {
|
|
1243
|
+
return Math.pow(this.strainPeaks.reduce((a, v) => a + v, 0) * this.starsPerDouble, 0.8);
|
|
1244
|
+
}
|
|
1265
1245
|
}
|
|
1266
1246
|
|
|
1267
1247
|
/**
|
|
@@ -1453,7 +1433,8 @@ class DroidVisualEvaluator {
|
|
|
1453
1433
|
static evaluateDifficultyOf(current, isHiddenMod, withSliders) {
|
|
1454
1434
|
if (current.object instanceof osuBase.Spinner ||
|
|
1455
1435
|
// Exclude overlapping objects that can be tapped at once.
|
|
1456
|
-
current.isOverlapping(true)
|
|
1436
|
+
current.isOverlapping(true) ||
|
|
1437
|
+
current.index === 0) {
|
|
1457
1438
|
return 0;
|
|
1458
1439
|
}
|
|
1459
1440
|
// Start with base density and give global bonus for Hidden.
|
|
@@ -1480,7 +1461,7 @@ class DroidVisualEvaluator {
|
|
|
1480
1461
|
}
|
|
1481
1462
|
strain +=
|
|
1482
1463
|
(1 -
|
|
1483
|
-
current.opacityAt(previous.object.startTime, isHiddenMod
|
|
1464
|
+
current.opacityAt(previous.object.startTime, isHiddenMod)) /
|
|
1484
1465
|
4;
|
|
1485
1466
|
}
|
|
1486
1467
|
// Scale the value with overlapping factor.
|
|
@@ -1516,44 +1497,6 @@ class DroidVisualEvaluator {
|
|
|
1516
1497
|
Math.min(1, 300 / cumulativeStrainTime);
|
|
1517
1498
|
}
|
|
1518
1499
|
}
|
|
1519
|
-
// Reward for rhythm changes.
|
|
1520
|
-
if (current.rhythmMultiplier > 1) {
|
|
1521
|
-
let rhythmBonus = (current.rhythmMultiplier - 1) / 20;
|
|
1522
|
-
// Rhythm changes are harder to read in Hidden.
|
|
1523
|
-
// Add additional bonus for Hidden.
|
|
1524
|
-
if (isHiddenMod) {
|
|
1525
|
-
rhythmBonus += (current.rhythmMultiplier - 1) / 25;
|
|
1526
|
-
}
|
|
1527
|
-
// Rhythm changes are harder to read when objects are stacked together.
|
|
1528
|
-
// Scale rhythm bonus based on the stack of past objects.
|
|
1529
|
-
const diameter = 2 * current.object.getRadius(osuBase.Modes.droid);
|
|
1530
|
-
let cumulativeStrainTime = 0;
|
|
1531
|
-
for (let i = 0; i < Math.min(current.index, 5); ++i) {
|
|
1532
|
-
const previous = current.previous(i);
|
|
1533
|
-
if (previous.object instanceof osuBase.Spinner ||
|
|
1534
|
-
// Exclude overlapping objects that can be tapped at once.
|
|
1535
|
-
previous.isOverlapping(true)) {
|
|
1536
|
-
continue;
|
|
1537
|
-
}
|
|
1538
|
-
const jumpDistance = current.object
|
|
1539
|
-
.getStackedPosition(osuBase.Modes.droid)
|
|
1540
|
-
.getDistance(previous.object.getStackedEndPosition(osuBase.Modes.droid));
|
|
1541
|
-
cumulativeStrainTime += previous.strainTime;
|
|
1542
|
-
rhythmBonus +=
|
|
1543
|
-
// Scale the bonus with diameter.
|
|
1544
|
-
osuBase.MathUtils.clamp((0.5 - jumpDistance / diameter) / 10, 0, 0.05) *
|
|
1545
|
-
// Scale with cumulative strain time to avoid overbuffing past objects.
|
|
1546
|
-
Math.min(1, 300 / cumulativeStrainTime);
|
|
1547
|
-
// Give a larger bonus for Hidden.
|
|
1548
|
-
if (isHiddenMod) {
|
|
1549
|
-
rhythmBonus +=
|
|
1550
|
-
(1 -
|
|
1551
|
-
current.opacityAt(previous.object.startTime, isHiddenMod, osuBase.Modes.droid)) /
|
|
1552
|
-
20;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
strain += rhythmBonus;
|
|
1556
|
-
}
|
|
1557
1500
|
return strain;
|
|
1558
1501
|
}
|
|
1559
1502
|
}
|
|
@@ -1578,7 +1521,7 @@ class DroidVisual extends DroidSkill {
|
|
|
1578
1521
|
this.currentStrain *= this.strainDecay(current.deltaTime);
|
|
1579
1522
|
this.currentStrain +=
|
|
1580
1523
|
DroidVisualEvaluator.evaluateDifficultyOf(current, this.isHidden, this.withsliders) * this.skillMultiplier;
|
|
1581
|
-
return this.currentStrain;
|
|
1524
|
+
return this.currentStrain * (1 + (current.rhythmMultiplier - 1) / 5);
|
|
1582
1525
|
}
|
|
1583
1526
|
saveToHitObject(current) {
|
|
1584
1527
|
if (this.withsliders) {
|
|
@@ -1632,15 +1575,21 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1632
1575
|
flashlightDifficulty: 0,
|
|
1633
1576
|
speedNoteCount: 0,
|
|
1634
1577
|
sliderFactor: 0,
|
|
1578
|
+
clockRate: 1,
|
|
1635
1579
|
approachRate: 0,
|
|
1636
1580
|
overallDifficulty: 0,
|
|
1637
1581
|
hitCircleCount: 0,
|
|
1638
1582
|
sliderCount: 0,
|
|
1639
1583
|
spinnerCount: 0,
|
|
1584
|
+
aimDifficultStrainCount: 0,
|
|
1585
|
+
tapDifficultStrainCount: 0,
|
|
1586
|
+
flashlightDifficultStrainCount: 0,
|
|
1587
|
+
visualDifficultStrainCount: 0,
|
|
1640
1588
|
flashlightSliderFactor: 0,
|
|
1641
1589
|
visualSliderFactor: 0,
|
|
1642
1590
|
possibleThreeFingeredSections: [],
|
|
1643
1591
|
difficultSliders: [],
|
|
1592
|
+
averageSpeedDeltaTime: 0,
|
|
1644
1593
|
};
|
|
1645
1594
|
difficultyMultiplier = 0.18;
|
|
1646
1595
|
mode = osuBase.Modes.droid;
|
|
@@ -1762,9 +1711,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1762
1711
|
}
|
|
1763
1712
|
this.calculateTotal();
|
|
1764
1713
|
}
|
|
1765
|
-
/**
|
|
1766
|
-
* Returns a string representative of the class.
|
|
1767
|
-
*/
|
|
1768
1714
|
toString() {
|
|
1769
1715
|
return (this.total.toFixed(2) +
|
|
1770
1716
|
" stars (" +
|
|
@@ -1779,9 +1725,13 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1779
1725
|
this.visual.toFixed(2) +
|
|
1780
1726
|
" visual)");
|
|
1781
1727
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1728
|
+
preProcess() {
|
|
1729
|
+
const scale = osuBase.CircleSizeCalculator.standardCSToStandardScale(this.stats.cs);
|
|
1730
|
+
for (const object of this.beatmap.hitObjects.objects) {
|
|
1731
|
+
object.droidScale = scale;
|
|
1732
|
+
}
|
|
1733
|
+
osuBase.HitObjectStackEvaluator.applyDroidStacking(this.beatmap.hitObjects.objects, this.beatmap.general.stackLeniency);
|
|
1734
|
+
}
|
|
1785
1735
|
createSkills() {
|
|
1786
1736
|
return [
|
|
1787
1737
|
new DroidAim(this.mods, true),
|
|
@@ -1822,7 +1772,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1822
1772
|
calculateAimAttributes() {
|
|
1823
1773
|
const objectStrains = [];
|
|
1824
1774
|
let maxStrain = 0;
|
|
1825
|
-
// Take the top 15% most difficult sliders based on velocity.
|
|
1826
1775
|
const topDifficultSliders = [];
|
|
1827
1776
|
for (let i = 0; i < this.objects.length; ++i) {
|
|
1828
1777
|
const object = this.objects[i];
|
|
@@ -1834,22 +1783,28 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1834
1783
|
index: i,
|
|
1835
1784
|
velocity: velocity,
|
|
1836
1785
|
});
|
|
1837
|
-
topDifficultSliders.sort((a, b) => b.velocity - a.velocity);
|
|
1838
|
-
while (topDifficultSliders.length >
|
|
1839
|
-
Math.ceil(0.15 * this.beatmap.hitObjects.sliders)) {
|
|
1840
|
-
topDifficultSliders.pop();
|
|
1841
|
-
}
|
|
1842
1786
|
}
|
|
1843
1787
|
}
|
|
1844
1788
|
if (maxStrain) {
|
|
1845
1789
|
this.attributes.aimNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
1790
|
+
this.attributes.aimDifficultStrainCount = objectStrains.reduce((total, next) => total + Math.pow(next / maxStrain, 4), 0);
|
|
1846
1791
|
}
|
|
1847
1792
|
const velocitySum = topDifficultSliders.reduce((a, v) => a + v.velocity, 0);
|
|
1848
1793
|
for (const slider of topDifficultSliders) {
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1794
|
+
const difficultyRating = slider.velocity / velocitySum;
|
|
1795
|
+
// Only consider sliders that are fast enough.
|
|
1796
|
+
if (difficultyRating > 0.02) {
|
|
1797
|
+
this.attributes.difficultSliders.push({
|
|
1798
|
+
index: slider.index,
|
|
1799
|
+
difficultyRating: slider.velocity / velocitySum,
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
this.attributes.difficultSliders.sort((a, b) => b.difficultyRating - a.difficultyRating);
|
|
1804
|
+
// Take the top 15% most difficult sliders.
|
|
1805
|
+
while (this.attributes.difficultSliders.length >
|
|
1806
|
+
Math.ceil(0.15 * this.beatmap.hitObjects.sliders)) {
|
|
1807
|
+
this.attributes.difficultSliders.pop();
|
|
1853
1808
|
}
|
|
1854
1809
|
}
|
|
1855
1810
|
/**
|
|
@@ -1868,6 +1823,7 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1868
1823
|
this.attributes.possibleThreeFingeredSections = [];
|
|
1869
1824
|
const tempSections = [];
|
|
1870
1825
|
const objectStrains = [];
|
|
1826
|
+
const objectDeltaTimes = [];
|
|
1871
1827
|
let maxStrain = 0;
|
|
1872
1828
|
const maxSectionDeltaTime = 2000;
|
|
1873
1829
|
const minSectionObjectCount = 5;
|
|
@@ -1877,8 +1833,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1877
1833
|
const next = this.objects[i + 1];
|
|
1878
1834
|
if (i === 0) {
|
|
1879
1835
|
objectStrains.push(current.tapStrain);
|
|
1836
|
+
objectDeltaTimes.push(current.deltaTime);
|
|
1880
1837
|
}
|
|
1881
1838
|
objectStrains.push(next.tapStrain);
|
|
1839
|
+
objectDeltaTimes.push(next.deltaTime);
|
|
1882
1840
|
maxStrain = Math.max(current.tapStrain, maxStrain);
|
|
1883
1841
|
const realDeltaTime = next.object.startTime - current.object.endTime;
|
|
1884
1842
|
if (realDeltaTime >= maxSectionDeltaTime) {
|
|
@@ -1917,6 +1875,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1917
1875
|
if (inSpeedSection &&
|
|
1918
1876
|
current.originalTapStrain < threeFingerStrainThreshold) {
|
|
1919
1877
|
inSpeedSection = false;
|
|
1878
|
+
// Ignore sections that don't meet object count requirement.
|
|
1879
|
+
if (i - newFirstObjectIndex < minSectionObjectCount) {
|
|
1880
|
+
continue;
|
|
1881
|
+
}
|
|
1920
1882
|
this.attributes.possibleThreeFingeredSections.push({
|
|
1921
1883
|
firstObjectIndex: newFirstObjectIndex,
|
|
1922
1884
|
lastObjectIndex: i,
|
|
@@ -1925,7 +1887,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1925
1887
|
}
|
|
1926
1888
|
}
|
|
1927
1889
|
// Don't forget to manually add the last beatmap section, which would otherwise be ignored.
|
|
1928
|
-
|
|
1890
|
+
// Ignore sections that don't meet object count requirement.
|
|
1891
|
+
if (inSpeedSection &&
|
|
1892
|
+
section.lastObjectIndex - newFirstObjectIndex >=
|
|
1893
|
+
minSectionObjectCount) {
|
|
1929
1894
|
this.attributes.possibleThreeFingeredSections.push({
|
|
1930
1895
|
firstObjectIndex: newFirstObjectIndex,
|
|
1931
1896
|
lastObjectIndex: section.lastObjectIndex,
|
|
@@ -1935,6 +1900,16 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1935
1900
|
}
|
|
1936
1901
|
if (maxStrain) {
|
|
1937
1902
|
this.attributes.speedNoteCount = objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
|
|
1903
|
+
this.attributes.averageSpeedDeltaTime =
|
|
1904
|
+
objectDeltaTimes.reduce((total, next, index) => total +
|
|
1905
|
+
(next * 1) /
|
|
1906
|
+
(1 +
|
|
1907
|
+
Math.exp(-((objectStrains[index] / maxStrain) *
|
|
1908
|
+
25 -
|
|
1909
|
+
20))), 0) /
|
|
1910
|
+
objectStrains.reduce((total, next) => total +
|
|
1911
|
+
1 / (1 + Math.exp(-((next / maxStrain) * 25 - 20))), 0);
|
|
1912
|
+
this.attributes.tapDifficultStrainCount = objectStrains.reduce((total, next) => total + Math.pow(next / maxStrain, 4), 0);
|
|
1938
1913
|
}
|
|
1939
1914
|
}
|
|
1940
1915
|
/**
|
|
@@ -1977,6 +1952,12 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1977
1952
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
1978
1953
|
this.flashlight *= 0.7;
|
|
1979
1954
|
}
|
|
1955
|
+
const objectStrains = this.objects.map((v) => v.flashlightStrainWithSliders);
|
|
1956
|
+
const maxStrain = Math.max(...objectStrains);
|
|
1957
|
+
if (maxStrain) {
|
|
1958
|
+
this.attributes.flashlightDifficultStrainCount =
|
|
1959
|
+
objectStrains.reduce((total, next) => total + Math.pow(next / maxStrain, 4), 0);
|
|
1960
|
+
}
|
|
1980
1961
|
this.attributes.flashlightDifficulty = this.flashlight;
|
|
1981
1962
|
}
|
|
1982
1963
|
/**
|
|
@@ -1994,6 +1975,11 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1994
1975
|
this.starValue(visualSkillWithoutSliders.difficultyValue()) /
|
|
1995
1976
|
this.visual;
|
|
1996
1977
|
}
|
|
1978
|
+
const objectStrains = this.objects.map((v) => v.flashlightStrainWithSliders);
|
|
1979
|
+
const maxStrain = Math.max(...objectStrains);
|
|
1980
|
+
if (maxStrain) {
|
|
1981
|
+
this.attributes.visualDifficultStrainCount = objectStrains.reduce((total, next) => total + Math.pow(next / maxStrain, 4), 0);
|
|
1982
|
+
}
|
|
1997
1983
|
}
|
|
1998
1984
|
}
|
|
1999
1985
|
|
|
@@ -2116,7 +2102,7 @@ class PerformanceCalculator {
|
|
|
2116
2102
|
if (this.difficultyAttributes.sliderCount > 0) {
|
|
2117
2103
|
// We assume 15% of sliders in a beatmap are difficult since there's no way to tell from the performance calculator.
|
|
2118
2104
|
const estimateDifficultSliders = this.difficultyAttributes.sliderCount * 0.15;
|
|
2119
|
-
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.computedAccuracy.
|
|
2105
|
+
const estimateSliderEndsDropped = osuBase.MathUtils.clamp(Math.min(this.computedAccuracy.n100 +
|
|
2120
2106
|
this.computedAccuracy.n50 +
|
|
2121
2107
|
this.computedAccuracy.nmiss, maxCombo - combo), 0, estimateDifficultSliders);
|
|
2122
2108
|
this.sliderNerfFactor =
|
|
@@ -2253,11 +2239,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2253
2239
|
*
|
|
2254
2240
|
* The aim and total performance value will be recalculated afterwards.
|
|
2255
2241
|
*
|
|
2256
|
-
* @param value The slider cheese penalty value. Must be between than 0
|
|
2242
|
+
* @param value The slider cheese penalty value. Must be between than 0 and 1.
|
|
2257
2243
|
*/
|
|
2258
2244
|
applyAimSliderCheesePenalty(value) {
|
|
2259
|
-
if (value
|
|
2260
|
-
throw new RangeError("New aim slider cheese penalty must be greater than zero.");
|
|
2245
|
+
if (value < 0) {
|
|
2246
|
+
throw new RangeError("New aim slider cheese penalty must be greater than or equal to zero.");
|
|
2261
2247
|
}
|
|
2262
2248
|
if (value > 1) {
|
|
2263
2249
|
throw new RangeError("New aim slider cheese penalty must be less than or equal to one.");
|
|
@@ -2265,8 +2251,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2265
2251
|
if (value === this._aimSliderCheesePenalty) {
|
|
2266
2252
|
return;
|
|
2267
2253
|
}
|
|
2268
|
-
this.aim *= value / this._aimSliderCheesePenalty;
|
|
2269
2254
|
this._aimSliderCheesePenalty = value;
|
|
2255
|
+
this.calculateAimValue();
|
|
2270
2256
|
this.calculateTotalValue();
|
|
2271
2257
|
}
|
|
2272
2258
|
/**
|
|
@@ -2274,11 +2260,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2274
2260
|
*
|
|
2275
2261
|
* The flashlight and total performance value will be recalculated afterwards.
|
|
2276
2262
|
*
|
|
2277
|
-
* @param value The slider cheese penalty value. Must be between 0
|
|
2263
|
+
* @param value The slider cheese penalty value. Must be between 0 and 1.
|
|
2278
2264
|
*/
|
|
2279
2265
|
applyFlashlightSliderCheesePenalty(value) {
|
|
2280
|
-
if (value
|
|
2281
|
-
throw new RangeError("New flashlight slider cheese penalty must be greater than zero.");
|
|
2266
|
+
if (value < 0) {
|
|
2267
|
+
throw new RangeError("New flashlight slider cheese penalty must be greater than or equal to zero.");
|
|
2282
2268
|
}
|
|
2283
2269
|
if (value > 1) {
|
|
2284
2270
|
throw new RangeError("New flashlight slider cheese penalty must be less than or equal to one.");
|
|
@@ -2286,8 +2272,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2286
2272
|
if (value === this._flashlightSliderCheesePenalty) {
|
|
2287
2273
|
return;
|
|
2288
2274
|
}
|
|
2289
|
-
this.flashlight *= value / this._flashlightSliderCheesePenalty;
|
|
2290
2275
|
this._flashlightSliderCheesePenalty = value;
|
|
2276
|
+
this.calculateFlashlightValue();
|
|
2291
2277
|
this.calculateTotalValue();
|
|
2292
2278
|
}
|
|
2293
2279
|
/**
|
|
@@ -2295,11 +2281,11 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2295
2281
|
*
|
|
2296
2282
|
* The visual and total performance value will be recalculated afterwards.
|
|
2297
2283
|
*
|
|
2298
|
-
* @param value The slider cheese penalty value. Must be between 0
|
|
2284
|
+
* @param value The slider cheese penalty value. Must be between 0 and 1.
|
|
2299
2285
|
*/
|
|
2300
2286
|
applyVisualSliderCheesePenalty(value) {
|
|
2301
|
-
if (value
|
|
2302
|
-
throw new RangeError("New visual slider cheese penalty must be greater than zero.");
|
|
2287
|
+
if (value < 0) {
|
|
2288
|
+
throw new RangeError("New visual slider cheese penalty must be greater than or equal to zero.");
|
|
2303
2289
|
}
|
|
2304
2290
|
if (value > 1) {
|
|
2305
2291
|
throw new RangeError("New visual slider cheese penalty must be less than or equal to one.");
|
|
@@ -2307,8 +2293,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2307
2293
|
if (value === this._visualSliderCheesePenalty) {
|
|
2308
2294
|
return;
|
|
2309
2295
|
}
|
|
2310
|
-
this.visual *= value / this._visualSliderCheesePenalty;
|
|
2311
2296
|
this._visualSliderCheesePenalty = value;
|
|
2297
|
+
this.calculateVisualValue();
|
|
2312
2298
|
this.calculateTotalValue();
|
|
2313
2299
|
}
|
|
2314
2300
|
calculateValues() {
|
|
@@ -2342,16 +2328,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2342
2328
|
*/
|
|
2343
2329
|
calculateAimValue() {
|
|
2344
2330
|
this.aim = this.baseValue(Math.pow(this.difficultyAttributes.aimDifficulty, 0.8));
|
|
2345
|
-
|
|
2346
|
-
// Penalize misses by assessing # of misses relative to the total # of objects.
|
|
2347
|
-
// Default a 3% reduction for any # of misses.
|
|
2348
|
-
this.aim *=
|
|
2349
|
-
0.97 *
|
|
2350
|
-
Math.pow(1 -
|
|
2351
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
2352
|
-
}
|
|
2353
|
-
// Combo scaling
|
|
2354
|
-
this.aim *= this.comboPenalty;
|
|
2331
|
+
this.aim *= this.calculateMissPenalty(this.difficultyAttributes.aimDifficultStrainCount);
|
|
2355
2332
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
2356
2333
|
this.aim *= this.sliderNerfFactor;
|
|
2357
2334
|
// Scale the aim value with slider cheese penalty.
|
|
@@ -2366,20 +2343,23 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2366
2343
|
*/
|
|
2367
2344
|
calculateTapValue() {
|
|
2368
2345
|
this.tap = this.baseValue(this.difficultyAttributes.tapDifficulty);
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
this.
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2346
|
+
this.tap *= this.calculateMissPenalty(this.difficultyAttributes.tapDifficultStrainCount);
|
|
2347
|
+
// Normalize the deviation to 300 BPM.
|
|
2348
|
+
const normalizedDeviation = this.tapDeviation *
|
|
2349
|
+
Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
|
|
2350
|
+
// We expect the player to get 7500/x deviation when doubletapping x BPM.
|
|
2351
|
+
// Using this expectation, we penalize scores with deviation above 25.
|
|
2352
|
+
const averageBPM = 60000 / 4 / this.difficultyAttributes.averageSpeedDeltaTime;
|
|
2353
|
+
const adjustedDeviation = normalizedDeviation *
|
|
2354
|
+
(1 +
|
|
2355
|
+
1 /
|
|
2356
|
+
(1 +
|
|
2357
|
+
Math.exp(-(normalizedDeviation - 7500 / averageBPM) /
|
|
2358
|
+
((2 * 300) / averageBPM))));
|
|
2379
2359
|
// Scale the tap value with tap deviation.
|
|
2380
2360
|
this.tap *=
|
|
2381
2361
|
1.1 *
|
|
2382
|
-
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 *
|
|
2362
|
+
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * adjustedDeviation)), 1.25);
|
|
2383
2363
|
// Scale the tap value with three-fingered penalty.
|
|
2384
2364
|
this.tap /= this._tapPenalty;
|
|
2385
2365
|
}
|
|
@@ -2394,7 +2374,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2394
2374
|
}
|
|
2395
2375
|
this.accuracy =
|
|
2396
2376
|
650 *
|
|
2397
|
-
Math.exp(-0.
|
|
2377
|
+
Math.exp(-0.1 * this._deviation) *
|
|
2398
2378
|
// The following function is to give higher reward for deviations lower than 25 (250 UR).
|
|
2399
2379
|
(15 / (this._deviation + 15) + 0.65);
|
|
2400
2380
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
|
|
@@ -2421,15 +2401,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2421
2401
|
}
|
|
2422
2402
|
this.flashlight =
|
|
2423
2403
|
Math.pow(this.difficultyAttributes.flashlightDifficulty, 1.6) * 25;
|
|
2424
|
-
|
|
2425
|
-
this.flashlight *= this.comboPenalty;
|
|
2426
|
-
if (this.effectiveMissCount > 0) {
|
|
2427
|
-
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
2428
|
-
this.flashlight *=
|
|
2429
|
-
0.97 *
|
|
2430
|
-
Math.pow(1 -
|
|
2431
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), Math.pow(this.effectiveMissCount, 0.875));
|
|
2432
|
-
}
|
|
2404
|
+
this.flashlight *= this.calculateMissPenalty(this.difficultyAttributes.flashlightDifficultStrainCount);
|
|
2433
2405
|
// Account for shorter maps having a higher ratio of 0 combo/100 combo flashlight radius.
|
|
2434
2406
|
this.flashlight *=
|
|
2435
2407
|
0.7 +
|
|
@@ -2448,15 +2420,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2448
2420
|
calculateVisualValue() {
|
|
2449
2421
|
this.visual =
|
|
2450
2422
|
Math.pow(this.difficultyAttributes.visualDifficulty, 1.6) * 22.5;
|
|
2451
|
-
|
|
2452
|
-
// Penalize misses by assessing # of misses relative to the total # of objects. Default a 3% reduction for any # of misses.
|
|
2453
|
-
this.visual *=
|
|
2454
|
-
0.97 *
|
|
2455
|
-
Math.pow(1 -
|
|
2456
|
-
Math.pow(this.effectiveMissCount / this.totalHits, 0.775), this.effectiveMissCount);
|
|
2457
|
-
}
|
|
2458
|
-
// Combo scaling
|
|
2459
|
-
this.visual *= this.comboPenalty;
|
|
2423
|
+
this.visual *= this.calculateMissPenalty(this.difficultyAttributes.visualDifficultStrainCount);
|
|
2460
2424
|
// Scale the visual value with object count to penalize short maps.
|
|
2461
2425
|
this.visual *= Math.min(1, 1.650668 +
|
|
2462
2426
|
(0.4845796 - 1.650668) /
|
|
@@ -2468,6 +2432,21 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2468
2432
|
1.065 *
|
|
2469
2433
|
Math.pow(osuBase.ErrorFunction.erf(30 / (Math.SQRT2 * this._deviation)), 1.75);
|
|
2470
2434
|
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Calculates miss penalty.
|
|
2437
|
+
*
|
|
2438
|
+
* Miss penalty assumes that a player will miss on the hardest parts of a map,
|
|
2439
|
+
* so we use the amount of relatively difficult sections to adjust miss penalty
|
|
2440
|
+
* to make it more punishing on maps with lower amount of hard sections.
|
|
2441
|
+
*/
|
|
2442
|
+
calculateMissPenalty(difficultStrainCount) {
|
|
2443
|
+
if (this.effectiveMissCount === 0) {
|
|
2444
|
+
return 1;
|
|
2445
|
+
}
|
|
2446
|
+
return (0.94 /
|
|
2447
|
+
(this.effectiveMissCount / (2 * Math.sqrt(difficultStrainCount)) +
|
|
2448
|
+
1));
|
|
2449
|
+
}
|
|
2471
2450
|
/**
|
|
2472
2451
|
* Estimates the player's tap deviation based on the OD, number of circles and sliders,
|
|
2473
2452
|
* and number of 300s, 100s, 50s, and misses, assuming the player's mean hit error is 0.
|
|
@@ -2487,17 +2466,16 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2487
2466
|
return Number.POSITIVE_INFINITY;
|
|
2488
2467
|
}
|
|
2489
2468
|
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).hitWindowFor300();
|
|
2490
|
-
// Obtain the 50 hit window for droid.
|
|
2491
|
-
const
|
|
2492
|
-
mods: this.difficultyAttributes.mods,
|
|
2493
|
-
}).calculate().speedMultiplier;
|
|
2494
|
-
const realHitWindow300 = hitWindow300 * clockRate;
|
|
2469
|
+
// Obtain the 50 and 100 hit window for droid.
|
|
2470
|
+
const realHitWindow300 = hitWindow300 * this.difficultyAttributes.clockRate;
|
|
2495
2471
|
const droidHitWindow = new osuBase.DroidHitWindow(osuBase.OsuHitWindow.hitWindow300ToOD(realHitWindow300));
|
|
2496
|
-
const
|
|
2497
|
-
const
|
|
2498
|
-
this.
|
|
2499
|
-
|
|
2500
|
-
this.
|
|
2472
|
+
const isPrecise = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
2473
|
+
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) /
|
|
2474
|
+
this.difficultyAttributes.clockRate;
|
|
2475
|
+
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) /
|
|
2476
|
+
this.difficultyAttributes.clockRate;
|
|
2477
|
+
const { n300, n100, n50, nmiss } = this.computedAccuracy;
|
|
2478
|
+
const greatCountOnCircles = this.difficultyAttributes.hitCircleCount - n100 - n50 - nmiss;
|
|
2501
2479
|
// The probability that a player hits a circle is unknown, but we can estimate it to be
|
|
2502
2480
|
// the number of greats on circles divided by the number of circles, and then add one
|
|
2503
2481
|
// to the number of circles as a bias correction / bayesian prior.
|
|
@@ -2516,10 +2494,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2516
2494
|
if (greatProbabilityCircle === 0 && greatProbabilitySlider === 0) {
|
|
2517
2495
|
return Number.POSITIVE_INFINITY;
|
|
2518
2496
|
}
|
|
2519
|
-
const
|
|
2520
|
-
(
|
|
2521
|
-
|
|
2522
|
-
|
|
2497
|
+
const calculateDeviation = (mainHitWindow, probability) => {
|
|
2498
|
+
if (probability === 0) {
|
|
2499
|
+
return Number.POSITIVE_INFINITY;
|
|
2500
|
+
}
|
|
2501
|
+
// Start with normal deviation.
|
|
2502
|
+
const normalDeviation = mainHitWindow /
|
|
2503
|
+
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(probability));
|
|
2504
|
+
// Get the variance of the truncated variable.
|
|
2505
|
+
const truncatedVariance = Math.pow(normalDeviation, 2) -
|
|
2506
|
+
(Math.SQRT2 *
|
|
2507
|
+
hitWindow100 *
|
|
2508
|
+
normalDeviation *
|
|
2509
|
+
Math.exp(-0.5 * Math.pow(hitWindow100 / normalDeviation, 2))) /
|
|
2510
|
+
(Math.sqrt(Math.PI) *
|
|
2511
|
+
osuBase.ErrorFunction.erf(hitWindow100 / (Math.SQRT2 * normalDeviation)));
|
|
2512
|
+
// Add 50s by assuming they are uniformly distributed.
|
|
2513
|
+
return Math.sqrt((1 / (n300 + n100 + n50)) *
|
|
2514
|
+
((n300 + n100) * truncatedVariance +
|
|
2515
|
+
(n50 *
|
|
2516
|
+
(Math.pow(hitWindow50, 2) +
|
|
2517
|
+
hitWindow100 * hitWindow50 +
|
|
2518
|
+
Math.pow(hitWindow100, 2))) /
|
|
2519
|
+
3));
|
|
2520
|
+
};
|
|
2521
|
+
const deviationOnCircles = calculateDeviation(hitWindow300, greatProbabilityCircle);
|
|
2522
|
+
const deviationOnSliders = calculateDeviation(hitWindow50, greatProbabilitySlider);
|
|
2523
2523
|
return Math.min(deviationOnCircles, deviationOnSliders);
|
|
2524
2524
|
}
|
|
2525
2525
|
/**
|
|
@@ -2533,13 +2533,48 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2533
2533
|
return Number.POSITIVE_INFINITY;
|
|
2534
2534
|
}
|
|
2535
2535
|
const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).hitWindowFor300();
|
|
2536
|
-
|
|
2537
|
-
const
|
|
2536
|
+
// Obtain the 50 and 100 hit window for droid.
|
|
2537
|
+
const realHitWindow300 = hitWindow300 * this.difficultyAttributes.clockRate;
|
|
2538
|
+
const droidHitWindow = new osuBase.DroidHitWindow(osuBase.OsuHitWindow.hitWindow300ToOD(realHitWindow300));
|
|
2539
|
+
const isPrecise = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise);
|
|
2540
|
+
const hitWindow50 = droidHitWindow.hitWindowFor50(isPrecise) /
|
|
2541
|
+
this.difficultyAttributes.clockRate;
|
|
2542
|
+
const hitWindow100 = droidHitWindow.hitWindowFor100(isPrecise) /
|
|
2543
|
+
this.difficultyAttributes.clockRate;
|
|
2544
|
+
const { n300, n100, n50, nmiss } = this.computedAccuracy;
|
|
2545
|
+
// Assume a fixed ratio of non-300s hit in speed notes based on speed note count ratio and OD.
|
|
2546
|
+
// Graph: https://www.desmos.com/calculator/31argjcxqc
|
|
2547
|
+
const speedNoteRatio = this.difficultyAttributes.speedNoteCount / this.totalHits;
|
|
2548
|
+
const nonGreatCount = n100 + n50 + nmiss;
|
|
2549
|
+
const nonGreatRatio = 1 -
|
|
2550
|
+
(Math.pow(Math.exp(Math.sqrt(hitWindow300)) + 1, 1 - speedNoteRatio) -
|
|
2551
|
+
1) /
|
|
2552
|
+
Math.exp(Math.sqrt(hitWindow300));
|
|
2553
|
+
const relevantCountGreat = Math.max(0, this.difficultyAttributes.speedNoteCount -
|
|
2554
|
+
nonGreatCount * nonGreatRatio);
|
|
2538
2555
|
if (relevantCountGreat === 0) {
|
|
2539
2556
|
return Number.POSITIVE_INFINITY;
|
|
2540
2557
|
}
|
|
2541
2558
|
const greatProbability = relevantCountGreat / (this.difficultyAttributes.speedNoteCount + 1);
|
|
2542
|
-
|
|
2559
|
+
// Start with normal deviation.
|
|
2560
|
+
const normalDeviation = hitWindow300 /
|
|
2561
|
+
(Math.SQRT2 * osuBase.ErrorFunction.erfInv(greatProbability));
|
|
2562
|
+
// Get the variance of the truncated variable.
|
|
2563
|
+
const truncatedVariance = Math.pow(normalDeviation, 2) -
|
|
2564
|
+
(Math.SQRT2 *
|
|
2565
|
+
hitWindow100 *
|
|
2566
|
+
normalDeviation *
|
|
2567
|
+
Math.exp(-0.5 * Math.pow(hitWindow100 / normalDeviation, 2))) /
|
|
2568
|
+
(Math.sqrt(Math.PI) *
|
|
2569
|
+
osuBase.ErrorFunction.erf(hitWindow100 / (Math.SQRT2 * normalDeviation)));
|
|
2570
|
+
// Add 50s by assuming they are uniformly distributed.
|
|
2571
|
+
return Math.sqrt((1 / (n300 + n100 + n50)) *
|
|
2572
|
+
((n300 + n100) * truncatedVariance +
|
|
2573
|
+
(n50 *
|
|
2574
|
+
(Math.pow(hitWindow50, 2) +
|
|
2575
|
+
hitWindow100 * hitWindow50 +
|
|
2576
|
+
Math.pow(hitWindow100, 2))) /
|
|
2577
|
+
3));
|
|
2543
2578
|
}
|
|
2544
2579
|
toString() {
|
|
2545
2580
|
return (this.total.toFixed(2) +
|
|
@@ -3002,7 +3037,7 @@ class OsuFlashlightEvaluator extends FlashlightEvaluator {
|
|
|
3002
3037
|
const opacityBonus = 1 +
|
|
3003
3038
|
this.maxOpacityBonus *
|
|
3004
3039
|
(1 -
|
|
3005
|
-
current.opacityAt(currentObject.object.startTime, isHiddenMod
|
|
3040
|
+
current.opacityAt(currentObject.object.startTime, isHiddenMod));
|
|
3006
3041
|
result +=
|
|
3007
3042
|
(stackNerf * opacityBonus * scalingFactor * jumpDistance) /
|
|
3008
3043
|
cumulativeStrainTime;
|
|
@@ -3094,6 +3129,7 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3094
3129
|
flashlightDifficulty: 0,
|
|
3095
3130
|
speedNoteCount: 0,
|
|
3096
3131
|
sliderFactor: 0,
|
|
3132
|
+
clockRate: 1,
|
|
3097
3133
|
approachRate: 0,
|
|
3098
3134
|
overallDifficulty: 0,
|
|
3099
3135
|
hitCircleCount: 0,
|
|
@@ -3181,9 +3217,6 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3181
3217
|
this.postCalculateFlashlight(flashlightSkill);
|
|
3182
3218
|
this.calculateTotal();
|
|
3183
3219
|
}
|
|
3184
|
-
/**
|
|
3185
|
-
* Returns a string representative of the class.
|
|
3186
|
-
*/
|
|
3187
3220
|
toString() {
|
|
3188
3221
|
return (this.total.toFixed(2) +
|
|
3189
3222
|
" stars (" +
|
|
@@ -3194,9 +3227,17 @@ class OsuDifficultyCalculator extends DifficultyCalculator {
|
|
|
3194
3227
|
this.flashlight.toFixed(2) +
|
|
3195
3228
|
" flashlight)");
|
|
3196
3229
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3230
|
+
preProcess() {
|
|
3231
|
+
const scale = osuBase.CircleSizeCalculator.standardCSToStandardScale(this.stats.cs);
|
|
3232
|
+
for (const object of this.beatmap.hitObjects.objects) {
|
|
3233
|
+
object.osuScale = scale;
|
|
3234
|
+
}
|
|
3235
|
+
const ar = new osuBase.MapStats({
|
|
3236
|
+
ar: this.beatmap.difficulty.ar,
|
|
3237
|
+
mods: osuBase.ModUtil.removeSpeedChangingMods(this.mods),
|
|
3238
|
+
}).calculate().ar;
|
|
3239
|
+
osuBase.HitObjectStackEvaluator.applyStandardStacking(this.beatmap.formatVersion, this.beatmap.hitObjects.objects, ar, this.beatmap.general.stackLeniency);
|
|
3240
|
+
}
|
|
3200
3241
|
createSkills() {
|
|
3201
3242
|
return [
|
|
3202
3243
|
new OsuAim(this.mods, true),
|
|
@@ -3390,7 +3431,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3390
3431
|
// Scale the aim value with slider factor to nerf very likely dropped sliderends.
|
|
3391
3432
|
this.aim *= this.sliderNerfFactor;
|
|
3392
3433
|
// Scale the aim value with accuracy.
|
|
3393
|
-
this.aim *= this.computedAccuracy.value(
|
|
3434
|
+
this.aim *= this.computedAccuracy.value();
|
|
3394
3435
|
// It is also important to consider accuracy difficulty when doing that.
|
|
3395
3436
|
const odScaling = Math.pow(this.difficultyAttributes.overallDifficulty, 2) / 2500;
|
|
3396
3437
|
this.aim *= 0.98 + odScaling;
|
|
@@ -3438,15 +3479,14 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3438
3479
|
n300: Math.max(0, countGreat - relevantTotalDiff),
|
|
3439
3480
|
n100: Math.max(0, countOk - Math.max(0, relevantTotalDiff - countGreat)),
|
|
3440
3481
|
n50: Math.max(0, countMeh - Math.max(0, relevantTotalDiff - countGreat - countOk)),
|
|
3441
|
-
nmiss: this.effectiveMissCount,
|
|
3442
3482
|
});
|
|
3443
3483
|
// Scale the speed value with accuracy and OD.
|
|
3444
3484
|
this.speed *=
|
|
3445
3485
|
(0.95 +
|
|
3446
3486
|
Math.pow(this.difficultyAttributes.overallDifficulty, 2) /
|
|
3447
3487
|
750) *
|
|
3448
|
-
Math.pow((this.computedAccuracy.value(
|
|
3449
|
-
relevantAccuracy.value()) /
|
|
3488
|
+
Math.pow((this.computedAccuracy.value() +
|
|
3489
|
+
relevantAccuracy.value(this.difficultyAttributes.speedNoteCount)) /
|
|
3450
3490
|
2, (14.5 -
|
|
3451
3491
|
Math.max(this.difficultyAttributes.overallDifficulty, 8)) /
|
|
3452
3492
|
2);
|
|
@@ -3476,7 +3516,8 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3476
3516
|
// Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution
|
|
3477
3517
|
this.accuracy =
|
|
3478
3518
|
Math.pow(1.52163, this.difficultyAttributes.overallDifficulty) *
|
|
3479
|
-
|
|
3519
|
+
// It is possible to reach a negative accuracy with this formula. Cap it at zero - zero points.
|
|
3520
|
+
Math.pow(realAccuracy.n300 < 0 ? 0 : realAccuracy.value(), 24) *
|
|
3480
3521
|
2.83;
|
|
3481
3522
|
// Bonus for many hitcircles - it's harder to keep good accuracy up for longer
|
|
3482
3523
|
this.accuracy *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
|
|
@@ -3514,8 +3555,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
|
|
|
3514
3555
|
? 0.2 * Math.min(1, (this.totalHits - 200) / 200)
|
|
3515
3556
|
: 0);
|
|
3516
3557
|
// Scale the flashlight value with accuracy slightly.
|
|
3517
|
-
this.flashlight *=
|
|
3518
|
-
0.5 + this.computedAccuracy.value(this.totalHits) / 2;
|
|
3558
|
+
this.flashlight *= 0.5 + this.computedAccuracy.value() / 2;
|
|
3519
3559
|
// It is also important to consider accuracy difficulty when doing that.
|
|
3520
3560
|
const odScaling = Math.pow(this.difficultyAttributes.overallDifficulty, 2) / 2500;
|
|
3521
3561
|
this.flashlight *= 0.98 + odScaling;
|