@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.21 → 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
@@ -367,6 +367,15 @@ class DifficultyHitObject {
367
367
  if (slider.lazyEndPosition) {
368
368
  return;
369
369
  }
370
+ if (this.mode === osuBase.Modes.droid) {
371
+ // Temporary lazy end position until a real result can be derived.
372
+ slider.lazyEndPosition = slider.getStackedPosition(this.mode);
373
+ // Stop here if the slider has too short duration, allowing the player to essentially
374
+ // complete the slider without movement, making travel distance and time irrelevant.
375
+ if (osuBase.Precision.almostEqualsNumber(slider.startTime, slider.endTime)) {
376
+ return;
377
+ }
378
+ }
370
379
  // Not using slider.endTime due to legacy last tick offset.
371
380
  slider.lazyTravelTime =
372
381
  slider.nestedHitObjects.at(-1).startTime - slider.startTime;
@@ -681,6 +690,7 @@ class DroidSkill extends StrainSkill {
681
690
  constructor() {
682
691
  super(...arguments);
683
692
  this._objectStrains = [];
693
+ this.difficulty = 0;
684
694
  }
685
695
  /**
686
696
  * The strains of hitobjects.
@@ -694,14 +704,14 @@ class DroidSkill extends StrainSkill {
694
704
  * The result is scaled by clock rate as it affects the total number of strains.
695
705
  */
696
706
  countDifficultStrains() {
697
- if (this._objectStrains.length === 0) {
698
- return 0;
699
- }
700
- const maxStrain = Math.max(...this._objectStrains);
701
- if (maxStrain === 0) {
707
+ if (this.difficulty === 0) {
702
708
  return 0;
703
709
  }
704
- 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);
705
715
  }
706
716
  process(current) {
707
717
  super.process(current);
@@ -719,12 +729,12 @@ class DroidSkill extends StrainSkill {
719
729
  }
720
730
  // Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
721
731
  // This also applies to two sets of notes with equal difficulty.
722
- return Math.pow(strains.reduce((a, v) => {
723
- if (v <= 0) {
724
- return a;
725
- }
726
- return a + Math.pow(v, 1 / Math.log2(this.starsPerDouble));
727
- }, 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;
728
738
  }
729
739
  calculateCurrentSectionStart(current) {
730
740
  return current.startTime;
@@ -1307,11 +1317,12 @@ class DroidVisualEvaluator {
1307
1317
  // Invert the scaling factor to determine the true travel distance independent of circle size.
1308
1318
  const pixelTravelDistance = current.object.lazyTravelDistance / scalingFactor;
1309
1319
  const currentVelocity = pixelTravelDistance / current.travelTime;
1320
+ const spanTravelDistance = pixelTravelDistance / current.object.spanCount;
1310
1321
  strain +=
1311
1322
  // Reward sliders based on velocity, while also avoiding overbuffing extremely fast sliders.
1312
1323
  Math.min(6, currentVelocity * 1.5) *
1313
1324
  // Longer sliders require more reading.
1314
- (pixelTravelDistance / 100);
1325
+ (spanTravelDistance / 100);
1315
1326
  let cumulativeStrainTime = 0;
1316
1327
  // Reward for velocity changes based on last few sliders.
1317
1328
  for (let i = 0; i < Math.min(current.index, 4); ++i) {
@@ -1323,14 +1334,15 @@ class DroidVisualEvaluator {
1323
1334
  continue;
1324
1335
  }
1325
1336
  // Invert the scaling factor to determine the true travel distance independent of circle size.
1326
- const pixelTravelDistance = last.object.lazyTravelDistance / scalingFactor;
1327
- 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;
1328
1340
  strain +=
1329
1341
  // Reward past sliders based on velocity changes, while also
1330
1342
  // avoiding overbuffing extremely fast velocity changes.
1331
1343
  Math.min(10, 2.5 * Math.abs(currentVelocity - lastVelocity)) *
1332
1344
  // Longer sliders require more reading.
1333
- (pixelTravelDistance / 125) *
1345
+ (lastSpanTravelDistance / 125) *
1334
1346
  // Avoid overbuffing past sliders.
1335
1347
  Math.min(1, 300 / cumulativeStrainTime);
1336
1348
  }
@@ -2346,8 +2358,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2346
2358
  aimValue *= this._aimSliderCheesePenalty;
2347
2359
  // Scale the aim value with deviation.
2348
2360
  aimValue *=
2349
- 1.05 *
2350
- 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);
2351
2363
  // OD 7 SS stays the same.
2352
2364
  aimValue *= 0.98 + Math.pow(7, 2) / 2500;
2353
2365
  return aimValue;
@@ -2375,8 +2387,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2375
2387
  ((2 * 300) / averageBPM))));
2376
2388
  // Scale the tap value with tap deviation.
2377
2389
  tapValue *=
2378
- 1.1 *
2379
- 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);
2380
2392
  // Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
2381
2393
  // Higher BPMs require more precise tapping. When the deviation is too high,
2382
2394
  // it can be assumed that the player taps invariant to rhythm.
@@ -2401,7 +2413,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2401
2413
  this.totalSuccessfulHits === 0) {
2402
2414
  return 0;
2403
2415
  }
2404
- let accuracyValue = 800 * Math.exp(-0.1 * this._deviation);
2416
+ let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
2405
2417
  const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
2406
2418
  ? this.totalHits - this.difficultyAttributes.spinnerCount
2407
2419
  : this.difficultyAttributes.hitCircleCount;
@@ -2454,8 +2466,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2454
2466
  visualValue *= this._visualSliderCheesePenalty;
2455
2467
  // Scale the visual value with deviation.
2456
2468
  visualValue *=
2457
- 1.065 *
2458
- 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);
2459
2471
  // OD 5 SS stays the same.
2460
2472
  visualValue *= 0.98 + Math.pow(5, 2) / 2500;
2461
2473
  return visualValue;
@@ -2471,8 +2483,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2471
2483
  if (this.effectiveMissCount === 0) {
2472
2484
  return 1;
2473
2485
  }
2474
- return (0.94 /
2475
- (this.effectiveMissCount / (2 * Math.sqrt(difficultStrainCount)) +
2486
+ return (0.96 /
2487
+ (this.effectiveMissCount /
2488
+ (4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
2476
2489
  1));
2477
2490
  }
2478
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.21",
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": "be2833348b74ce7b1ce9fff3fd29af04b778955e"
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
  *