1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

Merge pull request #11084 from bdach/fix-hidden-increased-visibility-state-2

This commit is contained in:
Dean Herbert 2020-12-04 14:08:36 +09:00 committed by GitHub
commit e37c325d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -2,12 +2,15 @@
// 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.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Play;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Osu.Tests.Mods namespace osu.Game.Rulesets.Osu.Tests.Mods
@ -17,15 +20,15 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
[Test] [Test]
public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData
{ {
Mod = new OsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
PassCondition = checkSomeHit PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(0)
}); });
[Test] [Test]
public void FirstCircleAfterTwoSpinners() => CreateModTest(new ModTestData public void FirstCircleAfterTwoSpinners() => CreateModTest(new ModTestData
{ {
Mod = new OsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = new Beatmap
{ {
@ -54,13 +57,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
} }
} }
}, },
PassCondition = checkSomeHit PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
}); });
[Test] [Test]
public void FirstSliderAfterTwoSpinners() => CreateModTest(new ModTestData public void FirstSliderAfterTwoSpinners() => CreateModTest(new ModTestData
{ {
Mod = new OsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = new Beatmap
{ {
@ -89,13 +92,13 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
} }
} }
}, },
PassCondition = checkSomeHit PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
}); });
[Test] [Test]
public void TestWithSliderReuse() => CreateModTest(new ModTestData public void TestWithSliderReuse() => CreateModTest(new ModTestData
{ {
Mod = new OsuModHidden(), Mod = new TestOsuModHidden(),
Autoplay = true, Autoplay = true,
Beatmap = new Beatmap Beatmap = new Beatmap
{ {
@ -116,9 +119,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
PassCondition = checkSomeHit PassCondition = checkSomeHit
}); });
private bool checkSomeHit() private bool checkSomeHit() => Player.ScoreProcessor.JudgedHits >= 4;
private bool objectWithIncreasedVisibilityHasIndex(int index)
=> Player.Mods.Value.OfType<TestOsuModHidden>().Single().FirstObject == Player.ChildrenOfType<GameplayBeatmap>().Single().HitObjects[index];
private class TestOsuModHidden : OsuModHidden
{ {
return Player.ScoreProcessor.JudgedHits >= 4; public new HitObject FirstObject => base.FirstObject;
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Mods
private const double fade_in_duration_multiplier = 0.4; private const double fade_in_duration_multiplier = 0.4;
private const double fade_out_duration_multiplier = 0.3; private const double fade_out_duration_multiplier = 0.3;
protected override bool IsFirstAdjustableObject(HitObject hitObject) => !(hitObject is Spinner); protected override bool IsFirstAdjustableObject(HitObject hitObject) => !(hitObject is Spinner || hitObject is SpinnerTick);
public override void ApplyToBeatmap(IBeatmap beatmap) public override void ApplyToBeatmap(IBeatmap beatmap)
{ {