From 57723107dd313833902032268921f779346f5472 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Nov 2022 16:15:32 +0900 Subject: [PATCH] Fix osu!mania hold notes occasionally getting in a visually incorrect hit state To correctly end a mania hold note, `endHold()` needs to be called. This was not happening in a very specific scenario: - The hold note's head is not hit - The user pressed the column's key within the hold note's tail's window, but does so to hit the next object (a note in proximity to the hold note's tail). - The hit policy forces a miss on the hold note, but `endHold()` is not called - `CheckForResult` is not called after this point due to `Judged` being `true`. Closes #21311. --- .../Objects/Drawables/DrawableHoldNote.cs | 14 ++++++++++++-- .../Objects/Drawables/DrawableManiaHitObject.cs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index c68eec610c..86d4ad0a36 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -262,14 +262,24 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables tick.MissForcefully(); } - ApplyResult(r => r.Type = Tail.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult); - endHold(); + if (Tail.IsHit) + ApplyResult(r => r.Type = r.Judgement.MaxResult); + else + MissForcefully(); } if (Tail.Judged && !Tail.IsHit) HoldBrokenTime = Time.Current; } + public override void MissForcefully() + { + base.MissForcefully(); + + // Important that this is always called when a result is applied. + endHold(); + } + public bool OnPressed(KeyBindingPressEvent e) { if (AllJudged) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index 73dc937a00..51f8ab1cf8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// /// Causes this to get missed, disregarding all conditions in implementations of . /// - public void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult); + public virtual void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult); } public abstract class DrawableManiaHitObject : DrawableManiaHitObject