From 09f6889eae605a5642cab177328b21c8a4bbe739 Mon Sep 17 00:00:00 2001 From: danielthirtle Date: Wed, 8 Jan 2025 01:51:32 +1300 Subject: [PATCH] code cleanup --- .../Difficulty/OsuPerformanceCalculator.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 43ca18cb23..5572ba0af4 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -167,9 +167,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (effectiveMissCount > 0) { - double missedComboPercent = 1.0 - (double)score.MaxCombo / attributes.MaxCombo; - double estimatedSliderbreaks = Math.Min(countMeh + countOk, countMiss * attributes.AimTopWeightedSliderFactor) * DifficultyCalculationUtils.Logistic(missedComboPercent, 0.33, 15); - aimValue *= calculateMissPenalty(effectiveMissCount + (usingClassicSliderAccuracy ? estimatedSliderbreaks : 0), attributes.AimDifficultStrainCount); + double estimatedSliderbreaks = calculateEstimatedSliderbreaks(attributes.AimTopWeightedSliderFactor, attributes); + aimValue *= calculateMissPenalty(effectiveMissCount + estimatedSliderbreaks, attributes.AimDifficultStrainCount); } double approachRateFactor = 0.0; @@ -211,9 +210,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (effectiveMissCount > 0) { - double missedComboPercent = 1.0 - (double)score.MaxCombo / attributes.MaxCombo; - double estimatedSliderbreaks = Math.Min(countMeh + countOk, countMiss * attributes.SpeedTopWeightedSliderFactor) * DifficultyCalculationUtils.Logistic(missedComboPercent, 0.33, 15); - speedValue *= calculateMissPenalty(effectiveMissCount + (usingClassicSliderAccuracy ? estimatedSliderbreaks : 0), attributes.SpeedDifficultStrainCount); + double estimatedSliderbreaks = calculateEstimatedSliderbreaks(attributes.SpeedTopWeightedSliderFactor, attributes); + speedValue *= calculateMissPenalty(effectiveMissCount + estimatedSliderbreaks, attributes.SpeedDifficultStrainCount); } double approachRateFactor = 0.0; @@ -318,6 +316,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty // to make it more punishing on maps with lower amount of hard sections. private double calculateMissPenalty(double missCount, double difficultStrainCount) => 0.96 / ((missCount / (4 * Math.Pow(Math.Log(difficultStrainCount), 0.94))) + 1); 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 double calculateEstimatedSliderbreaks(double topWeightedSliderFactor, OsuDifficultyAttributes attributes) + { + if (!usingClassicSliderAccuracy) + return 0; + double missedComboPercent = 1.0 - (double)scoreMaxCombo / attributes.MaxCombo; + double estimatedSliderbreaks = countMiss * topWeightedSliderFactor * DifficultyCalculationUtils.Logistic(missedComboPercent, 0.33, 15); + return Math.Min(countMeh + countOk, estimatedSliderbreaks); + } private int totalHits => countGreat + countOk + countMeh + countMiss; private int totalImperfectHits => countOk + countMeh + countMiss; }