mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Fixes hyperdash computation (for nested objects)
This commit is contained in:
@ -74,42 +74,43 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
|
|
||||||
private void initialiseHyperDash(List<CatchHitObject> objects)
|
private void initialiseHyperDash(List<CatchHitObject> objects)
|
||||||
{
|
{
|
||||||
// todo: add difficulty adjust.
|
if (objects.Count == 0)
|
||||||
double halfCatcherWidth = CatcherArea.CATCHER_SIZE * (objects.FirstOrDefault()?.Scale ?? 1) / CatchPlayfield.BASE_WIDTH / 2;
|
return;
|
||||||
|
|
||||||
|
List<CatchHitObject> objectWithDroplets = new List<CatchHitObject>();
|
||||||
|
|
||||||
|
foreach (var currentObject in objects)
|
||||||
|
{
|
||||||
|
if (currentObject is Fruit)
|
||||||
|
objectWithDroplets.Add(currentObject);
|
||||||
|
if (currentObject is JuiceStream)
|
||||||
|
foreach (var currentJuiceElement in currentObject.NestedHitObjects)
|
||||||
|
if (!(currentJuiceElement is TinyDroplet))
|
||||||
|
objectWithDroplets.Add((CatchHitObject)currentJuiceElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
double halfCatcherWidth = CatcherArea.CATCHER_SIZE * objectWithDroplets[0].Scale / CatchPlayfield.BASE_WIDTH / 2;
|
||||||
int lastDirection = 0;
|
int lastDirection = 0;
|
||||||
double lastExcess = halfCatcherWidth;
|
double lastExcess = halfCatcherWidth;
|
||||||
|
|
||||||
int objCount = objects.Count;
|
for (int i = 0; i < objectWithDroplets.Count - 1; i++)
|
||||||
|
|
||||||
for (int i = 0; i < objCount - 1; i++)
|
|
||||||
{
|
{
|
||||||
CatchHitObject currentObject = objects[i];
|
CatchHitObject currentObject = objectWithDroplets[i];
|
||||||
|
CatchHitObject nextObject = objectWithDroplets[i + 1];
|
||||||
// not needed?
|
|
||||||
// if (currentObject is TinyDroplet) continue;
|
|
||||||
|
|
||||||
CatchHitObject nextObject = objects[i + 1];
|
|
||||||
|
|
||||||
// while (nextObject is TinyDroplet)
|
|
||||||
// {
|
|
||||||
// if (++i == objCount - 1) break;
|
|
||||||
// nextObject = objects[i + 1];
|
|
||||||
// }
|
|
||||||
|
|
||||||
int thisDirection = nextObject.X > currentObject.X ? 1 : -1;
|
int thisDirection = nextObject.X > currentObject.X ? 1 : -1;
|
||||||
double timeToNext = nextObject.StartTime - ((currentObject as IHasEndTime)?.EndTime ?? currentObject.StartTime) - 4;
|
double timeToNext = nextObject.StartTime - currentObject.StartTime;
|
||||||
double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
|
double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
|
||||||
|
float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext);
|
||||||
if (timeToNext * CatcherArea.Catcher.BASE_SPEED < distanceToNext)
|
if (distanceToHyper < 0)
|
||||||
{
|
{
|
||||||
currentObject.HyperDashTarget = nextObject;
|
currentObject.HyperDashTarget = nextObject;
|
||||||
lastExcess = halfCatcherWidth;
|
lastExcess = halfCatcherWidth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//currentObject.DistanceToHyperDash = timeToNext - distanceToNext;
|
currentObject.DistanceToHyperDash = distanceToHyper;
|
||||||
lastExcess = MathHelper.Clamp(timeToNext - distanceToNext, 0, halfCatcherWidth);
|
lastExcess = MathHelper.Clamp(distanceToHyper, 0, halfCatcherWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastDirection = thisDirection;
|
lastDirection = thisDirection;
|
||||||
|
@ -27,7 +27,9 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
public int ComboIndex { get; set; }
|
public int ComboIndex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The distance for a fruit to to next hyper if it's not a hyper.
|
/// The difference between the distance of the next object
|
||||||
|
/// and the distance that would have triggered hyper dashing.
|
||||||
|
/// A value close to 0 indicates a difficult jump (for SR calculation)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float DistanceToHyperDash { get; set; }
|
public float DistanceToHyperDash { get; set; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user