Skip to content

Commit

Permalink
merged givi's accuracy changes
Browse files Browse the repository at this point in the history
stat acc save me
  • Loading branch information
Finadoggie committed May 24, 2024
1 parent 4fe55d4 commit 1f55c14
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s
countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss);
countLargeTickMiss = score.Statistics.GetValueOrDefault(HitResult.LargeTickMiss);

if (totalHits > 0) accuracy = calculateEffectiveAccuracy(countGreat, countOk, countMeh, countMiss, osuAttributes);

if (!useClassicSlider)
countSliderEndsDropped = osuAttributes.SliderCount - score.Statistics.GetValueOrDefault(HitResult.SliderTailHit);

Expand Down Expand Up @@ -192,7 +194,8 @@ private double computeSpeedValue(ScoreInfo score, OsuDifficultyAttributes attrib
double relevantCountGreat = Math.Max(0, countGreat - relevantTotalDiff);
double relevantCountOk = Math.Max(0, countOk - Math.Max(0, relevantTotalDiff - countGreat));
double relevantCountMeh = Math.Max(0, countMeh - Math.Max(0, relevantTotalDiff - countGreat - countOk));
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0);
double relevantCountMiss = Math.Max(0, countMiss - Math.Max(0, relevantTotalDiff - countGreat - countOk - countMeh));
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : calculateEffectiveAccuracy(relevantCountGreat, relevantCountOk, relevantCountMeh, relevantCountMiss, attributes);

// Scale the speed value with accuracy and OD.
speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - Math.Max(attributes.OverallDifficulty, 8)) / 2);
Expand Down Expand Up @@ -283,6 +286,25 @@ private double calculateEffectiveMissCount(OsuDifficultyAttributes attributes)
return Math.Max(countMiss, comboBasedMissCount);
}

// This function is calculating accuracy trying to remove sliders from mistap if slideracc is present
// This is wrong way to do this, but doing it right way overnerfs already set scores
// This is used to no until the better way (statistical accuracy) to do this is present
private double calculateEffectiveAccuracy(double c300, double c100, double c50, double cMiss, OsuDifficultyAttributes attributes)
{
double accuracy = (c300 * 6 + c100 * 2 + c50) / (c300 + c100 + c50 + cMiss) / 6;
if (useClassicSlider) return accuracy;

// Try to remove sliders from mistakes
double mistakesPortion = 1 - accuracy;

double hitcircleRatio = (double)attributes.HitCircleCount / (attributes.HitCircleCount + attributes.SliderCount);
mistakesPortion *= hitcircleRatio;

accuracy = Math.Max(accuracy, 1 - mistakesPortion);

return accuracy;
}

private double getComboScalingFactor(OsuDifficultyAttributes attributes) => attributes.MaxCombo <= 0 ? 1.0 : Math.Min(Math.Pow(scoreMaxCombo, 0.8) / Math.Pow(attributes.MaxCombo, 0.8), 1.0);
private int totalHits => countGreat + countOk + countMeh + countMiss;
}
Expand Down

0 comments on commit 1f55c14

Please sign in to comment.