From 06565871d684549769ed28b30742f5eed609ea8f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 24 Jun 2023 01:03:18 +0900 Subject: [PATCH] Add flag to disable computing legacy scoring values --- .../Difficulty/CatchDifficultyCalculator.cs | 17 +++++++++++------ .../Difficulty/ManiaDifficultyCalculator.cs | 13 +++++++++---- .../Difficulty/OsuDifficultyCalculator.cs | 17 +++++++++++------ .../Difficulty/TaikoDifficultyCalculator.cs | 17 +++++++++++------ .../Rulesets/Difficulty/DifficultyCalculator.cs | 7 +++++++ 5 files changed, 49 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 36af9fb980..a44aaf6dfa 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -41,18 +41,23 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat // this is the same as osu!, so there's potential to share the implementation... maybe double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate; - CatchScoreV1Processor sv1Processor = new CatchScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); - - return new CatchDifficultyAttributes + CatchDifficultyAttributes attributes = new CatchDifficultyAttributes { StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor, Mods = mods, ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)), - LegacyAccuracyScore = sv1Processor.AccuracyScore, - LegacyComboScore = sv1Processor.ComboScore, - LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio }; + + if (ComputeLegacyScoringValues) + { + CatchScoreV1Processor sv1Processor = new CatchScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); + attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore; + attributes.LegacyComboScore = sv1Processor.ComboScore; + attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio; + } + + return attributes; } protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index d1058a9f8c..675f6099e2 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -48,9 +48,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat HitWindows hitWindows = new ManiaHitWindows(); hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty); - ManiaScoreV1Processor sv1Processor = new ManiaScoreV1Processor(mods); - - return new ManiaDifficultyAttributes + ManiaDifficultyAttributes attributes = new ManiaDifficultyAttributes { StarRating = skills[0].DifficultyValue() * star_scaling_factor, Mods = mods, @@ -58,8 +56,15 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat // This is done the way it is to introduce fractional differences in order to match osu-stable for the time being. GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate), MaxCombo = beatmap.HitObjects.Sum(maxComboForObject), - LegacyComboScore = sv1Processor.TotalScore }; + + if (ComputeLegacyScoringValues) + { + ManiaScoreV1Processor sv1Processor = new ManiaScoreV1Processor(mods); + attributes.LegacyComboScore = sv1Processor.TotalScore; + } + + return attributes; } private static int maxComboForObject(HitObject hitObject) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 5d6ed4792d..5158ea8a16 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -91,9 +91,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat double hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate; - OsuScoreV1Processor sv1Processor = new OsuScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); - - return new OsuDifficultyAttributes + OsuDifficultyAttributes attributes = new OsuDifficultyAttributes { StarRating = starRating, Mods = mods, @@ -109,10 +107,17 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat HitCircleCount = hitCirclesCount, SliderCount = sliderCount, SpinnerCount = spinnerCount, - LegacyAccuracyScore = sv1Processor.AccuracyScore, - LegacyComboScore = sv1Processor.ComboScore, - LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio }; + + if (ComputeLegacyScoringValues) + { + OsuScoreV1Processor sv1Processor = new OsuScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); + attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore; + attributes.LegacyComboScore = sv1Processor.ComboScore; + attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio; + } + + return attributes; } protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 49222adc89..d2f19e1e67 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -89,9 +89,7 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat HitWindows hitWindows = new TaikoHitWindows(); hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty); - TaikoScoreV1Processor sv1Processor = new TaikoScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); - - return new TaikoDifficultyAttributes + TaikoDifficultyAttributes attributes = new TaikoDifficultyAttributes { StarRating = starRating, Mods = mods, @@ -101,10 +99,17 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat PeakDifficulty = combinedRating, GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate, MaxCombo = beatmap.HitObjects.Count(h => h is Hit), - LegacyAccuracyScore = sv1Processor.AccuracyScore, - LegacyComboScore = sv1Processor.ComboScore, - LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio }; + + if (ComputeLegacyScoringValues) + { + TaikoScoreV1Processor sv1Processor = new TaikoScoreV1Processor(workingBeatmap.Beatmap, beatmap, mods); + attributes.LegacyAccuracyScore = sv1Processor.AccuracyScore; + attributes.LegacyComboScore = sv1Processor.ComboScore; + attributes.LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio; + } + + return attributes; } /// diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 00c90bd317..d005bbfc7a 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -23,6 +23,13 @@ namespace osu.Game.Rulesets.Difficulty { public abstract class DifficultyCalculator { + /// + /// Whether legacy scoring values (ScoreV1) should be computed to populate the difficulty attributes + /// , , + /// and . + /// + public bool ComputeLegacyScoringValues; + /// /// The beatmap for which difficulty will be calculated. ///