1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs
2023-05-09 19:33:33 +09:00

64 lines
2.0 KiB
C#

// 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 System;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.Scoring
{
public partial class TaikoScoreProcessor : ScoreProcessor
{
private const double combo_base = 4;
protected override double ClassicScoreMultiplier => 22;
public TaikoScoreProcessor(Ruleset ruleset)
: base(ruleset)
{
}
protected override double ComputeTotalScore()
{
return
(int)Math.Round
((
250000 * ComboPortion / MaxComboPortion +
750000 * Math.Pow(Accuracy.Value, 3.6) * ((double)CurrentBasicJudgements / MaxBasicJudgements) +
BonusPortion
) * ScoreMultiplier);
}
protected override void AddScoreChange(JudgementResult result)
{
var change = computeScoreChange(result);
BonusPortion += change.bonus;
ComboPortion += change.combo;
}
protected override void RemoveScoreChange(JudgementResult result)
{
var change = computeScoreChange(result);
BonusPortion -= change.bonus;
ComboPortion -= change.combo;
}
private (double combo, double bonus) computeScoreChange(JudgementResult result)
{
double hitValue = Judgement.ToNumericResult(result.Type);
if (result.HitObject is StrongNestedHitObject strong)
{
double strongBonus = strong.Parent is DrumRollTick ? 3 : 7;
hitValue *= strongBonus;
}
if (result.Type.IsBonus())
return (0, hitValue);
return (hitValue * Math.Min(Math.Max(0.5, Math.Log(result.ComboAtJudgement, combo_base)), Math.Log(400, combo_base)), 0);
}
}
}