From 640f2b53494746e9b3de24c981f85e5ebd80d954 Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Fri, 15 Nov 2024 20:46:40 +0200 Subject: [PATCH 1/3] revert offtopic change --- .../Simulate/OsuSimulateCommand.cs | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) 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; } } } From 8b210e852b92c1ee3ddac87b439d980b54ac6c9a Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Sat, 16 Nov 2024 02:27:50 +0200 Subject: [PATCH 2/3] revert accidental change --- PerformanceCalculator/Simulate/SimulateCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs index be319ad99..957b2f290 100644 --- a/PerformanceCalculator/Simulate/SimulateCommand.cs +++ b/PerformanceCalculator/Simulate/SimulateCommand.cs @@ -63,7 +63,7 @@ public override void Execute() var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(Beatmap); var mods = ParseMods(ruleset, Mods, ModOptions); - var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); var beatmapMaxCombo = beatmap.GetMaxCombo(); var statistics = GenerateHitResults(beatmap); From 64675e4b6a871095302cede824acf5f94a87aee9 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 18 Nov 2024 17:04:17 +0900 Subject: [PATCH 3/3] Revert "Merge pull request #232 from Givikap120/fix_acc_formula_console" This reverts commit 80e80179761a0ec3de2ab61b6657f2e963acbdf3, reversing changes made to 3057db5e7842f78307508e3e4e9ca7433633ea46. --- .../Simulate/CatchSimulateCommand.cs | 5 +- .../Simulate/ManiaSimulateCommand.cs | 29 +++++----- .../Simulate/OsuSimulateCommand.cs | 54 ++++--------------- .../Simulate/SimulateCommand.cs | 7 ++- .../Simulate/TaikoSimulateCommand.cs | 5 +- 5 files changed, 28 insertions(+), 72 deletions(-) diff --git a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs index 86fa47101..f2fb26958 100644 --- a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs @@ -7,7 +7,6 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Catch.Objects; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using System; using System.Collections.Generic; @@ -36,9 +35,7 @@ public class CatchSimulateCommand : SimulateCommand public override Ruleset Ruleset => new CatchRuleset(); - protected override Dictionary GenerateHitResults(IBeatmap beatmap, Mod[] mods) => generateHitResults(beatmap, Accuracy / 100, Misses, Mehs, Goods); - - private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countGood) + protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { var maxCombo = beatmap.GetMaxCombo(); int maxTinyDroplets = beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.OfType().Count()); diff --git a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs index 0287c50df..22ed21a4a 100644 --- a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Objects; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; namespace PerformanceCalculator.Simulate @@ -36,23 +35,21 @@ public class ManiaSimulateCommand : SimulateCommand public override Ruleset Ruleset => new ManiaRuleset(); - protected override Dictionary GenerateHitResults(IBeatmap beatmap, Mod[] mods) => generateHitResults(beatmap, Accuracy / 100, Misses, Mehs, oks, Goods, greats); - - private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countOk, int? countGood, int? countGreat) + 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). var totalHits = beatmap.HitObjects.Count + beatmap.HitObjects.Count(ho => ho is HoldNote); - if (countMeh != null || countOk != null || countGood != null || countGreat != null) + if (countMeh != null || oks != null || countGood != null || greats != null) { - int countPerfect = totalHits - (countMiss + (countMeh ?? 0) + (countOk ?? 0) + (countGood ?? 0) + (countGreat ?? 0)); + int countPerfect = totalHits - (countMiss + (countMeh ?? 0) + (oks ?? 0) + (countGood ?? 0) + (greats ?? 0)); return new Dictionary { [HitResult.Perfect] = countPerfect, - [HitResult.Great] = countGreat ?? 0, + [HitResult.Great] = greats ?? 0, [HitResult.Good] = countGood ?? 0, - [HitResult.Ok] = countOk ?? 0, + [HitResult.Ok] = oks ?? 0, [HitResult.Meh] = countMeh ?? 0, [HitResult.Miss] = countMiss }; @@ -69,10 +66,10 @@ private static Dictionary generateHitResults(IBeatmap beatmap, d // Each great and perfect increases total by 5 (great-meh=5) // There is no difference in accuracy between them, so just halve arbitrarily (favouring perfects for an odd number). int greatsAndPerfects = Math.Min(delta / 5, remainingHits); - int greats = greatsAndPerfects / 2; - int perfects = greatsAndPerfects - greats; - delta -= (greats + perfects) * 5; - remainingHits -= greats + perfects; + int countGreat = greatsAndPerfects / 2; + int perfects = greatsAndPerfects - countGreat; + delta -= (countGreat + perfects) * 5; + remainingHits -= countGreat + perfects; // Each good increases total by 3 (good-meh=3). countGood = Math.Min(delta / 3, remainingHits); @@ -80,8 +77,8 @@ private static Dictionary generateHitResults(IBeatmap beatmap, d remainingHits -= countGood.Value; // Each ok increases total by 1 (ok-meh=1). - int oks = delta; - remainingHits -= oks; + int countOk = delta; + remainingHits -= countOk; // Everything else is a meh, as initially assumed. countMeh = remainingHits; @@ -89,8 +86,8 @@ private static Dictionary generateHitResults(IBeatmap beatmap, d return new Dictionary { { HitResult.Perfect, perfects }, - { HitResult.Great, greats }, - { HitResult.Ok, oks }, + { HitResult.Great, countGreat }, + { HitResult.Ok, countOk }, { HitResult.Good, countGood.Value }, { HitResult.Meh, countMeh.Value }, { HitResult.Miss, countMiss } diff --git a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs index 246897b37..1b76cb0af 100644 --- a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs @@ -8,9 +8,7 @@ using McMaster.Extensions.CommandLineUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; -using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; @@ -45,19 +43,7 @@ public class OsuSimulateCommand : SimulateCommand public override Ruleset Ruleset => new OsuRuleset(); - protected override Dictionary GenerateHitResults(IBeatmap beatmap, Mod[] mods) - { - if (mods.OfType().Any(m => m.NoSliderHeadAccuracy.Value)) - { - return generateHitResults(beatmap, Accuracy / 100, Misses, Mehs, Goods, null, null); - } - else - { - return 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) + protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { int countGreat; @@ -133,21 +119,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, largeTickMisses }, + { HitResult.SliderTailHit, beatmap.HitObjects.Count(x => x is Slider) - sliderTailMisses }, { 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) @@ -157,28 +137,14 @@ protected override double GetAccuracy(IBeatmap beatmap, Dictionary 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.SliderTailHit)) - { - var countSliders = beatmap.HitObjects.Count(x => x is Slider); - var countSliderTailHit = statistics[HitResult.SliderTailHit]; - - total += 3 * countSliderTailHit; - max += 3 * countSliders; - } - - 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; } } } diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs index 6f17cf634..c7c31b1c1 100644 --- a/PerformanceCalculator/Simulate/SimulateCommand.cs +++ b/PerformanceCalculator/Simulate/SimulateCommand.cs @@ -8,7 +8,6 @@ using McMaster.Extensions.CommandLineUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -64,10 +63,10 @@ public override void Execute() var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(Beatmap); var mods = ParseMods(ruleset, Mods, ModOptions); - var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); var beatmapMaxCombo = beatmap.GetMaxCombo(); - var statistics = GenerateHitResults(beatmap, mods); + var statistics = GenerateHitResults(Accuracy / 100, beatmap, Misses, Mehs, Goods); var scoreInfo = new ScoreInfo(beatmap.BeatmapInfo, ruleset.RulesetInfo) { Accuracy = GetAccuracy(beatmap, statistics), @@ -84,7 +83,7 @@ public override void Execute() OutputPerformance(scoreInfo, performanceAttributes, difficultyAttributes); } - protected abstract Dictionary GenerateHitResults(IBeatmap beatmap, Mod[] mods); + protected abstract Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood); protected virtual double GetAccuracy(IBeatmap beatmap, Dictionary statistics) => 0; } diff --git a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs index bf537a7c8..1680f29bb 100644 --- a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs @@ -7,7 +7,6 @@ using McMaster.Extensions.CommandLineUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko; @@ -30,9 +29,7 @@ public class TaikoSimulateCommand : SimulateCommand public override Ruleset Ruleset => new TaikoRuleset(); - protected override Dictionary GenerateHitResults(IBeatmap beatmap, Mod[] mods) => generateHitResults(Accuracy / 100, beatmap, Misses, Goods); - - private static Dictionary generateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countGood) + protected override Dictionary GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { var totalResultCount = beatmap.GetMaxCombo();