diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyHitPolicy.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyHitPolicy.cs index cc5c27a62c..b4ab53a658 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyHitPolicy.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneLegacyHitPolicy.cs @@ -639,7 +639,12 @@ namespace osu.Game.Rulesets.Osu.Tests AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0); AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen()); - AddStep("Substitute hit policy", () => currentPlayer.ChildrenOfType().Single().HitPolicy = testPolicy = new TestLegacyHitPolicy()); + AddStep("Substitute hit policy", () => + { + var playfield = currentPlayer.ChildrenOfType().Single(); + var currentPolicy = playfield.HitPolicy; + playfield.HitPolicy = testPolicy = new TestLegacyHitPolicy(currentPolicy); + }); AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value); } @@ -670,11 +675,18 @@ namespace osu.Game.Rulesets.Osu.Tests private class TestLegacyHitPolicy : LegacyHitPolicy { + private readonly IHitPolicy currentPolicy; + + public TestLegacyHitPolicy(IHitPolicy currentPolicy) + { + this.currentPolicy = currentPolicy; + } + public List ClickActions { get; } = new List(); public override ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult result) { - var action = base.CheckHittable(hitObject, time, result); + var action = currentPolicy.CheckHittable(hitObject, time, result); ClickActions.Add(action); return action; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs index 229f80c2bd..82deec41f5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModClassic.cs @@ -11,6 +11,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -57,7 +58,10 @@ namespace osu.Game.Rulesets.Osu.Mods var osuRuleset = (DrawableOsuRuleset)drawableRuleset; if (ClassicNoteLock.Value) - osuRuleset.Playfield.HitPolicy = new LegacyHitPolicy(); + { + double hittableRange = OsuHitWindows.MISS_WINDOW - (drawableRuleset.Mods.OfType().Any() ? 200 : 0); + osuRuleset.Playfield.HitPolicy = new LegacyHitPolicy(hittableRange); + } usingHiddenFading = drawableRuleset.Mods.OfType().SingleOrDefault()?.OnlyFadeApproachCircles.Value == false; } diff --git a/osu.Game.Rulesets.Osu/UI/LegacyHitPolicy.cs b/osu.Game.Rulesets.Osu/UI/LegacyHitPolicy.cs index 5260215345..2b6359fb46 100644 --- a/osu.Game.Rulesets.Osu/UI/LegacyHitPolicy.cs +++ b/osu.Game.Rulesets.Osu/UI/LegacyHitPolicy.cs @@ -8,6 +8,7 @@ using System.Linq; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -23,6 +24,13 @@ namespace osu.Game.Rulesets.Osu.UI { public IHitObjectContainer HitObjectContainer { get; set; } + private readonly double hittableRange; + + public LegacyHitPolicy(double hittableRange = OsuHitWindows.MISS_WINDOW) + { + this.hittableRange = hittableRange; + } + public void HandleHit(DrawableHitObject hitObject) { } @@ -57,11 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI return ClickAction.Shake; } - // stable has `const HitObjectManager.HITTABLE_RANGE = 400;`, which is only used for notelock code. - // probably not a coincidence that this is equivalent to lazer's OsuHitWindows.MISS_WINDOW. - - // TODO stable compares to 200 when autopilot is enabled, instead of 400. - return Math.Abs(hitObject.HitObject.StartTime - time) < 400 ? ClickAction.Hit : ClickAction.Shake; + return Math.Abs(hitObject.HitObject.StartTime - time) < hittableRange ? ClickAction.Hit : ClickAction.Shake; } } }