From 970ea50269f8b248b69aa458a4baa0aa41e7e45b Mon Sep 17 00:00:00 2001 From: chayleaf Date: Thu, 20 Jul 2023 20:53:27 +0700 Subject: [PATCH] fix alive hitobjects blocking hits in taiko with hd --- .../Mods/TestSceneTaikoModHidden.cs | 55 +++++++++++++++++-- .../Mods/TaikoModHidden.cs | 6 ++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs index edc53429b1..6e6be26e43 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModHidden.cs @@ -1,24 +1,71 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Taiko.Mods; +using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Tests.Mods { public partial class TestSceneTaikoModHidden : TaikoModTestScene { + private Func checkAllMaxResultJudgements(int count) => () + => Player.ScoreProcessor.JudgedHits >= count + && Player.Results.All(result => result.Type == result.Judgement.MaxResult); + [Test] public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData { Mod = new TaikoModHidden(), Autoplay = true, - PassCondition = checkSomeAutoplayHits + PassCondition = checkAllMaxResultJudgements(4), }); - private bool checkSomeAutoplayHits() - => Player.ScoreProcessor.JudgedHits >= 4 - && Player.Results.All(result => result.Type == result.Judgement.MaxResult); + [Test] + public void TestHitTwoNotesWithinShortPeriod() + { + const double hit_time = 1; + + var beatmap = new Beatmap + { + HitObjects = new List + { + new Hit + { + Type = HitType.Rim, + StartTime = hit_time, + }, + new Hit + { + Type = HitType.Centre, + StartTime = hit_time * 2, + }, + }, + BeatmapInfo = + { + Difficulty = new BeatmapDifficulty + { + SliderTickRate = 4, + OverallDifficulty = 0, + }, + Ruleset = new TaikoRuleset().RulesetInfo + }, + }; + + beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f }); + + CreateModTest(new ModTestData + { + Mod = new TaikoModHidden(), + Autoplay = true, + PassCondition = checkAllMaxResultJudgements(2), + Beatmap = beatmap, + }); + } } } diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs index 2c3b4a8d18..ad17955f75 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs @@ -57,6 +57,12 @@ protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, { hitObject.FadeOut(duration); + // Keep updating the object even after it stopped being visible. + // This is required because of the custom logic in DrawableHit's Update method. + // Specifically, pressHandledThisFrame wasn't reset, which caused further hits + // within the object's lifetime to be rejected. + hitObject.AlwaysPresent = true; + // DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed. // in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly. hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged