1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Remove superfluous recomputation of accuracy

This commit is contained in:
Bartłomiej Dach 2024-01-22 20:25:29 +01:00
parent db4849442e
commit 217cbf684b
No known key found for this signature in database

View File

@ -240,9 +240,10 @@ namespace osu.Game.Database
var ruleset = score.Ruleset.CreateInstance(); var ruleset = score.Ruleset.CreateInstance();
var scoreProcessor = ruleset.CreateScoreProcessor(); var scoreProcessor = ruleset.CreateScoreProcessor();
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, beatmap); // warning: ordering is important here - both total score and ranks are dependent on accuracy!
score.Accuracy = computeAccuracy(score, scoreProcessor); score.Accuracy = computeAccuracy(score, scoreProcessor);
score.Rank = computeRank(score, scoreProcessor); score.Rank = computeRank(score, scoreProcessor);
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, beatmap);
} }
/// <summary> /// <summary>
@ -260,9 +261,10 @@ namespace osu.Game.Database
{ {
var scoreProcessor = ruleset.CreateScoreProcessor(); var scoreProcessor = ruleset.CreateScoreProcessor();
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, difficulty, attributes); // warning: ordering is important here - both total score and ranks are dependent on accuracy!
score.Accuracy = computeAccuracy(score, scoreProcessor); score.Accuracy = computeAccuracy(score, scoreProcessor);
score.Rank = computeRank(score, scoreProcessor); score.Rank = computeRank(score, scoreProcessor);
score.TotalScore = convertFromLegacyTotalScore(score, ruleset, difficulty, attributes);
} }
/// <summary> /// <summary>
@ -484,14 +486,9 @@ namespace osu.Game.Database
break; break;
case 3: case 3:
// in the mania case accuracy actually changes between score V1 and score V2 / standardised
// (PERFECT weighting changes from 300 to 305),
// so for better accuracy recompute accuracy locally based on hit statistics and use that instead,
double scoreV2Accuracy = ComputeAccuracy(score);
convertedTotalScore = (long)Math.Round(( convertedTotalScore = (long)Math.Round((
850000 * comboProportion 850000 * comboProportion
+ 150000 * Math.Pow(scoreV2Accuracy, 2 + 2 * scoreV2Accuracy) + 150000 * Math.Pow(score.Accuracy, 2 + 2 * score.Accuracy)
+ bonusProportion) * modMultiplier); + bonusProportion) * modMultiplier);
break; break;
@ -594,8 +591,6 @@ namespace osu.Game.Database
} }
} }
public static double ComputeAccuracy(ScoreInfo scoreInfo) => computeAccuracy(scoreInfo, scoreInfo.Ruleset.CreateInstance().CreateScoreProcessor());
private static double computeAccuracy(ScoreInfo scoreInfo, ScoreProcessor scoreProcessor) private static double computeAccuracy(ScoreInfo scoreInfo, ScoreProcessor scoreProcessor)
{ {
int baseScore = scoreInfo.Statistics.Where(kvp => kvp.Key.AffectsAccuracy()) int baseScore = scoreInfo.Statistics.Where(kvp => kvp.Key.AffectsAccuracy())