-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 #25420 from smoogipoo/hp-drain-fix-breaks
Fix osu! and base HP processor break time simulation
- Loading branch information
Showing
4 changed files
with
202 additions
and
41 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
osu.Game.Rulesets.Osu.Tests/TestSceneOsuHealthProcessor.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,93 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Beatmaps.Timing; | ||
using osu.Game.Rulesets.Osu.Objects; | ||
using osu.Game.Rulesets.Osu.Scoring; | ||
|
||
namespace osu.Game.Rulesets.Osu.Tests | ||
{ | ||
[TestFixture] | ||
public class TestSceneOsuHealthProcessor | ||
{ | ||
[Test] | ||
public void TestNoBreak() | ||
{ | ||
OsuHealthProcessor hp = new OsuHealthProcessor(-1000); | ||
hp.ApplyBeatmap(new Beatmap<OsuHitObject> | ||
{ | ||
HitObjects = | ||
{ | ||
new HitCircle { StartTime = 0 }, | ||
new HitCircle { StartTime = 2000 } | ||
} | ||
}); | ||
|
||
Assert.That(hp.DrainRate, Is.EqualTo(1.4E-5).Within(0.1E-5)); | ||
} | ||
|
||
[Test] | ||
public void TestSingleBreak() | ||
{ | ||
OsuHealthProcessor hp = new OsuHealthProcessor(-1000); | ||
hp.ApplyBeatmap(new Beatmap<OsuHitObject> | ||
{ | ||
HitObjects = | ||
{ | ||
new HitCircle { StartTime = 0 }, | ||
new HitCircle { StartTime = 2000 } | ||
}, | ||
Breaks = | ||
{ | ||
new BreakPeriod(500, 1500) | ||
} | ||
}); | ||
|
||
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5)); | ||
} | ||
|
||
[Test] | ||
public void TestOverlappingBreak() | ||
{ | ||
OsuHealthProcessor hp = new OsuHealthProcessor(-1000); | ||
hp.ApplyBeatmap(new Beatmap<OsuHitObject> | ||
{ | ||
HitObjects = | ||
{ | ||
new HitCircle { StartTime = 0 }, | ||
new HitCircle { StartTime = 2000 } | ||
}, | ||
Breaks = | ||
{ | ||
new BreakPeriod(500, 1400), | ||
new BreakPeriod(750, 1500), | ||
} | ||
}); | ||
|
||
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5)); | ||
} | ||
|
||
[Test] | ||
public void TestSequentialBreak() | ||
{ | ||
OsuHealthProcessor hp = new OsuHealthProcessor(-1000); | ||
hp.ApplyBeatmap(new Beatmap<OsuHitObject> | ||
{ | ||
HitObjects = | ||
{ | ||
new HitCircle { StartTime = 0 }, | ||
new HitCircle { StartTime = 2000 } | ||
}, | ||
Breaks = | ||
{ | ||
new BreakPeriod(500, 1000), | ||
new BreakPeriod(1000, 1500), | ||
} | ||
}); | ||
|
||
Assert.That(hp.DrainRate, Is.EqualTo(4.3E-5).Within(0.1E-5)); | ||
} | ||
} | ||
} |
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