diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBloom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBloom.cs new file mode 100644 index 0000000000..193b0142df --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBloom.cs @@ -0,0 +1,106 @@ +// 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.Diagnostics; +using osu.Framework.Bindables; +using osu.Framework.Localisation; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Rulesets.Osu.UI.Cursor; + +namespace osu.Game.Rulesets.Osu.Mods +{ + public class OsuModBloom : Mod, IApplicableToScoreProcessor, IUpdatableByPlayfield, IApplicableToPlayer + { + public override string Name => "Bloom"; + public override string Acronym => "BM"; + public override ModType Type => ModType.Fun; + public override LocalisableString Description => "The cursor blooms into a.. larger cursor!"; + public override double ScoreMultiplier => 1; + protected const float MIN_SIZE = 1; + protected const float TRANSITION_DURATION = 100; + public override Type[] IncompatibleMods => new[] { typeof(OsuModFlashlight), typeof(OsuModNoScope), typeof(OsuModObjectScaleTween), typeof(OsuModTouchDevice), typeof(OsuModAutopilot) }; + + + protected readonly BindableNumber CurrentCombo = new BindableInt(); + protected readonly IBindable IsBreakTime = new Bindable(); + protected float ComboBasedSize; + + + [SettingSource( + "Max Size at Combo", + "The combo count at which the cursor reaches its maximum size", + SettingControlType = typeof(SettingsSlider) + )] + public BindableInt MaxSizeComboCount { get; } = new BindableInt(50) + { + MinValue = 0, + MaxValue = 100, + }; + [SettingSource( + "Final Size Multiplier", + "The multiplier applied to cursor size when combo reaches maximum", + SettingControlType = typeof(SettingsSlider>) + )] + public BindableFloat MaxMulti { get; } = new BindableFloat(10f) + { + MinValue = 5f, + MaxValue = 15f, + Precision = 0.5f, + }; + public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank; + public void ApplyToPlayer(Player player) + { + IsBreakTime.BindTo(player.IsBreakTime); + } + + public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) + { + if (MaxSizeComboCount.Value == 0) return; + + CurrentCombo.BindTo(scoreProcessor.Combo); + CurrentCombo.BindValueChanged(combo => + { + ComboBasedSize = Math.Min(MaxMulti.Value, 10 * ((float)combo.NewValue / MaxSizeComboCount.Value)); + ComboBasedSize = Math.Max(ComboBasedSize, MIN_SIZE); + }, true + ); + } + public void Update(Playfield playfield) + //terrible terrible handling on making sure cursor position stays accurate, will fix + { + bool beBaseSize = IsBreakTime.Value; + var osuPlayfield = (OsuPlayfield)playfield; + Debug.Assert(osuPlayfield.Cursor != null); + var realCursor = (OsuCursor)osuPlayfield.Cursor.ActiveCursor; + realCursor.isBloom = true; + if (beBaseSize) + { + realCursor.ComboSize = 1; + } + else + { + realCursor.ComboSize = ComboBasedSize; + } + } + + + + + } + public partial class MaxSizeSlider : RoundedSliderBar + { + public override LocalisableString TooltipText => Current.Value == 0 ? "always at max size" : base.TooltipText; + } + +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 2f928aaefa..25b1dd9b12 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -214,7 +214,8 @@ public override IEnumerable GetModsFor(ModType type) new OsuModFreezeFrame(), new OsuModBubbles(), new OsuModSynesthesia(), - new OsuModDepth() + new OsuModDepth(), + new OsuModBloom() }; case ModType.System: diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs index 0bb316e0aa..75a38826ad 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/OsuCursor.cs @@ -39,6 +39,8 @@ public partial class OsuCursor : SkinReloadableDrawable public IBindable CursorScale => cursorScale; private readonly Bindable cursorScale = new BindableFloat(1); + public bool isBloom; + public float ComboSize; private Bindable userCursorScale = null!; private Bindable autoCursorScale = null!; @@ -68,6 +70,7 @@ private void load() autoCursorScale.ValueChanged += _ => cursorScale.Value = CalculateCursorScale(); cursorScale.BindValueChanged(e => cursorScaleContainer.Scale = new Vector2(e.NewValue), true); + isBloom = false; } protected override void LoadComplete() @@ -75,6 +78,15 @@ protected override void LoadComplete() base.LoadComplete(); cursorScale.Value = CalculateCursorScale(); } + protected override void Update() + //this should not exist will implement sane fix + { + base.Update(); + if (isBloom) + { + cursorScale.Value = ComboSize; + } + } protected virtual Drawable CreateCursorContent() => cursorScaleContainer = new Container {