mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:05:29 +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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
|
|
||||||
// create statistics assuming all hit objects have perfect hit result
|
// create statistics assuming all hit objects have perfect hit result
|
||||||
var statistics = beatmap.HitObjects
|
var statistics = beatmap.HitObjects
|
||||||
.Select(ho => ho.CreateJudgement().MaxResult)
|
.SelectMany(getPerfectHitResults)
|
||||||
.GroupBy(hr => hr, (hr, list) => (hitResult: hr, count: list.Count()))
|
.GroupBy(hr => hr, (hr, list) => (hitResult: hr, count: list.Count()))
|
||||||
.ToDictionary(pair => pair.hitResult, pair => pair.count);
|
.ToDictionary(pair => pair.hitResult, pair => pair.count);
|
||||||
perfectPlay.Statistics = statistics;
|
perfectPlay.Statistics = statistics;
|
||||||
@ -89,5 +91,13 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
return ruleset.CreatePerformanceCalculator(difficulty.Value.Attributes, perfectPlay)?.Calculate();
|
return ruleset.CreatePerformanceCalculator(difficulty.Value.Attributes, perfectPlay)?.Calculate();
|
||||||
}, cancellationToken);
|
}, 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