From 930267a8d05485bd50615448d9f0302c17b9a59b Mon Sep 17 00:00:00 2001 From: fredzio2006 Date: Fri, 2 May 2025 03:54:32 +0200 Subject: [PATCH 1/5] Only allow perfect hits in mania option for Perfect Mod --- osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs index b02a18c9f4..21f497e108 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; +using osu.Game.Configuration; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; @@ -9,13 +11,15 @@ namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModPerfect : ModPerfect { + [SettingSource("Only allow perfect hits")] + public BindableBool PerfectScoreOnly { get; } = new BindableBool(); protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) { if (!isRelevantResult(result.Judgement.MinResult) && !isRelevantResult(result.Judgement.MaxResult) && !isRelevantResult(result.Type)) return false; // Mania allows imperfect "Great" hits without failing. - if (result.Judgement.MaxResult == HitResult.Perfect) + if (result.Judgement.MaxResult == HitResult.Perfect && !PerfectScoreOnly.Value) return result.Type < HitResult.Great; return result.Type != result.Judgement.MaxResult; From 843c48c4f83c070717e62e96e63fde46cd88687d Mon Sep 17 00:00:00 2001 From: fredzio2006 Date: Fri, 2 May 2025 04:35:29 +0200 Subject: [PATCH 2/5] Added blank line --- osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs index 21f497e108..c8e822a466 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods { [SettingSource("Only allow perfect hits")] public BindableBool PerfectScoreOnly { get; } = new BindableBool(); + protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) { if (!isRelevantResult(result.Judgement.MinResult) && !isRelevantResult(result.Judgement.MaxResult) && !isRelevantResult(result.Type)) From 70d2eb841d73fa8b262ad96890502c22763dc424 Mon Sep 17 00:00:00 2001 From: fredzio2006 Date: Wed, 7 May 2025 21:29:17 +0200 Subject: [PATCH 3/5] Add test coverage --- .../Mods/TestSceneManiaModPerfect.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs index b7a9b31dcc..f2bb61bf26 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs @@ -30,11 +30,15 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods [TestCase(true)] public void TestHoldNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HoldNote { StartTime = 1000, EndTime = 3000 }), shouldMiss); - [Test] - public void TestGreatHit() => CreateModTest(new ModTestData + [TestCase(false)] + [TestCase(true)] + public void TestGreatHit(bool onlyPerfectHits) => CreateModTest(new ModTestData { - Mod = new ManiaModPerfect(), - PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), + Mod = new ManiaModPerfect + { + PerfectScoreOnly = { Value = onlyPerfectHits } + }, + PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(onlyPerfectHits), Autoplay = false, CreateBeatmap = () => new Beatmap { From 4d5a7e560424f88207e15a250550f4c0840397a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 8 May 2025 07:46:51 +0200 Subject: [PATCH 4/5] Expand test coverage --- .../Mods/TestSceneManiaModPerfect.cs | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs index f2bb61bf26..316bd800ab 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs @@ -30,15 +30,40 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods [TestCase(true)] public void TestHoldNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HoldNote { StartTime = 1000, EndTime = 3000 }), shouldMiss); - [TestCase(false)] - [TestCase(true)] - public void TestGreatHit(bool onlyPerfectHits) => CreateModTest(new ModTestData + [Test] + public void TestPerfectHits([Values] bool requirePerfectHits) => CreateModTest(new ModTestData { Mod = new ManiaModPerfect { - PerfectScoreOnly = { Value = onlyPerfectHits } + PerfectScoreOnly = { Value = requirePerfectHits } }, - PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(onlyPerfectHits), + PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), + Autoplay = false, + CreateBeatmap = () => new Beatmap + { + HitObjects = new List + { + new Note + { + StartTime = 1000, + } + }, + }, + ReplayFrames = new List + { + new ManiaReplayFrame(1000, ManiaAction.Key1), + new ManiaReplayFrame(2000) + } + }); + + [Test] + public void TestGreatHit([Values] bool requirePerfectHits) => CreateModTest(new ModTestData + { + Mod = new ManiaModPerfect + { + PerfectScoreOnly = { Value = requirePerfectHits } + }, + PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(requirePerfectHits), Autoplay = false, CreateBeatmap = () => new Beatmap { From 1e61abde7498e7d101dfa81b149ddc4d49d3fa36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 8 May 2025 07:47:24 +0200 Subject: [PATCH 5/5] Rename mod setting Just feels better? --- .../Mods/TestSceneManiaModPerfect.cs | 4 ++-- osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs index 316bd800ab..e823d57b0b 100644 --- a/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModPerfect.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods { Mod = new ManiaModPerfect { - PerfectScoreOnly = { Value = requirePerfectHits } + RequirePerfectHits = { Value = requirePerfectHits } }, PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), Autoplay = false, @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods { Mod = new ManiaModPerfect { - PerfectScoreOnly = { Value = requirePerfectHits } + RequirePerfectHits = { Value = requirePerfectHits } }, PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(requirePerfectHits), Autoplay = false, diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs index c8e822a466..7ce750f4f8 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModPerfect.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModPerfect : ModPerfect { - [SettingSource("Only allow perfect hits")] - public BindableBool PerfectScoreOnly { get; } = new BindableBool(); + [SettingSource("Require perfect hits")] + public BindableBool RequirePerfectHits { get; } = new BindableBool(); protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) { @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mania.Mods return false; // Mania allows imperfect "Great" hits without failing. - if (result.Judgement.MaxResult == HitResult.Perfect && !PerfectScoreOnly.Value) + if (result.Judgement.MaxResult == HitResult.Perfect && !RequirePerfectHits.Value) return result.Type < HitResult.Great; return result.Type != result.Judgement.MaxResult;