diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModWindDown.cs b/osu.Game.Rulesets.Catch/Mods/CatchModWindDown.cs index 535cc1c290..95aa7c814c 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModWindDown.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModWindDown.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModWindUp.cs b/osu.Game.Rulesets.Catch/Mods/CatchModWindUp.cs index 3293840e92..1c447d4c8b 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModWindUp.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModWindUp.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Catch.Objects; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModWindDown.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModWindDown.cs index 3ecb8f5f23..39dae4502c 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModWindDown.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModWindDown.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModWindUp.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModWindUp.cs index f482fe0641..6ad0693910 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModWindUp.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModWindUp.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mania.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWindDown.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWindDown.cs index 1a6abd5a8d..200fe54692 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWindDown.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWindDown.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWindUp.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWindUp.cs index 16ee9c0ed1..884f3fa716 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWindUp.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWindUp.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModWindDown.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModWindDown.cs index 6a56ed1917..566e39049a 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModWindDown.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModWindDown.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModWindUp.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModWindUp.cs index 5a9dfb8348..ea980c1212 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModWindUp.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModWindUp.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs index d87fb5de23..e59654c60d 100644 --- a/osu.Game/Rulesets/Mods/ModDoubleTime.cs +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -15,7 +15,7 @@ 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(ModWindUp) }; + public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime), typeof(ModTimeRamp) }; public virtual void ApplyToClock(IAdjustableClock clock) { diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs index 0b421431d3..07cceb6f49 100644 --- a/osu.Game/Rulesets/Mods/ModHalfTime.cs +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -15,7 +15,7 @@ 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(ModWindUp) }; + public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModTimeRamp) }; public virtual void ApplyToClock(IAdjustableClock clock) { diff --git a/osu.Game/Rulesets/Mods/ModTimeRamp.cs b/osu.Game/Rulesets/Mods/ModTimeRamp.cs new file mode 100644 index 0000000000..5941be20c9 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModTimeRamp.cs @@ -0,0 +1,46 @@ +// Copyright (c) ppy Pty Ltd . 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; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModTimeRamp : Mod + { + public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) }; + public abstract double AppendRate { get; } + } + + public abstract class ModTimeRamp : ModTimeRamp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap + where T : HitObject + { + private double lastObjectEndTime; + private IAdjustableClock clock; + private IHasPitchAdjust pitchAdjust; + + public virtual void ApplyToClock(IAdjustableClock clk) + { + clock = clk; + pitchAdjust = clk as IHasPitchAdjust; + } + + public virtual void ApplyToBeatmap(Beatmap beatmap) + { + HitObject lastObject = beatmap.HitObjects[beatmap.HitObjects.Count - 1]; + lastObjectEndTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; + } + + public virtual void Update(Playfield playfield) + { + double newRate = 1 + (AppendRate * (clock.CurrentTime / lastObjectEndTime)); + clock.Rate = newRate; + pitchAdjust.PitchAdjust = newRate; + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModWindDown.cs b/osu.Game/Rulesets/Mods/ModWindDown.cs index e590e06ed6..474a1d4551 100644 --- a/osu.Game/Rulesets/Mods/ModWindDown.cs +++ b/osu.Game/Rulesets/Mods/ModWindDown.cs @@ -6,13 +6,14 @@ using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mods { - public class ModWindDown : ModWindUp + public class ModWindDown : ModTimeRamp where T : HitObject { public override string Name => "Wind Down"; public override string Acronym => "WD"; - public override string Description => "Slow down."; + public override string Description => "Cool down."; public override FontAwesome Icon => FontAwesome.fa_chevron_circle_down; + public override double ScoreMultiplier => 1.0; public override double AppendRate => -0.25; } } \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModWindUp.cs b/osu.Game/Rulesets/Mods/ModWindUp.cs index d1b9f6dbf7..6b41cd565c 100644 --- a/osu.Game/Rulesets/Mods/ModWindUp.cs +++ b/osu.Game/Rulesets/Mods/ModWindUp.cs @@ -1,58 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; -using osu.Framework.Audio; -using osu.Framework.Audio.Track; -using osu.Framework.Configuration; -using osu.Framework.Timing; -using osu.Framework.Graphics; -using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mods { - public abstract class ModWindUp : Mod + public class ModWindUp : ModTimeRamp + where T : HitObject { public override string Name => "Wind Up"; public override string Acronym => "WU"; - public override ModType Type => ModType.Fun; - public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up; public override string Description => "Crank it up!"; - public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) }; - public abstract double AppendRate { get; } - } - - public abstract class ModWindUp : ModWindUp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap - where T : HitObject - { - private double LastObjectEndTime; - private IAdjustableClock Clock; - private IHasPitchAdjust ClockAdjust; + public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up; + public override double ScoreMultiplier => 1.0; public override double AppendRate => 0.5; - - public virtual void ApplyToClock(IAdjustableClock clock) - { - Clock = clock; - ClockAdjust = clock as IHasPitchAdjust; - } - - public virtual void ApplyToBeatmap(Beatmap beatmap) - { - HitObject LastObject = beatmap.HitObjects[beatmap.HitObjects.Count - 1]; - LastObjectEndTime = (LastObject as IHasEndTime)?.EndTime ?? LastObject?.StartTime ?? 0; - } - - public virtual void Update(Playfield playfield) - { - double newRate = 1 + (AppendRate * (Clock.CurrentTime / LastObjectEndTime)); - Clock.Rate = newRate; - ClockAdjust.PitchAdjust = newRate; - } } } \ No newline at end of file