1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 22:22:55 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.3 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
2023-05-09 18:33:33 +08:00
using System;
2024-01-19 17:43:15 +08:00
using System.Collections.Generic;
2023-05-09 18:33:33 +08:00
using osu.Game.Rulesets.Judgements;
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Scoring;
2023-05-09 18:33:33 +08:00
using osu.Game.Rulesets.Taiko.Objects;
2024-01-19 17:43:15 +08:00
using osu.Game.Scoring;
2018-04-13 17:19:50 +08:00
2017-04-18 15:05:58 +08:00
namespace osu.Game.Rulesets.Taiko.Scoring
{
2023-05-09 18:33:33 +08:00
public partial class TaikoScoreProcessor : ScoreProcessor
{
2023-05-09 18:33:33 +08:00
private const double combo_base = 4;
public TaikoScoreProcessor()
: base(new TaikoRuleset())
{
}
2023-05-19 16:27:02 +08:00
protected override double ComputeTotalScore(double comboProgress, double accuracyProgress, double bonusPortion)
2023-05-09 18:33:33 +08:00
{
2023-05-19 16:27:02 +08:00
return 250000 * comboProgress
+ 750000 * Math.Pow(Accuracy.Value, 3.6) * accuracyProgress
2023-05-19 13:37:26 +08:00
+ bonusPortion;
2023-05-09 18:33:33 +08:00
}
2020-07-16 13:13:46 +08:00
2023-05-19 13:37:26 +08:00
protected override double GetBonusScoreChange(JudgementResult result) => base.GetBonusScoreChange(result) * strongScaleValue(result);
2023-05-19 13:37:26 +08:00
protected override double GetComboScoreChange(JudgementResult result)
2023-05-09 18:33:33 +08:00
{
2023-12-21 13:58:23 +08:00
return GetBaseScoreForResult(result.Type)
2023-05-19 13:37:26 +08:00
* Math.Min(Math.Max(0.5, Math.Log(result.ComboAfterJudgement, combo_base)), Math.Log(400, combo_base))
* strongScaleValue(result);
2023-05-09 18:33:33 +08:00
}
public override ScoreRank RankFromScore(double accuracy, IReadOnlyDictionary<HitResult, int> results)
2024-01-19 17:43:15 +08:00
{
ScoreRank rank = base.RankFromScore(accuracy, results);
switch (rank)
{
case ScoreRank.S:
case ScoreRank.X:
if (results.GetValueOrDefault(HitResult.Miss) > 0)
2024-01-19 17:43:15 +08:00
rank = ScoreRank.A;
break;
}
return rank;
}
2023-12-21 13:58:23 +08:00
public override int GetBaseScoreForResult(HitResult result)
2023-12-19 12:50:46 +08:00
{
switch (result)
2023-12-19 12:50:46 +08:00
{
case HitResult.Ok:
return 150;
}
2023-12-21 13:58:23 +08:00
return base.GetBaseScoreForResult(result);
2023-12-19 12:50:46 +08:00
}
2023-05-19 13:37:26 +08:00
private double strongScaleValue(JudgementResult result)
2023-05-09 18:33:33 +08:00
{
if (result.HitObject is StrongNestedHitObject strong)
2023-05-19 13:37:26 +08:00
return strong.Parent is DrumRollTick ? 3 : 7;
2023-05-09 18:33:33 +08:00
2023-05-19 13:37:26 +08:00
return 1;
2023-05-09 18:33:33 +08:00
}
}
}