From 9a982a9564e11252ba3a7e0dda77ffc6c0d86e0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 13 Dec 2023 17:13:15 +0900 Subject: [PATCH] Tidy up `GetRateAdjustedDisplayDifficulty` implemetations --- osu.Game.Rulesets.Catch/CatchRuleset.cs | 7 +++++-- osu.Game.Rulesets.Osu/OsuRuleset.cs | 10 ++++++++-- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 8 +++++--- osu.Game/Rulesets/Ruleset.cs | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 12d197109b..bcb28328f0 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -240,10 +240,13 @@ namespace osu.Game.Rulesets.Catch { BeatmapDifficulty adjustedDifficulty = new BeatmapDifficulty(difficulty); - double preempt = adjustedDifficulty.ApproachRate < 6 ? (1200.0 + 600.0 * (5 - adjustedDifficulty.ApproachRate) / 5) : (1200.0 - 750.0 * (adjustedDifficulty.ApproachRate - 5) / 5); + double preempt = adjustedDifficulty.ApproachRate < 6 + ? 1200.0 + 600.0 * (5 - adjustedDifficulty.ApproachRate) / 5 + : 1200.0 - 750.0 * (adjustedDifficulty.ApproachRate - 5) / 5; preempt /= rate; - adjustedDifficulty.ApproachRate = (float)(preempt > 1200 ? ((1800 - preempt) / 120) : ((1200 - preempt) / 150 + 5)); + + adjustedDifficulty.ApproachRate = (float)(preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5); return adjustedDifficulty; } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 88489f2dc3..5355743a50 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -336,12 +336,18 @@ namespace osu.Game.Rulesets.Osu { BeatmapDifficulty adjustedDifficulty = new BeatmapDifficulty(difficulty); - double preempt = adjustedDifficulty.ApproachRate < 5 ? (1200.0 + 600.0 * (5 - adjustedDifficulty.ApproachRate) / 5) : (1200.0 - 750.0 * (adjustedDifficulty.ApproachRate - 5) / 5); + double preempt = adjustedDifficulty.ApproachRate < 5 + ? 1200.0 + 600.0 * (5 - adjustedDifficulty.ApproachRate) / 5 + : 1200.0 - 750.0 * (adjustedDifficulty.ApproachRate - 5) / 5; + preempt /= rate; - adjustedDifficulty.ApproachRate = (float)(preempt > 1200 ? ((1800 - preempt) / 120) : ((1200 - preempt) / 150 + 5)); + + adjustedDifficulty.ApproachRate = (float)(preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5); double hitwindow = 80.0 - 6 * adjustedDifficulty.OverallDifficulty; + hitwindow /= rate; + adjustedDifficulty.OverallDifficulty = (float)(80.0 - hitwindow) / 6; return adjustedDifficulty; diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 6e5cdbf2d1..94136a11d3 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -269,9 +269,11 @@ namespace osu.Game.Rulesets.Taiko { BeatmapDifficulty adjustedDifficulty = new BeatmapDifficulty(difficulty); - double hitwindow = 35.0 - 15.0 * (adjustedDifficulty.OverallDifficulty - 5) / 5; - hitwindow /= rate; - adjustedDifficulty.OverallDifficulty = (float)(5 * (35 - hitwindow) / 15 + 5); + double hitWindow = 35.0 - 15.0 * (adjustedDifficulty.OverallDifficulty - 5) / 5; + + hitWindow /= rate; + + adjustedDifficulty.OverallDifficulty = (float)(5 * (35 - hitWindow) / 15 + 5); return adjustedDifficulty; } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index c7c81ecb55..37a35fd3ae 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -380,6 +380,7 @@ namespace osu.Game.Rulesets /// /// Applies changes to difficulty attributes for presenting to a user a rough estimate of how rate adjust mods affect difficulty. /// Importantly, this should NOT BE USED FOR ANY CALCULATIONS. + /// /// It is also not always correct, and arguably is never correct depending on your frame of mind. /// /// >The that will be adjusted.