<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Osu.Mods
{
    public class OsuModFreezeFrame : ModWithVisibilityAdjustment, IApplicableToDrawableRuleset<OsuHitObject>
    {
        public override string Name => "Freeze Frame";

        public override string Acronym => "FF";

        public override double ScoreMultiplier => 1;

        public override LocalisableString Description => "Burn the notes into your memory";

        public override ModType Type => ModType.Fun;

        public override IconUsage? Icon => FontAwesome.Solid.Camera;

        [SettingSource("Measure", "How often the hit-circles should be Grouped to freeze")]
        public Bindable<BeatDivisor> Divisor { get; } = new Bindable<BeatDivisor>(BeatDivisor.Single_Measure);

        public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
        {
            (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
        }

        public override void ApplyToBeatmap(IBeatmap beatmap)
        {
            base.ApplyToBeatmap(beatmap);

            foreach (var obj in beatmap.HitObjects.OfType<OsuHitObject>())
            {
                // The +1s below are added due to First HitCircle in each measure not appearing appropriately without them.
                var lastTimingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime + 1);
                double controlPointDifference = obj.StartTime + 1 - lastTimingPoint.Time;
                double remainder = controlPointDifference % (lastTimingPoint.BeatLength * getMeasure(Divisor.Value)) - 1;
                double finalPreempt = obj.TimePreempt + remainder;
                applyFadeInAdjustment(obj);

                void applyFadeInAdjustment(OsuHitObject osuObject)
                {
                    osuObject.TimePreempt = finalPreempt;
                    foreach (var nested in osuObject.NestedHitObjects.OfType<OsuHitObject>())
                        applyFadeInAdjustment(nested);
                }
            }
        }

        protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) { }

        protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) { }

        private float getMeasure(BeatDivisor divisor)
        {
            switch (divisor)
            {
                case BeatDivisor.Quarter_Measure:
                    return 0.25f;

                case BeatDivisor.Half_Measure:
                    return 0.5f;

                case BeatDivisor.Single_Measure:
                    return 1;

                case BeatDivisor.Double_Measure:
                    return 2;

                case BeatDivisor.Quadruple_Measure:
                    return 4;

                default:
                    throw new ArgumentOutOfRangeException(nameof(divisor), divisor, null);
            }
        }

        //Todo: find better way to represent these Enums to the player
        public enum BeatDivisor
        {
            Quarter_Measure,
            Half_Measure,
            Single_Measure,
            Double_Measure,
            Quadruple_Measure
        }
    }
}
<commit_msg>Give enums descriptions, change acronym and remove icon<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using System.ComponentModel;
using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Osu.Mods
{
    public class OsuModFreezeFrame : ModWithVisibilityAdjustment, IApplicableToDrawableRuleset<OsuHitObject>
    {
        public override string Name => "Freeze Frame";

        public override string Acronym => "FR";

        public override double ScoreMultiplier => 1;

        public override LocalisableString Description => "Burn the notes into your memory.";

        public override ModType Type => ModType.Fun;

        [SettingSource("Beat Divisor", "How often the hitobjects should be grouped according to BPM")]
        public Bindable<BeatDivisor> Divisor { get; } = new Bindable<BeatDivisor>(BeatDivisor.Single_Measure);

        public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
        {
            (drawableRuleset.Playfield as OsuPlayfield)?.FollowPoints.Hide();
        }

        public override void ApplyToBeatmap(IBeatmap beatmap)
        {
            base.ApplyToBeatmap(beatmap);

            foreach (var obj in beatmap.HitObjects.OfType<OsuHitObject>())
            {
                // The +1s below are added due to First HitCircle in each measure not appearing appropriately without them.
                var lastTimingPoint = beatmap.ControlPointInfo.TimingPointAt(obj.StartTime + 1);
                double controlPointDifference = obj.StartTime + 1 - lastTimingPoint.Time;
                double remainder = controlPointDifference % (lastTimingPoint.BeatLength * getMeasure(Divisor.Value)) - 1;
                double finalPreempt = obj.TimePreempt + remainder;
                applyFadeInAdjustment(obj);

                void applyFadeInAdjustment(OsuHitObject osuObject)
                {
                    osuObject.TimePreempt = finalPreempt;
                    foreach (var nested in osuObject.NestedHitObjects.OfType<OsuHitObject>())
                        applyFadeInAdjustment(nested);
                }
            }
        }

        protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) { }

        protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) { }

        private float getMeasure(BeatDivisor divisor)
        {
            switch (divisor)
            {
                case BeatDivisor.Quarter_Measure:
                    return 0.25f;

                case BeatDivisor.Half_Measure:
                    return 0.5f;

                case BeatDivisor.Single_Measure:
                    return 1;

                case BeatDivisor.Double_Measure:
                    return 2;

                case BeatDivisor.Quadruple_Measure:
                    return 4;

                default:
                    throw new ArgumentOutOfRangeException(nameof(divisor), divisor, null);
            }
        }

        public enum BeatDivisor
        {
            [Description("1/4")]
            Quarter_Measure,

            [Description("1/2")]
            Half_Measure,

            [Description("1")]
            Single_Measure,

            [Description("2")]
            Double_Measure,

            [Description("4")]
            Quadruple_Measure
        }
    }
}
{'fraction_non_alphanumeric': 0.07246376811594203, 'fraction_numerical': 0.004428341384863124, 'mean_word_length': 2.1634125636672326, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1077565', 'n_tokens_mistral': 2087, 'n_tokens_neox': 1917, 'n_words': 474}