mirror of
https://github.com/ppy/osu
synced 2025-01-25 07:13:22 +00:00
Add consistentRatioPenalty
to the Colour
skill. (#31285)
* fix colour * review fix Co-authored-by: StanR <castl@inbox.ru> * remove cancelled out operand * increase nerf, adjust tests * fix automated spacing issues * up penalty * adjust tests * apply review changes * fix nullable hell --------- Co-authored-by: StanR <castl@inbox.ru>
This commit is contained in:
parent
76ac11ff59
commit
4095b2662b
@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
|
||||
|
||||
[TestCase(3.0950934814938953d, 200, "diffcalc-test")]
|
||||
[TestCase(3.0950934814938953d, 200, "diffcalc-test-strong")]
|
||||
[TestCase(2.837609165845338d, 200, "diffcalc-test")]
|
||||
[TestCase(2.837609165845338d, 200, "diffcalc-test-strong")]
|
||||
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
|
||||
=> base.Test(expectedStarRating, expectedMaxCombo, name);
|
||||
|
||||
[TestCase(4.0839365008715403d, 200, "diffcalc-test")]
|
||||
[TestCase(4.0839365008715403d, 200, "diffcalc-test-strong")]
|
||||
[TestCase(3.8005218640444949, 200, "diffcalc-test")]
|
||||
[TestCase(3.8005218640444949, 200, "diffcalc-test-strong")]
|
||||
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
|
||||
=> Test(expectedStarRating, expectedMaxCombo, name, new TaikoModDoubleTime());
|
||||
|
||||
|
@ -36,18 +36,70 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
|
||||
return 2 * (1 - DifficultyCalculationUtils.Logistic(exponent: Math.E * repeatingHitPattern.RepetitionInterval - 2 * Math.E));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates a consistency penalty based on the number of consecutive consistent intervals,
|
||||
/// considering the delta time between each colour sequence.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The current hitObject to consider.</param>
|
||||
/// <param name="threshold"> The allowable margin of error for determining whether ratios are consistent.</param>
|
||||
/// <param name="maxObjectsToCheck">The maximum objects to check per count of consistent ratio.</param>
|
||||
private static double consistentRatioPenalty(TaikoDifficultyHitObject hitObject, double threshold = 0.01, int maxObjectsToCheck = 64)
|
||||
{
|
||||
int consistentRatioCount = 0;
|
||||
double totalRatioCount = 0.0;
|
||||
|
||||
TaikoDifficultyHitObject current = hitObject;
|
||||
|
||||
for (int i = 0; i < maxObjectsToCheck; i++)
|
||||
{
|
||||
// Break if there is no valid previous object
|
||||
if (current.Index <= 1)
|
||||
break;
|
||||
|
||||
var previousHitObject = (TaikoDifficultyHitObject)current.Previous(1);
|
||||
|
||||
double currentRatio = current.Rhythm.Ratio;
|
||||
double previousRatio = previousHitObject.Rhythm.Ratio;
|
||||
|
||||
// A consistent interval is defined as the percentage difference between the two rhythmic ratios with the margin of error.
|
||||
if (Math.Abs(1 - currentRatio / previousRatio) <= threshold)
|
||||
{
|
||||
consistentRatioCount++;
|
||||
totalRatioCount += currentRatio;
|
||||
break;
|
||||
}
|
||||
|
||||
// Move to the previous object
|
||||
current = previousHitObject;
|
||||
}
|
||||
|
||||
// Ensure no division by zero
|
||||
double ratioPenalty = 1 - totalRatioCount / (consistentRatioCount + 1) * 0.80;
|
||||
|
||||
return ratioPenalty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate the difficulty of the first hitobject within a colour streak.
|
||||
/// </summary>
|
||||
public static double EvaluateDifficultyOf(DifficultyHitObject hitObject)
|
||||
{
|
||||
TaikoDifficultyHitObjectColour colour = ((TaikoDifficultyHitObject)hitObject).Colour;
|
||||
var taikoObject = (TaikoDifficultyHitObject)hitObject;
|
||||
TaikoDifficultyHitObjectColour colour = taikoObject.Colour;
|
||||
double difficulty = 0.0d;
|
||||
|
||||
if (colour.MonoStreak?.FirstHitObject == hitObject) // Difficulty for MonoStreak
|
||||
difficulty += EvaluateDifficultyOf(colour.MonoStreak);
|
||||
|
||||
if (colour.AlternatingMonoPattern?.FirstHitObject == hitObject) // Difficulty for AlternatingMonoPattern
|
||||
difficulty += EvaluateDifficultyOf(colour.AlternatingMonoPattern);
|
||||
|
||||
if (colour.RepeatingHitPattern?.FirstHitObject == hitObject) // Difficulty for RepeatingHitPattern
|
||||
difficulty += EvaluateDifficultyOf(colour.RepeatingHitPattern);
|
||||
|
||||
double consistencyPenalty = consistentRatioPenalty(taikoObject);
|
||||
difficulty *= consistencyPenalty;
|
||||
|
||||
return difficulty;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user