1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 14:47:25 +08:00

fix alive hitobjects blocking hits in taiko with hd

This commit is contained in:
chayleaf 2023-07-20 20:53:27 +07:00
parent 285a232cc2
commit 970ea50269
2 changed files with 57 additions and 4 deletions

View File

@ -1,24 +1,71 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Mods; using osu.Game.Rulesets.Taiko.Mods;
using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.Tests.Mods namespace osu.Game.Rulesets.Taiko.Tests.Mods
{ {
public partial class TestSceneTaikoModHidden : TaikoModTestScene public partial class TestSceneTaikoModHidden : TaikoModTestScene
{ {
private Func<bool> checkAllMaxResultJudgements(int count) => ()
=> Player.ScoreProcessor.JudgedHits >= count
&& Player.Results.All(result => result.Type == result.Judgement.MaxResult);
[Test] [Test]
public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData
{ {
Mod = new TaikoModHidden(), Mod = new TaikoModHidden(),
Autoplay = true, Autoplay = true,
PassCondition = checkSomeAutoplayHits PassCondition = checkAllMaxResultJudgements(4),
}); });
private bool checkSomeAutoplayHits() [Test]
=> Player.ScoreProcessor.JudgedHits >= 4 public void TestHitTwoNotesWithinShortPeriod()
&& Player.Results.All(result => result.Type == result.Judgement.MaxResult); {
const double hit_time = 1;
var beatmap = new Beatmap<TaikoHitObject>
{
HitObjects = new List<TaikoHitObject>
{
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,
});
}
} }
} }

View File

@ -57,6 +57,12 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
hitObject.FadeOut(duration); 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. // 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. // 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 hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged