mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 17:00:17 +08:00
a2bae15db1
Reported (in a rather confusing manner) in https://discord.com/channels/188630481301012481/1097318920991559880/1426084740783538268. The relevant bit here is the following logic: https://github.com/ppy/osu/blob/32c60bfb36ae428e6fe56b077d9397c6bc57dd30/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs#L111-L118 which mania enables.
68 lines
2.6 KiB
C#
68 lines
2.6 KiB
C#
// 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;
|
|
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.Framework.Utils;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
{
|
|
public class ManiaModHoldOff : Mod, 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 => OsuIcon.ModHoldOff;
|
|
|
|
public override ModType Type => ModType.Conversion;
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ManiaModInvert), typeof(ManiaModNoRelease) };
|
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
|
{
|
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
|
|
|
double mostCommonBeatLengthBefore = beatmap.GetMostCommonBeatLength();
|
|
|
|
var newObjects = new List<ManiaHitObject>();
|
|
|
|
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)
|
|
});
|
|
}
|
|
|
|
maniaBeatmap.HitObjects = maniaBeatmap.HitObjects.OfType<Note>().Concat(newObjects).OrderBy(h => h.StartTime).ToList();
|
|
|
|
double mostCommonBeatLengthAfter = beatmap.GetMostCommonBeatLength();
|
|
|
|
// the process of removing hold notes can result in shortening the beatmap's play time,
|
|
// and therefore, as a side effect, changing the most common BPM, which will change scroll speed.
|
|
// to compensate for this, apply a multiplier to effect points in order to maintain the beatmap's original intended scroll speed.
|
|
if (!Precision.AlmostEquals(mostCommonBeatLengthBefore, mostCommonBeatLengthAfter))
|
|
{
|
|
foreach (var effectPoint in beatmap.ControlPointInfo.EffectPoints)
|
|
effectPoint.ScrollSpeed *= mostCommonBeatLengthBefore / mostCommonBeatLengthAfter;
|
|
}
|
|
}
|
|
}
|
|
}
|