From b72d44b1e805c5b142bac0543126ffae6df94119 Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Wed, 5 Sep 2018 22:54:07 +0200 Subject: [PATCH] Added OsuModDeflate class and adjusted OsuRuleset.cs --- osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs | 44 +++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 5 +++ 2 files changed, 49 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs b/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs new file mode 100644 index 0000000000..ec80537a52 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModDeflate.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public class OsuModDeflate : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Deflate"; + public override string ShortenedName => "DF"; + public override FontAwesome Icon => FontAwesome.fa_compress; + public override ModType Type => ModType.Fun; + public override string Description => "Become one with the approach circle..."; + public override double ScoreMultiplier => 1; + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + foreach (var drawable in drawables) + drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState; + } + + protected void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) + { + if (!(drawable is DrawableHitCircle d)) + return; + + d.ApproachCircle.Hide(); + var h = d.HitObject; + + using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt)) + { + var origScale = d.Scale; + d.ScaleTo(1.1f); + d.ScaleTo(origScale, h.TimePreempt); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index fa6e9a018a..461f7188c9 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -117,6 +117,11 @@ public override IEnumerable GetModsFor(ModType type) new OsuModRelax(), new OsuModAutopilot(), }; + case ModType.Fun: + return new Mod[] + { + new OsuModDeflate(), + }; default: return new Mod[] { }; }