@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.101 → 4.0.0-beta.103

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
@@ -581,34 +581,6 @@ class VariableLengthStrainSkill extends Skill {
581
581
  }
582
582
  }
583
583
 
584
- /**
585
- * An evaluator for calculating osu!droid agility aim difficulty.
586
- */
587
- class DroidAgilityEvaluator {
588
- /**
589
- * Evaluates the difficulty of fast aiming the current object.
590
- *
591
- * @param current The current object.
592
- */
593
- static evaluateDifficultyOf(current) {
594
- if (current.object instanceof osuBase.Spinner) {
595
- return 0;
596
- }
597
- const prev = current.previous(0);
598
- // For objects that are stacked, we want to reduce the agility difficulty slightly by combining delta times
599
- // of both objects together because we can assume that they likely would be done in one movement.
600
- let previousDelta = 0;
601
- if (prev !== null) {
602
- previousDelta = prev.strainTime * osuBase.MathUtils.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, 0);
603
- }
604
- const combinedDelta = current.strainTime + previousDelta * this.previousDeltaInfluence;
605
- let difficulty = Math.pow(1000 / combinedDelta, 2);
606
- difficulty *= Math.pow(current.smallCircleBonus, 1.5);
607
- return difficulty;
608
- }
609
- }
610
- DroidAgilityEvaluator.previousDeltaInfluence = 0.5;
611
-
612
584
  /**
613
585
  * An evaluator for calculating osu!droid snap aim difficulty.
614
586
  */
@@ -625,12 +597,10 @@ class DroidSnapAimEvaluator {
625
597
  * @param withSliders Whether to take slider difficulty into account.
626
598
  */
627
599
  static evaluateDifficultyOf(current, withSliders) {
628
- var _a;
629
600
  if (current.object instanceof osuBase.Spinner ||
630
601
  // Exclude overlapping objects that can be tapped at once.
631
602
  current.isOverlapping(true) ||
632
- current.index <= 1 ||
633
- ((_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
603
+ current.index <= 1) {
634
604
  return 0;
635
605
  }
636
606
  const last = current.previous(0);
@@ -647,11 +617,7 @@ class DroidSnapAimEvaluator {
647
617
  // Start strain with regular velocity.
648
618
  let strain = currentVelocity;
649
619
  strain *= this.calculateVectorAngleRepetition(current, last);
650
- const acuteAngleBonus = this.calculateAcuteAngleBonus(current, last, currentVelocity, prevVelocity);
651
- const wideAngleBonus = this.calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders);
652
- // Add in acute angle bonus or wide angle bonus, whichever is larger.
653
- strain += Math.max(acuteAngleBonus, wideAngleBonus);
654
- strain += this.calculateWiggleBonus(current, last, currentVelocity, prevVelocity, currentDistance, prevDistance);
620
+ strain += this.calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders);
655
621
  strain += this.calculateVelocityChangeBonus(withSliders, prevVelocity, currentVelocity, currentDistance, current, last);
656
622
  if (current.object instanceof osuBase.Slider && withSliders) {
657
623
  strain += this.calculateSliderBonus(current);
@@ -661,31 +627,6 @@ class DroidSnapAimEvaluator {
661
627
  strain *= this.highBpmBonus(current.strainTime);
662
628
  return strain;
663
629
  }
664
- static calculateAcuteAngleBonus(current, last, currentVelocity, prevVelocity) {
665
- if (current.angle === null || last.angle === null) {
666
- return 0;
667
- }
668
- // Only reward acute angles when rhythms are the same.
669
- if (Math.max(current.strainTime, last.strainTime) >=
670
- 1.25 * Math.min(current.strainTime, last.strainTime)) {
671
- return 0;
672
- }
673
- let acuteAngleBonus = this.calculateAcuteAngleAcuteness(current.angle);
674
- // Penalize angle repetition. It is important to do it _before_ multiplying by anything because we
675
- // compare raw acuteness here.
676
- acuteAngleBonus *=
677
- 0.08 +
678
- 0.92 *
679
- (1 -
680
- Math.min(acuteAngleBonus, Math.pow(this.calculateAcuteAngleAcuteness(last.angle), 3)));
681
- const velocity = Math.min(currentVelocity, prevVelocity);
682
- // Apply acute angle bonus for BPM above 300 1/2.
683
- acuteAngleBonus *=
684
- velocity *
685
- osuBase.MathUtils.smootherstep(osuBase.MathUtils.millisecondsToBPM(current.strainTime, 2), 300, 450) *
686
- osuBase.MathUtils.smootherstep(current.lazyJumpDistance, 0, current.normalizedDiameter * 2);
687
- return acuteAngleBonus * this.acuteAngleMultiplier;
688
- }
689
630
  static calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders) {
690
631
  if (current.angle === null || last.angle === null) {
691
632
  return 0;
@@ -698,14 +639,13 @@ class DroidSnapAimEvaluator {
698
639
  0.75 *
699
640
  (1 -
700
641
  Math.min(wideAngleBonus, Math.pow(this.calculateWideAngleAcuteness(last.angle), 3)));
701
- // Rescale velocity for wide angle bonus.
702
- const wideAngleTimeScale = 1.45;
703
- let wideAngleCurrentVelocity = currentDistance / Math.pow(current.strainTime, wideAngleTimeScale);
704
- const wideAnglePrevVelocity = prevDistance / Math.pow(last.strainTime, wideAngleTimeScale);
642
+ let wideAngleCurrentVelocity = currentDistance /
643
+ Math.pow(current.strainTime, this.wideAngleTimeScale);
644
+ const wideAnglePrevVelocity = prevDistance / Math.pow(last.strainTime, this.wideAngleTimeScale);
705
645
  if (last.object instanceof osuBase.Slider && withSliders) {
706
646
  const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
707
647
  wideAngleCurrentVelocity = Math.max(wideAngleCurrentVelocity, sliderDistance /
708
- Math.pow(current.strainTime, wideAngleTimeScale));
648
+ Math.pow(current.strainTime, this.wideAngleTimeScale));
709
649
  }
710
650
  wideAngleBonus *= Math.min(wideAngleCurrentVelocity, wideAnglePrevVelocity);
711
651
  const last2 = current.previous(2);
@@ -729,6 +669,9 @@ class DroidSnapAimEvaluator {
729
669
  // individual jump and slider path velocities.
730
670
  currentVelocity = currentDistance / current.strainTime;
731
671
  }
672
+ // Cap velocity to at least 1 radius distance to only award snap patterns.
673
+ currentVelocity = Math.max(currentVelocity, current.normalizedDiameter / current.strainTime);
674
+ prevVelocity = Math.max(prevVelocity, last.normalizedDiameter / last.strainTime);
732
675
  // Scale with ratio of difference compared to half the max distance.
733
676
  const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
734
677
  Math.max(prevVelocity, currentVelocity), 0, 1);
@@ -741,25 +684,6 @@ class DroidSnapAimEvaluator {
741
684
  Math.max(current.strainTime, last.strainTime), 3);
742
685
  return velocityChangeBonus * this.velocityChangeMultiplier;
743
686
  }
744
- /**
745
- * Difficulty bonus for "wiggle" patterns - jumps that are [radius, 3*diameter] in distance, with < 110 angle.
746
- * https://www.desmos.com/calculator/dp0v0nvowc
747
- */
748
- static calculateWiggleBonus(current, last, currentVelocity, prevVelocity, currentDistance, prevDistance) {
749
- if (current.angle === null || last.angle === null) {
750
- return 0;
751
- }
752
- const radius = current.normalizedRadius;
753
- const diameter = current.normalizedDiameter;
754
- const wiggleBonus = Math.min(currentVelocity, prevVelocity) *
755
- osuBase.MathUtils.smootherstep(currentDistance, radius, diameter) *
756
- Math.pow(osuBase.MathUtils.reverseLerp(currentDistance, diameter * 3, diameter), 1.8) *
757
- osuBase.MathUtils.smootherstep(current.angle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60)) *
758
- osuBase.MathUtils.smootherstep(prevDistance, radius, diameter) *
759
- Math.pow(osuBase.MathUtils.reverseLerp(prevDistance, diameter * 3, diameter), 1.8) *
760
- osuBase.MathUtils.smootherstep(last.angle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60));
761
- return wiggleBonus * this.wiggleMultiplier;
762
- }
763
687
  static calculateSliderBonus(current) {
764
688
  // Reward sliders based on velocity.
765
689
  let sliderBonus = current.travelDistance / current.travelTime;
@@ -787,13 +711,17 @@ class DroidSnapAimEvaluator {
787
711
  return 1 / (1 - Math.pow(0.03, Math.pow(ms / 1000, 0.65)));
788
712
  }
789
713
  static calculateVectorAngleRepetition(current, prev) {
790
- if (current.angle === null || prev.angle === null) {
714
+ var _a;
715
+ if (current.angle === null ||
716
+ prev.angle === null ||
717
+ prev.object instanceof osuBase.Spinner ||
718
+ ((_a = prev.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
791
719
  return 1;
792
720
  }
793
721
  let constantAngleCount = 0;
794
722
  for (let i = 0; i < this.angleRepetitionNoteLimit; ++i) {
795
723
  const loopObj = current.previous(i);
796
- if (!loopObj) {
724
+ if (!loopObj || loopObj.object instanceof osuBase.Spinner) {
797
725
  break;
798
726
  }
799
727
  // Only consider vectors in the same jump section, as stopping to change rhythm ruins momentum.
@@ -827,10 +755,11 @@ class DroidSnapAimEvaluator {
827
755
  stackFactor, 2);
828
756
  }
829
757
  }
830
- DroidSnapAimEvaluator.wideAngleMultiplier = 9.67;
831
- DroidSnapAimEvaluator.acuteAngleMultiplier = 2.35;
832
- DroidSnapAimEvaluator.sliderMultiplier = 1.5;
833
- DroidSnapAimEvaluator.velocityChangeMultiplier = 0.9;
758
+ DroidSnapAimEvaluator.wideAngleMultiplier = 2.15;
759
+ // Rescale velocity for the wide angle bonus.
760
+ DroidSnapAimEvaluator.wideAngleTimeScale = 1.2;
761
+ DroidSnapAimEvaluator.sliderMultiplier = 1.35;
762
+ DroidSnapAimEvaluator.velocityChangeMultiplier = 0.85;
834
763
  // Increasing this multiplier beyond 1.02 reduces difficulty as distance increases.
835
764
  // Refer to the desmos link above the wiggle bonus calculation.
836
765
  DroidSnapAimEvaluator.wiggleMultiplier = 1.02;
@@ -838,15 +767,55 @@ DroidSnapAimEvaluator.angleRepetitionNoteLimit = 6;
838
767
  DroidSnapAimEvaluator.maximumRepetitionNerf = 0.15;
839
768
  DroidSnapAimEvaluator.maximumVectorInfluence = 0.5;
840
769
 
770
+ /**
771
+ * An evaluator for calculating osu!droid agility aim difficulty.
772
+ */
773
+ class DroidAgilityEvaluator {
774
+ /**
775
+ * Evaluates the difficulty of fast aiming the current object.
776
+ *
777
+ * @param current The current object.
778
+ */
779
+ static evaluateDifficultyOf(current) {
780
+ if (current.object instanceof osuBase.Spinner) {
781
+ return 0;
782
+ }
783
+ const prev = current.previous(0);
784
+ // Assume that the player always uses at least the full great hitwindow for the movement.
785
+ const currentDelta = Math.max(current.strainTime, current.hitWindowFor(osuBase.HitResult.Great));
786
+ // For objects that are stacked, we want to reduce the agility difficulty slightly by combining delta times
787
+ // of both objects together because we can assume that they likely would be done in one movement.
788
+ let previousDelta = 0;
789
+ if (prev !== null) {
790
+ previousDelta = prev.strainTime * osuBase.MathUtils.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, 0);
791
+ }
792
+ const combinedDelta = currentDelta + previousDelta * this.previousDeltaInfluence;
793
+ const angleSwitchingBonus = this.calculateAngleSwitchingBonus(current, prev);
794
+ let difficulty = (1 + angleSwitchingBonus) * 10000000 / Math.pow(combinedDelta, 3.1);
795
+ difficulty *= current.smallCircleBonus;
796
+ return difficulty;
797
+ }
798
+ static calculateAngleSwitchingBonus(current, prev) {
799
+ if (current.angle === null || typeof (prev === null || prev === void 0 ? void 0 : prev.angle) !== "number") {
800
+ return 0;
801
+ }
802
+ const acutenessDifference = 1 - Math.min(DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle), Math.pow(DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(prev.angle), 3));
803
+ const rhythmDifferencePenalty = Math.pow(Math.min(current.strainTime, prev.strainTime) / Math.max(current.strainTime, prev.strainTime), 3);
804
+ return (acutenessDifference *
805
+ rhythmDifferencePenalty *
806
+ osuBase.Interpolation.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, prev.normalizedDiameter) *
807
+ this.angleSwitchingBonus);
808
+ }
809
+ }
810
+ DroidAgilityEvaluator.previousDeltaInfluence = 0.5;
811
+ DroidAgilityEvaluator.angleSwitchingBonus = 0.8;
812
+
841
813
  /**
842
814
  * An evaluator for calculating osu!droid flow aim difficulty.
843
815
  */
844
816
  class DroidFlowAimEvaluator {
845
817
  static evaluateDifficultyOf(current, withSliders) {
846
- var _a;
847
- if (current.object instanceof osuBase.Spinner ||
848
- current.index <= 1 ||
849
- ((_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
818
+ if (current.object instanceof osuBase.Spinner || current.index <= 1) {
850
819
  return 0;
851
820
  }
852
821
  const next = current.next(0);
@@ -858,86 +827,18 @@ class DroidFlowAimEvaluator {
858
827
  const prevDistance = withSliders && !last.is2BSlider
859
828
  ? last.lazyJumpDistance
860
829
  : last.jumpDistance;
861
- let currentVelocity = currentDistance / current.strainTime;
862
- if (last.object instanceof osuBase.Slider && !last.is2BSlider && withSliders) {
863
- // If the last object is a slider, then we extend the travel velocity through the slider into the current object.
864
- const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
865
- currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
866
- }
830
+ const currentVelocity = this.calculateCurrentVelocity(current, last, currentDistance, withSliders);
867
831
  const prevVelocity = prevDistance / last.strainTime;
868
832
  let flowDifficulty = currentVelocity;
869
833
  // Apply high circle size bonus to the base velocity.
870
834
  // We use reduced CS bonus here because the bonus was made for an evaluator with a different d/t scaling.
871
- flowDifficulty *= Math.sqrt(current.smallCircleBonus);
872
- // Rhythm changes are harder to flow.
873
- flowDifficulty *=
874
- 1 +
875
- Math.min(0.1, Math.pow((Math.max(current.strainTime, last.strainTime) -
876
- Math.min(current.strainTime, last.strainTime)) /
877
- 50, 4));
878
- if (current.angle !== null && last.angle !== null) {
879
- // Low angular velocity (consistent angles) is easier to follow than erratic flow.
880
- const angleDifference = Math.abs(current.angle - last.angle);
881
- const angleDifferenceAdjusted = Math.sin(angleDifference / 2) * 180;
882
- const angularVelocity = angleDifferenceAdjusted / (current.strainTime * 0.1);
883
- flowDifficulty *= 0.8 + Math.sqrt(angularVelocity / 270);
884
- }
885
- if (current.angle !== null && next !== null && next.angle !== null) {
886
- const currentAcuteness = DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle);
887
- const nextAcuteness = DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(next.angle);
888
- let acuteness;
889
- let overlapWeight;
890
- // We want to evaluate flow turns at the center point of the actual turn, but curr.Angle is a prev2-prev-curr angle.
891
- // The issue with changing that to prev-curr-next is that we might evaluate the second note of a flow pattern as snap if prev is acute.
892
- // With min(curr,next) the evaluation (assuming acute affects snap/flow probability enough) behaves roughly like this:
893
- //
894
- // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
895
- // 🡓🡓
896
- // ooo 🡐 flow (prev2-prev-curr evaluates as wide)
897
- // /
898
- // ooo 🡐 snap (prev2-prev-curr evaluates as acute)
899
- // 🡑🡑
900
- // flow (prev-curr-next evaluates as wide)
901
- //
902
- //
903
- // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
904
- // 🡓🡓
905
- // ooo 🡐 flow (prev-curr-next and prev2-prev-curr evaluates as wide)
906
- // \
907
- // ooo 🡐 snap (prev-curr-next evaluates as acute as the center point of the turn)
908
- // 🡑🡑
909
- // flow (prev-curr-next evaluates as wide)
910
- //
911
- // In both examples the first object in a flow pattern is evaluated as acute (likely snap) and the rest are wide (likely flow).
912
- if (currentAcuteness < nextAcuteness) {
913
- acuteness = currentAcuteness;
914
- overlapWeight = this.calculateOverlapWeight(current, last, lastLast);
915
- }
916
- else {
917
- acuteness = nextAcuteness;
918
- overlapWeight = this.calculateOverlapWeight(next, current, last);
919
- }
920
- flowDifficulty += currentVelocity * acuteness * overlapWeight * this.acuteAngleMultiplier;
921
- }
922
- if (Math.max(prevVelocity, currentVelocity)) {
923
- if (withSliders) {
924
- currentVelocity = currentDistance / current.strainTime;
925
- }
926
- // Scale with ratio of difference compared to 0.5 * max distance.
927
- const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
928
- Math.max(prevVelocity, currentVelocity), 0, 1);
929
- // Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing.
930
- const overlapVelocityBuff = Math.min((current.normalizedDiameter * 1.25) /
931
- Math.min(current.strainTime, last.strainTime), Math.abs(prevVelocity - currentVelocity));
932
- flowDifficulty +=
933
- overlapVelocityBuff *
934
- distanceRatio *
935
- this.calculateOverlapWeight(current, last, lastLast) *
936
- this.velocityChangeMultiplier;
937
- }
835
+ flowDifficulty *= Math.pow(current.smallCircleBonus, 0.55);
836
+ flowDifficulty *= this.calculateRhythmChangeBonus(current, last);
837
+ flowDifficulty *= this.calculateAngularVelocityBonus(current, last);
838
+ flowDifficulty += this.calculateAcuteAngleBonus(current, last, lastLast, next, currentVelocity);
839
+ flowDifficulty += this.calculateVelocityChangeBonus(current, last, currentVelocity, prevVelocity, currentDistance, this.calculateOverlapWeight(current, last, lastLast), withSliders);
938
840
  if (current.object instanceof osuBase.Slider && withSliders) {
939
- // Include slider velocity to make velocity more consistent with snap.
940
- flowDifficulty += current.travelDistance / current.travelTime;
841
+ flowDifficulty += this.calculateSliderBonus(current);
941
842
  }
942
843
  // The final velocity is being raised to a power because flow difficulty scales harder with both high
943
844
  // distance and time, and we want to account for that.
@@ -946,6 +847,100 @@ class DroidFlowAimEvaluator {
946
847
  return (flowDifficulty *
947
848
  osuBase.MathUtils.smootherstep(currentDistance, 0, current.normalizedRadius));
948
849
  }
850
+ static calculateRhythmChangeBonus(current, last) {
851
+ const bonus = Math.pow((Math.max(current.strainTime, last.strainTime) -
852
+ Math.min(current.strainTime, last.strainTime)) /
853
+ 50, 4);
854
+ return 1 + Math.min(this.maximumRhythmChangeBonus, bonus);
855
+ }
856
+ /**
857
+ * Scales flow difficulty by angular velocity.
858
+ * This nerfs consistent angles whilst buffing "erratic" flow.
859
+ */
860
+ static calculateAngularVelocityBonus(current, last) {
861
+ if (current.angle === null || last.angle === null) {
862
+ return 1;
863
+ }
864
+ const angleDifference = Math.abs(current.angle - last.angle);
865
+ const angleDifferenceAdjusted = Math.sin(angleDifference / 2) * 180;
866
+ const angularVelocity = angleDifferenceAdjusted / (current.strainTime * 0.1);
867
+ return 0.8 + Math.sqrt(angularVelocity / 270);
868
+ }
869
+ static calculateAcuteAngleBonus(current, prev, prevPrev, next, currentVelocity) {
870
+ if (current.angle === null || typeof (next === null || next === void 0 ? void 0 : next.angle) !== "number") {
871
+ return 0;
872
+ }
873
+ const currentAcuteness = DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle);
874
+ const nextAcuteness = DroidSnapAimEvaluator.calculateAcuteAngleAcuteness(next.angle);
875
+ let acuteness;
876
+ let overlapWeight;
877
+ // We want to evaluate flow turns at the center point of the actual turn, but current.angle is a prev2-prev-curr angle.
878
+ // The issue with changing that to prev-curr-next is that we might evaluate the second note of a flow pattern as snap if prev is acute.
879
+ // With min(curr,next) the evaluation (assuming acute affects snap/flow probability enough) behaves roughly like this:
880
+ //
881
+ // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
882
+ // 🡓🡓
883
+ // ooo 🡐 flow (prev2-prev-curr evaluates as wide)
884
+ // /
885
+ // ooo 🡐 snap (prev2-prev-curr evaluates as acute)
886
+ // 🡑🡑
887
+ // flow (prev-curr-next evaluates as wide)
888
+ //
889
+ //
890
+ // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
891
+ // 🡓🡓
892
+ // ooo 🡐 flow (prev-curr-next and prev2-prev-curr evaluates as wide)
893
+ // \
894
+ // ooo 🡐 snap (prev-curr-next evaluates as acute as the center point of the turn)
895
+ // 🡑🡑
896
+ // flow (prev-curr-next evaluates as wide)
897
+ //
898
+ // In both examples the first object in a flow pattern is evaluated as acute (likely snap) and the rest are wide (likely flow).
899
+ if (currentAcuteness < nextAcuteness) {
900
+ acuteness = currentAcuteness;
901
+ overlapWeight = this.calculateOverlapWeight(current, prev, prevPrev);
902
+ }
903
+ else {
904
+ acuteness = nextAcuteness;
905
+ overlapWeight = this.calculateOverlapWeight(next, current, prev);
906
+ }
907
+ return (currentVelocity *
908
+ acuteness *
909
+ overlapWeight *
910
+ this.acuteAngleMultiplier);
911
+ }
912
+ static calculateVelocityChangeBonus(current, last, currentVelocity, prevVelocity, currentDistance, overlappedNotesWeight, withSliders) {
913
+ if (Math.max(prevVelocity, currentVelocity) === 0) {
914
+ return 0;
915
+ }
916
+ if (withSliders) {
917
+ currentVelocity = currentDistance / current.strainTime;
918
+ }
919
+ const velocityDistanceCap = current.normalizedDiameter * 1.1;
920
+ currentVelocity = Math.min(currentVelocity, velocityDistanceCap / current.strainTime);
921
+ prevVelocity = Math.min(prevVelocity, velocityDistanceCap / last.strainTime);
922
+ // Scale with ratio of difference compared to 0.5 * max distance.
923
+ const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
924
+ Math.max(prevVelocity, currentVelocity), 0, 1);
925
+ let velocityChangeBonus = Math.abs(prevVelocity - currentVelocity) * distanceRatio;
926
+ velocityChangeBonus *= Math.pow(Math.min(current.strainTime, last.strainTime) /
927
+ Math.max(current.strainTime, last.strainTime), 3);
928
+ return (velocityChangeBonus *
929
+ overlappedNotesWeight *
930
+ this.velocityChangeMultiplier);
931
+ }
932
+ static calculateSliderBonus(current) {
933
+ return current.travelDistance / current.travelTime;
934
+ }
935
+ static calculateCurrentVelocity(current, prev, currentDistance, withSliders) {
936
+ let currentVelocity = currentDistance / current.strainTime;
937
+ if (prev.object instanceof osuBase.Slider && !prev.is2BSlider && withSliders) {
938
+ // If the last object is a slider, then we extend the travel velocity through the slider into the current object.
939
+ const sliderDistance = prev.lazyTravelDistance + current.lazyJumpDistance;
940
+ currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
941
+ }
942
+ return currentVelocity;
943
+ }
949
944
  // If all three notes overlap, do not reward bonuses as there is no required additional movement.
950
945
  static calculateOverlapWeight(first, second, third) {
951
946
  const o1 = this.calculateOverlapFactor(first, second);
@@ -959,8 +954,26 @@ class DroidFlowAimEvaluator {
959
954
  return osuBase.MathUtils.clamp(1 - Math.pow(Math.max(distance - radius, 0) / radius, 2), 0, 1);
960
955
  }
961
956
  }
962
- DroidFlowAimEvaluator.velocityChangeMultiplier = 0.55;
963
- DroidFlowAimEvaluator.acuteAngleMultiplier = 1.3;
957
+ DroidFlowAimEvaluator.velocityChangeMultiplier = 1.9;
958
+ DroidFlowAimEvaluator.maximumRhythmChangeBonus = 0.1;
959
+ DroidFlowAimEvaluator.acuteAngleMultiplier = 0.9;
960
+
961
+ class DroidSpinnerEvaluator {
962
+ /**
963
+ * Evaluates difficulty of spinning.
964
+ *
965
+ * @param current The current {@link DroidDifficultyHitObject} to evaluate.
966
+ */
967
+ static evaluateDifficultyOf(current) {
968
+ if (!(current.object instanceof osuBase.Spinner) || current.object.spinsRequired <= 0) {
969
+ return 0;
970
+ }
971
+ const duration = current.object.duration / 1000;
972
+ const rps = current.object.spinsRequired / duration;
973
+ // The longer the spinner the more lenient spinning requirements are.
974
+ return rps / duration;
975
+ }
976
+ }
964
977
 
965
978
  /**
966
979
  * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
@@ -968,12 +981,14 @@ DroidFlowAimEvaluator.acuteAngleMultiplier = 1.3;
968
981
  class DroidAim extends VariableLengthStrainSkill {
969
982
  constructor(mods, withSliders) {
970
983
  super(mods);
984
+ this.withSliders = withSliders;
971
985
  this.currentStrain = 0;
972
- this.skillMultiplierSnap = 71;
973
- this.skillMultiplierAgility = 1.63;
974
- this.skillMultiplierFlow = 247;
986
+ this.skillMultiplierSnap = 78.3;
987
+ this.skillMultiplierAgility = 32.5;
988
+ this.skillMultiplierFlow = 251;
989
+ this.skillMultiplierSpinner = 1.8;
975
990
  this.skillMultiplierTotal = 1.12;
976
- this.combinedSnapNormExponent = 1.2;
991
+ this.combinedSnapNormExponent = 1.5;
977
992
  /**
978
993
  * The number of sections with the highest strains, which the peak strain reductions will apply to.
979
994
  * This is done in order to decrease their impact on the overall difficulty of the beatmap.
@@ -985,7 +1000,6 @@ class DroidAim extends VariableLengthStrainSkill {
985
1000
  this.reducedStrainBaseline = 0.727;
986
1001
  this.sliderStrains = [];
987
1002
  this.maxSliderStrain = 0;
988
- this.withSliders = withSliders;
989
1003
  }
990
1004
  /**
991
1005
  * Obtains the amount of sliders that are considered difficult in terms of relative strain.
@@ -1042,6 +1056,9 @@ class DroidAim extends VariableLengthStrainSkill {
1042
1056
  }
1043
1057
  }
1044
1058
  calculateAdjustedDifficulty(current) {
1059
+ if (current.object instanceof osuBase.Spinner) {
1060
+ return DroidSpinnerEvaluator.evaluateDifficultyOf(current) * this.skillMultiplierSpinner;
1061
+ }
1045
1062
  const snapDifficulty = DroidSnapAimEvaluator.evaluateDifficultyOf(current, this.withSliders) * this.skillMultiplierSnap;
1046
1063
  const agilityDifficulty = DroidAgilityEvaluator.evaluateDifficultyOf(current) *
1047
1064
  this.skillMultiplierAgility;
@@ -1057,9 +1074,8 @@ class DroidAim extends VariableLengthStrainSkill {
1057
1074
  const pSnap = this.calculateSnapFlowProbability(flowDifficulty / combinedSnapDifficulty);
1058
1075
  const pFlow = 1 - pSnap;
1059
1076
  // Invert rating summation to obtain a more accurate TD adjustment.
1060
- snapDifficulty =
1061
- Math.pow(0.02275 * Math.pow(10, 0.63), (0.8 - 1) / 0.63) *
1062
- Math.pow(snapDifficulty, 0.8);
1077
+ snapDifficulty = this.invertRatingSummation(snapDifficulty, 0.82);
1078
+ agilityDifficulty = this.invertRatingSummation(agilityDifficulty, 0.82);
1063
1079
  combinedSnapDifficulty = osuBase.MathUtils.norm(this.combinedSnapNormExponent, snapDifficulty, agilityDifficulty);
1064
1080
  if (this.mods.has(osuBase.ModRelax)) {
1065
1081
  combinedSnapDifficulty *= 0.75;
@@ -1149,6 +1165,10 @@ class DroidAim extends VariableLengthStrainSkill {
1149
1165
  strains.splice(0, strainsToRemove);
1150
1166
  return strains.sort((a, b) => b.value - a.value);
1151
1167
  }
1168
+ invertRatingSummation(rating, exponent) {
1169
+ return Math.pow(0.02275 * Math.pow(10, 0.63), (exponent - 1) / 0.63) *
1170
+ Math.pow(rating, exponent);
1171
+ }
1152
1172
  strainDecay(ms) {
1153
1173
  return Math.pow(0.2, ms / 1000);
1154
1174
  }
@@ -1172,9 +1192,8 @@ class DroidFlashlightEvaluator {
1172
1192
  */
1173
1193
  static evaluateDifficultyOf(current, mods) {
1174
1194
  var _a;
1175
- if (current.object instanceof osuBase.Spinner ||
1176
- // Exclude overlapping objects that can be tapped at once.
1177
- current.isOverlapping(true)) {
1195
+ // Exclude overlapping objects that can be tapped at once.
1196
+ if (current.isOverlapping(true)) {
1178
1197
  return 0;
1179
1198
  }
1180
1199
  const scalingFactor = 52 / current.object.radius;
@@ -1190,9 +1209,8 @@ class DroidFlashlightEvaluator {
1190
1209
  for (let i = 0; i < Math.min(current.index, 10); ++i) {
1191
1210
  const currentObject = current.previous(i);
1192
1211
  cumulativeStrainTime += last.strainTime;
1193
- if (!(currentObject.object instanceof osuBase.Spinner) &&
1194
- // Exclude overlapping objects that can be tapped at once.
1195
- !currentObject.isOverlapping(false)) {
1212
+ // Exclude overlapping objects that can be tapped at once.
1213
+ if (!currentObject.isOverlapping(false)) {
1196
1214
  const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.stackedEndPosition).length;
1197
1215
  // We want to nerf objects that can be easily seen within the Flashlight circle radius.
1198
1216
  if (i === 0) {
@@ -1659,7 +1677,7 @@ class DroidReadingEvaluator {
1659
1677
  let preemptDifficulty = Math.pow((this.preemptStartingPoint -
1660
1678
  preempt +
1661
1679
  Math.abs(preempt - this.preemptStartingPoint)) /
1662
- 2, 2.5) / this.preemptBalancingFactor;
1680
+ 2, 2.475) / this.preemptBalancingFactor;
1663
1681
  preemptDifficulty *= constantAngleNerfFactor * velocity;
1664
1682
  return preemptDifficulty;
1665
1683
  }
@@ -1939,7 +1957,7 @@ class DroidReading extends HarmonicSkill {
1939
1957
  current.readingDifficulty = difficulty;
1940
1958
  }
1941
1959
  calculateAdjustedDifficulty(current) {
1942
- let difficulty = Math.pow(DroidReadingEvaluator.evaluateDifficultyOf(current, this.mods), 0.89);
1960
+ let difficulty = DroidReadingEvaluator.evaluateDifficultyOf(current, this.mods);
1943
1961
  if (this.mods.has(osuBase.ModRelax)) {
1944
1962
  difficulty *= 0.4;
1945
1963
  }
@@ -1970,7 +1988,7 @@ class DroidTapEvaluator {
1970
1988
  */
1971
1989
  static evaluateDifficultyOf(current, considerCheesability) {
1972
1990
  if (current.index < 0 ||
1973
- current.object instanceof osuBase.Spinner ||
1991
+ (current.object instanceof osuBase.Spinner && current.object.spinsRequired <= 0) ||
1974
1992
  // Exclude overlapping objects that can be tapped at once.
1975
1993
  current.isOverlapping(false)) {
1976
1994
  return 0;
@@ -2202,10 +2220,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2202
2220
  aimValue *= this.calculateDeviationBasedLengthScaling();
2203
2221
  // Scale the aim value with slider cheese penalty.
2204
2222
  aimValue *= this._sliderCheesePenalty;
2205
- // Scale the aim value with deviation.
2206
- aimValue *=
2207
- 1.025 *
2208
- Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.475);
2209
2223
  return aimValue;
2210
2224
  }
2211
2225
  /**
@@ -2245,14 +2259,14 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2245
2259
  if (this.mods.has(osuBase.ModRelax) || this.totalSuccessfulHits === 0) {
2246
2260
  return 0;
2247
2261
  }
2248
- let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
2262
+ let accuracyValue = 725 * Math.exp(-0.1 * this._deviation);
2249
2263
  const ncircles = this.mods.has(osuBase.ModScoreV2)
2250
2264
  ? this.totalHits - this.difficultyAttributes.spinnerCount
2251
2265
  : this.difficultyAttributes.hitCircleCount;
2252
2266
  // Bonus for many hitcircles - it's harder to keep good accuracy up for longer.
2253
2267
  accuracyValue *= Math.pow(Math.log(1 + ((Math.E - 1) * ncircles) / 1000), ncircles < 1000 ? 0.5 : 0.25);
2254
2268
  // Scale the accuracy value with rhythm complexity.
2255
- accuracyValue *= osuBase.MathUtils.offsetLogistic(this.difficultyAttributes.rhythmDifficulty, 1, 0.5, 1.8);
2269
+ accuracyValue *= osuBase.MathUtils.offsetLogistic(this.difficultyAttributes.rhythmDifficulty, 1, 0.5, 1.6);
2256
2270
  // Penalize accuracy pp after the first miss.
2257
2271
  accuracyValue *= Math.pow(0.97, Math.max(0, this._effectiveMissCount - 1));
2258
2272
  return accuracyValue;
@@ -2272,8 +2286,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2272
2286
  Math.pow(1 -
2273
2287
  Math.pow(this._effectiveMissCount / this.totalHits, 0.775), Math.pow(this._effectiveMissCount, 0.875));
2274
2288
  }
2275
- // Scale the flashlight value with deviation.
2276
- flashlightValue *= osuBase.ErrorFunction.erf(50 / (Math.SQRT2 * this._deviation));
2277
2289
  return flashlightValue;
2278
2290
  }
2279
2291
  /**
@@ -2288,10 +2300,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2288
2300
  // Scale the reading value with estimated full combo deviation.
2289
2301
  // As reading is easily "bypassable" with memorization, punish for memorization.
2290
2302
  readingValue *= Math.min(1, this.calculateDeviationBasedLengthScaling(undefined, true));
2291
- // Scale the reading value with deviation.
2292
- readingValue *=
2293
- 1.025 *
2294
- Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 1.25);
2295
2303
  return readingValue;
2296
2304
  }
2297
2305
  /**
@@ -2832,6 +2840,8 @@ class DifficultyHitObject {
2832
2840
  }
2833
2841
  /**
2834
2842
  * Retrieves the full rate-adjusted hit window for a {@link HitResult}.
2843
+ *
2844
+ * This is **not** safe to use for {@link Spinner}s, as they do not have hit windows and will always return 0.
2835
2845
  */
2836
2846
  hitWindowFor(result) {
2837
2847
  return (2 * this.rawHitWindow.hitWindowFor(result)) / this.clockRate;
@@ -2855,10 +2865,10 @@ class DifficultyHitObject {
2855
2865
  this.travelTime = Math.max(this.lazyTravelTime / clockRate, DifficultyHitObject.minDeltaTime);
2856
2866
  }
2857
2867
  this.minimumJumpTime = this.strainTime;
2858
- // We don't need to calculate either angle or distance when one of the last->curr objects is a spinner.
2868
+ // Skip angle/distance calculation for instant spinners.
2859
2869
  if (!this.lastObject ||
2860
- this.object instanceof osuBase.Spinner ||
2861
- this.lastObject instanceof osuBase.Spinner) {
2870
+ (this.object instanceof osuBase.Spinner && this.object.spinsRequired <= 0) ||
2871
+ (this.lastObject instanceof osuBase.Spinner && this.lastObject.spinsRequired <= 0)) {
2862
2872
  return;
2863
2873
  }
2864
2874
  // We will scale distances by this factor, so we can assume a uniform circle size among beatmaps.
@@ -3062,7 +3072,7 @@ class DroidDifficultyHitObject extends DifficultyHitObject {
3062
3072
  return this.normalizedRadius * 2;
3063
3073
  }
3064
3074
  get smallCircleBonus() {
3065
- return 1 + Math.pow(Math.max(0, 62.5 - this.object.radius) / 30, 1.5);
3075
+ return 1 + Math.pow(Math.max(0, 62.5 - this.object.radius) / 32.5, 1.5);
3066
3076
  }
3067
3077
  opacityAt(time, mods) {
3068
3078
  // Traceable hides the primary piece of a hit circle (that is, its body), so consider it as fully invisible.
@@ -3545,20 +3555,19 @@ class DroidScoreUtils {
3545
3555
  // For scores that were set in a higher refresh rate, this estimation will underestimate
3546
3556
  // the actual maximum spinner bonus.
3547
3557
  const maximumRotationsPerSecond = (Math.PI / 2) * 120;
3548
- // Taken from https://github.com/osudroid/osu-droid/blob/45ae4d66ce275382c5de037245ceca8704b3ae75/src/ru/nsu/ccfit/zuev/osu/game/GameScene.java#L1640.
3549
- const minimumRotationsPerSecond = 2 + (2 * playableBeatmap.difficulty.od) / 10;
3550
3558
  for (const obj of hitObjects.objects) {
3551
3559
  if (!(obj instanceof osuBase.Spinner)) {
3552
3560
  continue;
3553
3561
  }
3554
3562
  const secondsDuration = obj.duration / 1000;
3555
- const spinsRequiredBeforeBonus = secondsDuration * minimumRotationsPerSecond;
3563
+ const spinsRequiredBeforeBonus = obj.spinsRequired;
3556
3564
  const totalPossibleSpins = secondsDuration * maximumRotationsPerSecond;
3557
3565
  // In osu!droid, spinner bonus points are awarded for each full rotation every nth spin after the required spins.
3558
3566
  // For example, if a spinner requires 5.6 spins before bonus, the first bonus will be awarded at 6 spins instead
3559
- // of 6.6 spins.
3567
+ // of 6.6 spins. Likewise, if a spinner requires exactly 6 spins, the 6th spin already awards the first bonus.
3560
3568
  const maximumPossibleBonusSpins = Math.max(0, Math.floor(totalPossibleSpins) -
3561
- Math.ceil(spinsRequiredBeforeBonus));
3569
+ Math.ceil(spinsRequiredBeforeBonus) +
3570
+ 1);
3562
3571
  bonus += maximumPossibleBonusSpins * 1000;
3563
3572
  }
3564
3573
  return Math.floor(Math.fround(bonus * scoreMultiplier));
@@ -3806,124 +3815,6 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
3806
3815
  }
3807
3816
  }
3808
3817
 
3809
- /**
3810
- * An evaluator for calculating osu!standard agility aim difficulty.
3811
- */
3812
- class OsuAgilityEvaluator {
3813
- /**
3814
- * Evaluates the difficulty of fast aiming the current object.
3815
- *
3816
- * @param current The current object.
3817
- */
3818
- static evaluateDifficultyOf(current) {
3819
- if (current.object instanceof osuBase.Spinner) {
3820
- return 0;
3821
- }
3822
- const prev = current.previous(0);
3823
- // For objects that are stacked, we want to reduce the agility difficulty slightly by combining delta times
3824
- // of both objects together because we can assume that they likely would be done in one movement.
3825
- let previousDelta = 0;
3826
- if (prev !== null) {
3827
- previousDelta = prev.strainTime * osuBase.MathUtils.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, 0);
3828
- }
3829
- const combinedDelta = current.strainTime + previousDelta * this.previousDeltaInfluence;
3830
- let difficulty = Math.pow(1000 / combinedDelta, 2);
3831
- difficulty *= Math.pow(current.smallCircleBonus, 1.5);
3832
- return difficulty;
3833
- }
3834
- }
3835
- OsuAgilityEvaluator.previousDeltaInfluence = 0.5;
3836
-
3837
- /**
3838
- * An evaluator for calculating osu!standard Flashlight skill.
3839
- */
3840
- class OsuFlashlightEvaluator {
3841
- /**
3842
- * Evaluates the difficulty of memorizing and hitting the current object, based on:
3843
- *
3844
- * - distance between a number of previous objects and the current object,
3845
- * - the visual opacity of the current object,
3846
- * - the angle made by the current object,
3847
- * - length and speed of the current object (for sliders),
3848
- * - and whether Hidden mod is enabled.
3849
- *
3850
- * @param current The current object.
3851
- * @param mods The mods used.
3852
- */
3853
- static evaluateDifficultyOf(current, mods) {
3854
- var _a;
3855
- if (current.object instanceof osuBase.Spinner) {
3856
- return 0;
3857
- }
3858
- const scalingFactor = 52 / current.object.radius;
3859
- let smallDistNerf = 1;
3860
- let cumulativeStrainTime = 0;
3861
- let result = 0;
3862
- let last = current;
3863
- let angleRepeatCount = 0;
3864
- // Hidden's fade-out only affects opacity when the "only fade approach circles" setting is off.
3865
- const opacityMods = ((_a = mods.get(osuBase.ModHidden)) === null || _a === void 0 ? void 0 : _a.onlyFadeApproachCircles.value)
3866
- ? undefined
3867
- : mods;
3868
- for (let i = 0; i < Math.min(current.index, 10); ++i) {
3869
- const currentObject = current.previous(i);
3870
- cumulativeStrainTime += last.strainTime;
3871
- if (!(currentObject.object instanceof osuBase.Spinner)) {
3872
- const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.stackedEndPosition).length;
3873
- // We want to nerf objects that can be easily seen within the Flashlight circle radius.
3874
- if (i === 0) {
3875
- smallDistNerf = Math.min(1, jumpDistance / 75);
3876
- }
3877
- // We also want to nerf stacks so that only the first object of the stack is accounted for.
3878
- const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
3879
- // Bonus based on how visible the object is.
3880
- const opacityBonus = 1 +
3881
- this.maxOpacityBonus *
3882
- (1 -
3883
- current.opacityAt(currentObject.object.startTime, opacityMods));
3884
- result +=
3885
- (stackNerf * opacityBonus * scalingFactor * jumpDistance) /
3886
- cumulativeStrainTime;
3887
- if (currentObject.angle !== null && current.angle !== null) {
3888
- // Objects further back in time should count less for the nerf.
3889
- if (Math.abs(currentObject.angle - current.angle) < 0.02) {
3890
- angleRepeatCount += Math.max(0, 1 - 0.1 * i);
3891
- }
3892
- }
3893
- }
3894
- last = currentObject;
3895
- }
3896
- result = Math.pow(smallDistNerf * result, 2);
3897
- // Additional bonus for Hidden due to there being no approach circles.
3898
- if (mods.has(osuBase.ModHidden)) {
3899
- result *= 1 + this.hiddenBonus;
3900
- }
3901
- // Nerf patterns with repeated angles.
3902
- result *=
3903
- this.minAngleMultiplier +
3904
- (1 - this.minAngleMultiplier) / (angleRepeatCount + 1);
3905
- let sliderBonus = 0;
3906
- if (current.object instanceof osuBase.Slider) {
3907
- // Invert the scaling factor to determine the true travel distance independent of circle size.
3908
- const pixelTravelDistance = current.lazyTravelDistance / scalingFactor;
3909
- // Reward sliders based on velocity.
3910
- sliderBonus = Math.pow(Math.max(0, pixelTravelDistance / current.travelTime - this.minVelocity), 0.5);
3911
- // Longer sliders require more memorization.
3912
- sliderBonus *= pixelTravelDistance;
3913
- // Nerf sliders with repeats, as less memorization is required.
3914
- if (current.object.repeatCount > 0)
3915
- sliderBonus /= current.object.repeatCount + 1;
3916
- }
3917
- result += sliderBonus * this.sliderMultiplier;
3918
- return result;
3919
- }
3920
- }
3921
- OsuFlashlightEvaluator.maxOpacityBonus = 0.4;
3922
- OsuFlashlightEvaluator.hiddenBonus = 0.2;
3923
- OsuFlashlightEvaluator.minVelocity = 0.5;
3924
- OsuFlashlightEvaluator.sliderMultiplier = 1.3;
3925
- OsuFlashlightEvaluator.minAngleMultiplier = 0.2;
3926
-
3927
3818
  /**
3928
3819
  * An evaluator for calculating osu!standard snap aim difficulty.
3929
3820
  */
@@ -3940,12 +3831,11 @@ class OsuSnapAimEvaluator {
3940
3831
  * @param withSliders Whether to take slider difficulty into account.
3941
3832
  */
3942
3833
  static evaluateDifficultyOf(current, withSliders) {
3943
- const last = current.previous(0);
3944
3834
  if (current.object instanceof osuBase.Spinner ||
3945
- current.index <= 1 ||
3946
- last.object instanceof osuBase.Spinner) {
3835
+ current.index <= 1) {
3947
3836
  return 0;
3948
3837
  }
3838
+ const last = current.previous(0);
3949
3839
  const currentDistance = withSliders
3950
3840
  ? current.lazyJumpDistance
3951
3841
  : current.jumpDistance;
@@ -3958,11 +3848,7 @@ class OsuSnapAimEvaluator {
3958
3848
  let strain = currentVelocity;
3959
3849
  // Penalize angle repetition.
3960
3850
  strain *= this.calculateVectorAngleRepetition(current, last);
3961
- const acuteAngleBonus = this.calculateAcuteAngleBonus(current, last, currentDistance, currentVelocity, prevVelocity);
3962
- const wideAngleBonus = this.calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders);
3963
- // Add in acute angle bonus or wide angle bonus, whichever is larger.
3964
- strain += Math.max(acuteAngleBonus, wideAngleBonus);
3965
- strain += this.calculateWiggleBonus(current, last, currentVelocity, prevVelocity, currentDistance, prevDistance);
3851
+ strain += this.calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders);
3966
3852
  strain += this.calculateVelocityChangeBonus(withSliders, prevVelocity, currentVelocity, currentDistance, current, last);
3967
3853
  if (current.object instanceof osuBase.Slider && withSliders) {
3968
3854
  strain += this.calculateSliderBonus(current);
@@ -3972,31 +3858,6 @@ class OsuSnapAimEvaluator {
3972
3858
  strain *= this.highBpmBonus(current.strainTime);
3973
3859
  return strain;
3974
3860
  }
3975
- static calculateAcuteAngleBonus(current, last, currentDistance, currentVelocity, prevVelocity) {
3976
- if (current.angle === null || last.angle === null) {
3977
- return 0;
3978
- }
3979
- // Only reward acute angles when rhythms are the same.
3980
- if (Math.max(current.strainTime, last.strainTime) >=
3981
- 1.25 * Math.min(current.strainTime, last.strainTime)) {
3982
- return 0;
3983
- }
3984
- let acuteAngleBonus = this.calculateAcuteAngleAcuteness(current.angle);
3985
- // Penalize angle repetition. It is important to do it _before_ multiplying by anything because we
3986
- // compare raw acuteness here.
3987
- acuteAngleBonus *=
3988
- 0.08 +
3989
- 0.92 *
3990
- (1 -
3991
- Math.min(acuteAngleBonus, Math.pow(this.calculateAcuteAngleAcuteness(last.angle), 3)));
3992
- const velocity = Math.min(currentVelocity, prevVelocity);
3993
- // Apply acute angle bonus for BPM above 300 1/2 and distance more than one diameter.
3994
- acuteAngleBonus *=
3995
- velocity *
3996
- osuBase.MathUtils.smootherstep(osuBase.MathUtils.millisecondsToBPM(current.strainTime, 2), 300, 400) *
3997
- osuBase.MathUtils.smootherstep(currentDistance, 0, current.normalizedDiameter * 2);
3998
- return acuteAngleBonus * this.acuteAngleMultiplier;
3999
- }
4000
3861
  static calculateWideAngleBonus(current, last, currentDistance, prevDistance, withSliders) {
4001
3862
  if (current.angle === null || last.angle === null) {
4002
3863
  return 0;
@@ -4009,14 +3870,12 @@ class OsuSnapAimEvaluator {
4009
3870
  0.75 *
4010
3871
  (1 -
4011
3872
  Math.min(wideAngleBonus, Math.pow(this.calculateWideAngleAcuteness(last.angle), 3)));
4012
- // Rescale velocity for the wide angle bonus.
4013
- const wideAngleTimeScale = 1.45;
4014
- let currentRescaledVelocity = currentDistance / Math.pow(current.strainTime, wideAngleTimeScale);
4015
- const prevRescaledVelocity = prevDistance / Math.pow(last.strainTime, wideAngleTimeScale);
3873
+ let currentRescaledVelocity = currentDistance / Math.pow(current.strainTime, this.wideAngleTimeScale);
3874
+ const prevRescaledVelocity = prevDistance / Math.pow(last.strainTime, this.wideAngleTimeScale);
4016
3875
  if (last.object instanceof osuBase.Slider && withSliders) {
4017
3876
  const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
4018
3877
  currentRescaledVelocity = Math.max(currentRescaledVelocity, sliderDistance /
4019
- Math.pow(current.strainTime, wideAngleTimeScale));
3878
+ Math.pow(current.strainTime, this.wideAngleTimeScale));
4020
3879
  }
4021
3880
  wideAngleBonus *= Math.min(currentRescaledVelocity, prevRescaledVelocity);
4022
3881
  const last2 = current.previous(2);
@@ -4039,6 +3898,9 @@ class OsuSnapAimEvaluator {
4039
3898
  // We want to use just the object jump without slider velocity when awarding differences.
4040
3899
  currentVelocity = currentDistance / current.strainTime;
4041
3900
  }
3901
+ // Cap velocity to at least 1 radius distance to only award snap patterns.
3902
+ currentVelocity = Math.max(currentVelocity, current.normalizedDiameter / current.strainTime);
3903
+ prevVelocity = Math.max(prevVelocity, last.normalizedDiameter / last.strainTime);
4042
3904
  // Scale with ratio of difference compared to half the max distance.
4043
3905
  const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
4044
3906
  Math.max(prevVelocity, currentVelocity), 0, 1);
@@ -4051,25 +3913,6 @@ class OsuSnapAimEvaluator {
4051
3913
  Math.max(current.strainTime, last.strainTime), 3);
4052
3914
  return velocityChangeBonus * this.velocityChangeMultiplier;
4053
3915
  }
4054
- /**
4055
- * Difficulty bonus for "wiggle" patterns - jumps that are [radius, 3*diameter] in distance, with < 110 angle.
4056
- * https://www.desmos.com/calculator/dp0v0nvowc
4057
- */
4058
- static calculateWiggleBonus(current, last, currentVelocity, prevVelocity, currentDistance, prevDistance) {
4059
- if (current.angle === null || last.angle === null) {
4060
- return 0;
4061
- }
4062
- const radius = current.normalizedRadius;
4063
- const diameter = current.normalizedDiameter;
4064
- const wiggleBonus = Math.min(currentVelocity, prevVelocity) *
4065
- osuBase.MathUtils.smootherstep(currentDistance, radius, diameter) *
4066
- Math.pow(osuBase.MathUtils.reverseLerp(currentDistance, diameter * 3, diameter), 1.8) *
4067
- osuBase.MathUtils.smootherstep(current.angle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60)) *
4068
- osuBase.MathUtils.smootherstep(prevDistance, radius, diameter) *
4069
- Math.pow(osuBase.MathUtils.reverseLerp(prevDistance, diameter * 3, diameter), 1.8) *
4070
- osuBase.MathUtils.smootherstep(last.angle, osuBase.MathUtils.degreesToRadians(110), osuBase.MathUtils.degreesToRadians(60));
4071
- return wiggleBonus * this.wiggleMultiplier;
4072
- }
4073
3916
  static calculateSliderBonus(current) {
4074
3917
  // Reward sliders based on velocity.
4075
3918
  const sliderBonus = current.travelDistance / current.travelTime;
@@ -4096,13 +3939,17 @@ class OsuSnapAimEvaluator {
4096
3939
  return 1 / (1 - Math.pow(0.03, Math.pow(ms / 1000, 0.65)));
4097
3940
  }
4098
3941
  static calculateVectorAngleRepetition(current, prev) {
4099
- if (current.angle === null || prev.angle === null) {
3942
+ var _a;
3943
+ if (current.angle === null ||
3944
+ prev.angle === null ||
3945
+ prev.object instanceof osuBase.Spinner ||
3946
+ ((_a = prev.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
4100
3947
  return 1;
4101
3948
  }
4102
3949
  let constantAngleCount = 0;
4103
3950
  for (let i = 0; i < this.angleRepetitionNoteLimit; ++i) {
4104
3951
  const loopObj = current.previous(i);
4105
- if (!loopObj) {
3952
+ if (!loopObj || loopObj.object instanceof osuBase.Spinner) {
4106
3953
  break;
4107
3954
  }
4108
3955
  // Only consider vectors in the same jump section, as stopping to change rhythm ruins momentum.
@@ -4136,26 +3983,150 @@ class OsuSnapAimEvaluator {
4136
3983
  stackFactor, 2);
4137
3984
  }
4138
3985
  }
4139
- OsuSnapAimEvaluator.wideAngleMultiplier = 9.67;
4140
- OsuSnapAimEvaluator.acuteAngleMultiplier = 2.35;
4141
- OsuSnapAimEvaluator.sliderMultiplier = 1.5;
4142
- OsuSnapAimEvaluator.velocityChangeMultiplier = 0.9;
4143
- // Increasing this multiplier beyond 1.02 reduces difficulty as distance increases.
4144
- // Refer to the desmos link above the wiggle bonus calculation.
4145
- OsuSnapAimEvaluator.wiggleMultiplier = 1.02;
3986
+ OsuSnapAimEvaluator.wideAngleMultiplier = 2.15;
3987
+ // Rescale velocity for the wide angle bonus.
3988
+ OsuSnapAimEvaluator.wideAngleTimeScale = 1.2;
3989
+ OsuSnapAimEvaluator.sliderMultiplier = 1.35;
3990
+ OsuSnapAimEvaluator.velocityChangeMultiplier = 0.85;
4146
3991
  OsuSnapAimEvaluator.angleRepetitionNoteLimit = 6;
4147
3992
  OsuSnapAimEvaluator.maximumRepetitionNerf = 0.15;
4148
3993
  OsuSnapAimEvaluator.maximumVectorInfluence = 0.5;
4149
3994
 
3995
+ /**
3996
+ * An evaluator for calculating osu!standard agility aim difficulty.
3997
+ */
3998
+ class OsuAgilityEvaluator {
3999
+ /**
4000
+ * Evaluates the difficulty of fast aiming the current object.
4001
+ *
4002
+ * @param current The current object.
4003
+ */
4004
+ static evaluateDifficultyOf(current) {
4005
+ if (current.object instanceof osuBase.Spinner) {
4006
+ return 0;
4007
+ }
4008
+ const prev = current.previous(0);
4009
+ // Assume that the player always uses at least the full great hitwindow for the movement.
4010
+ const currentDelta = Math.max(current.strainTime, current.hitWindowFor(osuBase.HitResult.Great));
4011
+ // For objects that are stacked, we want to reduce the agility difficulty slightly by combining delta times
4012
+ // of both objects together because we can assume that they likely would be done in one movement.
4013
+ let previousDelta = 0;
4014
+ if (prev !== null) {
4015
+ previousDelta = prev.strainTime * osuBase.MathUtils.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, 0);
4016
+ }
4017
+ const combinedDelta = currentDelta + previousDelta * this.previousDeltaInfluence;
4018
+ const angleSwitchingBonus = this.calculateAngleSwitchingBonus(current, prev);
4019
+ let difficulty = (1 + angleSwitchingBonus) * 10000000 / Math.pow(combinedDelta, 3.1);
4020
+ difficulty *= current.smallCircleBonus;
4021
+ return difficulty;
4022
+ }
4023
+ static calculateAngleSwitchingBonus(current, prev) {
4024
+ if (current.angle === null || typeof (prev === null || prev === void 0 ? void 0 : prev.angle) !== "number") {
4025
+ return 0;
4026
+ }
4027
+ const acutenessDifference = 1 - Math.min(OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle), Math.pow(OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(prev.angle), 3));
4028
+ const rhythmDifferencePenalty = Math.pow(Math.min(current.strainTime, prev.strainTime) / Math.max(current.strainTime, prev.strainTime), 3);
4029
+ return (acutenessDifference *
4030
+ rhythmDifferencePenalty *
4031
+ osuBase.Interpolation.reverseLerp(prev.lazyJumpDistance, prev.normalizedRadius, prev.normalizedDiameter) *
4032
+ this.angleSwitchingBonus);
4033
+ }
4034
+ }
4035
+ OsuAgilityEvaluator.previousDeltaInfluence = 0.5;
4036
+ OsuAgilityEvaluator.angleSwitchingBonus = 0.8;
4037
+
4038
+ /**
4039
+ * An evaluator for calculating osu!standard Flashlight skill.
4040
+ */
4041
+ class OsuFlashlightEvaluator {
4042
+ /**
4043
+ * Evaluates the difficulty of memorizing and hitting the current object, based on:
4044
+ *
4045
+ * - distance between a number of previous objects and the current object,
4046
+ * - the visual opacity of the current object,
4047
+ * - the angle made by the current object,
4048
+ * - length and speed of the current object (for sliders),
4049
+ * - and whether Hidden mod is enabled.
4050
+ *
4051
+ * @param current The current object.
4052
+ * @param mods The mods used.
4053
+ */
4054
+ static evaluateDifficultyOf(current, mods) {
4055
+ var _a;
4056
+ const scalingFactor = 52 / current.object.radius;
4057
+ let smallDistNerf = 1;
4058
+ let cumulativeStrainTime = 0;
4059
+ let result = 0;
4060
+ let last = current;
4061
+ let angleRepeatCount = 0;
4062
+ // Hidden's fade-out only affects opacity when the "only fade approach circles" setting is off.
4063
+ const opacityMods = ((_a = mods.get(osuBase.ModHidden)) === null || _a === void 0 ? void 0 : _a.onlyFadeApproachCircles.value)
4064
+ ? undefined
4065
+ : mods;
4066
+ for (let i = 0; i < Math.min(current.index, 10); ++i) {
4067
+ const currentObject = current.previous(i);
4068
+ cumulativeStrainTime += last.strainTime;
4069
+ const jumpDistance = current.object.stackedPosition.subtract(currentObject.object.stackedEndPosition).length;
4070
+ // We want to nerf objects that can be easily seen within the Flashlight circle radius.
4071
+ if (i === 0) {
4072
+ smallDistNerf = Math.min(1, jumpDistance / 75);
4073
+ }
4074
+ // We also want to nerf stacks so that only the first object of the stack is accounted for.
4075
+ const stackNerf = Math.min(1, currentObject.lazyJumpDistance / scalingFactor / 25);
4076
+ // Bonus based on how visible the object is.
4077
+ const opacityBonus = 1 +
4078
+ this.maxOpacityBonus *
4079
+ (1 -
4080
+ current.opacityAt(currentObject.object.startTime, opacityMods));
4081
+ result +=
4082
+ (stackNerf * opacityBonus * scalingFactor * jumpDistance) /
4083
+ cumulativeStrainTime;
4084
+ if (currentObject.angle !== null && current.angle !== null) {
4085
+ // Objects further back in time should count less for the nerf.
4086
+ if (Math.abs(currentObject.angle - current.angle) < 0.02) {
4087
+ angleRepeatCount += Math.max(0, 1 - 0.1 * i);
4088
+ }
4089
+ }
4090
+ last = currentObject;
4091
+ }
4092
+ result = Math.pow(smallDistNerf * result, 2);
4093
+ // Additional bonus for Hidden due to there being no approach circles.
4094
+ if (mods.has(osuBase.ModHidden)) {
4095
+ result *= 1 + this.hiddenBonus;
4096
+ }
4097
+ // Nerf patterns with repeated angles.
4098
+ result *=
4099
+ this.minAngleMultiplier +
4100
+ (1 - this.minAngleMultiplier) / (angleRepeatCount + 1);
4101
+ let sliderBonus = 0;
4102
+ if (current.object instanceof osuBase.Slider) {
4103
+ // Invert the scaling factor to determine the true travel distance independent of circle size.
4104
+ const pixelTravelDistance = current.lazyTravelDistance / scalingFactor;
4105
+ // Reward sliders based on velocity.
4106
+ sliderBonus = Math.pow(Math.max(0, pixelTravelDistance / current.travelTime - this.minVelocity), 0.5);
4107
+ // Longer sliders require more memorization.
4108
+ sliderBonus *= pixelTravelDistance;
4109
+ // Nerf sliders with repeats, as less memorization is required.
4110
+ if (current.object.repeatCount > 0)
4111
+ sliderBonus /= current.object.repeatCount + 1;
4112
+ }
4113
+ result += sliderBonus * this.sliderMultiplier;
4114
+ return result;
4115
+ }
4116
+ }
4117
+ OsuFlashlightEvaluator.maxOpacityBonus = 0.4;
4118
+ OsuFlashlightEvaluator.hiddenBonus = 0.2;
4119
+ OsuFlashlightEvaluator.minVelocity = 0.5;
4120
+ OsuFlashlightEvaluator.sliderMultiplier = 1.3;
4121
+ OsuFlashlightEvaluator.minAngleMultiplier = 0.2;
4122
+
4150
4123
  /**
4151
4124
  * An evaluator for calculating osu!standard flow aim difficulty.
4152
4125
  */
4153
4126
  class OsuFlowAimEvaluator {
4154
4127
  static evaluateDifficultyOf(current, withSliders) {
4155
- var _a;
4156
4128
  if (current.object instanceof osuBase.Spinner ||
4157
- current.index <= 1 ||
4158
- ((_a = current.previous(0)) === null || _a === void 0 ? void 0 : _a.object) instanceof osuBase.Spinner) {
4129
+ current.index <= 1) {
4159
4130
  return 0;
4160
4131
  }
4161
4132
  const next = current.next(0);
@@ -4167,86 +4138,18 @@ class OsuFlowAimEvaluator {
4167
4138
  const prevDistance = withSliders
4168
4139
  ? last.lazyJumpDistance
4169
4140
  : last.jumpDistance;
4170
- let currentVelocity = currentDistance / current.strainTime;
4171
- if (last.object instanceof osuBase.Slider && withSliders) {
4172
- // If the last object is a slider, then we extend the travel velocity through the slider into the current object.
4173
- const sliderDistance = last.lazyTravelDistance + current.lazyJumpDistance;
4174
- currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
4175
- }
4141
+ const currentVelocity = this.calculateCurrentVelocity(current, last, currentDistance, withSliders);
4176
4142
  const prevVelocity = prevDistance / last.strainTime;
4177
4143
  let flowDifficulty = currentVelocity;
4178
4144
  // Apply high circle size bonus to the base velocity.
4179
4145
  // We use reduced CS bonus here because the bonus was made for an evaluator with a different d/t scaling.
4180
- flowDifficulty *= Math.sqrt(current.smallCircleBonus);
4181
- // Rhythm changes are harder to flow.
4182
- flowDifficulty *=
4183
- 1 +
4184
- Math.min(0.1, Math.pow((Math.max(current.strainTime, last.strainTime) -
4185
- Math.min(current.strainTime, last.strainTime)) /
4186
- 50, 4));
4187
- if (current.angle !== null && last.angle !== null) {
4188
- // Low angular velocity (consistent angles) is easier to follow than erratic flow.
4189
- const angleDifference = Math.abs(current.angle - last.angle);
4190
- const angleDifferenceAdjusted = Math.sin(angleDifference / 2) * 180;
4191
- const angularVelocity = angleDifferenceAdjusted / (current.strainTime * 0.1);
4192
- flowDifficulty *= 0.8 + Math.sqrt(angularVelocity / 270);
4193
- }
4194
- if (current.angle !== null && next !== null && next.angle !== null) {
4195
- const currentAcuteness = OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle);
4196
- const nextAcuteness = OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(next.angle);
4197
- let acuteness;
4198
- let overlapWeight;
4199
- // We want to evaluate flow turns at the center point of the actual turn, but curr.Angle is a prev2-prev-curr angle.
4200
- // The issue with changing that to prev-curr-next is that we might evaluate the second note of a flow pattern as snap if prev is acute.
4201
- // With min(curr,next) the evaluation (assuming acute affects snap/flow probability enough) behaves roughly like this:
4202
- //
4203
- // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4204
- // 🡓🡓
4205
- // ooo 🡐 flow (prev2-prev-curr evaluates as wide)
4206
- // /
4207
- // ooo 🡐 snap (prev2-prev-curr evaluates as acute)
4208
- // 🡑🡑
4209
- // flow (prev-curr-next evaluates as wide)
4210
- //
4211
- //
4212
- // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4213
- // 🡓🡓
4214
- // ooo 🡐 flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4215
- // \
4216
- // ooo 🡐 snap (prev-curr-next evaluates as acute as the center point of the turn)
4217
- // 🡑🡑
4218
- // flow (prev-curr-next evaluates as wide)
4219
- //
4220
- // In both examples the first object in a flow pattern is evaluated as acute (likely snap) and the rest are wide (likely flow).
4221
- if (currentAcuteness < nextAcuteness) {
4222
- acuteness = currentAcuteness;
4223
- overlapWeight = this.calculateOverlapWeight(current, last, lastLast);
4224
- }
4225
- else {
4226
- acuteness = nextAcuteness;
4227
- overlapWeight = this.calculateOverlapWeight(next, current, last);
4228
- }
4229
- flowDifficulty += currentVelocity * acuteness * overlapWeight * this.acuteAngleMultiplier;
4230
- }
4231
- if (Math.max(prevVelocity, currentVelocity)) {
4232
- if (withSliders) {
4233
- currentVelocity = currentDistance / current.strainTime;
4234
- }
4235
- // Scale with ratio of difference compared to 0.5 * max distance.
4236
- const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
4237
- Math.max(prevVelocity, currentVelocity), 0, 1);
4238
- // Reward for % distance up to 125 / strainTime for overlaps where velocity is still changing.
4239
- const overlapVelocityBuff = Math.min((current.normalizedDiameter * 1.25) /
4240
- Math.min(current.strainTime, last.strainTime), Math.abs(prevVelocity - currentVelocity));
4241
- flowDifficulty +=
4242
- overlapVelocityBuff *
4243
- distanceRatio *
4244
- this.calculateOverlapWeight(current, last, lastLast) *
4245
- this.velocityChangeMultiplier;
4246
- }
4146
+ flowDifficulty *= Math.pow(current.smallCircleBonus, 0.55);
4147
+ flowDifficulty *= this.calculateRhythmChangeBonus(current, last);
4148
+ flowDifficulty *= this.calculateAngularVelocityBonus(current, last);
4149
+ flowDifficulty += this.calculateAcuteAngleBonus(current, last, lastLast, next, currentVelocity);
4150
+ flowDifficulty += this.calculateVelocityChangeBonus(current, last, currentVelocity, prevVelocity, currentDistance, this.calculateOverlapWeight(current, last, lastLast), withSliders);
4247
4151
  if (current.object instanceof osuBase.Slider && withSliders) {
4248
- // Include slider velocity to make velocity more consistent with snap.
4249
- flowDifficulty += current.travelDistance / current.travelTime;
4152
+ flowDifficulty += this.calculateSliderBonus(current);
4250
4153
  }
4251
4154
  // The final velocity is being raised to a power because flow difficulty scales harder with both high
4252
4155
  // distance and time, and we want to account for that.
@@ -4255,6 +4158,96 @@ class OsuFlowAimEvaluator {
4255
4158
  return (flowDifficulty *
4256
4159
  osuBase.MathUtils.smootherstep(currentDistance, 0, current.normalizedRadius));
4257
4160
  }
4161
+ static calculateRhythmChangeBonus(current, last) {
4162
+ const bonus = Math.pow((Math.max(current.strainTime, last.strainTime) -
4163
+ Math.min(current.strainTime, last.strainTime)) / 50, 4);
4164
+ return 1 + Math.min(this.maximumRhythmChangeBonus, bonus);
4165
+ }
4166
+ /**
4167
+ * Scales flow difficulty by angular velocity.
4168
+ * This nerfs consistent angles whilst buffing "erratic" flow.
4169
+ */
4170
+ static calculateAngularVelocityBonus(current, last) {
4171
+ if (current.angle === null || last.angle === null) {
4172
+ return 1;
4173
+ }
4174
+ const angleDifference = Math.abs(current.angle - last.angle);
4175
+ const angleDifferenceAdjusted = Math.sin(angleDifference / 2) * 180;
4176
+ const angularVelocity = angleDifferenceAdjusted / (current.strainTime * 0.1);
4177
+ return 0.8 + Math.sqrt(angularVelocity / 270);
4178
+ }
4179
+ static calculateAcuteAngleBonus(current, prev, prevPrev, next, currentVelocity) {
4180
+ if (current.angle === null || typeof (next === null || next === void 0 ? void 0 : next.angle) !== "number") {
4181
+ return 0;
4182
+ }
4183
+ const currentAcuteness = OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(current.angle);
4184
+ const nextAcuteness = OsuSnapAimEvaluator.calculateAcuteAngleAcuteness(next.angle);
4185
+ let acuteness;
4186
+ let overlapWeight;
4187
+ // We want to evaluate flow turns at the center point of the actual turn, but current.angle is a prev2-prev-curr angle.
4188
+ // The issue with changing that to prev-curr-next is that we might evaluate the second note of a flow pattern as snap if prev is acute.
4189
+ // With min(curr,next) the evaluation (assuming acute affects snap/flow probability enough) behaves roughly like this:
4190
+ //
4191
+ // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4192
+ // 🡓🡓
4193
+ // ooo 🡐 flow (prev2-prev-curr evaluates as wide)
4194
+ // /
4195
+ // ooo 🡐 snap (prev2-prev-curr evaluates as acute)
4196
+ // 🡑🡑
4197
+ // flow (prev-curr-next evaluates as wide)
4198
+ //
4199
+ //
4200
+ // flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4201
+ // 🡓🡓
4202
+ // ooo 🡐 flow (prev-curr-next and prev2-prev-curr evaluates as wide)
4203
+ // \
4204
+ // ooo 🡐 snap (prev-curr-next evaluates as acute as the center point of the turn)
4205
+ // 🡑🡑
4206
+ // flow (prev-curr-next evaluates as wide)
4207
+ //
4208
+ // In both examples the first object in a flow pattern is evaluated as acute (likely snap) and the rest are wide (likely flow).
4209
+ if (currentAcuteness < nextAcuteness) {
4210
+ acuteness = currentAcuteness;
4211
+ overlapWeight = this.calculateOverlapWeight(current, prev, prevPrev);
4212
+ }
4213
+ else {
4214
+ acuteness = nextAcuteness;
4215
+ overlapWeight = this.calculateOverlapWeight(next, current, prev);
4216
+ }
4217
+ return currentVelocity * acuteness * overlapWeight * this.acuteAngleMultiplier;
4218
+ }
4219
+ static calculateVelocityChangeBonus(current, last, currentVelocity, prevVelocity, currentDistance, overlappedNotesWeight, withSliders) {
4220
+ if (Math.max(prevVelocity, currentVelocity) === 0) {
4221
+ return 0;
4222
+ }
4223
+ if (withSliders) {
4224
+ currentVelocity = currentDistance / current.strainTime;
4225
+ }
4226
+ const velocityDistanceCap = current.normalizedDiameter * 1.1;
4227
+ currentVelocity = Math.min(currentVelocity, velocityDistanceCap / current.strainTime);
4228
+ prevVelocity = Math.min(prevVelocity, velocityDistanceCap / last.strainTime);
4229
+ // Scale with ratio of difference compared to 0.5 * max distance.
4230
+ const distanceRatio = osuBase.MathUtils.smoothstep(Math.abs(prevVelocity - currentVelocity) /
4231
+ Math.max(prevVelocity, currentVelocity), 0, 1);
4232
+ let velocityChangeBonus = Math.abs(prevVelocity - currentVelocity) * distanceRatio;
4233
+ velocityChangeBonus *= Math.pow(Math.min(current.strainTime, last.strainTime) /
4234
+ Math.max(current.strainTime, last.strainTime), 3);
4235
+ return (velocityChangeBonus *
4236
+ overlappedNotesWeight *
4237
+ this.velocityChangeMultiplier);
4238
+ }
4239
+ static calculateSliderBonus(current) {
4240
+ return current.travelDistance / current.travelTime;
4241
+ }
4242
+ static calculateCurrentVelocity(current, prev, currentDistance, withSliders) {
4243
+ let currentVelocity = currentDistance / current.strainTime;
4244
+ if (prev.object instanceof osuBase.Slider && withSliders) {
4245
+ // If the last object is a slider, then we extend the travel velocity through the slider into the current object.
4246
+ const sliderDistance = prev.lazyTravelDistance + current.lazyJumpDistance;
4247
+ currentVelocity = Math.max(currentVelocity, sliderDistance / current.strainTime);
4248
+ }
4249
+ return currentVelocity;
4250
+ }
4258
4251
  // If all three notes overlap, do not reward bonuses as there is no required additional movement.
4259
4252
  static calculateOverlapWeight(first, second, third) {
4260
4253
  const o1 = this.calculateOverlapFactor(first, second);
@@ -4268,8 +4261,9 @@ class OsuFlowAimEvaluator {
4268
4261
  return osuBase.MathUtils.clamp(1 - Math.pow(Math.max(distance - radius, 0) / radius, 2), 0, 1);
4269
4262
  }
4270
4263
  }
4271
- OsuFlowAimEvaluator.velocityChangeMultiplier = 0.55;
4272
- OsuFlowAimEvaluator.acuteAngleMultiplier = 1.3;
4264
+ OsuFlowAimEvaluator.velocityChangeMultiplier = 1.9;
4265
+ OsuFlowAimEvaluator.maximumRhythmChangeBonus = 0.1;
4266
+ OsuFlowAimEvaluator.acuteAngleMultiplier = 0.9;
4273
4267
 
4274
4268
  /**
4275
4269
  * Evaluator for reading difficulty in osu!standard.
@@ -4696,9 +4690,6 @@ class OsuSpeedEvaluator {
4696
4690
  * @param current The current object.
4697
4691
  */
4698
4692
  static evaluateDifficultyOf(current) {
4699
- if (current.object instanceof osuBase.Spinner) {
4700
- return 0;
4701
- }
4702
4693
  const doubletapness = 1 - current.getDoubletapness(current.next(0));
4703
4694
  let difficulty = osuBase.MathUtils.millisecondsToBPM(current.strainTime);
4704
4695
  difficulty *= this.calculateSpeedBonus(current);
@@ -4726,6 +4717,23 @@ class OsuSpeedEvaluator {
4726
4717
  // ~200 1/4 BPM streams
4727
4718
  OsuSpeedEvaluator.minSpeedBonus = 200;
4728
4719
 
4720
+ class OsuSpinnerEvaluator {
4721
+ /**
4722
+ * Evaluates difficulty of spinning.
4723
+ */
4724
+ static evaluateDifficultyOf(current) {
4725
+ if (!(current.object instanceof osuBase.Spinner) || current.object.spinsRequired <= 0) {
4726
+ return 0;
4727
+ }
4728
+ // This duration is *not* rate scaled because spinners work by applying rates on rotations.
4729
+ // This means spinning difficulty remains constant for a spinner, regardless of the applied rate.
4730
+ const duration = current.object.duration / 1000;
4731
+ const rps = current.object.spinsRequired / duration;
4732
+ // The longer the spinner the more lenient spinning requirements are.
4733
+ return rps / duration;
4734
+ }
4735
+ }
4736
+
4729
4737
  /**
4730
4738
  * Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
4731
4739
  */
@@ -4733,11 +4741,12 @@ class OsuAim extends VariableLengthStrainSkill {
4733
4741
  constructor(mods, withSliders) {
4734
4742
  super(mods);
4735
4743
  this.currentStrain = 0;
4736
- this.skillMultiplierSnap = 71;
4737
- this.skillMultiplierAgility = 1.63;
4738
- this.skillMultiplierFlow = 247;
4744
+ this.skillMultiplierSnap = 78.3;
4745
+ this.skillMultiplierAgility = 32.5;
4746
+ this.skillMultiplierFlow = 251;
4747
+ this.skillMultiplierSpinner = 22;
4739
4748
  this.skillMultiplierTotal = 1.12;
4740
- this.combinedSnapNormExponent = 1.2;
4749
+ this.combinedSnapNormExponent = 1.5;
4741
4750
  /**
4742
4751
  * The number of sections with the highest strains, which the peak strain reductions will apply to.
4743
4752
  * This is done in order to decrease their impact on the overall difficulty of the beatmap.
@@ -4806,6 +4815,9 @@ class OsuAim extends VariableLengthStrainSkill {
4806
4815
  }
4807
4816
  }
4808
4817
  calculateAdjustedDifficulty(current) {
4818
+ if (current.object instanceof osuBase.Spinner) {
4819
+ return OsuSpinnerEvaluator.evaluateDifficultyOf(current) * this.skillMultiplierSpinner;
4820
+ }
4809
4821
  const snapDifficulty = OsuSnapAimEvaluator.evaluateDifficultyOf(current, this.withSliders) * this.skillMultiplierSnap;
4810
4822
  const agilityDifficulty = OsuAgilityEvaluator.evaluateDifficultyOf(current) *
4811
4823
  this.skillMultiplierAgility;
@@ -5545,7 +5557,7 @@ class OsuDifficultyHitObject extends DifficultyHitObject {
5545
5557
  this.mode = osuBase.Modes.Osu;
5546
5558
  }
5547
5559
  get smallCircleBonus() {
5548
- return Math.max(1, 1 + (30 - this.object.radius) / 70);
5560
+ return Math.max(1, 1 + (30 - this.object.radius) / 75);
5549
5561
  }
5550
5562
  get overallDifficulty() {
5551
5563
  const hitWindowGreat = this.hitWindowFor(osuBase.HitResult.Great) / 2;
@@ -5654,8 +5666,12 @@ class OsuFlashlight extends OsuSkill {
5654
5666
  else if (this.mods.has(osuBase.ModAutopilot)) {
5655
5667
  difficulty *= 0.4;
5656
5668
  }
5657
- difficulty *=
5658
- 0.985 + Math.pow(Math.max(0, current.overallDifficulty), 2) / 4000;
5669
+ // Spinner OD is a special case wherein we don't want to apply rates, and the available hit windows on the object itself are all empty.
5670
+ // Trying to account for this is more effort than its worth, so skip OD scaling.
5671
+ if (!(current.object instanceof osuBase.Spinner)) {
5672
+ difficulty *=
5673
+ 0.985 + Math.pow(Math.max(0, current.overallDifficulty), 2) / 4000;
5674
+ }
5659
5675
  return difficulty;
5660
5676
  }
5661
5677
  strainDecay(ms) {