Esempio n. 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.Entity.IsEgg)
        {
            Util.Shuffle(m.AsSpan());
        }

        const int count = 4;

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