Ejemplo n.º 1
0
        /// <summary>
        ///     Applies mods to the map.
        /// </summary>
        /// <param name="mods">a list of mods to apply</param>
        public void ApplyMods(ModIdentifier mods)
        {
            if (mods.HasFlag(ModIdentifier.NoLongNotes))
            {
                ReplaceLongNotesWithRegularNotes();
            }

            if (mods.HasFlag(ModIdentifier.Inverse))
            {
                ApplyInverse();
            }

            // FullLN is NLN followed by Inverse.
            if (mods.HasFlag(ModIdentifier.FullLN))
            {
                ReplaceLongNotesWithRegularNotes();
                ApplyInverse();
            }

            if (mods.HasFlag(ModIdentifier.Mirror))
            {
                MirrorHitObjects();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Adds all modifiers from a mod enum combo
        /// </summary>
        public static void AddModsFromIdentifiers(ModIdentifier mods)
        {
            // Remove all the current mods that we have on.
            ModManager.RemoveAllMods();

            for (var i = 0; i <= Math.Log((long)mods, 2); i++)
            {
                var mod = (ModIdentifier)((long)Math.Pow(2, i));

                if (!mods.HasFlag(mod))
                {
                    continue;
                }

                try
                {
                    ModManager.AddMod(mod);
                }
                catch (Exception e)
                {
                    Logger.Error(e, LogType.Runtime);
                }
            }
        }
Ejemplo n.º 3
0
Archivo: Map.cs Proyecto: AiAe/Quaver-1
        /// <summary>
        ///     Retrieve the map's difficulty rating from given mods
        /// </summary>
        /// <returns></returns>
        public double DifficultyFromMods(ModIdentifier mods)
        {
            if (mods.HasFlag(ModIdentifier.Speed05X))
            {
                return(Difficulty05X);
            }
            if (mods.HasFlag(ModIdentifier.Speed055X))
            {
                return(Difficulty055X);
            }
            if (mods.HasFlag(ModIdentifier.Speed06X))
            {
                return(Difficulty06X);
            }
            if (mods.HasFlag(ModIdentifier.Speed065X))
            {
                return(Difficulty065X);
            }
            if (mods.HasFlag(ModIdentifier.Speed07X))
            {
                return(Difficulty07X);
            }
            if (mods.HasFlag(ModIdentifier.Speed075X))
            {
                return(Difficulty075X);
            }
            if (mods.HasFlag(ModIdentifier.Speed08X))
            {
                return(Difficulty08X);
            }
            if (mods.HasFlag(ModIdentifier.Speed085X))
            {
                return(Difficulty085X);
            }
            if (mods.HasFlag(ModIdentifier.Speed09X))
            {
                return(Difficulty09X);
            }
            if (mods.HasFlag(ModIdentifier.Speed095X))
            {
                return(Difficulty095X);
            }
            if (mods.HasFlag(ModIdentifier.Speed11X))
            {
                return(Difficulty11X);
            }
            if (mods.HasFlag(ModIdentifier.Speed12X))
            {
                return(Difficulty12X);
            }
            if (mods.HasFlag(ModIdentifier.Speed13X))
            {
                return(Difficulty13X);
            }
            if (mods.HasFlag(ModIdentifier.Speed14X))
            {
                return(Difficulty14X);
            }
            if (mods.HasFlag(ModIdentifier.Speed15X))
            {
                return(Difficulty15X);
            }
            if (mods.HasFlag(ModIdentifier.Speed16X))
            {
                return(Difficulty16X);
            }
            if (mods.HasFlag(ModIdentifier.Speed17X))
            {
                return(Difficulty17X);
            }
            if (mods.HasFlag(ModIdentifier.Speed18X))
            {
                return(Difficulty18X);
            }
            if (mods.HasFlag(ModIdentifier.Speed19X))
            {
                return(Difficulty19X);
            }
            if (mods.HasFlag(ModIdentifier.Speed20X))
            {
                return(Difficulty20X);
            }

            return(Difficulty10X);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mods"></param>
        /// <returns></returns>
        public static string GetModsString(ModIdentifier mods)
        {
            if (mods <= 0)
            {
                return("None");
            }

            var modStrings = new List <string>();

            foreach (ModIdentifier mod in Enum.GetValues(typeof(ModIdentifier)))
            {
                if (!mods.HasFlag(mod))
                {
                    continue;
                }

                switch (mod)
                {
                case ModIdentifier.NoSliderVelocity:
                    modStrings.Add("NSV");
                    break;

                case ModIdentifier.Speed05X:
                    modStrings.Add("0.5x");
                    break;

                case ModIdentifier.Speed055X:
                    modStrings.Add("0.55x");
                    break;

                case ModIdentifier.Speed06X:
                    modStrings.Add("0.6x");
                    break;

                case ModIdentifier.Speed065X:
                    modStrings.Add("0.65x");
                    break;

                case ModIdentifier.Speed07X:
                    modStrings.Add("0.7x");
                    break;

                case ModIdentifier.Speed075X:
                    modStrings.Add("0.75x");
                    break;

                case ModIdentifier.Speed08X:
                    modStrings.Add("0.8x");
                    break;

                case ModIdentifier.Speed085X:
                    modStrings.Add("0.85x");
                    break;

                case ModIdentifier.Speed09X:
                    modStrings.Add("0.9x");
                    break;

                case ModIdentifier.Speed095X:
                    modStrings.Add("0.95x");
                    break;

                case ModIdentifier.Speed11X:
                    modStrings.Add("1.1x");
                    break;

                case ModIdentifier.Speed12X:
                    modStrings.Add("1.2x");
                    break;

                case ModIdentifier.Speed13X:
                    modStrings.Add("1.3x");
                    break;

                case ModIdentifier.Speed14X:
                    modStrings.Add("1.4x");
                    break;

                case ModIdentifier.Speed15X:
                    modStrings.Add("1.5x");
                    break;

                case ModIdentifier.Speed16X:
                    modStrings.Add("1.6x");
                    break;

                case ModIdentifier.Speed17X:
                    modStrings.Add("1.7x");
                    break;

                case ModIdentifier.Speed18X:
                    modStrings.Add("1.8x");
                    break;

                case ModIdentifier.Speed19X:
                    modStrings.Add("1.9x");
                    break;

                case ModIdentifier.Speed20X:
                    modStrings.Add("2.0x");
                    break;

                case ModIdentifier.Strict:
                    modStrings.Add("ST");
                    break;

                case ModIdentifier.Chill:
                    modStrings.Add("CH");
                    break;

                case ModIdentifier.NoPause:
                    modStrings.Add("NP");
                    break;

                case ModIdentifier.Autoplay:
                    modStrings.Add("AP");
                    break;

                case ModIdentifier.Paused:
                    modStrings.Add("PS");
                    break;

                case ModIdentifier.NoFail:
                    modStrings.Add("NF");
                    break;

                case ModIdentifier.NoLongNotes:
                    modStrings.Add("NLN");
                    break;

                case ModIdentifier.Randomize:
                    modStrings.Add("RND");
                    break;

                case ModIdentifier.Inverse:
                    modStrings.Add("IV");
                    break;

                case ModIdentifier.FullLN:
                    modStrings.Add("FLN");
                    break;

                case ModIdentifier.Mirror:
                    modStrings.Add("MR");
                    break;

                default:
                    throw new ArgumentOutOfRangeException($"Short string for ModIdentifier: {mod} does not exist.");
                }
            }

            return(string.Join(", ", modStrings));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Gets the audio rate from selected mods.
        /// </summary>
        /// <param name="mods"></param>
        /// <returns></returns>
        public static float GetRateFromMods(ModIdentifier mods)
        {
            // The rate of the audio.
            var rate = 1.0f;

            // Map mods to rate.
            if (mods.HasFlag(ModIdentifier.None))
            {
                rate = 1.0f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed05X))
            {
                rate = 0.5f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed055X))
            {
                rate = 0.55f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed06X))
            {
                rate = 0.6f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed065X))
            {
                rate = 0.65f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed07X))
            {
                rate = 0.7f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed075X))
            {
                rate = 0.75f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed08X))
            {
                rate = 0.8f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed085X))
            {
                rate = 0.85f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed09X))
            {
                rate = 0.9f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed095X))
            {
                rate = 0.95f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed11X))
            {
                rate = 1.1f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed12X))
            {
                rate = 1.2f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed13X))
            {
                rate = 1.3f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed14X))
            {
                rate = 1.4f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed15X))
            {
                rate = 1.5f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed16X))
            {
                rate = 1.6f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed17X))
            {
                rate = 1.7f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed18X))
            {
                rate = 1.8f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed19X))
            {
                rate = 1.9f;
            }
            else if (mods.HasFlag(ModIdentifier.Speed20X))
            {
                rate = 2.0f;
            }

            return(rate);
        }