@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.22 → 4.0.0-beta.23

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
@@ -690,6 +690,7 @@ class DroidSkill extends StrainSkill {
690
690
  constructor() {
691
691
  super(...arguments);
692
692
  this._objectStrains = [];
693
+ this.difficulty = 0;
693
694
  }
694
695
  /**
695
696
  * The strains of hitobjects.
@@ -703,14 +704,14 @@ class DroidSkill extends StrainSkill {
703
704
  * The result is scaled by clock rate as it affects the total number of strains.
704
705
  */
705
706
  countDifficultStrains() {
706
- if (this._objectStrains.length === 0) {
707
- return 0;
708
- }
709
- const maxStrain = Math.max(...this._objectStrains);
710
- if (maxStrain === 0) {
707
+ if (this.difficulty === 0) {
711
708
  return 0;
712
709
  }
713
- return this._objectStrains.reduce((total, next) => total + Math.pow(next / maxStrain, 4), 0);
710
+ // This is what the top strain is if all strain values were identical.
711
+ const consistentTopStrain = this.difficulty / 10;
712
+ // Use a weighted sum of all strains.
713
+ return this._objectStrains.reduce((total, next) => total +
714
+ 1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
714
715
  }
715
716
  process(current) {
716
717
  super.process(current);
@@ -728,12 +729,12 @@ class DroidSkill extends StrainSkill {
728
729
  }
729
730
  // Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
730
731
  // This also applies to two sets of notes with equal difficulty.
731
- return Math.pow(strains.reduce((a, v) => {
732
- if (v <= 0) {
733
- return a;
734
- }
735
- return a + Math.pow(v, 1 / Math.log2(this.starsPerDouble));
736
- }, 0), Math.log2(this.starsPerDouble));
732
+ this.difficulty = 0;
733
+ for (const strain of strains) {
734
+ this.difficulty += Math.pow(strain, 1 / Math.log2(this.starsPerDouble));
735
+ }
736
+ this.difficulty = Math.pow(this.difficulty, Math.log2(this.starsPerDouble));
737
+ return this.difficulty;
737
738
  }
738
739
  calculateCurrentSectionStart(current) {
739
740
  return current.startTime;
@@ -1316,11 +1317,12 @@ class DroidVisualEvaluator {
1316
1317
  // Invert the scaling factor to determine the true travel distance independent of circle size.
1317
1318
  const pixelTravelDistance = current.object.lazyTravelDistance / scalingFactor;
1318
1319
  const currentVelocity = pixelTravelDistance / current.travelTime;
1320
+ const spanTravelDistance = pixelTravelDistance / current.object.spanCount;
1319
1321
  strain +=
1320
1322
  // Reward sliders based on velocity, while also avoiding overbuffing extremely fast sliders.
1321
1323
  Math.min(6, currentVelocity * 1.5) *
1322
1324
  // Longer sliders require more reading.
1323
- (pixelTravelDistance / 100);
1325
+ (spanTravelDistance / 100);
1324
1326
  let cumulativeStrainTime = 0;
1325
1327
  // Reward for velocity changes based on last few sliders.
1326
1328
  for (let i = 0; i < Math.min(current.index, 4); ++i) {
@@ -1332,14 +1334,15 @@ class DroidVisualEvaluator {
1332
1334
  continue;
1333
1335
  }
1334
1336
  // Invert the scaling factor to determine the true travel distance independent of circle size.
1335
- const pixelTravelDistance = last.object.lazyTravelDistance / scalingFactor;
1336
- const lastVelocity = pixelTravelDistance / last.travelTime;
1337
+ const lastPixelTravelDistance = last.object.lazyTravelDistance / scalingFactor;
1338
+ const lastVelocity = lastPixelTravelDistance / last.travelTime;
1339
+ const lastSpanTravelDistance = lastPixelTravelDistance / last.object.spanCount;
1337
1340
  strain +=
1338
1341
  // Reward past sliders based on velocity changes, while also
1339
1342
  // avoiding overbuffing extremely fast velocity changes.
1340
1343
  Math.min(10, 2.5 * Math.abs(currentVelocity - lastVelocity)) *
1341
1344
  // Longer sliders require more reading.
1342
- (pixelTravelDistance / 125) *
1345
+ (lastSpanTravelDistance / 125) *
1343
1346
  // Avoid overbuffing past sliders.
1344
1347
  Math.min(1, 300 / cumulativeStrainTime);
1345
1348
  }
@@ -2355,8 +2358,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2355
2358
  aimValue *= this._aimSliderCheesePenalty;
2356
2359
  // Scale the aim value with deviation.
2357
2360
  aimValue *=
2358
- 1.05 *
2359
- Math.sqrt(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)));
2361
+ 1.025 *
2362
+ Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.475);
2360
2363
  // OD 7 SS stays the same.
2361
2364
  aimValue *= 0.98 + Math.pow(7, 2) / 2500;
2362
2365
  return aimValue;
@@ -2384,8 +2387,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2384
2387
  ((2 * 300) / averageBPM))));
2385
2388
  // Scale the tap value with tap deviation.
2386
2389
  tapValue *=
2387
- 1.1 *
2388
- Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.625);
2390
+ 1.05 *
2391
+ Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.6);
2389
2392
  // Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
2390
2393
  // Higher BPMs require more precise tapping. When the deviation is too high,
2391
2394
  // it can be assumed that the player taps invariant to rhythm.
@@ -2410,7 +2413,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2410
2413
  this.totalSuccessfulHits === 0) {
2411
2414
  return 0;
2412
2415
  }
2413
- let accuracyValue = 800 * Math.exp(-0.1 * this._deviation);
2416
+ let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
2414
2417
  const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
2415
2418
  ? this.totalHits - this.difficultyAttributes.spinnerCount
2416
2419
  : this.difficultyAttributes.hitCircleCount;
@@ -2463,8 +2466,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2463
2466
  visualValue *= this._visualSliderCheesePenalty;
2464
2467
  // Scale the visual value with deviation.
2465
2468
  visualValue *=
2466
- 1.065 *
2467
- Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.8);
2469
+ 1.05 *
2470
+ Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.775);
2468
2471
  // OD 5 SS stays the same.
2469
2472
  visualValue *= 0.98 + Math.pow(5, 2) / 2500;
2470
2473
  return visualValue;
@@ -2480,8 +2483,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2480
2483
  if (this.effectiveMissCount === 0) {
2481
2484
  return 1;
2482
2485
  }
2483
- return (0.94 /
2484
- (this.effectiveMissCount / (2 * Math.sqrt(difficultStrainCount)) +
2486
+ return (0.96 /
2487
+ (this.effectiveMissCount /
2488
+ (4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
2485
2489
  1));
2486
2490
  }
2487
2491
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "4.0.0-beta.22",
3
+ "version": "4.0.0-beta.23",
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.19"
36
+ "@rian8337/osu-base": "^4.0.0-beta.23"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "d8b62a07a4f862cf83bf106a46f67c6c6562c545"
41
+ "gitHead": "62063ddac57c3a60426c7206268a0573cc6db6dd"
42
42
  }
@@ -520,6 +520,7 @@ declare abstract class DroidSkill extends StrainSkill {
520
520
  * The strains of hitobjects.
521
521
  */
522
522
  get objectStrains(): readonly number[];
523
+ private difficulty;
523
524
  /**
524
525
  * Returns the number of strains weighed against the top strain.
525
526
  *