1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Expose only as one method

This commit is contained in:
Dan Balasescu 2023-12-21 14:58:23 +09:00
parent 4e3b994142
commit 6b4b2a57fc
No known key found for this signature in database
12 changed files with 30 additions and 88 deletions

View File

@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
if (isBonus)
{
legacyBonusScore += scoreIncrease;
standardisedBonusScore += scoreProcessor.GetRawBonusScore(bonusResult);
standardisedBonusScore += scoreProcessor.GetBaseScoreForResult(bonusResult);
}
else
attributes.AccuracyScore += scoreIncrease;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Scoring
}
protected override double GetComboScoreChange(JudgementResult result)
=> GetRawComboScore(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base));
=> GetBaseScoreForResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(combo_cap, combo_base));
public override ScoreRank RankFromAccuracy(double accuracy)
{

View File

@ -31,7 +31,12 @@ namespace osu.Game.Rulesets.Mania.Scoring
+ bonusPortion;
}
public override int GetRawAccuracyScore(HitResult result)
protected override double GetComboScoreChange(JudgementResult result)
{
return getBaseComboScoreForResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
}
public override int GetBaseScoreForResult(HitResult result)
{
switch (result)
{
@ -39,10 +44,10 @@ namespace osu.Game.Rulesets.Mania.Scoring
return 305;
}
return base.GetRawAccuracyScore(result);
return base.GetBaseScoreForResult(result);
}
public override int GetRawComboScore(HitResult result)
private int getBaseComboScoreForResult(HitResult result)
{
switch (result)
{
@ -50,12 +55,9 @@ namespace osu.Game.Rulesets.Mania.Scoring
return 300;
}
return base.GetRawComboScore(result);
return GetBaseScoreForResult(result);
}
protected override double GetComboScoreChange(JudgementResult result)
=> GetRawComboScore(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
private class JudgementOrderComparer : IComparer<HitObject>
{
public static readonly JudgementOrderComparer DEFAULT = new JudgementOrderComparer();

View File

@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Osu.Tests
// multipled by 2 to nullify the score multiplier. (autoplay mod selected)
long totalScore = scoreProcessor.TotalScore.Value * 2;
return totalScore == (int)(drawableSpinner.Result.TotalRotation / 360) * scoreProcessor.GetRawBonusScore(new SpinnerTick().CreateJudgement().MaxResult);
return totalScore == (int)(drawableSpinner.Result.TotalRotation / 360) * scoreProcessor.GetBaseScoreForResult(new SpinnerTick().CreateJudgement().MaxResult);
});
addSeekStep(0);

View File

@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
if (isBonus)
{
legacyBonusScore += scoreIncrease;
standardisedBonusScore += scoreProcessor.GetRawBonusScore(bonusResult);
standardisedBonusScore += scoreProcessor.GetBaseScoreForResult(bonusResult);
}
else
attributes.AccuracyScore += scoreIncrease;

View File

@ -313,7 +313,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
updateBonusScore();
}
private static readonly int score_per_tick = new OsuScoreProcessor().GetRawBonusScore(new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxResult);
private static readonly int score_per_tick = new OsuScoreProcessor().GetBaseScoreForResult(new SpinnerBonusTick.OsuSpinnerBonusTickJudgement().MaxResult);
private void updateBonusScore()
{

View File

@ -193,7 +193,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
if (isBonus)
{
legacyBonusScore += scoreIncrease;
standardisedBonusScore += scoreProcessor.GetRawBonusScore(bonusResult);
standardisedBonusScore += scoreProcessor.GetBaseScoreForResult(bonusResult);
}
else
attributes.AccuracyScore += scoreIncrease;

View File

@ -28,12 +28,12 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override double GetComboScoreChange(JudgementResult result)
{
return GetRawComboScore(result.Type)
return GetBaseScoreForResult(result.Type)
* Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base))
* strongScaleValue(result);
}
public override int GetRawAccuracyScore(HitResult result)
public override int GetBaseScoreForResult(HitResult result)
{
switch (result)
{
@ -41,18 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring
return 150;
}
return base.GetRawAccuracyScore(result);
}
public override int GetRawComboScore(HitResult result)
{
switch (result)
{
case HitResult.Ok:
return 150;
}
return base.GetRawComboScore(result);
return base.GetBaseScoreForResult(result);
}
private double strongScaleValue(JudgementResult result)

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Gameplay
// Apply a judgement
scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new TestJudgement(HitResult.LargeBonus)) { Type = HitResult.LargeBonus });
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(scoreProcessor.GetRawBonusScore(HitResult.LargeBonus)));
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(scoreProcessor.GetBaseScoreForResult(HitResult.LargeBonus)));
}
[Test]

View File

@ -57,14 +57,14 @@ namespace osu.Game.Database
// We are constructing a "best possible" score from the statistics provided because it's the best we can do.
List<HitResult> sortedHits = score.Statistics
.Where(kvp => kvp.Key.AffectsCombo())
.OrderByDescending(kvp => processor.GetRawComboScore(kvp.Key))
.OrderByDescending(kvp => processor.GetBaseScoreForResult(kvp.Key))
.SelectMany(kvp => Enumerable.Repeat(kvp.Key, kvp.Value))
.ToList();
// Attempt to use maximum statistics from the database.
var maximumJudgements = score.MaximumStatistics
.Where(kvp => kvp.Key.AffectsCombo())
.OrderByDescending(kvp => processor.GetRawComboScore(kvp.Key))
.OrderByDescending(kvp => processor.GetBaseScoreForResult(kvp.Key))
.SelectMany(kvp => Enumerable.Repeat(new FakeJudgement(kvp.Key), kvp.Value))
.ToList();

View File

@ -227,12 +227,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy())
{
currentMaximumBaseScore += GetRawAccuracyScore(result.Judgement.MaxResult);
currentMaximumBaseScore += GetBaseScoreForResult(result.Judgement.MaxResult);
currentAccuracyJudgementCount++;
}
if (result.Type.AffectsAccuracy())
currentBaseScore += GetRawAccuracyScore(result.Type);
currentBaseScore += GetBaseScoreForResult(result.Type);
if (result.Type.IsBonus())
currentBonusPortion += GetBonusScoreChange(result);
@ -276,12 +276,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy())
{
currentMaximumBaseScore -= GetRawAccuracyScore(result.Judgement.MaxResult);
currentMaximumBaseScore -= GetBaseScoreForResult(result.Judgement.MaxResult);
currentAccuracyJudgementCount--;
}
if (result.Type.AffectsAccuracy())
currentBaseScore -= GetRawAccuracyScore(result.Type);
currentBaseScore -= GetBaseScoreForResult(result.Type);
if (result.Type.IsBonus())
currentBonusPortion -= GetBonusScoreChange(result);
@ -301,19 +301,15 @@ namespace osu.Game.Rulesets.Scoring
/// Gets the final score change to be applied to the bonus portion of the score.
/// </summary>
/// <param name="result">The judgement result.</param>
protected virtual double GetBonusScoreChange(JudgementResult result) => GetRawBonusScore(result.Type);
protected virtual double GetBonusScoreChange(JudgementResult result) => GetBaseScoreForResult(result.Type);
/// <summary>
/// Gets the final score change to be applied to the combo portion of the score.
/// </summary>
/// <param name="result">The judgement result.</param>
protected virtual double GetComboScoreChange(JudgementResult result) => GetRawComboScore(result.Judgement.MaxResult) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT);
protected virtual double GetComboScoreChange(JudgementResult result) => GetBaseScoreForResult(result.Judgement.MaxResult) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT);
/// <summary>
/// Retrieves the raw score value for a hit result, in order to be applied to the combo portion.
/// </summary>
/// <param name="result">The hit result.</param>
public virtual int GetRawComboScore(HitResult result)
public virtual int GetBaseScoreForResult(HitResult result)
{
switch (result)
{
@ -338,51 +334,6 @@ namespace osu.Game.Rulesets.Scoring
case HitResult.Great:
case HitResult.Perfect: // Perfect doesn't actually give more score / accuracy directly.
return 300;
}
}
/// <summary>
/// Retrieves the raw score value for a hit result, in order to be applied to the accuracy portion.
/// </summary>
/// <param name="result">The hit result.</param>
public virtual int GetRawAccuracyScore(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.SmallTickHit:
return 10;
case HitResult.LargeTickHit:
return 30;
case HitResult.Meh:
return 50;
case HitResult.Ok:
return 100;
case HitResult.Good:
return 200;
case HitResult.Great:
case HitResult.Perfect: // Perfect doesn't actually give more score / accuracy directly.
return 300;
}
}
/// <summary>
/// Retrieves the raw score value for a hit result, in order to be applied to the bonus portion.
/// </summary>
/// <param name="result">The hit result.</param>
public virtual int GetRawBonusScore(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.SmallBonus:
return 10;
@ -619,7 +570,7 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
/// <remarks>
/// Used to compute accuracy.
/// See: <see cref="HitResultExtensions.IsBasic"/> and <see cref="ScoreProcessor.GetRawAccuracyScore"/>.
/// See: <see cref="HitResultExtensions.IsBasic"/> and <see cref="ScoreProcessor.GetBaseScoreForResult"/>.
/// </remarks>
[Key(0)]
public double BaseScore { get; set; }

View File

@ -131,7 +131,7 @@ namespace osu.Game.Scoring
// Populate the maximum statistics.
HitResult maxBasicResult = rulesetInstance.GetHitResults()
.Select(h => h.result)
.Where(h => h.IsBasic()).MaxBy(scoreProcessor.GetRawAccuracyScore);
.Where(h => h.IsBasic()).MaxBy(scoreProcessor.GetBaseScoreForResult);
foreach ((HitResult result, int count) in score.Statistics)
{