Merge pull request #13629 from ekrctb/hard-rock-pattern

Add osu!catch Difficulty Adjust setting to enable "Hard Rock offsets"
This commit is contained in:
Dan Balasescu
2021-06-23 20:05:14 +09:00
committed by GitHub

View File

@ -5,11 +5,12 @@ using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Mods namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModDifficultyAdjust : ModDifficultyAdjust public class CatchModDifficultyAdjust : ModDifficultyAdjust, IApplicableToBeatmapProcessor
{ {
[SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)] [SettingSource("Circle Size", "Override a beatmap's set CS.", FIRST_SETTING_ORDER - 1)]
public BindableNumber<float> CircleSize { get; } = new BindableFloatWithLimitExtension public BindableNumber<float> CircleSize { get; } = new BindableFloatWithLimitExtension
@ -31,6 +32,9 @@ namespace osu.Game.Rulesets.Catch.Mods
Value = 5, Value = 5,
}; };
[SettingSource("Spicy Patterns", "Adjust the patterns as if Hard Rock is enabled.")]
public BindableBool HardRockOffsets { get; } = new BindableBool();
protected override void ApplyLimits(bool extended) protected override void ApplyLimits(bool extended)
{ {
base.ApplyLimits(extended); base.ApplyLimits(extended);
@ -45,12 +49,14 @@ namespace osu.Game.Rulesets.Catch.Mods
{ {
string circleSize = CircleSize.IsDefault ? string.Empty : $"CS {CircleSize.Value:N1}"; string circleSize = CircleSize.IsDefault ? string.Empty : $"CS {CircleSize.Value:N1}";
string approachRate = ApproachRate.IsDefault ? string.Empty : $"AR {ApproachRate.Value:N1}"; string approachRate = ApproachRate.IsDefault ? string.Empty : $"AR {ApproachRate.Value:N1}";
string spicyPatterns = HardRockOffsets.IsDefault ? string.Empty : "Spicy patterns";
return string.Join(", ", new[] return string.Join(", ", new[]
{ {
circleSize, circleSize,
base.SettingDescription, base.SettingDescription,
approachRate approachRate,
spicyPatterns,
}.Where(s => !string.IsNullOrEmpty(s))); }.Where(s => !string.IsNullOrEmpty(s)));
} }
} }
@ -70,5 +76,11 @@ namespace osu.Game.Rulesets.Catch.Mods
ApplySetting(CircleSize, cs => difficulty.CircleSize = cs); ApplySetting(CircleSize, cs => difficulty.CircleSize = cs);
ApplySetting(ApproachRate, ar => difficulty.ApproachRate = ar); ApplySetting(ApproachRate, ar => difficulty.ApproachRate = ar);
} }
public void ApplyToBeatmapProcessor(IBeatmapProcessor beatmapProcessor)
{
var catchProcessor = (CatchBeatmapProcessor)beatmapProcessor;
catchProcessor.HardRockOffsets = HardRockOffsets.Value;
}
} }
} }