1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-17 22:43:21 +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.

33 lines
1.2 KiB
C#
Raw Normal View History

2022-06-06 12:42:49 +08:00
using System;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
{
public class ColourEvaluator
{
private static double sigmoid(double val, double center, double width)
{
return Math.Tanh(Math.E * -(val - center) / width);
}
public static double EvaluateDifficultyOf(DifficultyHitObject current)
{
TaikoDifficultyHitObject taikoCurrent = (TaikoDifficultyHitObject)current;
TaikoDifficultyHitObjectColour colour = taikoCurrent.Colour;
if (colour == null) return 0;
double objectStrain = 1.6;
2022-06-06 12:42:49 +08:00
if (colour.Delta)
{
objectStrain /= Math.Pow(colour.DeltaRunLength, 0.7);
2022-06-06 12:42:49 +08:00
}
else
{
objectStrain *= sigmoid(colour.DeltaRunLength, 4, 4) * 0.5 + 0.5;
2022-06-06 12:42:49 +08:00
}
objectStrain *= -sigmoid(colour.RepetitionInterval, 8, 8) * 0.5 + 0.5;
2022-06-06 12:42:49 +08:00
// Console.WriteLine($"{current.StartTime},{colour.GetHashCode()},{colour.Delta},{colour.DeltaRunLength},{colour.RepetitionInterval},{objectStrain}");
return objectStrain;
}
}
}