1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Use reduced hittable range with autopilot active

This commit is contained in:
Bartłomiej Dach 2023-08-23 13:37:39 +02:00
parent a316036460
commit 7f215f163f
No known key found for this signature in database
3 changed files with 28 additions and 8 deletions

View File

@ -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<OsuPlayfield>().Single().HitPolicy = testPolicy = new TestLegacyHitPolicy());
AddStep("Substitute hit policy", () =>
{
var playfield = currentPlayer.ChildrenOfType<OsuPlayfield>().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<ClickAction> ClickActions { get; } = new List<ClickAction>();
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;
}

View File

@ -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<OsuModAutopilot>().Any() ? 200 : 0);
osuRuleset.Playfield.HitPolicy = new LegacyHitPolicy(hittableRange);
}
usingHiddenFading = drawableRuleset.Mods.OfType<OsuModHidden>().SingleOrDefault()?.OnlyFadeApproachCircles.Value == false;
}

View File

@ -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;
}
}
}