Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update performanceplus #2

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Difficalcy.PerformancePlus.Tests/OsuCalculatorServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class OsuCalculatorServiceTest : CalculatorServiceTest<OsuScore, OsuDiffi
protected override CalculatorService<OsuScore, OsuDifficulty, OsuPerformance, OsuCalculation> 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 });

Expand All @@ -27,6 +27,6 @@ public void TestAllParameters()
Mehs = 4,
Oks = 3,
};
TestGetCalculationReturnsCorrectValues(11.091002784977283, 1080.0385506471903d, score);
TestGetCalculationReturnsCorrectValues(11.098551152482028d, 1082.5784934845988d, score);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
53 changes: 26 additions & 27 deletions Difficalcy.PerformancePlus/Services/OsuCalculatorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -92,14 +92,13 @@ protected override OsuCalculation CalculatePerformance(OsuScore score, object di
Mods = mods
};

var performanceCalculator = OsuRuleset.CreatePerformanceCalculator(osuDifficultyAttributes, scoreInfo);
var performanceAttributes = new Dictionary<string, double>();
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
};
Expand Down Expand Up @@ -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<string, double> 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
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu
Submodule osu updated 4754 files
Loading