diff --git a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs index fd3b1c548..ea7e83fcc 100644 --- a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs @@ -45,7 +45,7 @@ public class OsuSimulateCommand : SimulateCommand protected override Dictionary GenerateHitResults(IBeatmap beatmap) => generateHitResults(beatmap, Accuracy / 100, Misses, Mehs, Goods, largeTickMisses, sliderTailMisses); - private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countGood, int? countLargeTickMisses, int? countSliderTailMisses) + private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countGood, int countLargeTickMisses, int countSliderTailMisses) { int countGreat; @@ -121,21 +121,15 @@ private static Dictionary generateHitResults(IBeatmap beatmap, d countGreat = (int)(totalResultCount - countGood - countMeh - countMiss); } - var result = new Dictionary + return new Dictionary { { HitResult.Great, countGreat }, { HitResult.Ok, countGood ?? 0 }, { HitResult.Meh, countMeh ?? 0 }, + { HitResult.LargeTickMiss, countLargeTickMisses }, + { HitResult.SliderTailHit, beatmap.HitObjects.Count(x => x is Slider) - countSliderTailMisses }, { HitResult.Miss, countMiss } }; - - if (countLargeTickMisses != null) - result[HitResult.LargeTickMiss] = countLargeTickMisses.Value; - - if (countSliderTailMisses != null) - result[HitResult.SliderTailHit] = beatmap.HitObjects.Count(x => x is Slider) - countSliderTailMisses.Value; - - return result; } protected override double GetAccuracy(IBeatmap beatmap, Dictionary statistics) @@ -145,28 +139,14 @@ protected override double GetAccuracy(IBeatmap beatmap, Dictionary x is Slider); - var countSliderTailHit = statistics[HitResult.SliderTailHit]; - - total += 3 * countSliderTailHit; - max += 3 * countSliders; - } + var countSliders = beatmap.HitObjects.Count(x => x is Slider); + var countSliderTailHit = statistics[HitResult.SliderTailHit]; + var countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); + var countLargeTickHit = countLargeTicks - statistics[HitResult.LargeTickMiss]; - if (statistics.ContainsKey(HitResult.LargeTickMiss)) - { - var countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); - var countLargeTickHit = countLargeTicks - statistics[HitResult.LargeTickMiss]; - - total += 0.6 * countLargeTickHit; - max += 0.6 * countLargeTicks; - } + double total = 6 * (countGreat + countGood + countMeh + countMiss) + 3 * countSliders + 0.6 * countLargeTicks; - return total / max; + return (6 * countGreat + 2 * countGood + countMeh + 3 * countSliderTailHit + 0.6 * countLargeTickHit) / total; } } }