2020-03-23 11:09:30 +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
|
|
|
|
|
2021-05-16 12:03:03 +08:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2020-03-23 11:09:30 +08:00
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Mods
|
|
|
|
{
|
|
|
|
public class TaikoModRandom : ModRandom, IApplicableToBeatmap
|
|
|
|
{
|
|
|
|
public override string Description => @"Shuffle around the colours!";
|
2021-05-17 11:04:01 +08:00
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(TaikoModSwap)).ToArray();
|
2020-03-23 11:09:30 +08:00
|
|
|
|
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
|
|
|
{
|
|
|
|
var taikoBeatmap = (TaikoBeatmap)beatmap;
|
|
|
|
|
2021-06-04 00:16:11 +08:00
|
|
|
Seed.Value ??= RNG.Next();
|
|
|
|
var rng = new Random((int)Seed.Value);
|
|
|
|
|
2020-03-23 11:09:30 +08:00
|
|
|
foreach (var obj in taikoBeatmap.HitObjects)
|
|
|
|
{
|
|
|
|
if (obj is Hit hit)
|
2021-06-04 00:16:11 +08:00
|
|
|
hit.Type = rng.Next(2) == 0 ? HitType.Centre : HitType.Rim;
|
2020-03-23 11:09:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|