@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.45 → 4.0.0-beta.47

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 CHANGED
@@ -832,14 +832,6 @@ class DroidAimEvaluator extends AimEvaluator {
832
832
  // Reward sliders based on velocity.
833
833
  sliderBonus = last.travelDistance / last.travelTime;
834
834
  }
835
- // Reduce snap aim difficulty for low spacing as the player is more likely to perform
836
- // a flowing movement instead of snapping to the object. This also prevents the weird
837
- // scenario of awarding flow aim difficulty in snap aim.
838
- const flowBonus = Math.pow(last.minimumJumpDistance / this.singleSpacingThreshold, 3.5);
839
- if (flowBonus < 1) {
840
- strain *= 0.5 * (1 + Math.sqrt(flowBonus));
841
- wideAngleBonus *= 0.5 * (1 + Math.sqrt(flowBonus));
842
- }
843
835
  strain += wiggleBonus * this.wiggleMultiplier;
844
836
  // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
845
837
  strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
@@ -1043,12 +1035,11 @@ class DroidAim extends DroidSkill {
1043
1035
  if (this.sliderStrains.length === 0) {
1044
1036
  return 0;
1045
1037
  }
1046
- const sortedStrains = this.sliderStrains.sort((a, b) => b - a);
1047
- const maxSliderStrain = sortedStrains[0];
1038
+ const maxSliderStrain = Math.max(...this.sliderStrains);
1048
1039
  if (maxSliderStrain === 0) {
1049
1040
  return 0;
1050
1041
  }
1051
- return sortedStrains.reduce((total, strain) => total +
1042
+ return this.sliderStrains.reduce((total, strain) => total +
1052
1043
  1 / (1 + Math.exp(-((strain / maxSliderStrain) * 12 - 6))), 0);
1053
1044
  }
1054
1045
  strainValueAt(current) {
@@ -1100,13 +1091,15 @@ class DroidTapEvaluator extends SpeedEvaluator {
1100
1091
  * Evaluates the difficulty of tapping the current object, based on:
1101
1092
  *
1102
1093
  * - time between pressing the previous and current object,
1094
+ * - distance between those objects,
1103
1095
  * - how easily they can be cheesed,
1104
1096
  * - and the strain time cap.
1105
1097
  *
1106
1098
  * @param current The current object.
1107
1099
  * @param considerCheesability Whether to consider cheesability.
1100
+ * @param strainTimeCap The strain time to cap the object's strain time to.
1108
1101
  */
1109
- static evaluateDifficultyOf(current, considerCheesability) {
1102
+ static evaluateDifficultyOf(current, considerCheesability, strainTimeCap) {
1110
1103
  if (current.object instanceof osuBase.Spinner ||
1111
1104
  // Exclude overlapping objects that can be tapped at once.
1112
1105
  current.isOverlapping(false)) {
@@ -1115,14 +1108,17 @@ class DroidTapEvaluator extends SpeedEvaluator {
1115
1108
  const doubletapness = considerCheesability
1116
1109
  ? 1 - current.doubletapness
1117
1110
  : 1;
1111
+ const strainTime = strainTimeCap !== undefined
1112
+ ? // We cap the strain time to 50 here as the chance of vibro is higher in any BPM higher than 300.
1113
+ Math.max(50, strainTimeCap, current.strainTime)
1114
+ : current.strainTime;
1118
1115
  let speedBonus = 1;
1119
- if (current.strainTime < this.minSpeedBonus) {
1116
+ if (strainTime < this.minSpeedBonus) {
1120
1117
  speedBonus +=
1121
1118
  0.75 *
1122
- Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - current.strainTime) / 40), 2);
1119
+ Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - strainTime) / 40), 2);
1123
1120
  }
1124
- return ((speedBonus * Math.pow(doubletapness, 1.5) * 1000) /
1125
- current.strainTime);
1121
+ return (speedBonus * Math.pow(doubletapness, 1.5) * 1000) / strainTime;
1126
1122
  }
1127
1123
  }
1128
1124
 
@@ -1130,7 +1126,13 @@ class DroidTapEvaluator extends SpeedEvaluator {
1130
1126
  * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
1131
1127
  */
1132
1128
  class DroidTap extends DroidSkill {
1133
- constructor(mods, considerCheesability) {
1129
+ /**
1130
+ * The delta time of hitobjects.
1131
+ */
1132
+ get objectDeltaTimes() {
1133
+ return this._objectDeltaTimes;
1134
+ }
1135
+ constructor(mods, considerCheesability, strainTimeCap) {
1134
1136
  super(mods);
1135
1137
  this.reducedSectionCount = 10;
1136
1138
  this.reducedSectionBaseline = 0.75;
@@ -1139,7 +1141,9 @@ class DroidTap extends DroidSkill {
1139
1141
  this.currentTapStrain = 0;
1140
1142
  this.currentRhythmMultiplier = 0;
1141
1143
  this.skillMultiplier = 1.375;
1144
+ this._objectDeltaTimes = [];
1142
1145
  this.considerCheesability = considerCheesability;
1146
+ this.strainTimeCap = strainTimeCap;
1143
1147
  }
1144
1148
  /**
1145
1149
  * The amount of notes that are relevant to the difficulty.
@@ -1154,11 +1158,31 @@ class DroidTap extends DroidSkill {
1154
1158
  }
1155
1159
  return this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
1156
1160
  }
1161
+ /**
1162
+ * The delta time relevant to the difficulty.
1163
+ */
1164
+ relevantDeltaTime() {
1165
+ if (this._objectStrains.length === 0) {
1166
+ return 0;
1167
+ }
1168
+ const maxStrain = Math.max(...this._objectStrains);
1169
+ if (maxStrain === 0) {
1170
+ return 0;
1171
+ }
1172
+ return (this._objectDeltaTimes.reduce((total, next, index) => total +
1173
+ (next * 1) /
1174
+ (1 +
1175
+ Math.exp(-((this._objectStrains[index] / maxStrain) *
1176
+ 25 -
1177
+ 20))), 0) /
1178
+ this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 25 - 20))), 0));
1179
+ }
1157
1180
  strainValueAt(current) {
1158
1181
  this.currentTapStrain *= this.strainDecay(current.strainTime);
1159
1182
  this.currentTapStrain +=
1160
- DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability) * this.skillMultiplier;
1183
+ DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability, this.strainTimeCap) * this.skillMultiplier;
1161
1184
  this.currentRhythmMultiplier = current.rhythmMultiplier;
1185
+ this._objectDeltaTimes.push(current.deltaTime);
1162
1186
  return this.currentTapStrain * current.rhythmMultiplier;
1163
1187
  }
1164
1188
  calculateInitialStrain(time, current) {
@@ -1174,6 +1198,9 @@ class DroidTap extends DroidSkill {
1174
1198
  * @param current The hitobject to save to.
1175
1199
  */
1176
1200
  saveToHitObject(current) {
1201
+ if (this.strainTimeCap !== undefined) {
1202
+ return;
1203
+ }
1177
1204
  const strain = this.currentTapStrain * this.currentRhythmMultiplier;
1178
1205
  if (this.considerCheesability) {
1179
1206
  current.tapStrain = strain;
@@ -1365,8 +1392,9 @@ class DroidRhythmEvaluator {
1365
1392
  * with historic data of the current object.
1366
1393
  *
1367
1394
  * @param current The current object.
1395
+ * @param useSliderAccuracy Whether to use slider accuracy.
1368
1396
  */
1369
- static evaluateDifficultyOf(current) {
1397
+ static evaluateDifficultyOf(current, useSliderAccuracy) {
1370
1398
  if (current.object instanceof osuBase.Spinner) {
1371
1399
  return 1;
1372
1400
  }
@@ -1428,15 +1456,17 @@ class DroidRhythmEvaluator {
1428
1456
  island.addDelta(currentDelta);
1429
1457
  }
1430
1458
  else {
1431
- // BPM change is into slider, this is easy acc window.
1432
- if (currentObject.object instanceof osuBase.Slider) {
1433
- effectiveRatio /= 8;
1434
- }
1435
- // BPM change was from a slider, this is easier typically than circle -> circle.
1436
- // Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
1437
- // than bursts without sliders.
1438
- if (prevObject.object instanceof osuBase.Slider) {
1439
- effectiveRatio *= 0.3;
1459
+ if (!useSliderAccuracy) {
1460
+ // BPM change is into slider, this is easy acc window.
1461
+ if (currentObject.object instanceof osuBase.Slider) {
1462
+ effectiveRatio /= 8;
1463
+ }
1464
+ // BPM change was from a slider, this is easier typically than circle -> circle.
1465
+ // Unintentional side effect is that bursts with kicksliders at the ends might have lower difficulty
1466
+ // than bursts without sliders.
1467
+ if (prevObject.object instanceof osuBase.Slider) {
1468
+ effectiveRatio *= 0.3;
1469
+ }
1440
1470
  }
1441
1471
  // Repeated island polarity (2 -> 4, 3 -> 5).
1442
1472
  if (island.isSimilarPolarity(previousIsland)) {
@@ -1519,18 +1549,19 @@ DroidRhythmEvaluator.rhythmRatioMultiplier = 12;
1519
1549
  * Represents the skill required to properly follow a beatmap's rhythm.
1520
1550
  */
1521
1551
  class DroidRhythm extends DroidSkill {
1522
- constructor() {
1523
- super(...arguments);
1552
+ constructor(mods) {
1553
+ super(mods);
1524
1554
  this.reducedSectionCount = 5;
1525
1555
  this.reducedSectionBaseline = 0.75;
1526
1556
  this.strainDecayBase = 0.3;
1527
1557
  this.starsPerDouble = 1.75;
1528
1558
  this.currentRhythmStrain = 0;
1529
1559
  this.currentRhythmMultiplier = 1;
1560
+ this.useSliderAccuracy = mods.some((m) => m instanceof osuBase.ModScoreV2);
1530
1561
  }
1531
1562
  strainValueAt(current) {
1532
1563
  this.currentRhythmMultiplier =
1533
- DroidRhythmEvaluator.evaluateDifficultyOf(current);
1564
+ DroidRhythmEvaluator.evaluateDifficultyOf(current, this.useSliderAccuracy);
1534
1565
  this.currentRhythmStrain *= this.strainDecay(current.deltaTime);
1535
1566
  this.currentRhythmStrain += this.currentRhythmMultiplier - 1;
1536
1567
  return this.currentRhythmStrain;
@@ -1723,6 +1754,8 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1723
1754
  visualSliderFactor: 0,
1724
1755
  possibleThreeFingeredSections: [],
1725
1756
  difficultSliders: [],
1757
+ averageSpeedDeltaTime: 0,
1758
+ vibroFactor: 1,
1726
1759
  };
1727
1760
  this.difficultyMultiplier = 0.18;
1728
1761
  this.mode = osuBase.Modes.droid;
@@ -1780,7 +1813,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1780
1813
  const tapSkillCheese = new DroidTap(this.mods, true);
1781
1814
  const tapSkillNoCheese = new DroidTap(this.mods, false);
1782
1815
  this.calculateSkills(tapSkillCheese, tapSkillNoCheese);
1783
- this.postCalculateTap(tapSkillCheese);
1816
+ const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
1817
+ this.calculateSkills(tapSkillVibro);
1818
+ this.postCalculateTap(tapSkillCheese, tapSkillVibro);
1784
1819
  }
1785
1820
  /**
1786
1821
  * Calculates the rhythm star rating of the beatmap and stores it in this instance.
@@ -1846,8 +1881,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1846
1881
  const flashlightSkillWithoutSliders = skills[6];
1847
1882
  const visualSkill = skills[7];
1848
1883
  const visualSkillWithoutSliders = skills[8];
1884
+ const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
1885
+ this.calculateSkills(tapSkillVibro);
1849
1886
  this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
1850
- this.postCalculateTap(tapSkillCheese);
1887
+ this.postCalculateTap(tapSkillCheese, tapSkillVibro);
1851
1888
  this.postCalculateRhythm(rhythmSkill);
1852
1889
  this.postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders);
1853
1890
  this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
@@ -1962,13 +1999,20 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1962
1999
  * Called after tap skill calculation.
1963
2000
  *
1964
2001
  * @param tapSkillCheese The tap skill that considers cheesing.
2002
+ * @param tapSkillVibro The tap skill that considers vibro.
1965
2003
  */
1966
- postCalculateTap(tapSkillCheese) {
2004
+ postCalculateTap(tapSkillCheese, tapSkillVibro) {
1967
2005
  this.strainPeaks.speed = tapSkillCheese.strainPeaks;
1968
2006
  this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
1969
2007
  ? 0
1970
2008
  : this.starValue(tapSkillCheese.difficultyValue());
2009
+ if (this.tap) {
2010
+ this.attributes.vibroFactor =
2011
+ this.starValue(tapSkillVibro.difficultyValue()) / this.tap;
2012
+ }
1971
2013
  this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
2014
+ this.attributes.averageSpeedDeltaTime =
2015
+ tapSkillCheese.relevantDeltaTime();
1972
2016
  this.attributes.tapDifficultStrainCount =
1973
2017
  tapSkillCheese.countDifficultStrains();
1974
2018
  this.calculateTapAttributes();
@@ -2110,12 +2154,10 @@ class PerformanceCalculator {
2110
2154
  * Nerf factor used for nerfing beatmaps with very likely dropped sliderends.
2111
2155
  */
2112
2156
  this.sliderNerfFactor = 1;
2113
- if (this.isCacheableAttribute(difficultyAttributes)) {
2114
- this.difficultyAttributes = Object.assign(Object.assign({}, difficultyAttributes), { mods: osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods) });
2115
- }
2116
- else {
2117
- this.difficultyAttributes = osuBase.Utils.deepCopy(difficultyAttributes);
2118
- }
2157
+ this.difficultyAttributes = difficultyAttributes;
2158
+ this.mods = this.isCacheableAttribute(difficultyAttributes)
2159
+ ? osuBase.ModUtil.pcStringToMods(difficultyAttributes.mods)
2160
+ : difficultyAttributes.mods;
2119
2161
  }
2120
2162
  /**
2121
2163
  * Calculates the performance points of the beatmap.
@@ -2190,15 +2232,15 @@ class PerformanceCalculator {
2190
2232
  });
2191
2233
  }
2192
2234
  this.effectiveMissCount = this.calculateEffectiveMissCount(combo, maxCombo);
2193
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModNoFail)) {
2235
+ if (this.mods.some((m) => m instanceof osuBase.ModNoFail)) {
2194
2236
  this.finalMultiplier *= Math.max(0.9, 1 - 0.02 * this.effectiveMissCount);
2195
2237
  }
2196
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModSpunOut)) {
2238
+ if (this.mods.some((m) => m instanceof osuBase.ModSpunOut)) {
2197
2239
  this.finalMultiplier *=
2198
2240
  1 -
2199
2241
  Math.pow(this.difficultyAttributes.spinnerCount / this.totalHits, 0.85);
2200
2242
  }
2201
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
2243
+ if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
2202
2244
  // Graph: https://www.desmos.com/calculator/bc9eybdthb
2203
2245
  // We use OD13.3 as maximum since it's the value at which great hit window becomes 0.
2204
2246
  const n100Multiplier = Math.max(0, this.difficultyAttributes.overallDifficulty > 0
@@ -2499,12 +2541,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2499
2541
  // Consider notes that are difficult to tap with respect to other notes, but
2500
2542
  // also cap the note count to prevent buffing filler patterns.
2501
2543
  tapValue *= this.calculateDeviationBasedLengthScaling(Math.min(this.difficultyAttributes.speedNoteCount, this.totalHits / 1.45));
2544
+ // Normalize the deviation to 300 BPM.
2545
+ const normalizedDeviation = this.tapDeviation *
2546
+ Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
2547
+ // We expect the player to get 7500/x deviation when doubletapping x BPM.
2548
+ // Using this expectation, we penalize scores with deviation above 25.
2549
+ const averageBPM = 60000 / 4 / this.difficultyAttributes.averageSpeedDeltaTime;
2550
+ const adjustedDeviation = normalizedDeviation *
2551
+ (1 +
2552
+ 1 /
2553
+ (1 +
2554
+ Math.exp(-(normalizedDeviation - 7500 / averageBPM) /
2555
+ ((2 * 300) / averageBPM))));
2502
2556
  // Scale the tap value with tap deviation.
2503
2557
  tapValue *=
2504
2558
  1.05 *
2505
- Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * this.tapDeviation)), 0.6);
2506
- // Scale the tap value with high deviation nerf.
2507
- tapValue *= this.calculateTapHighDeviationNerf();
2559
+ Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.6);
2560
+ // Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
2561
+ // Higher BPMs require more precise tapping. When the deviation is too high,
2562
+ // it can be assumed that the player taps invariant to rhythm.
2563
+ // We harshen the punishment for such scenario.
2564
+ tapValue *=
2565
+ (1 - Math.pow(this.difficultyAttributes.vibroFactor, 6)) /
2566
+ (1 +
2567
+ Math.exp((this._tapDeviation - 7500 / averageBPM) /
2568
+ ((2 * 300) / averageBPM))) +
2569
+ Math.pow(this.difficultyAttributes.vibroFactor, 6);
2508
2570
  // Scale the tap value with three-fingered penalty.
2509
2571
  tapValue /= this._tapPenalty;
2510
2572
  // OD 8 SS stays the same.
@@ -2515,12 +2577,12 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2515
2577
  * Calculates the accuracy performance value of the beatmap.
2516
2578
  */
2517
2579
  calculateAccuracyValue() {
2518
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax) ||
2580
+ if (this.mods.some((m) => m instanceof osuBase.ModRelax) ||
2519
2581
  this.totalSuccessfulHits === 0) {
2520
2582
  return 0;
2521
2583
  }
2522
2584
  let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
2523
- const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
2585
+ const ncircles = this.mods.some((m) => m instanceof osuBase.ModScoreV2)
2524
2586
  ? this.totalHits - this.difficultyAttributes.spinnerCount
2525
2587
  : this.difficultyAttributes.hitCircleCount;
2526
2588
  // Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
@@ -2532,7 +2594,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2532
2594
  Math.exp(-(this.difficultyAttributes.rhythmDifficulty - 1) / 2));
2533
2595
  // Penalize accuracy pp after the first miss.
2534
2596
  accuracyValue *= Math.pow(0.97, Math.max(0, this.effectiveMissCount - 1));
2535
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
2597
+ if (this.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
2536
2598
  accuracyValue *= 1.02;
2537
2599
  }
2538
2600
  return accuracyValue;
@@ -2541,7 +2603,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2541
2603
  * Calculates the flashlight performance value of the beatmap.
2542
2604
  */
2543
2605
  calculateFlashlightValue() {
2544
- if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
2606
+ if (!this.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
2545
2607
  return 0;
2546
2608
  }
2547
2609
  let flashlightValue = Math.pow(this.difficultyAttributes.flashlightDifficulty, 1.6) * 25;
@@ -2762,35 +2824,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2762
2824
  }
2763
2825
  return Number.POSITIVE_INFINITY;
2764
2826
  }
2765
- /**
2766
- * Calculates multiplier for tap to account for improper tapping based on the deviation and tap difficulty.
2767
- *
2768
- * https://www.desmos.com/calculator/dmogdhzofn
2769
- */
2770
- calculateTapHighDeviationNerf() {
2771
- if (this.tapDeviation === Number.POSITIVE_INFINITY) {
2772
- return 0;
2773
- }
2774
- const tapValue = this.baseValue(this.difficultyAttributes.tapDifficulty);
2775
- // Decide a point where the PP value achieved compared to the tap deviation is assumed to be
2776
- // tapped improperly. Any PP above this point is considered "excess" tap difficulty.
2777
- // This is used to cause PP above the cutoff to scale logarithmically towards the original
2778
- // tap value, thus nerfing the value.
2779
- const excessTapDifficultyCutoff = 100 + 220 * Math.pow(22 / this.tapDeviation, 6.5);
2780
- if (tapValue <= excessTapDifficultyCutoff) {
2781
- return 1;
2782
- }
2783
- const scale = 50;
2784
- const adjustedTapValue = scale *
2785
- (Math.log((tapValue - excessTapDifficultyCutoff) / scale + 1) +
2786
- excessTapDifficultyCutoff / scale);
2787
- // 200 UR and less are considered tapped correctly to ensure that normal scores will be punished as little as possible
2788
- const lerp = 1 - osuBase.MathUtils.clamp((this.tapDeviation - 20) / (24 - 20), 0, 1);
2789
- return osuBase.Interpolation.lerp(adjustedTapValue, tapValue, lerp) / tapValue;
2790
- }
2791
2827
  getConvertedHitWindow() {
2792
2828
  const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).greatWindow;
2793
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)) {
2829
+ if (this.mods.some((m) => m instanceof osuBase.ModPrecise)) {
2794
2830
  return new osuBase.PreciseDroidHitWindow(osuBase.PreciseDroidHitWindow.greatWindowToOD(hitWindow300 * this.difficultyAttributes.clockRate));
2795
2831
  }
2796
2832
  else {
@@ -3671,7 +3707,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3671
3707
  * Calculates the aim performance value of the beatmap.
3672
3708
  */
3673
3709
  calculateAimValue() {
3674
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
3710
+ if (this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
3675
3711
  return 0;
3676
3712
  }
3677
3713
  let aimValue = this.baseValue(this.difficultyAttributes.aimDifficulty);
@@ -3691,7 +3727,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3691
3727
  }
3692
3728
  aimValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.aimDifficultStrainCount);
3693
3729
  const calculatedAR = this.difficultyAttributes.approachRate;
3694
- if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
3730
+ if (!this.mods.some((m) => m instanceof osuBase.ModRelax)) {
3695
3731
  // AR scaling
3696
3732
  let arFactor = 0;
3697
3733
  if (calculatedAR > 10.33) {
@@ -3704,7 +3740,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3704
3740
  aimValue *= 1 + arFactor * lengthBonus;
3705
3741
  }
3706
3742
  // We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
3707
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
3743
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3708
3744
  aimValue *= 1 + 0.04 * (12 - calculatedAR);
3709
3745
  }
3710
3746
  // Scale the aim value with slider factor to nerf very likely dropped sliderends.
@@ -3720,7 +3756,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3720
3756
  * Calculates the speed performance value of the beatmap.
3721
3757
  */
3722
3758
  calculateSpeedValue() {
3723
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
3759
+ if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
3724
3760
  return 0;
3725
3761
  }
3726
3762
  let speedValue = this.baseValue(this.difficultyAttributes.speedDifficulty);
@@ -3734,11 +3770,11 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3734
3770
  // AR scaling
3735
3771
  const calculatedAR = this.difficultyAttributes.approachRate;
3736
3772
  if (calculatedAR > 10.33 &&
3737
- !this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
3773
+ !this.mods.some((m) => m instanceof osuBase.ModAutopilot)) {
3738
3774
  // Buff for longer maps with high AR.
3739
3775
  speedValue *= 1 + 0.3 * (calculatedAR - 10.33) * lengthBonus;
3740
3776
  }
3741
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
3777
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3742
3778
  speedValue *= 1 + 0.04 * (12 - calculatedAR);
3743
3779
  }
3744
3780
  // Calculate accuracy assuming the worst case scenario.
@@ -3771,10 +3807,10 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3771
3807
  * Calculates the accuracy performance value of the beatmap.
3772
3808
  */
3773
3809
  calculateAccuracyValue() {
3774
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModRelax)) {
3810
+ if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
3775
3811
  return 0;
3776
3812
  }
3777
- const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
3813
+ const ncircles = this.mods.some((m) => m instanceof osuBase.ModScoreV2)
3778
3814
  ? this.totalHits - this.difficultyAttributes.spinnerCount
3779
3815
  : this.difficultyAttributes.hitCircleCount;
3780
3816
  if (ncircles === 0) {
@@ -3789,10 +3825,10 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3789
3825
  2.83;
3790
3826
  // Bonus for many hitcircles - it's harder to keep good accuracy up for longer
3791
3827
  accuracyValue *= Math.min(1.15, Math.pow(ncircles / 1000, 0.3));
3792
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModHidden)) {
3828
+ if (this.mods.some((m) => m instanceof osuBase.ModHidden)) {
3793
3829
  accuracyValue *= 1.08;
3794
3830
  }
3795
- if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
3831
+ if (this.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
3796
3832
  accuracyValue *= 1.02;
3797
3833
  }
3798
3834
  return accuracyValue;
@@ -3801,7 +3837,7 @@ class OsuPerformanceCalculator extends PerformanceCalculator {
3801
3837
  * Calculates the flashlight performance value of the beatmap.
3802
3838
  */
3803
3839
  calculateFlashlightValue() {
3804
- if (!this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
3840
+ if (!this.mods.some((m) => m instanceof osuBase.ModFlashlight)) {
3805
3841
  return 0;
3806
3842
  }
3807
3843
  let flashlightValue = Math.pow(this.difficultyAttributes.flashlightDifficulty, 2) * 25;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "4.0.0-beta.45",
3
+ "version": "4.0.0-beta.47",
4
4
  "description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
5
5
  "keywords": [
6
6
  "osu",
@@ -33,10 +33,10 @@
33
33
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@rian8337/osu-base": "^4.0.0-beta.44"
36
+ "@rian8337/osu-base": "^4.0.0-beta.47"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "de7b995e670f1703fcd134209d16fbc1c6788eb9"
41
+ "gitHead": "5d907d19c542a636041ed9a29c5a74c4f4c5501d"
42
42
  }
@@ -735,6 +735,18 @@ interface DroidDifficultyAttributes extends DifficultyAttributes {
735
735
  * The amount of strains that are considered difficult with respect to the visual skill.
736
736
  */
737
737
  visualDifficultStrainCount: number;
738
+ /**
739
+ * The average delta time of speed objects.
740
+ */
741
+ averageSpeedDeltaTime: number;
742
+ /**
743
+ * Describes how much of tap difficulty is contributed by notes that are "vibroable".
744
+ *
745
+ * A value closer to 1 indicates most of tap difficulty is contributed by notes that are not "vibroable".
746
+ *
747
+ * A value closer to 0 indicates most of tap difficulty is contributed by notes that are "vibroable".
748
+ */
749
+ vibroFactor: number;
738
750
  }
739
751
 
740
752
  /**
@@ -882,6 +894,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
882
894
  * Called after tap skill calculation.
883
895
  *
884
896
  * @param tapSkillCheese The tap skill that considers cheesing.
897
+ * @param tapSkillVibro The tap skill that considers vibro.
885
898
  */
886
899
  private postCalculateTap;
887
900
  /**
@@ -1013,7 +1026,11 @@ declare abstract class PerformanceCalculator<T extends DifficultyAttributes> {
1013
1026
  /**
1014
1027
  * The difficulty attributes that is being calculated.
1015
1028
  */
1016
- readonly difficultyAttributes: T;
1029
+ readonly difficultyAttributes: T | CacheableDifficultyAttributes<T>;
1030
+ /**
1031
+ * The mods that were used.
1032
+ */
1033
+ protected readonly mods: Mod[];
1017
1034
  /**
1018
1035
  * The global multiplier to be applied to the final performance value.
1019
1036
  *
@@ -1253,12 +1270,6 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<DroidDiff
1253
1270
  * This is fine though, since this method is only used to scale tap pp.
1254
1271
  */
1255
1272
  private calculateTapDeviation;
1256
- /**
1257
- * Calculates multiplier for tap to account for improper tapping based on the deviation and tap difficulty.
1258
- *
1259
- * https://www.desmos.com/calculator/dmogdhzofn
1260
- */
1261
- private calculateTapHighDeviationNerf;
1262
1273
  private getConvertedHitWindow;
1263
1274
  toString(): string;
1264
1275
  }
@@ -1271,8 +1282,10 @@ declare class DroidRhythm extends DroidSkill {
1271
1282
  protected readonly reducedSectionBaseline = 0.75;
1272
1283
  protected readonly strainDecayBase = 0.3;
1273
1284
  protected readonly starsPerDouble = 1.75;
1285
+ private readonly useSliderAccuracy;
1274
1286
  private currentRhythmStrain;
1275
1287
  private currentRhythmMultiplier;
1288
+ constructor(mods: Mod[]);
1276
1289
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1277
1290
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1278
1291
  protected getObjectStrain(): number;
@@ -1292,8 +1305,9 @@ declare abstract class DroidRhythmEvaluator {
1292
1305
  * with historic data of the current object.
1293
1306
  *
1294
1307
  * @param current The current object.
1308
+ * @param useSliderAccuracy Whether to use slider accuracy.
1295
1309
  */
1296
- static evaluateDifficultyOf(current: DroidDifficultyHitObject): number;
1310
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, useSliderAccuracy: boolean): number;
1297
1311
  }
1298
1312
 
1299
1313
  /**
@@ -1308,11 +1322,21 @@ declare class DroidTap extends DroidSkill {
1308
1322
  private currentRhythmMultiplier;
1309
1323
  private readonly skillMultiplier;
1310
1324
  private readonly considerCheesability;
1311
- constructor(mods: Mod[], considerCheesability: boolean);
1325
+ private readonly strainTimeCap?;
1326
+ private readonly _objectDeltaTimes;
1327
+ /**
1328
+ * The delta time of hitobjects.
1329
+ */
1330
+ get objectDeltaTimes(): readonly number[];
1331
+ constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
1312
1332
  /**
1313
1333
  * The amount of notes that are relevant to the difficulty.
1314
1334
  */
1315
1335
  relevantNoteCount(): number;
1336
+ /**
1337
+ * The delta time relevant to the difficulty.
1338
+ */
1339
+ relevantDeltaTime(): number;
1316
1340
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1317
1341
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1318
1342
  protected getObjectStrain(): number;
@@ -1339,13 +1363,15 @@ declare abstract class DroidTapEvaluator extends SpeedEvaluator {
1339
1363
  * Evaluates the difficulty of tapping the current object, based on:
1340
1364
  *
1341
1365
  * - time between pressing the previous and current object,
1366
+ * - distance between those objects,
1342
1367
  * - how easily they can be cheesed,
1343
1368
  * - and the strain time cap.
1344
1369
  *
1345
1370
  * @param current The current object.
1346
1371
  * @param considerCheesability Whether to consider cheesability.
1372
+ * @param strainTimeCap The strain time to cap the object's strain time to.
1347
1373
  */
1348
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean): number;
1374
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean, strainTimeCap?: number): number;
1349
1375
  }
1350
1376
 
1351
1377
  /**