mirror of
https://github.com/ppy/osu.git
synced 2024-11-17 20:32:56 +08:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
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
|
|
{
|
|
// TODO - Share this sigmoid
|
|
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.8;
|
|
|
|
if (colour.Delta)
|
|
{
|
|
objectStrain *= sigmoid(colour.DeltaRunLength, 6, 4) * 0.5 + 0.5;
|
|
}
|
|
else
|
|
{
|
|
objectStrain *= sigmoid(colour.DeltaRunLength, 2, 2) * 0.5 + 0.5;
|
|
}
|
|
|
|
objectStrain *= -sigmoid(colour.RepetitionInterval, 8, 8) * 0.5 + 0.5;
|
|
return objectStrain;
|
|
}
|
|
}
|
|
}
|