From c1b55c7facaa675d62a68179657df8b9a1170846 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 19 Dec 2023 13:48:46 +0900 Subject: [PATCH 1/4] Add ScoreProcessor methods to override numeric result --- .../Scoring/CatchScoreProcessor.cs | 2 +- .../Scoring/ManiaScoreProcessor.cs | 2 +- .../Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 24 ++++++++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 66c76f9b17..503252df02 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Scoring } protected override double GetComboScoreChange(JudgementResult result) - => Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base)); + => GetNumericResultFor(result) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base)); public override ScoreRank RankFromAccuracy(double accuracy) { diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index c53f3c3e07..e5f9b33c6b 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Mania.Scoring } protected override double GetComboScoreChange(JudgementResult result) - => Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base)); + => GetNumericResultFor(result) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base)); private class JudgementOrderComparer : IComparer { diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index a77e6db6f3..a34e977ee9 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring protected override double GetComboScoreChange(JudgementResult result) { - return Judgement.ToNumericResult(result.Type) + return GetNumericResultFor(result) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base)) * strongScaleValue(result); } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index f110172988..aa8905c0b6 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -227,12 +227,12 @@ namespace osu.Game.Rulesets.Scoring if (result.Judgement.MaxResult.AffectsAccuracy()) { - currentMaximumBaseScore += Judgement.ToNumericResult(result.Judgement.MaxResult); + currentMaximumBaseScore += GetMaxNumericResultFor(result); currentAccuracyJudgementCount++; } if (result.Type.AffectsAccuracy()) - currentBaseScore += Judgement.ToNumericResult(result.Type); + currentBaseScore += GetNumericResultFor(result); if (result.Type.IsBonus()) currentBonusPortion += GetBonusScoreChange(result); @@ -276,12 +276,12 @@ namespace osu.Game.Rulesets.Scoring if (result.Judgement.MaxResult.AffectsAccuracy()) { - currentMaximumBaseScore -= Judgement.ToNumericResult(result.Judgement.MaxResult); + currentMaximumBaseScore -= GetMaxNumericResultFor(result); currentAccuracyJudgementCount--; } if (result.Type.AffectsAccuracy()) - currentBaseScore -= Judgement.ToNumericResult(result.Type); + currentBaseScore -= GetNumericResultFor(result); if (result.Type.IsBonus()) currentBonusPortion -= GetBonusScoreChange(result); @@ -297,9 +297,21 @@ namespace osu.Game.Rulesets.Scoring updateScore(); } - protected virtual double GetBonusScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Type); + protected virtual double GetBonusScoreChange(JudgementResult result) => GetNumericResultFor(result); - protected virtual double GetComboScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Judgement.MaxResult) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT); + protected virtual double GetComboScoreChange(JudgementResult result) => GetMaxNumericResultFor(result) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT); + + /// + /// Retrieves the numeric score representation for a . + /// + /// The . + protected virtual double GetNumericResultFor(JudgementResult result) => result.Judgement.NumericResultFor(result); + + /// + /// Retrieves the maximum numeric score representation for a . + /// + /// The . + protected virtual double GetMaxNumericResultFor(JudgementResult result) => result.Judgement.MaxNumericResult; protected virtual void ApplyScoreChange(JudgementResult result) { From 35c0eaee1c5ff6a55609e61aa40c14c6a3645fe9 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 19 Dec 2023 13:50:46 +0900 Subject: [PATCH 2/4] Make taiko OKs worth 150 points --- .../Scoring/TaikoScoreProcessor.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index a34e977ee9..bc1e42c5d1 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -33,6 +33,17 @@ namespace osu.Game.Rulesets.Taiko.Scoring * strongScaleValue(result); } + protected override double GetNumericResultFor(JudgementResult result) + { + switch (result.Type) + { + case HitResult.Ok: + return 150; + } + + return base.GetNumericResultFor(result); + } + private double strongScaleValue(JudgementResult result) { if (result.HitObject is StrongNestedHitObject strong) From f2edb3ea54ef0bd5cbc181bd6b25a4ba20eaba8d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 19 Dec 2023 14:01:08 +0900 Subject: [PATCH 3/4] Add test --- .../TestSceneTaikoScoreProcessor.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs new file mode 100644 index 0000000000..6f3b9f9748 --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs @@ -0,0 +1,41 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Scoring; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + [TestFixture] + public class TestSceneTaikoScoreProcessor + { + [Test] + public void TestInaccurateHitScore() + { + var beatmap = new Beatmap + { + HitObjects = + { + new Hit(), + new Hit { StartTime = 1000 } + } + }; + + var scoreProcessor = new TaikoScoreProcessor(); + scoreProcessor.ApplyBeatmap(beatmap); + + // Apply a miss judgement + scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new TaikoJudgement()) { Type = HitResult.Great }); + scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], new TaikoJudgement()) { Type = HitResult.Ok }); + + Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(453745)); + Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(0.75).Within(0.0001)); + } + } +} From 30957f847cdca20f1ee3a8619c406808289080a0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 19 Dec 2023 14:27:29 +0900 Subject: [PATCH 4/4] Rename class/file (this is not a test scene) --- ...stSceneTaikoScoreProcessor.cs => TaikoScoreProcessorTest.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Rulesets.Taiko.Tests/{TestSceneTaikoScoreProcessor.cs => TaikoScoreProcessorTest.cs} (96%) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoScoreProcessorTest.cs similarity index 96% rename from osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs rename to osu.Game.Rulesets.Taiko.Tests/TaikoScoreProcessorTest.cs index 6f3b9f9748..d74fe99a9f 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoScoreProcessorTest.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.Taiko.Scoring; namespace osu.Game.Rulesets.Taiko.Tests { [TestFixture] - public class TestSceneTaikoScoreProcessor + public class TaikoScoreProcessorTest { [Test] public void TestInaccurateHitScore()