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

Contain entirety of legacy notelock badness inside the hit policy

This commit is contained in:
Bartłomiej Dach 2023-08-23 13:12:18 +02:00
parent 64b36a73b1
commit ed2b1a0754
No known key found for this signature in database
9 changed files with 22 additions and 16 deletions

View File

@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Osu.Tests
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > hitOffset && CheckHittable?.Invoke(this, Time.Current) == ClickAction.Hit)
if (auto && !userTriggered && timeOffset > hitOffset && CheckHittable?.Invoke(this, Time.Current, HitResult.Great) == ClickAction.Hit)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);

View File

@ -635,9 +635,9 @@ namespace osu.Game.Rulesets.Osu.Tests
{
public List<ClickAction> ClickActions { get; } = new List<ClickAction>();
public override ClickAction CheckHittable(DrawableHitObject hitObject, double time)
public override ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult result)
{
var action = base.CheckHittable(hitObject, time);
var action = base.CheckHittable(hitObject, time, result);
ClickActions.Add(action);
return action;
}

View File

@ -155,15 +155,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
var result = ResultFor(timeOffset);
var clickAction = CheckHittable?.Invoke(this, Time.Current);
var clickAction = CheckHittable?.Invoke(this, Time.Current, result);
if (clickAction == ClickAction.Shake || (result == HitResult.None && clickAction != ClickAction.Ignore))
{
if (clickAction == ClickAction.Shake)
Shake();
return;
}
if (result == HitResult.None)
if (result == HitResult.None || clickAction != ClickAction.Hit)
return;
ApplyResult(r =>

View File

@ -13,6 +13,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
using osuTK;
using osuTK.Graphics;
@ -37,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// and <see cref="ClickAction.Shake"/>, and this hit object will be shaken for return values of
/// <see cref="ClickAction.Shake"/>.
/// </summary>
public Func<DrawableHitObject, double, ClickAction> CheckHittable;
public Func<DrawableHitObject, double, HitResult, ClickAction> CheckHittable;
protected DrawableOsuHitObject(OsuHitObject hitObject)
: base(hitObject)

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
pathVersion.BindTo(DrawableSlider.PathVersion);
CheckHittable = (d, t) => DrawableSlider.CheckHittable?.Invoke(d, t) ?? ClickAction.Hit;
CheckHittable = (d, t, r) => DrawableSlider.CheckHittable?.Invoke(d, t, r) ?? ClickAction.Hit;
}
protected override void Update()

View File

@ -4,6 +4,7 @@
#nullable disable
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI
@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
public IHitObjectContainer HitObjectContainer { get; set; }
public ClickAction CheckHittable(DrawableHitObject hitObject, double time) => ClickAction.Hit;
public ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult result) => ClickAction.Hit;
public void HandleHit(DrawableHitObject hitObject)
{

View File

@ -3,6 +3,7 @@
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI
@ -19,8 +20,9 @@ namespace osu.Game.Rulesets.Osu.UI
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to check.</param>
/// <param name="time">The time to check.</param>
/// <param name="result">The result that the object would be judged with if hit.</param>
/// <returns>Whether <paramref name="hitObject"/> can be hit at the given <paramref name="time"/>.</returns>
ClickAction CheckHittable(DrawableHitObject hitObject, double time);
ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult result);
/// <summary>
/// Handles a <see cref="HitObject"/> being hit.

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.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI
@ -26,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
}
public virtual ClickAction CheckHittable(DrawableHitObject hitObject, double time)
public virtual ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult result)
{
var aliveObjects = HitObjectContainer.AliveObjects.ToList();
int index = aliveObjects.IndexOf(hitObject);
@ -38,6 +39,9 @@ namespace osu.Game.Rulesets.Osu.UI
return ClickAction.Ignore;
}
if (result == HitResult.None)
return ClickAction.Shake;
foreach (DrawableHitObject testObject in aliveObjects)
{
if (testObject.AllJudged)

View File

@ -8,6 +8,7 @@ using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI
@ -24,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
public IHitObjectContainer HitObjectContainer { get; set; }
public ClickAction CheckHittable(DrawableHitObject hitObject, double time)
public ClickAction CheckHittable(DrawableHitObject hitObject, double time, HitResult _)
{
DrawableHitObject blockingObject = null;
@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.UI
if (!hitObjectCanBlockFutureHits(hitObject))
return;
if (CheckHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset) != ClickAction.Hit)
if (CheckHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset, hitObject.Result.Type) != ClickAction.Hit)
throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!");
// Miss all hitobjects prior to the hit one.