1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Merge pull request #9578 from smoogipoo/accuracy-based-mania

This commit is contained in:
Dean Herbert 2020-07-16 16:12:48 +09:00 committed by GitHub
commit 5049977395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 5 deletions

View File

@ -7,6 +7,10 @@ namespace osu.Game.Rulesets.Mania.Scoring
{
internal class ManiaScoreProcessor : ScoreProcessor
{
protected override double DefaultAccuracyPortion => 0.8;
protected override double DefaultComboPortion => 0.2;
public override HitWindows CreateHitWindows() => new ManiaHitWindows();
}
}

View File

@ -7,6 +7,10 @@ namespace osu.Game.Rulesets.Taiko.Scoring
{
internal class TaikoScoreProcessor : ScoreProcessor
{
protected override double DefaultAccuracyPortion => 0.75;
protected override double DefaultComboPortion => 0.25;
public override HitWindows CreateHitWindows() => new TaikoHitWindows();
}
}

View File

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Utils;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
@ -16,8 +17,6 @@ namespace osu.Game.Rulesets.Scoring
{
public class ScoreProcessor : JudgementProcessor
{
private const double base_portion = 0.3;
private const double combo_portion = 0.7;
private const double max_score = 1000000;
/// <summary>
@ -55,8 +54,20 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>();
private double maxHighestCombo;
/// <summary>
/// The default portion of <see cref="max_score"/> awarded for hitting <see cref="HitObject"/>s accurately. Defaults to 30%.
/// </summary>
protected virtual double DefaultAccuracyPortion => 0.3;
/// <summary>
/// The default portion of <see cref="max_score"/> awarded for achieving a high combo. Default to 70%.
/// </summary>
protected virtual double DefaultComboPortion => 0.7;
private readonly double accuracyPortion;
private readonly double comboPortion;
private double maxHighestCombo;
private double maxBaseScore;
private double rollingMaxBaseScore;
private double baseScore;
@ -69,7 +80,11 @@ namespace osu.Game.Rulesets.Scoring
public ScoreProcessor()
{
Debug.Assert(base_portion + combo_portion == 1.0);
accuracyPortion = DefaultAccuracyPortion;
comboPortion = DefaultComboPortion;
if (!Precision.AlmostEquals(1.0, accuracyPortion + comboPortion))
throw new InvalidOperationException($"{nameof(DefaultAccuracyPortion)} + {nameof(DefaultComboPortion)} must equal 1.");
Combo.ValueChanged += combo => HighestCombo.Value = Math.Max(HighestCombo.Value, combo.NewValue);
Accuracy.ValueChanged += accuracy =>
@ -189,7 +204,10 @@ namespace osu.Game.Rulesets.Scoring
{
default:
case ScoringMode.Standardised:
return (max_score * (base_portion * baseScore / maxBaseScore + combo_portion * HighestCombo.Value / maxHighestCombo) + bonusScore) * scoreMultiplier;
double accuracyScore = accuracyPortion * baseScore / maxBaseScore;
double comboScore = comboPortion * HighestCombo.Value / maxHighestCombo;
return (max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier;
case ScoringMode.Classic:
// should emulate osu-stable's scoring as closely as we can (https://osu.ppy.sh/help/wiki/Score/ScoreV1)