1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:45:09 +08:00

De-nest cheese detection logic

This commit is contained in:
Bartłomiej Dach 2020-08-18 19:18:36 +02:00
parent 6c759f31f1
commit 292d38362c

View File

@ -38,33 +38,34 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
if (!history.Full) if (!history.Full)
continue; continue;
bool isRepeat = true; if (!containsPatternRepeat(history, patternLength))
for (int j = 0; j < patternLength; j++)
{
if (history[j].HitType != history[j + patternLength].HitType)
{
isRepeat = false;
}
}
if (!isRepeat)
{ {
repetitionStart = i - 2 * patternLength; repetitionStart = i - 2 * patternLength;
continue;
} }
int repeatedLength = i - repetitionStart; int repeatedLength = i - repetitionStart;
if (repeatedLength < roll_min_repetitions)
continue;
if (repeatedLength >= roll_min_repetitions) for (int j = repetitionStart; j < i; j++)
{ {
for (int j = repetitionStart; j < i; j++) hitObjects[j].StaminaCheese = true;
{
hitObjects[j].StaminaCheese = true;
}
} }
} }
} }
private static bool containsPatternRepeat(LimitedCapacityQueue<TaikoDifficultyHitObject> history, int patternLength)
{
for (int j = 0; j < patternLength; j++)
{
if (history[j].HitType != history[j + patternLength].HitType)
return false;
}
return true;
}
private void findTlTap(int parity, HitType type) private void findTlTap(int parity, HitType type)
{ {
int tlLength = -2; int tlLength = -2;
@ -72,20 +73,16 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
for (int i = parity; i < hitObjects.Count; i += 2) for (int i = parity; i < hitObjects.Count; i += 2)
{ {
if (hitObjects[i].HitType == type) if (hitObjects[i].HitType == type)
{
tlLength += 2; tlLength += 2;
}
else else
{
tlLength = -2; tlLength = -2;
}
if (tlLength >= tl_min_repetitions) if (tlLength < tl_min_repetitions)
continue;
for (int j = Math.Max(0, i - tlLength); j < i; j++)
{ {
for (int j = Math.Max(0, i - tlLength); j < i; j++) hitObjects[j].StaminaCheese = true;
{
hitObjects[j].StaminaCheese = true;
}
} }
} }
} }