コード例 #1
0
        /// <summary>
        /// Gets a moveset for the provided <see cref="PKM"/> data.
        /// </summary>
        /// <param name="pk">PKM to generate for</param>
        /// <param name="random">Full movepool &amp; shuffling</param>
        /// <returns>4 moves</returns>
        public static int[] GetMoveSet(this PKM pk, bool random = false)
        {
            var la    = new LegalityAnalysis(pk);
            var moves = pk.GetMoveSet(la, random);

            if (random)
            {
                return(moves);
            }

            var clone = pk.Clone();

            clone.SetMoves(moves);
            var newLa = new LegalityAnalysis(pk);

            // ReSharper disable once TailRecursiveCall
            return(newLa.Valid ? moves : GetMoveSet(pk, true));
        }