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

Merge pull request #25887 from smoogipoo/restore-taiko-accuracy

Restore taiko accuracy to ScoreV2 values
This commit is contained in:
Dean Herbert 2023-12-20 17:29:40 +09:00 committed by GitHub
commit 831c273b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 9 deletions

View File

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

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
} }
protected override double GetComboScoreChange(JudgementResult result) protected override double GetComboScoreChange(JudgementResult result)
=> Judgement.ToNumericResult(result.Type) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base)); => GetNumericResultFor(result) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base));
private class JudgementOrderComparer : IComparer<HitObject> private class JudgementOrderComparer : IComparer<HitObject>
{ {

View File

@ -0,0 +1,41 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Scoring;
namespace osu.Game.Rulesets.Taiko.Tests
{
[TestFixture]
public class TaikoScoreProcessorTest
{
[Test]
public void TestInaccurateHitScore()
{
var beatmap = new Beatmap<HitObject>
{
HitObjects =
{
new Hit(),
new Hit { StartTime = 1000 }
}
};
var scoreProcessor = new TaikoScoreProcessor();
scoreProcessor.ApplyBeatmap(beatmap);
// Apply a miss judgement
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], new TaikoJudgement()) { Type = HitResult.Great });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], new TaikoJudgement()) { Type = HitResult.Ok });
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(453745));
Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(0.75).Within(0.0001));
}
}
}

View File

@ -28,11 +28,22 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override double GetComboScoreChange(JudgementResult result) protected override double GetComboScoreChange(JudgementResult result)
{ {
return Judgement.ToNumericResult(result.Type) return GetNumericResultFor(result)
* Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base)) * Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base))
* strongScaleValue(result); * strongScaleValue(result);
} }
protected override double GetNumericResultFor(JudgementResult result)
{
switch (result.Type)
{
case HitResult.Ok:
return 150;
}
return base.GetNumericResultFor(result);
}
private double strongScaleValue(JudgementResult result) private double strongScaleValue(JudgementResult result)
{ {
if (result.HitObject is StrongNestedHitObject strong) if (result.HitObject is StrongNestedHitObject strong)

View File

@ -227,12 +227,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy()) if (result.Judgement.MaxResult.AffectsAccuracy())
{ {
currentMaximumBaseScore += Judgement.ToNumericResult(result.Judgement.MaxResult); currentMaximumBaseScore += GetMaxNumericResultFor(result);
currentAccuracyJudgementCount++; currentAccuracyJudgementCount++;
} }
if (result.Type.AffectsAccuracy()) if (result.Type.AffectsAccuracy())
currentBaseScore += Judgement.ToNumericResult(result.Type); currentBaseScore += GetNumericResultFor(result);
if (result.Type.IsBonus()) if (result.Type.IsBonus())
currentBonusPortion += GetBonusScoreChange(result); currentBonusPortion += GetBonusScoreChange(result);
@ -276,12 +276,12 @@ namespace osu.Game.Rulesets.Scoring
if (result.Judgement.MaxResult.AffectsAccuracy()) if (result.Judgement.MaxResult.AffectsAccuracy())
{ {
currentMaximumBaseScore -= Judgement.ToNumericResult(result.Judgement.MaxResult); currentMaximumBaseScore -= GetMaxNumericResultFor(result);
currentAccuracyJudgementCount--; currentAccuracyJudgementCount--;
} }
if (result.Type.AffectsAccuracy()) if (result.Type.AffectsAccuracy())
currentBaseScore -= Judgement.ToNumericResult(result.Type); currentBaseScore -= GetNumericResultFor(result);
if (result.Type.IsBonus()) if (result.Type.IsBonus())
currentBonusPortion -= GetBonusScoreChange(result); currentBonusPortion -= GetBonusScoreChange(result);
@ -297,9 +297,21 @@ namespace osu.Game.Rulesets.Scoring
updateScore(); updateScore();
} }
protected virtual double GetBonusScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Type); protected virtual double GetBonusScoreChange(JudgementResult result) => GetNumericResultFor(result);
protected virtual double GetComboScoreChange(JudgementResult result) => Judgement.ToNumericResult(result.Judgement.MaxResult) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT); protected virtual double GetComboScoreChange(JudgementResult result) => GetMaxNumericResultFor(result) * Math.Pow(result.ComboAfterJudgement, COMBO_EXPONENT);
/// <summary>
/// Retrieves the numeric score representation for a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/>.</param>
protected virtual double GetNumericResultFor(JudgementResult result) => result.Judgement.NumericResultFor(result);
/// <summary>
/// Retrieves the maximum numeric score representation for a <see cref="JudgementResult"/>.
/// </summary>
/// <param name="result">The <see cref="JudgementResult"/>.</param>
protected virtual double GetMaxNumericResultFor(JudgementResult result) => result.Judgement.MaxNumericResult;
protected virtual void ApplyScoreChange(JudgementResult result) protected virtual void ApplyScoreChange(JudgementResult result)
{ {