1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-10 17:03:16 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Difficulty/Evaluators/ColourEvaluator.cs

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

55 lines
2.5 KiB
C#
Raw Normal View History

2022-07-15 19:07:01 +08:00
// 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.
2022-06-06 12:42:49 +08:00
using System;
using osu.Game.Rulesets.Difficulty.Preprocessing;
2024-11-07 23:36:00 +08:00
using osu.Game.Rulesets.Difficulty.Utils;
2022-06-06 12:42:49 +08:00
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
2022-07-15 19:07:01 +08:00
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data;
2022-06-06 12:42:49 +08:00
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
{
public class ColourEvaluator
{
/// <summary>
2022-08-19 15:31:03 +08:00
/// Evaluate the difficulty of the first note of a <see cref="MonoStreak"/>.
/// </summary>
2022-08-19 15:45:43 +08:00
public static double EvaluateDifficultyOf(MonoStreak monoStreak)
2022-06-06 12:42:49 +08:00
{
2024-11-07 23:36:00 +08:00
return DifficultyCalculationUtils.Logistic(exponent: Math.E * monoStreak.Index - 2 * Math.E) * EvaluateDifficultyOf(monoStreak.Parent) * 0.5;
}
/// <summary>
2022-08-19 15:31:03 +08:00
/// Evaluate the difficulty of the first note of a <see cref="AlternatingMonoPattern"/>.
/// </summary>
2022-08-19 15:45:43 +08:00
public static double EvaluateDifficultyOf(AlternatingMonoPattern alternatingMonoPattern)
{
2024-11-07 23:36:00 +08:00
return DifficultyCalculationUtils.Logistic(exponent: Math.E * alternatingMonoPattern.Index - 2 * Math.E) * EvaluateDifficultyOf(alternatingMonoPattern.Parent);
}
/// <summary>
2022-08-19 15:31:03 +08:00
/// Evaluate the difficulty of the first note of a <see cref="RepeatingHitPatterns"/>.
/// </summary>
2022-08-19 15:45:43 +08:00
public static double EvaluateDifficultyOf(RepeatingHitPatterns repeatingHitPattern)
{
2024-11-07 23:36:00 +08:00
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;
2022-07-15 19:07:01 +08:00
if (colour.MonoStreak?.FirstHitObject == hitObject) // Difficulty for MonoStreak
2022-10-28 12:07:44 +08:00
difficulty += EvaluateDifficultyOf(colour.MonoStreak);
if (colour.AlternatingMonoPattern?.FirstHitObject == hitObject) // Difficulty for AlternatingMonoPattern
2022-10-28 12:07:44 +08:00
difficulty += EvaluateDifficultyOf(colour.AlternatingMonoPattern);
if (colour.RepeatingHitPattern?.FirstHitObject == hitObject) // Difficulty for RepeatingHitPattern
2022-10-28 12:07:44 +08:00
difficulty += EvaluateDifficultyOf(colour.RepeatingHitPattern);
2022-07-15 19:07:01 +08:00
return difficulty;
2022-06-06 12:42:49 +08:00
}
}
2022-06-09 17:22:55 +08:00
}