Exemple #1
0
        private static IEnumerable <int> GetValidMoves(PKM pkm, GameVersion version, IReadOnlyList <IReadOnlyList <EvoCriteria> > evoChains, int minLvLG1 = 1, int minLvLG2 = 1, MoveSourceType types = MoveSourceType.Reminder, bool RemoveTransferHM = true)
        {
            var r = new List <int> {
                0
            };

            if (types.HasFlagFast(MoveSourceType.RelearnMoves) && pkm.Format >= 6)
            {
                r.AddRange(pkm.RelearnMoves);
            }

            int start = pkm.Generation;

            if (start < 0)
            {
                start = pkm.Format; // be generous instead of returning nothing
            }
            if (pkm is IBattleVersion b)
            {
                start = Math.Max(0, b.GetMinGeneration());
            }

            for (int generation = start; generation <= pkm.Format; generation++)
            {
                var chain = evoChains[generation];
                if (chain.Count == 0)
                {
                    continue;
                }
                r.AddRange(MoveList.GetValidMoves(pkm, version, chain, generation, minLvLG1: minLvLG1, minLvLG2: minLvLG2, types: types, RemoveTransferHM: RemoveTransferHM));
            }

            return(r.Distinct());
        }
    private static IEnumerable <int> GetValidMoves(PKM pk, GameVersion version, EvolutionHistory evoChains, MoveSourceType types = MoveSourceType.Reminder, bool RemoveTransferHM = true)
    {
        var r = new List <int> {
            0
        };

        if (types.HasFlagFast(MoveSourceType.RelearnMoves) && pk.Format >= 6)
        {
            r.AddRange(pk.RelearnMoves);
        }

        int start = pk.Generation;

        if (start < 0)
        {
            start = pk.Format; // be generous instead of returning nothing
        }
        if (pk is IBattleVersion b)
        {
            start = Math.Max(0, b.GetMinGeneration());
        }

        for (int generation = start; generation <= pk.Format; generation++)
        {
            var chain = evoChains[generation];
            if (chain.Length == 0)
            {
                continue;
            }
            r.AddRange(MoveList.GetValidMoves(pk, version, chain, generation, types: types, RemoveTransferHM: RemoveTransferHM));
        }

        return(r.Distinct());
    }