2021-02-03 14:08:59 +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.
|
|
|
|
|
2021-02-05 07:59:13 +00:00
|
|
|
using System.Collections.Generic;
|
2021-02-03 14:08:59 +00:00
|
|
|
using System.Linq;
|
2021-02-05 06:23:03 +00:00
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Configuration;
|
2021-02-03 14:08:59 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2021-02-05 07:59:13 +00:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2021-02-03 14:08:59 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2021-02-05 07:59:13 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2021-02-05 06:23:03 +00:00
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
|
|
|
using osu.Game.Rulesets.UI;
|
2021-02-03 14:08:59 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
2021-04-21 06:14:19 +00:00
|
|
|
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObjects, IApplicableToDrawableRuleset<OsuHitObject>
|
2021-02-03 14:08:59 +00:00
|
|
|
{
|
2021-02-10 09:41:28 +00:00
|
|
|
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
|
|
|
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
2021-02-05 06:23:03 +00:00
|
|
|
|
2021-02-10 09:41:28 +00:00
|
|
|
[SettingSource("No slider head movement", "Pins slider heads at their starting position, regardless of time.")]
|
|
|
|
public Bindable<bool> NoSliderHeadMovement { get; } = new BindableBool(true);
|
2021-02-05 06:23:03 +00:00
|
|
|
|
2021-02-10 09:41:28 +00:00
|
|
|
[SettingSource("Apply classic note lock", "Applies note lock to the full hit window.")]
|
|
|
|
public Bindable<bool> ClassicNoteLock { get; } = new BindableBool(true);
|
2021-02-05 06:23:03 +00:00
|
|
|
|
2021-02-10 09:41:28 +00:00
|
|
|
[SettingSource("Use fixed slider follow circle hit area", "Makes the slider follow circle track its final size at all times.")]
|
|
|
|
public Bindable<bool> FixedFollowCircleHitArea { get; } = new BindableBool(true);
|
2021-02-05 07:59:13 +00:00
|
|
|
|
2021-04-02 08:10:28 +00:00
|
|
|
[SettingSource("Always play a slider's tail sample", "Always plays a slider's tail sample regardless of whether it was hit or not.")]
|
|
|
|
public Bindable<bool> AlwaysPlayTailSample { get; } = new BindableBool(true);
|
|
|
|
|
2021-02-03 14:08:59 +00:00
|
|
|
public void ApplyToHitObject(HitObject hitObject)
|
|
|
|
{
|
|
|
|
switch (hitObject)
|
|
|
|
{
|
|
|
|
case Slider slider:
|
2021-02-10 09:46:26 +00:00
|
|
|
slider.OnlyJudgeNestedObjects = !NoSliderHeadAccuracy.Value;
|
2021-02-03 14:08:59 +00:00
|
|
|
|
|
|
|
foreach (var head in slider.NestedHitObjects.OfType<SliderHeadCircle>())
|
2021-02-10 09:41:28 +00:00
|
|
|
head.JudgeAsNormalHitCircle = !NoSliderHeadAccuracy.Value;
|
2021-02-03 14:08:59 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-02-05 06:23:03 +00:00
|
|
|
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
|
|
|
{
|
|
|
|
var osuRuleset = (DrawableOsuRuleset)drawableRuleset;
|
|
|
|
|
2021-02-10 11:27:47 +00:00
|
|
|
if (ClassicNoteLock.Value)
|
2021-02-05 06:23:03 +00:00
|
|
|
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
|
|
|
}
|
2021-02-05 07:59:13 +00:00
|
|
|
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
{
|
|
|
|
foreach (var obj in drawables)
|
|
|
|
{
|
2021-02-05 08:33:48 +00:00
|
|
|
switch (obj)
|
|
|
|
{
|
|
|
|
case DrawableSlider slider:
|
2021-02-10 09:53:23 +00:00
|
|
|
slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value;
|
2021-02-05 08:33:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DrawableSliderHead head:
|
2021-02-10 09:41:28 +00:00
|
|
|
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
|
2021-02-05 08:33:48 +00:00
|
|
|
break;
|
2021-04-02 07:54:35 +00:00
|
|
|
|
|
|
|
case DrawableSliderTail tail:
|
2021-04-02 08:56:23 +00:00
|
|
|
tail.SamplePlaysOnlyOnHit = !AlwaysPlayTailSample.Value;
|
2021-04-02 07:54:35 +00:00
|
|
|
break;
|
2021-02-05 08:33:48 +00:00
|
|
|
}
|
2021-02-05 07:59:13 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-03 14:08:59 +00:00
|
|
|
}
|
|
|
|
}
|