From 6edaf218ff634df535567f69712a723da21812cf Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Wed, 23 Oct 2024 13:17:31 +0200 Subject: [PATCH] Refactor `GetMaxCombo` --- PerformanceCalculator/Simulate/CatchSimulateCommand.cs | 3 --- PerformanceCalculator/Simulate/ManiaSimulateCommand.cs | 2 -- PerformanceCalculator/Simulate/OsuSimulateCommand.cs | 2 -- PerformanceCalculator/Simulate/SimulateCommand.cs | 2 +- PerformanceCalculator/Simulate/TaikoSimulateCommand.cs | 2 -- 5 files changed, 1 insertion(+), 10 deletions(-) diff --git a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs index 932ed3b..923f801 100644 --- a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs @@ -35,9 +35,6 @@ namespace PerformanceCalculator.Simulate public override Ruleset Ruleset => new CatchRuleset(); - protected override int GetMaxCombo(IBeatmap beatmap) => beatmap.HitObjects.Count(h => h is Fruit) - + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)); - protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { var maxCombo = GetMaxCombo(beatmap); diff --git a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs index b6d66af..22ed21a 100644 --- a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs @@ -35,8 +35,6 @@ namespace PerformanceCalculator.Simulate public override Ruleset Ruleset => new ManiaRuleset(); - protected override int GetMaxCombo(IBeatmap beatmap) => 0; - protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { // One judgement per normal note. Two judgements per hold note (head + tail). diff --git a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs index 10151ee..2d4744f 100644 --- a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs @@ -43,8 +43,6 @@ namespace PerformanceCalculator.Simulate public override Ruleset Ruleset => new OsuRuleset(); - protected override int GetMaxCombo(IBeatmap beatmap) => beatmap.GetMaxCombo(); - protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { int countGreat; diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs index be3dcb5..7ffa3ea 100644 --- a/PerformanceCalculator/Simulate/SimulateCommand.cs +++ b/PerformanceCalculator/Simulate/SimulateCommand.cs @@ -83,7 +83,7 @@ namespace PerformanceCalculator.Simulate OutputPerformance(scoreInfo, performanceAttributes, difficultyAttributes); } - protected abstract int GetMaxCombo(IBeatmap beatmap); + protected static int GetMaxCombo(IBeatmap beatmap) => beatmap.GetMaxCombo(); protected abstract Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood); diff --git a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs index 9559e1c..df62243 100644 --- a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs @@ -31,8 +31,6 @@ namespace PerformanceCalculator.Simulate public override Ruleset Ruleset => new TaikoRuleset(); - protected override int GetMaxCombo(IBeatmap beatmap) => beatmap.HitObjects.OfType().Count(); - protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { var totalResultCount = GetMaxCombo(beatmap);