diff --git a/osu.Game.Tests/Resources/TestResources.cs b/osu.Game.Tests/Resources/TestResources.cs index 81b624f908..00bb02a937 100644 --- a/osu.Game.Tests/Resources/TestResources.cs +++ b/osu.Game.Tests/Resources/TestResources.cs @@ -133,6 +133,7 @@ namespace osu.Game.Tests.Resources StarRating = diff, Length = length, BPM = bpm, + MaxCombo = 1000, Hash = Guid.NewGuid().ToString().ComputeMD5Hash(), Ruleset = rulesetInfo, Metadata = metadata, diff --git a/osu.Game/Rulesets/Scoring/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs index 514232db69..decd04967f 100644 --- a/osu.Game/Rulesets/Scoring/HitResult.cs +++ b/osu.Game/Rulesets/Scoring/HitResult.cs @@ -122,19 +122,33 @@ namespace osu.Game.Rulesets.Scoring public static class HitResultExtensions { /// - /// Whether a increases/decreases the combo, and affects the combo portion of the score. + /// Whether a increases the combo. /// - public static bool AffectsCombo(this HitResult result) + public static bool IncreasesCombo(this HitResult result) { switch (result) { - case HitResult.Miss: case HitResult.Meh: case HitResult.Ok: case HitResult.Good: case HitResult.Great: case HitResult.Perfect: case HitResult.LargeTickHit: + return true; + + default: + return false; + } + } + + /// + /// Whether a breaks the combo and resets it back to zero. + /// + public static bool BreaksCombo(this HitResult result) + { + switch (result) + { + case HitResult.Miss: case HitResult.LargeTickMiss: return true; @@ -143,6 +157,12 @@ namespace osu.Game.Rulesets.Scoring } } + /// + /// Whether a increases/breaks the combo, and affects the combo portion of the score. + /// + public static bool AffectsCombo(this HitResult result) + => IncreasesCombo(result) || BreaksCombo(result); + /// /// Whether a affects the accuracy portion of the score. /// diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 0c585fac98..1e268bb2eb 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -166,20 +166,10 @@ namespace osu.Game.Rulesets.Scoring if (!result.Type.IsScorable()) return; - if (result.Type.AffectsCombo()) - { - switch (result.Type) - { - case HitResult.Miss: - case HitResult.LargeTickMiss: - Combo.Value = 0; - break; - - default: - Combo.Value++; - break; - } - } + if (result.Type.IncreasesCombo()) + Combo.Value++; + else if (result.Type.BreaksCombo()) + Combo.Value = 0; double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs index 7e39708e65..1b1aa3a684 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Ranking.Expanded var topStatistics = new List { new AccuracyStatistic(score.Accuracy), - new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out int missCount) || missCount == 0), + new ComboStatistic(score.MaxCombo, beatmap.MaxCombo, score.Statistics.All(stat => !stat.Key.BreaksCombo() || stat.Value == 0)), new PerformanceStatistic(score), }; diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs index b92c244174..67d580270d 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs @@ -25,9 +25,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics /// Creates a new . /// /// The combo to be displayed. + /// The maximum value of . /// Whether this is a perfect combo. - public ComboStatistic(int combo, bool isPerfect) - : base("combo", combo) + public ComboStatistic(int combo, int? maxCombo, bool isPerfect) + : base("combo", combo, maxCombo) { this.isPerfect = isPerfect; }