2022-03-09 05:47:54 +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.
|
|
|
|
|
|
|
|
using System;
|
2022-03-20 02:29:44 +08:00
|
|
|
using System.Linq;
|
2022-03-09 05:47:54 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2022-03-20 02:29:44 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods.Objects;
|
2022-03-09 05:47:54 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2022-03-20 02:29:44 +08:00
|
|
|
using osu.Game.Rulesets.UI;
|
2022-03-09 05:47:54 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
2022-03-20 02:29:44 +08:00
|
|
|
public class OsuModStrictTracking : Mod, IApplicableAfterBeatmapConversion, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset<OsuHitObject>
|
2022-03-09 05:47:54 +08:00
|
|
|
{
|
|
|
|
public override string Name => @"Strict Tracking";
|
|
|
|
public override string Acronym => @"ST";
|
|
|
|
public override IconUsage? Icon => FontAwesome.Solid.PenFancy;
|
|
|
|
public override ModType Type => ModType.DifficultyIncrease;
|
|
|
|
public override string Description => @"Follow circles just got serious...";
|
|
|
|
public override double ScoreMultiplier => 1.0;
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModClassic) };
|
|
|
|
|
|
|
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
|
|
|
{
|
|
|
|
if (drawable is DrawableSlider slider)
|
|
|
|
{
|
|
|
|
slider.Tracking.ValueChanged += e =>
|
|
|
|
{
|
|
|
|
if (e.NewValue || slider.Judged) return;
|
|
|
|
|
|
|
|
slider.MissForcefully();
|
|
|
|
|
|
|
|
foreach (var o in slider.NestedHitObjects)
|
|
|
|
{
|
|
|
|
if (o is DrawableOsuHitObject h && !o.Judged)
|
|
|
|
h.MissForcefully();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-20 02:29:44 +08:00
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
2022-03-09 05:47:54 +08:00
|
|
|
{
|
2022-03-20 02:29:44 +08:00
|
|
|
var osuBeatmap = (OsuBeatmap)beatmap;
|
|
|
|
|
|
|
|
if (osuBeatmap.HitObjects.Count == 0) return;
|
|
|
|
|
|
|
|
var hitObjects = osuBeatmap.HitObjects.Select(ho =>
|
2022-03-09 05:47:54 +08:00
|
|
|
{
|
2022-03-20 02:29:44 +08:00
|
|
|
if (ho is Slider slider)
|
|
|
|
{
|
|
|
|
var newSlider = new StrictTrackingSlider(slider);
|
|
|
|
return newSlider;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ho;
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
osuBeatmap.HitObjects = hitObjects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
|
|
|
{
|
|
|
|
drawableRuleset.Playfield.RegisterPool<StrictTrackingSlider, DrawableSlider>(10, 100);
|
|
|
|
drawableRuleset.Playfield.RegisterPool<StrictTrackingSliderTailCircle, StrictTrackingDrawableSliderTail>(10, 100);
|
2022-03-09 05:47:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|