mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 16:27:43 +08:00
55 lines
2.5 KiB
C#
55 lines
2.5 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.Difficulty.Preprocessing;
|
|
using osu.Game.Rulesets.Difficulty.Utils;
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data;
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|
{
|
|
public class ColourEvaluator
|
|
{
|
|
/// <summary>
|
|
/// Evaluate the difficulty of the first note of a <see cref="MonoStreak"/>.
|
|
/// </summary>
|
|
public static double EvaluateDifficultyOf(MonoStreak monoStreak)
|
|
{
|
|
return DifficultyCalculationUtils.Logistic(exponent: Math.E * monoStreak.Index - 2 * Math.E) * EvaluateDifficultyOf(monoStreak.Parent) * 0.5;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluate the difficulty of the first note of a <see cref="AlternatingMonoPattern"/>.
|
|
/// </summary>
|
|
public static double EvaluateDifficultyOf(AlternatingMonoPattern alternatingMonoPattern)
|
|
{
|
|
return DifficultyCalculationUtils.Logistic(exponent: Math.E * alternatingMonoPattern.Index - 2 * Math.E) * EvaluateDifficultyOf(alternatingMonoPattern.Parent);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Evaluate the difficulty of the first note of a <see cref="RepeatingHitPatterns"/>.
|
|
/// </summary>
|
|
public static double EvaluateDifficultyOf(RepeatingHitPatterns repeatingHitPattern)
|
|
{
|
|
return 2 * (1 - DifficultyCalculationUtils.Logistic(exponent: Math.E * repeatingHitPattern.RepetitionInterval - 2 * Math.E));
|
|
}
|
|
|
|
public static double EvaluateDifficultyOf(DifficultyHitObject hitObject)
|
|
{
|
|
TaikoDifficultyHitObjectColour colour = ((TaikoDifficultyHitObject)hitObject).Colour;
|
|
double difficulty = 0.0d;
|
|
|
|
if (colour.MonoStreak?.FirstHitObject == hitObject) // Difficulty for MonoStreak
|
|
difficulty += EvaluateDifficultyOf(colour.MonoStreak);
|
|
if (colour.AlternatingMonoPattern?.FirstHitObject == hitObject) // Difficulty for AlternatingMonoPattern
|
|
difficulty += EvaluateDifficultyOf(colour.AlternatingMonoPattern);
|
|
if (colour.RepeatingHitPattern?.FirstHitObject == hitObject) // Difficulty for RepeatingHitPattern
|
|
difficulty += EvaluateDifficultyOf(colour.RepeatingHitPattern);
|
|
|
|
return difficulty;
|
|
}
|
|
}
|
|
}
|