mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 23:33:23 +08:00
Include hit results of nested hit objects in statistics of perfect score
This commit is contained in:
parent
1ce0b18003
commit
48aa1677dc
@ -1,12 +1,14 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -64,7 +66,7 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
|
||||
// create statistics assuming all hit objects have perfect hit result
|
||||
var statistics = beatmap.HitObjects
|
||||
.Select(ho => ho.CreateJudgement().MaxResult)
|
||||
.SelectMany(getPerfectHitResults)
|
||||
.GroupBy(hr => hr, (hr, list) => (hitResult: hr, count: list.Count()))
|
||||
.ToDictionary(pair => pair.hitResult, pair => pair.count);
|
||||
perfectPlay.Statistics = statistics;
|
||||
@ -89,5 +91,13 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
return ruleset.CreatePerformanceCalculator(difficulty.Value.Attributes, perfectPlay)?.Calculate();
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
private IEnumerable<HitResult> getPerfectHitResults(HitObject hitObject)
|
||||
{
|
||||
foreach (HitObject nested in hitObject.NestedHitObjects)
|
||||
yield return nested.CreateJudgement().MaxResult;
|
||||
|
||||
yield return hitObject.CreateJudgement().MaxResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user