diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
index b5f42ec2cc..1e03a3ff80 100644
--- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
+++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs
@@ -7,21 +7,28 @@ using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
using osu.Framework.Bindables;
+using osu.Framework.Localisation;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Extensions;
+using osu.Game.Localisation;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Replays;
using osu.Game.Scoring;
-using osu.Framework.Localisation;
-using osu.Game.Localisation;
namespace osu.Game.Rulesets.Scoring
{
public partial class ScoreProcessor : JudgementProcessor
{
+ private const double accuracy_cutoff_x = 1;
+ private const double accuracy_cutoff_s = 0.95;
+ private const double accuracy_cutoff_a = 0.9;
+ private const double accuracy_cutoff_b = 0.8;
+ private const double accuracy_cutoff_c = 0.7;
+ private const double accuracy_cutoff_d = 0;
+
private const double max_score = 1000000;
///
@@ -160,7 +167,7 @@ namespace osu.Game.Rulesets.Scoring
Combo.ValueChanged += combo => HighestCombo.Value = Math.Max(HighestCombo.Value, combo.NewValue);
Accuracy.ValueChanged += accuracy =>
{
- Rank.Value = rankFrom(accuracy.NewValue);
+ Rank.Value = RankFromAccuracy(accuracy.NewValue);
foreach (var mod in Mods.Value.OfType())
Rank.Value = mod.AdjustRank(Rank.Value, accuracy.NewValue);
};
@@ -369,22 +376,6 @@ namespace osu.Game.Rulesets.Scoring
}
}
- private ScoreRank rankFrom(double acc)
- {
- if (acc == 1)
- return ScoreRank.X;
- if (acc >= 0.95)
- return ScoreRank.S;
- if (acc >= 0.9)
- return ScoreRank.A;
- if (acc >= 0.8)
- return ScoreRank.B;
- if (acc >= 0.7)
- return ScoreRank.C;
-
- return ScoreRank.D;
- }
-
///
/// Resets this ScoreProcessor to a default state.
///
@@ -583,6 +574,70 @@ namespace osu.Game.Rulesets.Scoring
hitEvents.Clear();
}
+ #region Static helper methods
+
+ ///
+ /// Given an accuracy (0..1), return the correct .
+ ///
+ public static ScoreRank RankFromAccuracy(double accuracy)
+ {
+ switch (accuracy)
+ {
+ case accuracy_cutoff_x:
+ return ScoreRank.X;
+
+ case >= accuracy_cutoff_s:
+ return ScoreRank.S;
+
+ case >= accuracy_cutoff_a:
+ return ScoreRank.A;
+
+ case >= accuracy_cutoff_b:
+ return ScoreRank.B;
+
+ case >= accuracy_cutoff_c:
+ return ScoreRank.C;
+
+ default:
+ return ScoreRank.D;
+ }
+ }
+
+ ///
+ /// Given a , return the cutoff accuracy (0..1).
+ /// Accuracy must be great or equal to the cutoff to qualify for the provided rank.
+ ///
+ public static double AccuracyCutoffFromRank(ScoreRank rank)
+ {
+ switch (rank)
+ {
+ case ScoreRank.X:
+ case ScoreRank.XH:
+ return accuracy_cutoff_x;
+
+ case ScoreRank.S:
+ case ScoreRank.SH:
+ return accuracy_cutoff_s;
+
+ case ScoreRank.A:
+ return accuracy_cutoff_a;
+
+ case ScoreRank.B:
+ return accuracy_cutoff_b;
+
+ case ScoreRank.C:
+ return accuracy_cutoff_c;
+
+ case ScoreRank.D:
+ return accuracy_cutoff_d;
+
+ default:
+ throw new ArgumentOutOfRangeException(nameof(rank), rank, null);
+ }
+ }
+
+ #endregion
+
///
/// Stores the required scoring data that fulfils the minimum requirements for a to calculate score.
///
diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs
index 31ce3ddf95..2ec4270c3c 100644
--- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs
+++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs
@@ -17,6 +17,7 @@ using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
+using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Skinning;
using osuTK;
@@ -28,17 +29,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
///
public partial class AccuracyCircle : CompositeDrawable
{
- private const double accuracy_x = 1;
-
- private const double accuracy_s = 0.95;
-
- private const double accuracy_a = 0.9;
-
- private const double accuracy_b = 0.8;
-
- private const double accuracy_c = 0.7;
-
- private const double accuracy_d = 0;
+ private static readonly double accuracy_x = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.X);
+ private static readonly double accuracy_s = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.S);
+ private static readonly double accuracy_a = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.A);
+ private static readonly double accuracy_b = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.B);
+ private static readonly double accuracy_c = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.C);
+ private static readonly double accuracy_d = ScoreProcessor.AccuracyCutoffFromRank(ScoreRank.D);
///
/// Duration for the transforms causing this component to appear.