Example #1
0
        /// <summary>
        /// Gets a moveset for the provided <see cref="PKM"/> data.
        /// </summary>
        /// <param name="la">Precomputed optional</param>
        /// <param name="random">Full movepool &amp; shuffling</param>
        /// <returns>4 moves</returns>
        public static int[] GetMoveSet(this LegalityAnalysis la, bool random = false)
        {
            int[] m = la.GetSuggestedCurrentMoves(random ? MoveSourceType.All : MoveSourceType.Encounter);

            var learn = la.GetSuggestedMovesAndRelearn();

            if (!m.All(z => learn.Contains(z)))
            {
                m = m.Intersect(learn).ToArray();
            }

            if (random && !la.pkm.IsEgg)
            {
                Util.Shuffle(m);
            }

            const int count = 4;

            if (m.Length > count)
            {
                return(m.SliceEnd(m.Length - count));
            }
            Array.Resize(ref m, count);
            return(m);
        }