1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:13:34 +08:00

Fix mania Autoplay mod missing 0ms hold notes

This commit is contained in:
PercyDan54 2023-12-11 21:06:46 +08:00
parent a553387c3d
commit b20b2203ac
No known key found for this signature in database
GPG Key ID: 02F393D257E54E76
2 changed files with 54 additions and 5 deletions

View File

@ -0,0 +1,42 @@
// 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.
using System.Collections.Generic;
using NUnit.Framework;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests.Mods
{
public partial class TestSceneManiaModAutoplay : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
[Test]
public void TestPerfectScoreOnShortHoldNote()
{
CreateModTest(new ModTestData
{
Autoplay = true,
Beatmap = new ManiaBeatmap(new StageDefinition(1))
{
HitObjects = new List<ManiaHitObject>
{
new HoldNote
{
StartTime = 100,
EndTime = 100,
},
new HoldNote
{
StartTime = 100.1,
EndTime = 150,
},
}
},
PassCondition = () => Player.ScoreProcessor.Combo.Value == 4
});
}
}
}

View File

@ -87,15 +87,22 @@ namespace osu.Game.Rulesets.Mania.Replays
private double calculateReleaseTime(HitObject currentObject, HitObject? nextObject)
{
double endTime = currentObject.GetEndTime();
double releaseDelay = RELEASE_DELAY;
if (currentObject is HoldNote)
// hold note releases must be timed exactly.
return endTime;
if (currentObject is HoldNote hold)
{
if (hold.Duration > 0)
// hold note releases must be timed exactly.
return endTime;
// Special case for super short hold notes
releaseDelay = 1;
}
bool canDelayKeyUpFully = nextObject == null ||
nextObject.StartTime > endTime + RELEASE_DELAY;
nextObject.StartTime > endTime + releaseDelay;
return endTime + (canDelayKeyUpFully ? RELEASE_DELAY : (nextObject.AsNonNull().StartTime - endTime) * 0.9);
return endTime + (canDelayKeyUpFully ? releaseDelay : (nextObject.AsNonNull().StartTime - endTime) * 0.9);
}
protected override HitObject? GetNextObject(int currentIndex)