mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:20:04 +08:00
Fix hyperdash not initiating correctly when juice streams are present
This commit is contained in:
parent
f5e134806a
commit
e7f1f0f38b
@ -1,9 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
@ -22,8 +26,17 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
public void TestHyperDash()
|
public void TestHyperDash()
|
||||||
{
|
{
|
||||||
AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash);
|
AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash);
|
||||||
|
AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing);
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
AddUntilStep("wait for right hyperdash", () => getCatcher().Scale.X > 0 && getCatcher().HyperDashing);
|
||||||
|
AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CatcherArea.Catcher getCatcher() => Player.ChildrenOfType<CatcherArea>().First().MovableCatcher;
|
||||||
|
|
||||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||||
{
|
{
|
||||||
var beatmap = new Beatmap
|
var beatmap = new Beatmap
|
||||||
@ -35,17 +48,40 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Should produce a hyper-dash
|
// Should produce a hyper-dash (edge case test)
|
||||||
beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true });
|
beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 308 / 512f, NewCombo = true });
|
||||||
beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, });
|
beatmap.HitObjects.Add(new JuiceStream { StartTime = 2008, X = 56 / 512f, });
|
||||||
|
|
||||||
for (int i = 0; i < 512; i++)
|
double startTime = 3000;
|
||||||
{
|
|
||||||
if (i % 5 < 3)
|
const float left_x = 0.02f;
|
||||||
beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 });
|
const float right_x = 0.98f;
|
||||||
}
|
|
||||||
|
createObjects(() => new Fruit(), left_x);
|
||||||
|
createObjects(() => new JuiceStream(), right_x);
|
||||||
|
createObjects(() => new JuiceStream(), left_x);
|
||||||
|
createObjects(() => new Fruit(), right_x);
|
||||||
|
createObjects(() => new Fruit(), left_x);
|
||||||
|
createObjects(() => new Fruit(), right_x);
|
||||||
|
createObjects(() => new JuiceStream(), left_x);
|
||||||
|
|
||||||
return beatmap;
|
return beatmap;
|
||||||
|
|
||||||
|
void createObjects(Func<CatchHitObject> createObject, float x)
|
||||||
|
{
|
||||||
|
const float spacing = 140;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
var hitObject = createObject();
|
||||||
|
hitObject.X = x;
|
||||||
|
hitObject.StartTime = startTime + i * spacing;
|
||||||
|
|
||||||
|
beatmap.HitObjects.Add(hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
startTime += 700;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,6 +270,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
catchObjectPosition >= catcherPosition - halfCatchWidth &&
|
catchObjectPosition >= catcherPosition - halfCatchWidth &&
|
||||||
catchObjectPosition <= catcherPosition + halfCatchWidth;
|
catchObjectPosition <= catcherPosition + halfCatchWidth;
|
||||||
|
|
||||||
|
// only update hyperdash state if we are catching a fruit.
|
||||||
|
// exceptions are Droplets and JuiceStreams.
|
||||||
|
if (!(fruit is Fruit)) return validCatch;
|
||||||
|
|
||||||
if (validCatch && fruit.HyperDash)
|
if (validCatch && fruit.HyperDash)
|
||||||
{
|
{
|
||||||
var target = fruit.HyperDashTarget;
|
var target = fruit.HyperDashTarget;
|
||||||
|
Loading…
Reference in New Issue
Block a user