1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-02 22:21:12 +08:00
Files
osu-lazer/osu.Game/Rulesets/Mods/ModDaycore.cs
T
Bartłomiej Dach 926f1c99c7 Obsolete Mod.ScoreMultiplier and remove all other references to it (#37846)
- Part of https://github.com/ppy/osu/issues/37818
- [x] Depends on https://github.com/ppy/osu/pull/37845

Purely mechanical, split away for ease of review / due to size.

---------

Co-authored-by: Dean Herbert <pe@ppy.sh>
2026-05-27 16:09:16 +09:00

52 lines
2.0 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 osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModDaycore : ModRateAdjust
{
public override string Name => "Daycore";
public override string Acronym => "DC";
public override IconUsage? Icon => OsuIcon.ModDaycore;
public override ModType Type => ModType.DifficultyReduction;
public override LocalisableString Description => "Whoaaaaa...";
public override bool Ranked => UsesDefaultConfiguration;
[SettingSource("Speed decrease", "The actual decrease to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(0.75)
{
MinValue = 0.5,
MaxValue = 0.99,
Precision = 0.01,
};
private readonly BindableNumber<double> tempoAdjust = new BindableDouble(1);
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
protected ModDaycore()
{
// intentionally not using `RateAdjustModHelper`
// as the expected result of operation is not the same (daycore should preserve constant pitch).
SpeedChange.BindValueChanged(val =>
{
freqAdjust.Value = SpeedChange.Default;
tempoAdjust.Value = val.NewValue / SpeedChange.Default;
}, true);
}
public override void ApplyToTrack(IAdjustableAudioComponent track)
{
track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust);
}
}
}