diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs index eba0b2effe..25db2f7b70 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModHoldOff.cs @@ -6,27 +6,18 @@ using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; -using osu.Framework.Graphics.Sprites; using System.Collections.Generic; using osu.Framework.Localisation; using osu.Game.Rulesets.Mania.Beatmaps; namespace osu.Game.Rulesets.Mania.Mods { - public class ManiaModHoldOff : Mod, IApplicableAfterBeatmapConversion + public class ManiaModHoldOff : ModHoldOff, IApplicableAfterBeatmapConversion { - public override string Name => "Hold Off"; - - public override string Acronym => "HO"; - public override double ScoreMultiplier => 0.9; public override LocalisableString Description => @"Replaces all hold notes with normal notes."; - public override IconUsage? Icon => FontAwesome.Solid.DotCircle; - - public override ModType Type => ModType.Conversion; - public override Type[] IncompatibleMods => new[] { typeof(ManiaModInvert), typeof(ManiaModNoRelease) }; public void ApplyToBeatmap(IBeatmap beatmap) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHoldOff.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHoldOff.cs new file mode 100644 index 0000000000..9c9d9b49be --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHoldOff.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Mods; +using System.Collections.Generic; +using osu.Framework.Localisation; +using osu.Game.Rulesets.Osu.Beatmaps; +using osu.Game.Rulesets.Objects.Types; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public class OsuModHoldOff : ModHoldOff, IApplicableAfterBeatmapConversion + { + public override double ScoreMultiplier => 0.7; + + public override LocalisableString Description => @"Replaces all sliders with circles."; + + public override Type[] IncompatibleMods => new[] { typeof(OsuModStrictTracking) }; + + public void ApplyToBeatmap(IBeatmap beatmap) + { + var osuBeatmap = (OsuBeatmap)beatmap; + + var newObjects = new List(); + + foreach (var s in beatmap.HitObjects.OfType()) + { + newObjects.Add(new HitCircle + { + StartTime = s.StartTime, + Position = s.Position, + NewCombo = s.NewCombo, + Samples = s.GetNodeSamples(0) + }); + } + + osuBeatmap.HitObjects = osuBeatmap.HitObjects.Where(o => o is not Slider).Concat(newObjects).OrderBy(h => h.StartTime).ToList(); + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 7042ad0cd4..245615eb9a 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -182,6 +182,7 @@ namespace osu.Game.Rulesets.Osu new OsuModClassic(), new OsuModRandom(), new OsuModMirror(), + new OsuModHoldOff(), new MultiMod(new OsuModAlternate(), new OsuModSingleTap()) }; diff --git a/osu.Game/Rulesets/Mods/ModHoldOff.cs b/osu.Game/Rulesets/Mods/ModHoldOff.cs new file mode 100644 index 0000000000..57237f380f --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModHoldOff.cs @@ -0,0 +1,18 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModHoldOff : Mod + { + public override string Name => "Hold Off"; + + public override string Acronym => "HO"; + + public override IconUsage? Icon => FontAwesome.Solid.DotCircle; + + public override ModType Type => ModType.Conversion; + } +}