示例#1
0
        /// <summary>
        /// Sets the <see cref="PKM.RelearnMoves"/> based on a legality check's suggestions.
        /// </summary>
        /// <param name="pk"></param>
        public static void SetSuggestedRelearnMoves(this PKM pk)
        {
            if (pk.Format < 6)
            {
                return;
            }
            pk.ClearRelearnMoves();
            var la = new LegalityAnalysis(pk);

            var m = la.GetSuggestedRelearn();

            if (m.All(z => z == 0))
            {
                if (!pk.WasEgg && !pk.WasEvent && !pk.WasEventEgg && !pk.WasLink)
                {
                    if (pk.Version != (int)GameVersion.CXD)
                    {
                        var encounter = la.GetSuggestedMetInfo();
                        if (encounter != null)
                        {
                            m = encounter.Relearn;
                        }
                    }
                }
            }

            if (pk.RelearnMoves.SequenceEqual(m))
            {
                return;
            }
            if (m.Count > 3)
            {
                pk.SetRelearnMoves(m);
            }
        }
示例#2
0
        private PKM SetSuggestedRelearnMoves_PKSM(PKM Set)
        {
            Set.RelearnMove1 = 0;
            Set.RelearnMove2 = 0;
            Set.RelearnMove3 = 0;
            Set.RelearnMove4 = 0;
            LegalityAnalysis Legality = new LegalityAnalysis(Set);

            if (Set.Format < 6)
            {
                return(Set);
            }

            int[] m = Legality.GetSuggestedRelearn();
            if (m.All(z => z == 0))
            {
                if (!Set.WasEgg && !Set.WasEvent && !Set.WasEventEgg && !Set.WasLink)
                {
                    var encounter = Legality.GetSuggestedMetInfo();
                    if (encounter != null)
                    {
                        m = encounter.Relearn;
                    }
                }
            }

            if (Set.RelearnMoves.SequenceEqual(m))
            {
                return(Set);
            }

            Set.RelearnMove1 = m[0];
            Set.RelearnMove2 = m[1];
            Set.RelearnMove3 = m[2];
            Set.RelearnMove4 = m[3];
            return(Set);
        }