From 240fe1815d42e15cb5cf4f9dd37130e7f10b7c3e Mon Sep 17 00:00:00 2001 From: Samuel Cattini-Schultz Date: Wed, 1 May 2024 23:16:34 +1000 Subject: [PATCH] Update performanceplus --- .../OsuCalculatorServiceTest.cs | 6 +-- .../Services/CalculatorWorkingBeatmap.cs | 2 +- .../Services/OsuCalculatorService.cs | 53 +++++++++---------- osu | 2 +- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Difficalcy.PerformancePlus.Tests/OsuCalculatorServiceTest.cs b/Difficalcy.PerformancePlus.Tests/OsuCalculatorServiceTest.cs index e19812d..805f4a2 100644 --- a/Difficalcy.PerformancePlus.Tests/OsuCalculatorServiceTest.cs +++ b/Difficalcy.PerformancePlus.Tests/OsuCalculatorServiceTest.cs @@ -10,8 +10,8 @@ public class OsuCalculatorServiceTest : CalculatorServiceTest CalculatorService { get; } = new OsuCalculatorService(new InMemoryCache(), new TestBeatmapProvider(typeof(OsuCalculatorService).Assembly.GetName().Name)); [Theory] - [InlineData(6.5800462725623294d, 288.78160455080535d, "diffcalc-test", 0)] - [InlineData(8.8116860850192751d, 721.0879910961528d, "diffcalc-test", 64)] + [InlineData(6.578701261037768d, 288.6125590551904d, "diffcalc-test", 0)] + [InlineData(8.8180306947868328d, 722.9095478161727d, "diffcalc-test", 64)] public void Test(double expectedDifficultyTotal, double expectedPerformanceTotal, string beatmapId, int mods) => TestGetCalculationReturnsCorrectValues(expectedDifficultyTotal, expectedPerformanceTotal, new OsuScore { BeatmapId = beatmapId, Mods = mods }); @@ -27,6 +27,6 @@ public void TestAllParameters() Mehs = 4, Oks = 3, }; - TestGetCalculationReturnsCorrectValues(11.091002784977283, 1080.0385506471903d, score); + TestGetCalculationReturnsCorrectValues(11.098551152482028d, 1082.5784934845988d, score); } } diff --git a/Difficalcy.PerformancePlus/Services/CalculatorWorkingBeatmap.cs b/Difficalcy.PerformancePlus/Services/CalculatorWorkingBeatmap.cs index 99e8411..48ac58c 100644 --- a/Difficalcy.PerformancePlus/Services/CalculatorWorkingBeatmap.cs +++ b/Difficalcy.PerformancePlus/Services/CalculatorWorkingBeatmap.cs @@ -29,7 +29,7 @@ private static Beatmap readFromStream(Stream stream) } protected override IBeatmap GetBeatmap() => _beatmap; - protected override Texture GetBackground() => null; + public override Texture GetBackground() => null; protected override Track GetBeatmapTrack() => null; protected override ISkin GetSkin() => null; public override Stream GetStream(string storagePath) => null; diff --git a/Difficalcy.PerformancePlus/Services/OsuCalculatorService.cs b/Difficalcy.PerformancePlus/Services/OsuCalculatorService.cs index 9062ef0..10d6971 100644 --- a/Difficalcy.PerformancePlus/Services/OsuCalculatorService.cs +++ b/Difficalcy.PerformancePlus/Services/OsuCalculatorService.cs @@ -53,13 +53,13 @@ protected override (object, string) CalculateDifficultyAttributes(OsuScore score { difficultyAttributes.StarRating, difficultyAttributes.MaxCombo, - difficultyAttributes.AimStrain, - difficultyAttributes.JumpAimStrain, - difficultyAttributes.FlowAimStrain, - difficultyAttributes.PrecisionStrain, - difficultyAttributes.SpeedStrain, - difficultyAttributes.StaminaStrain, - difficultyAttributes.AccuracyStrain, + difficultyAttributes.AimDifficulty, + difficultyAttributes.JumpAimDifficulty, + difficultyAttributes.FlowAimDifficulty, + difficultyAttributes.PrecisionDifficulty, + difficultyAttributes.SpeedDifficulty, + difficultyAttributes.StaminaDifficulty, + difficultyAttributes.AccuracyDifficulty, difficultyAttributes.ApproachRate, difficultyAttributes.OverallDifficulty, difficultyAttributes.HitCircleCount, @@ -92,14 +92,13 @@ protected override OsuCalculation CalculatePerformance(OsuScore score, object di Mods = mods }; - var performanceCalculator = OsuRuleset.CreatePerformanceCalculator(osuDifficultyAttributes, scoreInfo); - var performanceAttributes = new Dictionary(); - var performance = performanceCalculator.Calculate(performanceAttributes); + var performanceCalculator = OsuRuleset.CreatePerformanceCalculator(); + var performanceAttributes = performanceCalculator.Calculate(scoreInfo, osuDifficultyAttributes) as OsuPerformanceAttributes; return new OsuCalculation() { Difficulty = GetDifficultyFromDifficultyAttributes(osuDifficultyAttributes), - Performance = GetPerformanceFromPerformanceAttributes(performance, performanceAttributes), + Performance = GetPerformanceFromPerformanceAttributes(performanceAttributes), Accuracy = accuracy, Combo = combo }; @@ -140,28 +139,28 @@ private static OsuDifficulty GetDifficultyFromDifficultyAttributes(OsuDifficulty return new OsuDifficulty() { Total = difficultyAttributes.StarRating, - Aim = difficultyAttributes.AimStrain, - JumpAim = difficultyAttributes.JumpAimStrain, - FlowAim = difficultyAttributes.FlowAimStrain, - Precision = difficultyAttributes.PrecisionStrain, - Speed = difficultyAttributes.SpeedStrain, - Stamina = difficultyAttributes.StaminaStrain, - Accuracy = difficultyAttributes.AccuracyStrain + Aim = difficultyAttributes.AimDifficulty, + JumpAim = difficultyAttributes.JumpAimDifficulty, + FlowAim = difficultyAttributes.FlowAimDifficulty, + Precision = difficultyAttributes.PrecisionDifficulty, + Speed = difficultyAttributes.SpeedDifficulty, + Stamina = difficultyAttributes.StaminaDifficulty, + Accuracy = difficultyAttributes.AccuracyDifficulty }; } - private static OsuPerformance GetPerformanceFromPerformanceAttributes(double total, Dictionary performanceAttributes) + private static OsuPerformance GetPerformanceFromPerformanceAttributes(OsuPerformanceAttributes performanceAttributes) { return new OsuPerformance() { - Total = total, - Aim = performanceAttributes["Aim"], - JumpAim = performanceAttributes["Jump Aim"], - FlowAim = performanceAttributes["Flow Aim"], - Precision = performanceAttributes["Precision"], - Speed = performanceAttributes["Speed"], - Stamina = performanceAttributes["Stamina"], - Accuracy = performanceAttributes["Accuracy"] + Total = performanceAttributes.Total, + Aim = performanceAttributes.Aim, + JumpAim = performanceAttributes.JumpAim, + FlowAim = performanceAttributes.FlowAim, + Precision = performanceAttributes.Precision, + Speed = performanceAttributes.Speed, + Stamina = performanceAttributes.Stamina, + Accuracy = performanceAttributes.Accuracy }; } } diff --git a/osu b/osu index 6f66c79..e6fc95d 160000 --- a/osu +++ b/osu @@ -1 +1 @@ -Subproject commit 6f66c7985c1901cf092748f1b08b98bbad8a144c +Subproject commit e6fc95d77047d18ae7f2c3f3571d66f091938c37