2022-05-31 23:17:39 +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 16:11:26 +08:00
|
|
|
using System;
|
2022-05-31 23:17:39 +08:00
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
|
|
|
{
|
|
|
|
public class StaminaEvaluator
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Applies a speed bonus dependent on the time since the last hit performed using this key.
|
|
|
|
/// </summary>
|
2022-06-22 17:17:19 +08:00
|
|
|
/// <param name="interval">The interval between the current and previous note hit using the same key.</param>
|
|
|
|
private static double speedBonus(double interval)
|
2022-05-31 23:17:39 +08:00
|
|
|
{
|
2022-07-07 16:04:46 +08:00
|
|
|
// return 15 / Math.Pow(interval, 0.6);
|
|
|
|
return Math.Pow(0.2, interval / 1000);
|
2022-05-31 23:17:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Evaluates the minimum mechanical stamina required to play the current object. This is calculated using the
|
|
|
|
/// maximum possible interval between two hits using the same key, by alternating 2 keys for each colour.
|
|
|
|
/// </summary>
|
|
|
|
public static double EvaluateDifficultyOf(DifficultyHitObject current)
|
|
|
|
{
|
|
|
|
if (!(current.BaseObject is Hit))
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find the previous hit object hit by the current key, which is two notes of the same colour prior.
|
|
|
|
TaikoDifficultyHitObject taikoCurrent = (TaikoDifficultyHitObject)current;
|
2022-06-01 05:20:08 +08:00
|
|
|
TaikoDifficultyHitObject keyPrevious = taikoCurrent.PreviousMono(1);
|
2022-06-09 17:22:55 +08:00
|
|
|
|
2022-06-01 05:20:08 +08:00
|
|
|
if (keyPrevious == null)
|
2022-05-31 23:17:39 +08:00
|
|
|
{
|
2022-06-01 05:20:08 +08:00
|
|
|
// There is no previous hit object hit by the current key
|
|
|
|
return 0.0;
|
|
|
|
}
|
2022-05-31 23:17:39 +08:00
|
|
|
|
2022-06-28 10:38:58 +08:00
|
|
|
double objectStrain = 1;
|
2022-06-22 17:17:19 +08:00
|
|
|
objectStrain *= speedBonus(taikoCurrent.StartTime - keyPrevious.StartTime);
|
2022-05-31 23:17:39 +08:00
|
|
|
return objectStrain;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|