From d4bfbe59174a7669d6027d704092ff829cb990d5 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 29 Aug 2024 20:21:32 +0900 Subject: [PATCH 1/3] Add test --- .../ManiaScoreProcessorTest.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 osu.Game.Rulesets.Mania.Tests/ManiaScoreProcessorTest.cs diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaScoreProcessorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaScoreProcessorTest.cs new file mode 100644 index 000000000000..1516aaf05858 --- /dev/null +++ b/osu.Game.Rulesets.Mania.Tests/ManiaScoreProcessorTest.cs @@ -0,0 +1,39 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using NUnit.Framework; +using osu.Game.Rulesets.Mania.Scoring; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; + +namespace osu.Game.Rulesets.Mania.Tests +{ + [TestFixture] + public class ManiaScoreProcessorTest + { + [TestCase(ScoreRank.X, 1, HitResult.Perfect)] + [TestCase(ScoreRank.X, 0.99, HitResult.Great)] + [TestCase(ScoreRank.D, 0.1, HitResult.Great)] + [TestCase(ScoreRank.X, 0.99, HitResult.Perfect, HitResult.Great)] + [TestCase(ScoreRank.X, 0.99, HitResult.Great, HitResult.Great)] + [TestCase(ScoreRank.S, 0.99, HitResult.Perfect, HitResult.Good)] + [TestCase(ScoreRank.S, 0.99, HitResult.Perfect, HitResult.Ok)] + [TestCase(ScoreRank.S, 0.99, HitResult.Perfect, HitResult.Meh)] + [TestCase(ScoreRank.S, 0.99, HitResult.Perfect, HitResult.Miss)] + [TestCase(ScoreRank.S, 0.99, HitResult.Great, HitResult.Good)] + [TestCase(ScoreRank.S, 0.99, HitResult.Great, HitResult.Ok)] + [TestCase(ScoreRank.S, 0.99, HitResult.Great, HitResult.Meh)] + [TestCase(ScoreRank.S, 0.99, HitResult.Great, HitResult.Miss)] + public void TestRanks(ScoreRank expected, double accuracy, params HitResult[] results) + { + var scoreProcessor = new ManiaScoreProcessor(); + + Dictionary resultsDict = new Dictionary(); + foreach (var result in results) + resultsDict[result] = resultsDict.GetValueOrDefault(result) + 1; + + Assert.That(scoreProcessor.RankFromScore(accuracy, resultsDict), Is.EqualTo(expected)); + } + } +} From d59d5685d08ef99f15beba32e60f2ebe0c2b9c18 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 29 Aug 2024 20:21:59 +0900 Subject: [PATCH 2/3] Make mania award SS even if there are GREAT judgements --- .../Scoring/ManiaScoreProcessor.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 0444394d8747..dfd6ed6dd245 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; namespace osu.Game.Rulesets.Mania.Scoring { @@ -58,6 +59,24 @@ private int getBaseComboScoreForResult(HitResult result) return GetBaseScoreForResult(result); } + public override ScoreRank RankFromScore(double accuracy, IReadOnlyDictionary results) + { + ScoreRank rank = base.RankFromScore(accuracy, results); + + if (rank != ScoreRank.S) + return rank; + + // SS is expected as long as all hitobjects have been hit with either a GREAT or PERFECT result. + + bool anyImperfect = + results.GetValueOrDefault(HitResult.Good) > 0 + || results.GetValueOrDefault(HitResult.Ok) > 0 + || results.GetValueOrDefault(HitResult.Meh) > 0 + || results.GetValueOrDefault(HitResult.Miss) > 0; + + return anyImperfect ? rank : ScoreRank.X; + } + private class JudgementOrderComparer : IComparer { public static readonly JudgementOrderComparer DEFAULT = new JudgementOrderComparer(); From d97a94aadd68aada70a8d808fdb7622e96267e44 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 29 Aug 2024 20:22:54 +0900 Subject: [PATCH 3/3] Change accuracy circle to show badges based on score rank --- osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index cebc54f49028..319a87fdfcbc 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -298,7 +298,7 @@ protected override void LoadComplete() { foreach (var badge in badges) { - if (badge.Accuracy > score.Accuracy) + if (badge.Rank > score.Rank) continue; using (BeginDelayedSequence(