1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

rewrote slider algorithm to be based on leniency and stored current cursor positions

This commit is contained in:
Xexxar 2021-11-03 15:38:23 +00:00
parent 7eb7d12589
commit 9afca5c5b6

View File

@ -93,37 +93,60 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
int repeatCount = 0; int repeatCount = 0;
Vector2 currSliderPosition = ((OsuHitObject)lastSlider.NestedHitObjects[0]).StackedPosition;
for (int i = 1; i < lastSlider.NestedHitObjects.Count; i++) for (int i = 1; i < lastSlider.NestedHitObjects.Count; i++)
{ {
Vector2 currSlider = Vector2.Subtract(((OsuHitObject)lastSlider.NestedHitObjects[i]).StackedPosition, ((OsuHitObject)lastSlider.NestedHitObjects[i - 1]).StackedPosition); Vector2 currSlider = Vector2.Subtract(((OsuHitObject)lastSlider.NestedHitObjects[i]).StackedPosition, currSliderPosition);
double currSliderLength = currSlider.Length * scalingFactor;
if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderRepeat && (OsuHitObject)lastSlider.NestedHitObjects[i - 1] is SliderRepeat) if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderEndCircle && !((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderRepeat))
{ {
repeatCount++; Vector2 possSlider = Vector2.Subtract((Vector2)lastSlider.LazyEndPosition, currSliderPosition);
TravelDistance += Math.Max(0, currSlider.Length * scalingFactor - 240); // remove 240 distance to avoid buffing overlapping followcircles. if (possSlider.Length < currSlider.Length)
currSlider = possSlider; // Take the least distance from slider end vs lazy end.
currSliderLength = currSlider.Length * scalingFactor;
}
if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderTick)
{
if (currSliderLength > 120)
{
currSliderPosition = Vector2.Add(currSliderPosition, Vector2.Multiply(currSlider, (float)((currSliderLength - 120) / currSliderLength)));
currSliderLength *= (currSliderLength - 120) / currSliderLength;
}
else
currSliderLength = 0;
} }
else if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderRepeat) else if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderRepeat)
{ {
repeatCount++; if (currSliderLength > 50)
TravelDistance += Math.Max(0, currSlider.Length * scalingFactor - 120); // remove 120 distance to avoid buffing overlapping followcircles.
}
else if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderEndCircle)
{ {
Vector2 possSlider = Vector2.Subtract((Vector2)lastSlider.LazyEndPosition, ((OsuHitObject)lastSlider.NestedHitObjects[i - 1]).StackedPosition); currSliderPosition = Vector2.Add(currSliderPosition, Vector2.Multiply(currSlider, (float)((currSliderLength - 50) / currSliderLength)));
TravelDistance += Math.Min(possSlider.Length, currSlider.Length) * scalingFactor; // Take the least distance from slider end vs lazy end. currSliderLength *= (currSliderLength - 50) / currSliderLength;
} }
else else
TravelDistance += Math.Max(0, currSlider.Length * scalingFactor - 100); // remove 100 distance to avoid buffing overlapping ticks, mostly needed to prevent buffing slow sliders with high tick rate. currSliderLength = 0;
}
else
{
if (currSliderLength > 0)
{
currSliderPosition = Vector2.Add(currSliderPosition, Vector2.Multiply(currSlider, (float)((currSliderLength - 0) / currSliderLength)));
currSliderLength *= (currSliderLength - 0) / currSliderLength;
}
else
currSliderLength = 0;
} }
if (repeatCount == 0) if ((OsuHitObject)lastSlider.NestedHitObjects[i] is SliderRepeat)
{ repeatCount++;
TravelDistance = Math.Max(TravelDistance, scalingFactor * // idea here is to prevent ticks from dropping difficulty of slider by removing distance in calculation.
Math.Min(Vector2.Subtract(((OsuHitObject)lastSlider.NestedHitObjects[lastSlider.NestedHitObjects.Count - 1]).StackedPosition, ((OsuHitObject)lastSlider.NestedHitObjects[0]).StackedPosition).Length, TravelDistance += currSliderLength;
Vector2.Subtract((Vector2)lastSlider.LazyEndPosition, ((OsuHitObject)lastSlider.NestedHitObjects[0]).StackedPosition).Length));
} }
else
TravelDistance *= Math.Pow(1 + repeatCount / 2.0, 1.0 / 2.0); // Bonus for repeat sliders until a better per nested object strain system can be achieved. TravelDistance *= Math.Pow(1 + repeatCount / 2.5, 1.0 / 2.5); // Bonus for repeat sliders until a better per nested object strain system can be achieved.
} }
Vector2 lastCursorPosition = getEndCursorPosition(lastObject); Vector2 lastCursorPosition = getEndCursorPosition(lastObject);