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

Store old total score as LegacyTotalScore

This commit is contained in:
Dan Balasescu 2023-06-27 14:59:40 +09:00
parent a9c65d200a
commit 0c5c09597c
3 changed files with 11 additions and 3 deletions

View File

@ -78,7 +78,7 @@ namespace osu.Game.Database
/// 28 2023-06-08 Added IsLegacyScore to ScoreInfo, parsed from replay files.
/// 29 2023-06-12 Run migration of old lazer scores to be best-effort in the new scoring number space. No actual realm changes.
/// 30 2023-06-16 Run migration of old lazer scores again. This time with more correct rounding considerations.
/// 31 2023-06-26 Add Version to ScoreInfo, set to 30000002.
/// 31 2023-06-26 Add Version and LegacyTotalScore to ScoreInfo, set Version to 30000002 and move TotalScore into LegacyTotalScore for legacy scores.
/// </summary>
private const int schema_version = 31;
@ -973,7 +973,10 @@ namespace osu.Game.Database
var scores = migration.NewRealm.All<ScoreInfo>();
foreach (var score in scores)
{
score.LegacyTotalScore = score.TotalScore;
score.Version = 30000002; // Last version before legacy total score conversion.
}
break;
}

View File

@ -155,6 +155,9 @@ namespace osu.Game.Scoring
public long ConvertFromLegacyTotalScore(ScoreInfo score)
{
if (!score.IsLegacyScore)
return score.TotalScore;
var beatmap = beatmaps().GetWorkingBeatmap(score.BeatmapInfo);
var ruleset = score.Ruleset.CreateInstance();
@ -173,10 +176,10 @@ namespace osu.Game.Scoring
int maximumLegacyBaseScore = maximumLegacyAccuracyScore + maximumLegacyComboScore;
// The combo proportion is calculated as a proportion of maximumLegacyBaseScore.
double comboProportion = Math.Min(1, (double)score.TotalScore / maximumLegacyBaseScore);
double comboProportion = Math.Min(1, (double)score.LegacyTotalScore / maximumLegacyBaseScore);
// The bonus proportion makes up the rest of the score that exceeds maximumLegacyBaseScore.
double bonusProportion = Math.Max(0, (score.TotalScore - maximumLegacyBaseScore) * maximumLegacyBonusRatio);
double bonusProportion = Math.Max(0, (score.LegacyTotalScore - maximumLegacyBaseScore) * maximumLegacyBonusRatio);
switch (ruleset.RulesetInfo.OnlineID)
{

View File

@ -54,6 +54,8 @@ namespace osu.Game.Scoring
public long TotalScore { get; set; }
public long LegacyTotalScore { get; set; }
public int MaxCombo { get; set; }
public double Accuracy { get; set; }