From accbf8bbd2fb717ac3543e3159050f589d351fa3 Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Sun, 16 Jun 2024 17:12:35 +0300 Subject: [PATCH] fixed the bug --- .../Difficulty/DifficultyCalculator.cs | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index d37cfc28b9dc..4644a457bfc1 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -109,26 +109,23 @@ public List CalculateTimed([NotNull] IEnumerable var progressiveBeatmap = new ProgressiveCalculationBeatmap(Beatmap); var difficultyObjects = getDifficultyHitObjects().ToArray(); - foreach (var obj in difficultyObjects) - { - // Implementations expect the progressive beatmap to only contain top-level objects from the original beatmap. - // At the same time, we also need to consider the possibility DHOs may not be generated for any given object, - // so we'll add all remaining objects up to the current point in time to the progressive beatmap. - for (int i = progressiveBeatmap.HitObjects.Count; i < Beatmap.HitObjects.Count; i++) - { - if (obj != difficultyObjects[^1] && Beatmap.HitObjects[i].StartTime > obj.BaseObject.StartTime) - break; + int currentIndex = 0; - progressiveBeatmap.HitObjects.Add(Beatmap.HitObjects[i]); - } + foreach (var obj in Beatmap.HitObjects) + { + progressiveBeatmap.HitObjects.Add(obj); - foreach (var skill in skills) + while (currentIndex < difficultyObjects.Length && difficultyObjects[currentIndex].BaseObject.GetEndTime() <= obj.GetEndTime()) { - cancellationToken.ThrowIfCancellationRequested(); - skill.Process(obj); + foreach (var skill in skills) + { + cancellationToken.ThrowIfCancellationRequested(); + skill.Process(difficultyObjects[currentIndex]); + } + currentIndex++; } - attribs.Add(new TimedDifficultyAttributes(obj.EndTime * clockRate, CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate))); + attribs.Add(new TimedDifficultyAttributes(obj.GetEndTime(), CreateDifficultyAttributes(progressiveBeatmap, playableMods, skills, clockRate))); } return attribs;