mirror of
https://github.com/ppy/osu
synced 2024-12-24 15:53:37 +00:00
Completely remove check as it can occur for hits too
This commit is contained in:
parent
1173ef0890
commit
626231d906
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -55,19 +56,19 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMissAfterNextObjectStartTime()
|
public void TestHoldNoteMissAfterNextObjectStartTime()
|
||||||
{
|
{
|
||||||
var objects = new List<ManiaHitObject>
|
var objects = new List<ManiaHitObject>
|
||||||
{
|
{
|
||||||
new HoldNote
|
new HoldNote
|
||||||
{
|
{
|
||||||
StartTime = 1000,
|
StartTime = 1000,
|
||||||
EndTime = 1200,
|
EndTime = 1010,
|
||||||
},
|
},
|
||||||
new HoldNote
|
new HoldNote
|
||||||
{
|
{
|
||||||
StartTime = 1220,
|
StartTime = 1020,
|
||||||
EndTime = 1420
|
EndTime = 1030
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,12 +78,54 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
addJudgementAssert(objects[1], HitResult.IgnoreMiss);
|
addJudgementAssert(objects[1], HitResult.IgnoreMiss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHoldNoteReleasedHitAfterNextObjectStartTime()
|
||||||
|
{
|
||||||
|
var objects = new List<ManiaHitObject>
|
||||||
|
{
|
||||||
|
new HoldNote
|
||||||
|
{
|
||||||
|
StartTime = 1000,
|
||||||
|
EndTime = 1010,
|
||||||
|
},
|
||||||
|
new HoldNote
|
||||||
|
{
|
||||||
|
StartTime = 1020,
|
||||||
|
EndTime = 1030
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new ManiaReplayFrame(1000, ManiaAction.Key1),
|
||||||
|
new ManiaReplayFrame(1030),
|
||||||
|
new ManiaReplayFrame(1040, ManiaAction.Key1),
|
||||||
|
new ManiaReplayFrame(1050)
|
||||||
|
};
|
||||||
|
|
||||||
|
performTest(objects, frames);
|
||||||
|
|
||||||
|
addJudgementAssert(objects[0], HitResult.IgnoreHit);
|
||||||
|
addJudgementAssert("first head", () => ((HoldNote)objects[0]).Head, HitResult.Perfect);
|
||||||
|
addJudgementAssert("first tail", () => ((HoldNote)objects[0]).Tail, HitResult.Perfect);
|
||||||
|
|
||||||
|
addJudgementAssert(objects[1], HitResult.IgnoreHit);
|
||||||
|
addJudgementAssert("second head", () => ((HoldNote)objects[1]).Head, HitResult.Great);
|
||||||
|
addJudgementAssert("second tail", () => ((HoldNote)objects[1]).Tail, HitResult.Perfect);
|
||||||
|
}
|
||||||
|
|
||||||
private void addJudgementAssert(ManiaHitObject hitObject, HitResult result)
|
private void addJudgementAssert(ManiaHitObject hitObject, HitResult result)
|
||||||
{
|
{
|
||||||
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",
|
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",
|
||||||
() => judgementResults.Single(r => r.HitObject == hitObject).Type == result);
|
() => judgementResults.Single(r => r.HitObject == hitObject).Type == result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addJudgementAssert(string name, Func<ManiaHitObject> hitObject, HitResult result)
|
||||||
|
{
|
||||||
|
AddAssert($"{name} judgement is {result}",
|
||||||
|
() => judgementResults.Single(r => r.HitObject == hitObject()).Type == result);
|
||||||
|
}
|
||||||
|
|
||||||
private void addJudgementOffsetAssert(ManiaHitObject hitObject, double offset)
|
private void addJudgementOffsetAssert(ManiaHitObject hitObject, double offset)
|
||||||
{
|
{
|
||||||
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judged at {offset}",
|
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judged at {offset}",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
@ -44,9 +43,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
/// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param>
|
/// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param>
|
||||||
public void HandleHit(DrawableHitObject hitObject)
|
public void HandleHit(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
if (hitObject.IsHit && !IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset))
|
|
||||||
throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!");
|
|
||||||
|
|
||||||
foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime))
|
foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime))
|
||||||
{
|
{
|
||||||
if (obj.Judged)
|
if (obj.Judged)
|
||||||
|
Loading…
Reference in New Issue
Block a user