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