-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ppy#26036 from smoogipoo/fix-perfect-mod-special-j…
…udgements Fix perfect mod not failing with special judgements
- Loading branch information
Showing
10 changed files
with
269 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModSuddenDeath.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// 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.Beatmaps; | ||
using osu.Game.Rulesets.Mania.Mods; | ||
using osu.Game.Rulesets.Mania.Objects; | ||
using osu.Game.Rulesets.Mania.Replays; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.Replays; | ||
using osu.Game.Tests.Visual; | ||
|
||
namespace osu.Game.Rulesets.Mania.Tests.Mods | ||
{ | ||
public partial class TestSceneManiaModSuddenDeath : ModFailConditionTestScene | ||
{ | ||
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset(); | ||
|
||
public TestSceneManiaModSuddenDeath() | ||
: base(new ManiaModSuddenDeath()) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void TestGreatHit() => CreateModTest(new ModTestData | ||
{ | ||
Mod = new ManiaModSuddenDeath(), | ||
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), | ||
Autoplay = false, | ||
Beatmap = new Beatmap | ||
{ | ||
HitObjects = new List<HitObject> | ||
{ | ||
new Note | ||
{ | ||
StartTime = 1000, | ||
} | ||
}, | ||
}, | ||
ReplayFrames = new List<ReplayFrame> | ||
{ | ||
new ManiaReplayFrame(1020, ManiaAction.Key1), | ||
new ManiaReplayFrame(2000) | ||
} | ||
}); | ||
|
||
[Test] | ||
public void TestBreakOnHoldNote() => CreateModTest(new ModTestData | ||
{ | ||
Mod = new ManiaModSuddenDeath(), | ||
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2, | ||
Autoplay = false, | ||
Beatmap = new Beatmap | ||
{ | ||
HitObjects = new List<HitObject> | ||
{ | ||
new HoldNote | ||
{ | ||
StartTime = 1000, | ||
EndTime = 3000, | ||
}, | ||
}, | ||
}, | ||
ReplayFrames = new List<ReplayFrame> | ||
{ | ||
new ManiaReplayFrame(1000, ManiaAction.Key1), | ||
new ManiaReplayFrame(2000) | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
// 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 osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Mania.Mods | ||
{ | ||
public class ManiaModPerfect : ModPerfect | ||
{ | ||
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) | ||
{ | ||
if (!isRelevantResult(result.Judgement.MinResult) && !isRelevantResult(result.Judgement.MaxResult) && !isRelevantResult(result.Type)) | ||
return false; | ||
|
||
// Mania allows imperfect "Great" hits without failing. | ||
if (result.Judgement.MaxResult == HitResult.Perfect) | ||
return result.Type < HitResult.Great; | ||
|
||
return result.Type != result.Judgement.MaxResult; | ||
} | ||
|
||
private bool isRelevantResult(HitResult result) => result.AffectsAccuracy() || result.AffectsCombo(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModSuddenDeath.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// 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.Beatmaps; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.Objects.Types; | ||
using osu.Game.Rulesets.Osu.Mods; | ||
using osu.Game.Rulesets.Osu.Objects; | ||
using osu.Game.Rulesets.Osu.Replays; | ||
using osu.Game.Rulesets.Replays; | ||
using osu.Game.Tests.Visual; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Osu.Tests.Mods | ||
{ | ||
public partial class TestSceneOsuModSuddenDeath : ModFailConditionTestScene | ||
{ | ||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset(); | ||
|
||
public TestSceneOsuModSuddenDeath() | ||
: base(new OsuModSuddenDeath()) | ||
{ | ||
} | ||
|
||
[Test] | ||
public void TestMissTail() => CreateModTest(new ModTestData | ||
{ | ||
Mod = new OsuModSuddenDeath(), | ||
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), | ||
Autoplay = false, | ||
Beatmap = new Beatmap | ||
{ | ||
HitObjects = new List<HitObject> | ||
{ | ||
new Slider | ||
{ | ||
Position = new Vector2(256, 192), | ||
StartTime = 1000, | ||
Path = new SliderPath(PathType.LINEAR, new[] { Vector2.Zero, new Vector2(100, 0), }) | ||
}, | ||
}, | ||
}, | ||
ReplayFrames = new List<ReplayFrame> | ||
{ | ||
new OsuReplayFrame(1000, new Vector2(256, 192), OsuAction.LeftButton), | ||
new OsuReplayFrame(1001, new Vector2(256, 192)), | ||
} | ||
}); | ||
|
||
[Test] | ||
public void TestMissTick() => CreateModTest(new ModTestData | ||
{ | ||
Mod = new OsuModSuddenDeath(), | ||
PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true), | ||
Autoplay = false, | ||
Beatmap = new Beatmap | ||
{ | ||
HitObjects = new List<HitObject> | ||
{ | ||
new Slider | ||
{ | ||
Position = new Vector2(256, 192), | ||
StartTime = 1000, | ||
Path = new SliderPath(PathType.LINEAR, new[] { Vector2.Zero, new Vector2(200, 0), }) | ||
}, | ||
}, | ||
}, | ||
ReplayFrames = new List<ReplayFrame> | ||
{ | ||
new OsuReplayFrame(1000, new Vector2(256, 192), OsuAction.LeftButton), | ||
new OsuReplayFrame(1001, new Vector2(256, 192)), | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.