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

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
@@ -568,6 +568,14 @@ class DroidAimEvaluator extends AimEvaluator {
568
568
  // Reward sliders based on velocity.
569
569
  sliderBonus = last.travelDistance / last.travelTime;
570
570
  }
571
+ // Reduce snap aim difficulty for low spacing as the player is more likely to perform
572
+ // a flowing movement instead of snapping to the object. This also prevents the weird
573
+ // scenario of awarding flow aim difficulty in snap aim.
574
+ const flowBonus = Math.pow(last.minimumJumpDistance / this.singleSpacingThreshold, 3.5);
575
+ if (flowBonus < 1) {
576
+ strain *= 0.5 * (1 + Math.sqrt(flowBonus));
577
+ wideAngleBonus *= 0.5 * (1 + Math.sqrt(flowBonus));
578
+ }
571
579
  // Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
572
580
  strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
573
581
  velocityChangeBonus * this.velocityChangeMultiplier);
@@ -582,16 +590,32 @@ class DroidAimEvaluator extends AimEvaluator {
582
590
  * Calculates the flow aim strain of a hitobject.
583
591
  */
584
592
  static flowAimStrainOf(current) {
585
- var _a, _b;
593
+ var _a;
586
594
  let speedBonus = 1;
587
595
  if (current.strainTime < this.minSpeedBonus) {
588
596
  speedBonus +=
589
597
  0.75 *
590
598
  Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
591
599
  }
592
- const travelDistance = (_b = (_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.travelDistance) !== null && _b !== void 0 ? _b : 0;
593
- const shortDistancePenalty = Math.pow(Math.min(this.singleSpacingThreshold, travelDistance + current.minimumJumpDistance) / this.singleSpacingThreshold, 3.5);
594
- return (200 * speedBonus * shortDistancePenalty) / current.strainTime;
600
+ const prev = current.previous(0);
601
+ // Punish low spacing as it is easier to aim.
602
+ const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
603
+ const distance = travelDistance + current.minimumJumpDistance;
604
+ const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
605
+ let adjustedDistanceScale = 1;
606
+ // Reward for inconsistent angles while punishing consistent ones.
607
+ // Graph: https://www.desmos.com/calculator/soomupyfwp
608
+ if (current.angle !== null &&
609
+ typeof (prev === null || prev === void 0 ? void 0 : prev.angle) === "number" &&
610
+ current.angle !== prev.angle) {
611
+ const angleDiff = Math.abs(current.angle - prev.angle);
612
+ const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
613
+ const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
614
+ const angularVelocityBonus = Math.max(0, Math.pow(angularVelocity, 0.4) - 1);
615
+ adjustedDistanceScale = 0.65 + angularVelocityBonus * 0.45;
616
+ }
617
+ return ((200 * speedBonus * shortDistancePenalty * adjustedDistanceScale) /
618
+ current.strainTime);
595
619
  }
596
620
  }
597
621
  DroidAimEvaluator.wideAngleMultiplier = 1.65;
@@ -689,6 +713,10 @@ class StrainSkill extends Skill {
689
713
  class DroidSkill extends StrainSkill {
690
714
  constructor() {
691
715
  super(...arguments);
716
+ /**
717
+ * The minimum number of strains to judge when computing for retryability.
718
+ */
719
+ this.minimumRetryabilityStrains = 500;
692
720
  this._objectStrains = [];
693
721
  this.difficulty = 0;
694
722
  }
@@ -713,6 +741,34 @@ class DroidSkill extends StrainSkill {
713
741
  return this._objectStrains.reduce((total, next) => total +
714
742
  1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
715
743
  }
744
+ /**
745
+ * Computes the retryability of the beatmap based on the strains of the hitobjects.
746
+ *
747
+ * Earlier difficult strains indicate higher retryability.
748
+ *
749
+ * The result is scaled by clock rate as it affects the total number of strains.
750
+ *
751
+ * @returns A number between 0 and 1. A higher value indicates higher retryability.
752
+ */
753
+ countRetryability() {
754
+ if (this._objectStrains.length === 0) {
755
+ return 0;
756
+ }
757
+ const maxStrain = Math.max(...this._objectStrains);
758
+ if (maxStrain === 0) {
759
+ return 0;
760
+ }
761
+ let weightedStrainSum = 0;
762
+ for (let i = 0; i < this._objectStrains.length; ++i) {
763
+ const strainRatio = this._objectStrains[i] / maxStrain;
764
+ // Give more weight to earlier strains.
765
+ const strainPositionWeight = 1 - Math.pow(i / this._objectStrains.length, 0.75) / 10;
766
+ weightedStrainSum += strainRatio * strainPositionWeight;
767
+ }
768
+ return (1 -
769
+ weightedStrainSum /
770
+ Math.max(this._objectStrains.length, this.minimumRetryabilityStrains));
771
+ }
716
772
  process(current) {
717
773
  super.process(current);
718
774
  this._objectStrains.push(this.getObjectStrain(current));
@@ -861,6 +917,7 @@ class DroidTap extends DroidSkill {
861
917
  this.reducedSectionBaseline = 0.75;
862
918
  this.strainDecayBase = 0.3;
863
919
  this.starsPerDouble = 1.1;
920
+ this.minimumRetryabilityStrains = 750;
864
921
  this.currentTapStrain = 0;
865
922
  this.currentRhythmMultiplier = 0;
866
923
  this.skillMultiplier = 1375;
@@ -1818,10 +1875,13 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1818
1875
  postCalculateAim(aimSkill, aimSkillWithoutSliders) {
1819
1876
  this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
1820
1877
  this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
1821
- this.attributes.aimDifficulty = this.starValue(aimSkill.difficultyValue());
1878
+ const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
1879
+ this.attributes.aimDifficulty =
1880
+ this.starValue(aimSkill.difficultyValue()) * retryabilityScaling;
1822
1881
  if (this.aim) {
1823
1882
  this.attributes.sliderFactor =
1824
- this.starValue(aimSkillWithoutSliders.difficultyValue()) /
1883
+ (this.starValue(aimSkillWithoutSliders.difficultyValue()) *
1884
+ retryabilityScaling) /
1825
1885
  this.aim;
1826
1886
  }
1827
1887
  if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
@@ -1872,12 +1932,16 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1872
1932
  */
1873
1933
  postCalculateTap(tapSkillCheese, tapSkillVibro) {
1874
1934
  this.strainPeaks.speed = tapSkillCheese.strainPeaks;
1935
+ const retryabilityScaling = this.calculateRetryabilityScaling(tapSkillCheese.countRetryability());
1875
1936
  this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
1876
1937
  ? 0
1877
- : this.starValue(tapSkillCheese.difficultyValue());
1938
+ : this.starValue(tapSkillCheese.difficultyValue()) *
1939
+ retryabilityScaling;
1878
1940
  if (this.tap) {
1879
1941
  this.attributes.vibroFactor =
1880
- this.starValue(tapSkillVibro.difficultyValue()) / this.tap;
1942
+ (this.starValue(tapSkillVibro.difficultyValue()) *
1943
+ retryabilityScaling) /
1944
+ this.tap;
1881
1945
  }
1882
1946
  this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
1883
1947
  this.attributes.averageSpeedDeltaTime =
@@ -1980,6 +2044,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1980
2044
  this.attributes.visualDifficultStrainCount =
1981
2045
  visualSkillWithSliders.countDifficultStrains();
1982
2046
  }
2047
+ calculateRetryabilityScaling(retryability) {
2048
+ return 1 - Math.pow(retryability, 4) / 10;
2049
+ }
1983
2050
  }
1984
2051
  /**
1985
2052
  * The strain threshold to start detecting for possible three-fingered section.
@@ -2371,8 +2438,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2371
2438
  let tapValue = this.baseValue(this.difficultyAttributes.tapDifficulty);
2372
2439
  tapValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.tapDifficultStrainCount);
2373
2440
  // Scale the tap value with estimated full combo deviation.
2374
- // Require more objects to be present as object count can rack up easily in tap-oriented beatmaps.
2375
- tapValue *= this.calculateDeviationBasedLengthScaling(this.totalHits / 1.45);
2441
+ // Consider notes that are difficult to tap with respect to other notes, but
2442
+ // also cap the note count to prevent buffing filler patterns.
2443
+ tapValue *= this.calculateDeviationBasedLengthScaling(Math.min(this.difficultyAttributes.speedNoteCount, this.totalHits / 1.45));
2376
2444
  // Normalize the deviation to 300 BPM.
2377
2445
  const normalizedDeviation = this.tapDeviation *
2378
2446
  Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "4.0.0-beta.23",
3
+ "version": "4.0.0-beta.24",
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.23"
36
+ "@rian8337/osu-base": "^4.0.0-beta.24"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "62063ddac57c3a60426c7206268a0573cc6db6dd"
41
+ "gitHead": "b567d54f6f8553aeaf56acb8a0b3741c3920b72b"
42
42
  }
@@ -515,6 +515,10 @@ declare abstract class DroidSkill extends StrainSkill {
515
515
  * The bonus multiplier that is given for a sequence of notes of equal difficulty.
516
516
  */
517
517
  protected abstract readonly starsPerDouble: number;
518
+ /**
519
+ * The minimum number of strains to judge when computing for retryability.
520
+ */
521
+ protected readonly minimumRetryabilityStrains: number;
518
522
  protected readonly _objectStrains: number[];
519
523
  /**
520
524
  * The strains of hitobjects.
@@ -527,6 +531,16 @@ declare abstract class DroidSkill extends StrainSkill {
527
531
  * The result is scaled by clock rate as it affects the total number of strains.
528
532
  */
529
533
  countDifficultStrains(): number;
534
+ /**
535
+ * Computes the retryability of the beatmap based on the strains of the hitobjects.
536
+ *
537
+ * Earlier difficult strains indicate higher retryability.
538
+ *
539
+ * The result is scaled by clock rate as it affects the total number of strains.
540
+ *
541
+ * @returns A number between 0 and 1. A higher value indicates higher retryability.
542
+ */
543
+ countRetryability(): number;
530
544
  process(current: DifficultyHitObject): void;
531
545
  difficultyValue(): number;
532
546
  /**
@@ -886,6 +900,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
886
900
  * @param visualSkillWithoutSliders The visual skill that doesn't consider sliders.
887
901
  */
888
902
  private postCalculateVisual;
903
+ private calculateRetryabilityScaling;
889
904
  }
890
905
 
891
906
  /**
@@ -1283,6 +1298,7 @@ declare class DroidTap extends DroidSkill {
1283
1298
  protected readonly reducedSectionBaseline = 0.75;
1284
1299
  protected readonly strainDecayBase = 0.3;
1285
1300
  protected readonly starsPerDouble = 1.1;
1301
+ protected readonly minimumRetryabilityStrains = 750;
1286
1302
  private currentTapStrain;
1287
1303
  private currentRhythmMultiplier;
1288
1304
  private readonly skillMultiplier;