Ejemplo n.º 1
0
        public bool SetRegenSettings(IEnumerable <string> lines)
        {
            var  split = RegenUtil.Split(lines);
            bool any   = false;

            foreach (var s in split)
            {
                var key   = s.Key;
                var value = s.Value;
                switch (key)
                {
                case nameof(Ball):
                    Ball = Aesthetics.GetBallFromString(value);
                    break;

                case nameof(Shiny):
                    ShinyType = Aesthetics.GetShinyType(value);
                    break;

                case nameof(Language):
                    Language = Aesthetics.GetLanguageId(value);
                    break;

                default:
                    continue;
                }
                any = true;
            }
            return(any);
        }
Ejemplo n.º 2
0
        private void LoadExtraInstructions(List <string> lines)
        {
            for (var i = 0; i < lines.Count; i++)
            {
                var line  = lines[i];
                var split = line.Split(ExtraSplitter, 0);
                if (split.Length != 2)
                {
                    continue;
                }
                var type  = split[0];
                var value = split[1];

                switch (type)
                {
                case "Ball":
                    Ball = Aesthetics.GetBallFromString(value);
                    break;

                case "Shiny":
                    ShinyType = Aesthetics.GetShinyType(value);
                    if (ShinyType != Core.Shiny.Random)
                    {
                        Shiny = ShinyType != Core.Shiny.Never;
                    }
                    break;

                default:
                    continue;
                }
                // Remove from lines
                lines.RemoveAt(i--);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set a valid Pokeball based on a legality check's suggestions.
        /// </summary>
        /// <param name="pk">Pokémon to modify</param>
        /// <param name="matching">Set matching ball</param>
        public static void SetSuggestedBall(this PKM pk, bool matching = true)
        {
            if (matching)
            {
                if (!pk.IsShiny)
                {
                    pk.SetMatchingBall();
                }
                else
                {
                    Aesthetics.ApplyShinyBall(pk);
                }
            }
            var la     = new LegalityAnalysis(pk);
            var report = la.Report();

            if (!report.Contains(LegalityCheckStrings.LBallEncMismatch))
            {
                return;
            }
            if (pk.GenNumber == 5 && pk.Met_Location == 75)
            {
                pk.Ball = (int)Ball.Dream;
            }
            else
            {
                pk.Ball = 4;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Set a valid Pokeball based on a legality check's suggestions.
        /// </summary>
        /// <param name="pk">Pokémon to modify</param>
        /// <param name="matching">Set matching ball</param>
        /// <param name="force"></param>
        /// <param name="ball"></param>
        public static void SetSuggestedBall(this PKM pk, bool matching = true, bool force = false, Ball ball = Ball.None)
        {
            if (ball != Ball.None)
            {
                var orig = pk.Ball;
                pk.Ball = (int)ball;
                if (!force && !pk.ValidBall())
                {
                    pk.Ball = orig;
                }
            }
            else if (matching)
            {
                if (!pk.IsShiny)
                {
                    pk.SetMatchingBall();
                }
                else
                {
                    Aesthetics.ApplyShinyBall(pk);
                }
            }
            var la     = new LegalityAnalysis(pk);
            var report = la.Report();

            if (!report.Contains(LegalityCheckStrings.LBallEncMismatch) || force)
            {
                return;
            }
            if (pk.Generation == 5 && pk.Met_Location == 75)
            {
                pk.Ball = (int)Ball.Dream;
            }
            else
            {
                pk.Ball = 4;
            }
        }
Ejemplo n.º 5
0
        public bool SetRegenSettings(IEnumerable <string> lines)
        {
            var  split = RegenUtil.Split(lines);
            bool any   = false;

            foreach (var s in split)
            {
                var key   = s.Key;
                var value = s.Value;
                switch (key)
                {
                case nameof(Ball):
                    Ball = Aesthetics.GetBallFromString(value);
                    break;

                case nameof(Shiny):
                    ShinyType = Aesthetics.GetShinyType(value);
                    break;

                case nameof(Language):
                    Language = Aesthetics.GetLanguageId(value);
                    break;

                case nameof(Ability):
                    Ability = Enum.TryParse(value, out AbilityRequest ar) ? ar : AbilityRequest.Any;
                    break;

                case nameof(Alpha):
                    Alpha = value == "Yes";
                    break;

                default:
                    continue;
                }
                any = true;
            }
            return(any);
        }