2020-04-16 13:11:38 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-04-16 13:11:38 +08:00
|
|
|
using System.Collections.Generic;
|
2020-12-04 05:38:51 +08:00
|
|
|
using System.Linq;
|
2020-04-16 13:11:38 +08:00
|
|
|
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 osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|
|
|
{
|
2020-06-04 04:23:56 +08:00
|
|
|
public class TestSceneOsuModHidden : OsuModTestScene
|
2020-04-16 13:11:38 +08:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(0)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void FirstCircleAfterTwoSpinners() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
EndTime = 1000,
|
|
|
|
},
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
StartTime = 1200,
|
|
|
|
EndTime = 2200,
|
|
|
|
},
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
Position = new Vector2(300, 192),
|
|
|
|
StartTime = 3200,
|
|
|
|
},
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
Position = new Vector2(384, 192),
|
|
|
|
StartTime = 4200,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void FirstSliderAfterTwoSpinners() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
EndTime = 1000,
|
|
|
|
},
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
StartTime = 1200,
|
|
|
|
EndTime = 2200,
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 3200,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 5200,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
2020-12-03 13:54:02 +08:00
|
|
|
[Test]
|
|
|
|
public void TestWithSliderReuse() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-12-03 13:54:02 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 1000,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 4000,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
PassCondition = checkSomeHit
|
|
|
|
});
|
|
|
|
|
2021-10-25 13:17:55 +08:00
|
|
|
[Test]
|
2021-10-26 10:30:26 +08:00
|
|
|
public void TestApproachCirclesOnly() => CreateModTest(new ModTestData
|
2021-10-25 13:17:55 +08:00
|
|
|
{
|
2021-10-25 15:25:32 +08:00
|
|
|
Mod = new OsuModHidden { OnlyFadeApproachCircles = { Value = true } },
|
2021-10-25 13:17:55 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
StartTime = 1000,
|
2021-10-26 10:30:26 +08:00
|
|
|
Position = new Vector2(206, 142)
|
2021-10-25 13:17:55 +08:00
|
|
|
},
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
StartTime = 2000,
|
2021-10-26 10:30:26 +08:00
|
|
|
Position = new Vector2(306, 142)
|
2021-10-25 13:17:55 +08:00
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 3000,
|
2021-10-26 10:30:26 +08:00
|
|
|
Position = new Vector2(156, 242),
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(200, 0), })
|
2021-10-25 13:17:55 +08:00
|
|
|
},
|
|
|
|
new Spinner
|
|
|
|
{
|
2021-10-26 10:30:26 +08:00
|
|
|
Position = new Vector2(256, 192),
|
2021-10-25 13:17:55 +08:00
|
|
|
StartTime = 7000,
|
|
|
|
EndTime = 9000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
PassCondition = checkSomeHit
|
|
|
|
});
|
|
|
|
|
2020-12-04 05:38:51 +08:00
|
|
|
private bool checkSomeHit() => Player.ScoreProcessor.JudgedHits >= 4;
|
|
|
|
|
|
|
|
private bool objectWithIncreasedVisibilityHasIndex(int index)
|
2021-10-07 15:26:24 +08:00
|
|
|
=> Player.GameplayState.Mods.OfType<TestOsuModHidden>().Single().FirstObject == Player.GameplayState.Beatmap.HitObjects[index];
|
2020-12-04 05:38:51 +08:00
|
|
|
|
|
|
|
private class TestOsuModHidden : OsuModHidden
|
2020-04-16 13:11:38 +08:00
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
public new HitObject FirstObject => base.FirstObject;
|
2020-04-16 13:11:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|