1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Simplify DT/HT/NC/DC

This commit is contained in:
Dean Herbert 2019-03-12 18:14:41 +09:00
parent c1a356161f
commit 6832e384a9
5 changed files with 36 additions and 16 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
public override void ApplyToClock(IAdjustableClock clock)
{
if (clock is IHasPitchAdjust pitchAdjust)
pitchAdjust.PitchAdjust = 0.75;
pitchAdjust.PitchAdjust *= RateAdjust;
else
base.ApplyToClock(clock);
}

View File

@ -2,12 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Timing;
using System.Linq;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModDoubleTime : Mod, IApplicableToClock
public abstract class ModDoubleTime : ModTimeAdjust, IApplicableToClock
{
public override string Name => "Double Time";
public override string Acronym => "DT";
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Zoooooooooom...";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime), typeof(ModTimeRamp) };
public virtual void ApplyToClock(IAdjustableClock clock)
{
clock.Rate = 1.5;
}
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModHalfTime)).ToArray();
protected override double RateAdjust => 1.5;
}
}

View File

@ -2,12 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Timing;
using System.Linq;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModHalfTime : Mod, IApplicableToClock
public abstract class ModHalfTime : ModTimeAdjust, IApplicableToClock
{
public override string Name => "Half Time";
public override string Acronym => "HT";
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyReduction;
public override string Description => "Less zoom...";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModTimeRamp) };
public virtual void ApplyToClock(IAdjustableClock clock)
{
clock.Rate = 0.75;
}
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModDoubleTime)).ToArray();
protected override double RateAdjust => 0.75;
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
public override void ApplyToClock(IAdjustableClock clock)
{
if (clock is IHasPitchAdjust pitchAdjust)
pitchAdjust.PitchAdjust = 1.5;
pitchAdjust.PitchAdjust *= RateAdjust;
else
base.ApplyToClock(clock);
}

View File

@ -0,0 +1,24 @@
// 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;
using osu.Framework.Audio;
using osu.Framework.Timing;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModTimeAdjust : Mod
{
public override Type[] IncompatibleMods => new[] { typeof(ModTimeRamp) };
protected abstract double RateAdjust { get; }
public virtual void ApplyToClock(IAdjustableClock clock)
{
if (clock is IHasTempoAdjust tempo)
tempo.TempoAdjust *= RateAdjust;
else
clock.Rate *= RateAdjust;
}
}
}