2022-01-28 04:56:51 +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-01-31 23:00:36 +08:00
|
|
|
|
using System;
|
2022-01-28 04:56:51 +08:00
|
|
|
|
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;
|
2022-08-11 04:09:11 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2022-01-28 04:56:51 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
|
|
|
{
|
2022-01-29 05:59:53 +08:00
|
|
|
|
public class ManiaModHoldOff : Mod, IApplicableAfterBeatmapConversion
|
2022-01-28 04:56:51 +08:00
|
|
|
|
{
|
2022-01-29 05:59:53 +08:00
|
|
|
|
public override string Name => "Hold Off";
|
2022-01-28 04:56:51 +08:00
|
|
|
|
|
2022-01-29 05:59:53 +08:00
|
|
|
|
public override string Acronym => "HO";
|
2022-01-28 04:56:51 +08:00
|
|
|
|
|
2022-11-01 16:57:20 +08:00
|
|
|
|
public override double ScoreMultiplier => 0.9;
|
2022-01-28 04:56:51 +08:00
|
|
|
|
|
2022-08-11 04:09:11 +08:00
|
|
|
|
public override LocalisableString Description => @"Replaces all hold notes with normal notes.";
|
2022-01-28 04:56:51 +08:00
|
|
|
|
|
|
|
|
|
public override IconUsage? Icon => FontAwesome.Solid.DotCircle;
|
|
|
|
|
|
|
|
|
|
public override ModType Type => ModType.Conversion;
|
2022-01-31 11:20:51 +08:00
|
|
|
|
|
2024-07-19 19:02:17 +08:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ManiaModInvert), typeof(ManiaModNoRelease) };
|
2022-01-31 23:00:36 +08:00
|
|
|
|
|
2022-01-28 04:56:51 +08:00
|
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
|
|
|
|
{
|
|
|
|
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
|
|
|
|
|
|
|
|
|
var newObjects = new List<ManiaHitObject>();
|
2022-01-29 12:47:04 +08:00
|
|
|
|
|
2022-01-28 04:56:51 +08:00
|
|
|
|
foreach (var h in beatmap.HitObjects.OfType<HoldNote>())
|
|
|
|
|
{
|
|
|
|
|
// Add a note for the beginning of the hold note
|
|
|
|
|
newObjects.Add(new Note
|
|
|
|
|
{
|
|
|
|
|
Column = h.Column,
|
|
|
|
|
StartTime = h.StartTime,
|
|
|
|
|
Samples = h.GetNodeSamples(0)
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-01-29 12:47:04 +08:00
|
|
|
|
|
2022-01-28 04:56:51 +08:00
|
|
|
|
maniaBeatmap.HitObjects = maniaBeatmap.HitObjects.OfType<Note>().Concat(newObjects).OrderBy(h => h.StartTime).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-29 12:47:04 +08:00
|
|
|
|
}
|