1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:52:54 +08:00

Rename GetImmediateScore() as overload of GetScore()

This commit is contained in:
Dan Balasescu 2022-03-08 11:26:07 +09:00
parent a352a140bc
commit 2c382bd1d9
4 changed files with 26 additions and 26 deletions

View File

@ -300,7 +300,7 @@ namespace osu.Game.Tests.Rulesets.Scoring
HitObjects = { new TestHitObject(result) } HitObjects = { new TestHitObject(result) }
}); });
Assert.That(scoreProcessor.GetImmediateScore(ScoringMode.Standardised, result.AffectsCombo() ? 1 : 0, statistic), Is.EqualTo(expectedScore).Within(0.5d)); Assert.That(scoreProcessor.GetScore(ScoringMode.Standardised, result.AffectsCombo() ? 1 : 0, statistic), Is.EqualTo(expectedScore).Within(0.5d));
} }
private class TestJudgement : Judgement private class TestJudgement : Judgement

View File

@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Difficulty
ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor(); ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor();
scoreProcessor.HighestCombo.Value = perfectPlay.MaxCombo; scoreProcessor.HighestCombo.Value = perfectPlay.MaxCombo;
scoreProcessor.Mods.Value = perfectPlay.Mods; scoreProcessor.Mods.Value = perfectPlay.Mods;
perfectPlay.TotalScore = (long)scoreProcessor.GetImmediateScore(ScoringMode.Standardised, perfectPlay.MaxCombo, statistics); perfectPlay.TotalScore = (long)scoreProcessor.GetScore(ScoringMode.Standardised, perfectPlay.MaxCombo, statistics);
// compute rank achieved // compute rank achieved
// default to SS, then adjust the rank with mods // default to SS, then adjust the rank with mods

View File

@ -218,6 +218,29 @@ namespace osu.Game.Rulesets.Scoring
scoreResultCounts); scoreResultCounts);
} }
/// <summary>
/// Given a minimal set of inputs, return the computed score for the tracked beatmap / mods combination, at the current point in time.
/// </summary>
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
/// <param name="maxCombo">The maximum combo achievable in the beatmap.</param>
/// <param name="statistics">Statistics to be used for calculating accuracy, bonus score, etc.</param>
/// <returns>The computed score for provided inputs.</returns>
public double GetScore(ScoringMode mode, int maxCombo, Dictionary<HitResult, int> statistics)
{
// calculate base score from statistics pairs
int computedBaseScore = 0;
foreach (var pair in statistics)
{
if (!pair.Key.AffectsAccuracy())
continue;
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
}
return GetScore(mode, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), statistics);
}
/// <summary> /// <summary>
/// Computes the total score. /// Computes the total score.
/// </summary> /// </summary>
@ -250,29 +273,6 @@ namespace osu.Game.Rulesets.Scoring
} }
} }
/// <summary>
/// Given a minimal set of inputs, return the computed score for the tracked beatmap / mods combination, at the current point in time.
/// </summary>
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
/// <param name="maxCombo">The maximum combo achievable in the beatmap.</param>
/// <param name="statistics">Statistics to be used for calculating accuracy, bonus score, etc.</param>
/// <returns>The computed score for provided inputs.</returns>
public double GetImmediateScore(ScoringMode mode, int maxCombo, Dictionary<HitResult, int> statistics)
{
// calculate base score from statistics pairs
int computedBaseScore = 0;
foreach (var pair in statistics)
{
if (!pair.Key.AffectsAccuracy())
continue;
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
}
return GetScore(mode, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), statistics);
}
/// <summary> /// <summary>
/// Get the accuracy fraction for the provided base score. /// Get the accuracy fraction for the provided base score.
/// </summary> /// </summary>

View File

@ -244,7 +244,7 @@ namespace osu.Game.Screens.Play.HUD
{ {
var header = frame.Header; var header = frame.Header;
Score.Value = ScoreProcessor.GetImmediateScore(ScoringMode.Value, header.MaxCombo, header.Statistics); Score.Value = ScoreProcessor.GetScore(ScoringMode.Value, header.MaxCombo, header.Statistics);
Accuracy.Value = header.Accuracy; Accuracy.Value = header.Accuracy;
CurrentCombo.Value = header.Combo; CurrentCombo.Value = header.Combo;
} }