2024-06-28 11:43:45 +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.
|
|
|
|
|
2024-07-19 11:02:17 +00:00
|
|
|
using System;
|
2024-07-01 11:34:33 +00:00
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
2024-06-28 11:43:45 +00:00
|
|
|
using osu.Framework.Localisation;
|
2024-07-01 11:34:33 +00:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
2024-06-28 11:43:45 +00:00
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2024-07-01 11:34:33 +00:00
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2024-06-28 11:43:45 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2024-07-01 11:34:33 +00:00
|
|
|
using osu.Game.Rulesets.UI;
|
2024-06-28 11:43:45 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Mods
|
|
|
|
{
|
2024-07-01 11:34:33 +00:00
|
|
|
public partial class ManiaModNoRelease : Mod, IApplicableAfterBeatmapConversion, IApplicableToDrawableRuleset<ManiaHitObject>
|
2024-06-28 11:43:45 +00:00
|
|
|
{
|
|
|
|
public override string Name => "No Release";
|
|
|
|
|
|
|
|
public override string Acronym => "NR";
|
|
|
|
|
|
|
|
public override LocalisableString Description => "No more timing the end of hold notes.";
|
|
|
|
|
|
|
|
public override double ScoreMultiplier => 0.9;
|
|
|
|
|
|
|
|
public override ModType Type => ModType.DifficultyReduction;
|
|
|
|
|
2024-07-19 11:02:17 +00:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ManiaModHoldOff) };
|
|
|
|
|
2024-07-01 11:34:33 +00:00
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
2024-06-28 11:43:45 +00:00
|
|
|
{
|
2024-07-01 11:34:33 +00:00
|
|
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
|
|
|
var hitObjects = maniaBeatmap.HitObjects.Select(obj =>
|
2024-06-28 11:43:45 +00:00
|
|
|
{
|
2024-07-01 11:34:33 +00:00
|
|
|
if (obj is HoldNote hold)
|
|
|
|
return new NoReleaseHoldNote(hold);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
maniaBeatmap.HitObjects = hitObjects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
|
|
|
{
|
|
|
|
var maniaRuleset = (DrawableManiaRuleset)drawableRuleset;
|
|
|
|
|
|
|
|
foreach (var stage in maniaRuleset.Playfield.Stages)
|
|
|
|
{
|
|
|
|
foreach (var column in stage.Columns)
|
|
|
|
{
|
|
|
|
column.RegisterPool<NoReleaseTailNote, NoReleaseDrawableHoldNoteTail>(10, 50);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private partial class NoReleaseDrawableHoldNoteTail : DrawableHoldNoteTail
|
|
|
|
{
|
|
|
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
|
|
|
{
|
|
|
|
// apply perfect once the tail is reached
|
|
|
|
if (HoldNote.HoldStartTime != null && timeOffset >= 0)
|
|
|
|
ApplyResult(GetCappedResult(HitResult.Perfect));
|
|
|
|
else
|
|
|
|
base.CheckForResult(userTriggered, timeOffset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class NoReleaseTailNote : TailNote
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private class NoReleaseHoldNote : HoldNote
|
|
|
|
{
|
|
|
|
public NoReleaseHoldNote(HoldNote hold)
|
|
|
|
{
|
|
|
|
StartTime = hold.StartTime;
|
|
|
|
Duration = hold.Duration;
|
|
|
|
Column = hold.Column;
|
|
|
|
NodeSamples = hold.NodeSamples;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
AddNested(Head = new HeadNote
|
|
|
|
{
|
|
|
|
StartTime = StartTime,
|
|
|
|
Column = Column,
|
|
|
|
Samples = GetNodeSamples(0),
|
|
|
|
});
|
|
|
|
|
|
|
|
AddNested(Tail = new NoReleaseTailNote
|
|
|
|
{
|
|
|
|
StartTime = EndTime,
|
|
|
|
Column = Column,
|
|
|
|
Samples = GetNodeSamples((NodeSamples?.Count - 1) ?? 1),
|
|
|
|
});
|
|
|
|
|
|
|
|
AddNested(Body = new HoldNoteBody
|
2024-06-28 11:43:45 +00:00
|
|
|
{
|
2024-07-01 11:34:33 +00:00
|
|
|
StartTime = StartTime,
|
|
|
|
Column = Column
|
|
|
|
});
|
2024-06-28 11:43:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|