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

40 lines
1.1 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
{
2022-06-09 17:22:55 +08:00
// TODO - Share this sigmoid
2022-06-06 12:42:49 +08:00
private static double sigmoid(double val, double center, double width)
{
return Math.Tanh(Math.E * -(val - center) / width);
}
public static double EvaluateDifficultyOf(TaikoDifficultyHitObjectColour colour)
2022-06-06 12:42:49 +08:00
{
if (colour == null) return 0;
2022-06-09 17:22:55 +08:00
double objectStrain = 1.85;
2022-06-09 17:22:55 +08:00
2022-06-06 12:42:49 +08:00
if (colour.Delta)
{
objectStrain *= sigmoid(colour.DeltaRunLength, 3, 3) * 0.5 + 0.5;
2022-06-06 12:42:49 +08:00
}
else
{
2022-06-09 12:35:26 +08:00
objectStrain *= sigmoid(colour.DeltaRunLength, 2, 2) * 0.5 + 0.5;
2022-06-06 12:42:49 +08:00
}
2022-06-09 17:22:55 +08:00
objectStrain *= -sigmoid(colour.RepetitionInterval, 1, 8);
2022-06-06 12:42:49 +08:00
return objectStrain;
}
public static double EvaluateDifficultyOf(DifficultyHitObject current)
{
return EvaluateDifficultyOf(((TaikoDifficultyHitObject)current).Colour);
}
2022-06-06 12:42:49 +08:00
}
2022-06-09 17:22:55 +08:00
}