private static IEnumerable <int> GetMovesForGeneration(PKM pk, EvoCriteria[] chain, int generation)
    {
        IEnumerable <int> moves = MoveList.GetValidMoves(pk, chain, generation);

        if (generation <= 2)
        {
            moves = moves.Concat(MoveList.GetValidMoves(pk, chain, generation, MoveSourceType.LevelUp));
        }
        if (pk.Format >= 8)
        {
            // Shared Egg Moves via daycare
            // Any egg move can be obtained
            moves = moves.Concat(MoveEgg.GetSharedEggMoves(pk, generation));

            // TR moves -- default logic checks the TR flags, so we need to add all possible ones here.
            if (!(pk.BDSP || pk.LA))
            {
                moves = moves.Concat(MoveTechnicalMachine.GetAllPossibleRecords(pk.Species, pk.Form));
            }
        }
        if (pk.Species == (int)Species.Shedinja)
        {
            // Leveling up Nincada in Gen3/4 levels up, evolves to Ninjask, applies moves for Ninjask, then spawns Shedinja with the current moveset.
            // Future games spawn the Shedinja before doing Ninjask moves, so this is a special case.
            // Can't get more than the evolved-at level move; >=2 special moves will get caught by the legality checker later.
            return(generation switch
            {
                3 => moves.Concat(Legal.LevelUpE [(int)Species.Ninjask].GetMoves(100, 20)),
                4 => moves.Concat(Legal.LevelUpPt[(int)Species.Ninjask].GetMoves(100, 20)),
                _ => moves,
            });