Ejemplo n.º 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 = la.GetMoveSet(random);

        if (random)
        {
            return(moves);
        }

        var clone = pk.Clone();

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

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