From 88151eff3f2a49b0882b833392935656357c4131 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 22 Aug 2017 13:34:58 +0900 Subject: [PATCH] Fix dofficulty calculators not working and make mania set the correct key count for non-mania specific maps. --- .../ManiaDifficultyCalculator.cs | 5 +++-- .../UI/ManiaRulesetContainer.cs | 16 +++++++++++++++- .../TaikoDifficultyCalculator.cs | 4 ++-- osu.Game/Beatmaps/DifficultyCalculator.cs | 6 +++++- osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs index aaba4d94f0..1f01750f44 100644 --- a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs @@ -6,6 +6,7 @@ using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using System.Collections.Generic; +using System; namespace osu.Game.Rulesets.Mania { @@ -21,6 +22,6 @@ protected override double CalculateInternal(Dictionary categoryD return 0; } - protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(true, (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize))); } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 58ce05b165..6502b77cac 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -91,7 +91,21 @@ private void load() protected override BeatmapConverter CreateBeatmapConverter() { - availableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize)); + if (IsForCurrentRuleset) + availableColumns = (int)Math.Max(1, Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize)); + else + { + float percentSliderOrSpinner = WorkingBeatmap.Beatmap.HitObjects.Count(h => h is IHasEndTime) / WorkingBeatmap.Beatmap.HitObjects.Count; + if (percentSliderOrSpinner < 0.2) + availableColumns = 7; + else if (percentSliderOrSpinner < 0.3 || Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize) >= 5) + availableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 5 ? 7 : 6; + else if (percentSliderOrSpinner > 0.6) + availableColumns = Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) > 4 ? 5 : 4; + else + availableColumns = Math.Max(4, Math.Min((int)Math.Round(WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty) + 1, 7)); + } + return new ManiaBeatmapConverter(IsForCurrentRuleset, availableColumns); } diff --git a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs index 33e9510f1c..35f849c704 100644 --- a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs @@ -135,6 +135,6 @@ private double calculateDifficulty() return difficulty; } - protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(true); } -} \ No newline at end of file +} diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 474d38aa1b..5071e2c1b6 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -30,11 +30,15 @@ public double Calculate(Dictionary categoryDifficulty = null) public abstract class DifficultyCalculator : DifficultyCalculator where T : HitObject { + protected readonly Beatmap Beatmap; + protected List Objects; protected DifficultyCalculator(Beatmap beatmap) { - Objects = CreateBeatmapConverter().Convert(beatmap, true).HitObjects; + Beatmap = beatmap; + + Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects; foreach (var h in Objects) h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.Difficulty); diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index c7240448b9..1d5b27a7fb 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -169,7 +169,7 @@ internal RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap, bool i throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the current ruleset (converter: {converter})."); // Convert the beatmap - Beatmap = converter.Convert(workingBeatmap.Beatmap, isForCurrentRuleset); + Beatmap = converter.Convert(workingBeatmap.Beatmap); // Apply difficulty adjustments from mods before using Difficulty. foreach (var mod in Mods.OfType())