Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions osu.Game.Rulesets.Taiko/Difficulty/Evaluators/ColourEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Utils;
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
Expand All @@ -24,19 +26,21 @@ private static double consistentRatioPenalty(TaikoDifficultyHitObject hitObject,
int consistentRatioCount = 0;
double totalRatioCount = 0.0;

List<double> recentRatios = new List<double>();
TaikoDifficultyHitObject current = hitObject;
var previousHitObject = (TaikoDifficultyHitObject)current.Previous(1);

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.RhythmData.Ratio;
double previousRatio = previousHitObject.RhythmData.Ratio;

recentRatios.Add(currentRatio);

// 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)
{
Expand All @@ -45,14 +49,21 @@ private static double consistentRatioPenalty(TaikoDifficultyHitObject hitObject,
break;
}

// Move to the previous object
current = previousHitObject;
}

// Ensure no division by zero
double ratioPenalty = 1 - totalRatioCount / (consistentRatioCount + 1) * 0.80;
if (consistentRatioCount > 0)
return 1 - totalRatioCount / (consistentRatioCount + 1) * 0.80;

if (recentRatios.Count <= 1) return 1.0;

// As a fallback, calculate the maximum deviation from the average of the recent ratios to ensure slightly off-snapped objects don't bypass the penalty.
double maxRatioDeviation = recentRatios.Max(r => Math.Abs(r - recentRatios.Average()));

double consistentRatioPenalty = 0.7 + 0.3 * DifficultyCalculationUtils.Smootherstep(maxRatioDeviation, 0.0, 1.0);

return ratioPenalty;
return consistentRatioPenalty;
}

/// <summary>
Expand Down
Loading