Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the Evolution from the source <see cref="IEncounterable"/> is valid.
        /// </summary>
        /// <param name="pkm">Source data to verify</param>
        /// <param name="info">Source supporting information to verify with</param>
        /// <returns>Evolution is valid or not</returns>
        private static bool IsValidEvolution(PKM pkm, LegalInfo info)
        {
            int species = pkm.Species;

            if (info.EncounterMatch.Species == species)
            {
                return(true);
            }
            if (info.EncounterMatch.EggEncounter && species == 350 && pkm.Format >= 5 && !pkm.IsUntraded) // Prism Scale
            {
                return(true);
            }

            if (EvolutionChain.GetEvoChainSpeciesIndex(info.EvoChainsAllGens[pkm.Format], pkm.Species) < 0)
            {
                return(false); // Can't exist as current species
            }
            if (info.Generation > 0 && info.EvoChainsAllGens[info.Generation].All(z => z.Species != info.EncounterMatch.Species))
            {
                return(false); // Can't exist as origin species
            }
            // If current species evolved with a move evolution and encounter species is not current species check if the evolution by move is valid
            // Only the evolution by move is checked, if there is another evolution before the evolution by move is covered in IsEvolutionValid
            if (Legal.SpeciesEvolutionWithMove.Contains(pkm.Species))
            {
                return(Legal.IsEvolutionValidWithMove(pkm, info));
            }
            return(true);
        }
Ejemplo n.º 2
0
Archivo: Core.cs Proyecto: LLNet/PKHeX
        private static List <int> GetValidPostEvolutionMoves(PKM pkm, int Species, IReadOnlyList <EvoCriteria> evoChain, int Generation, GameVersion Version)
        {
            var evomoves = new List <int>();
            var index    = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, Species);

            for (int i = 0; i <= index; i++)
            {
                var evo   = evoChain[i];
                var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation);
                // Moves from Species or any species after in the evolution phase
                evomoves.AddRange(moves);
            }
            return(evomoves);
        }
Ejemplo n.º 3
0
Archivo: Core.cs Proyecto: LLNet/PKHeX
        internal static IEnumerable <int> GetExclusivePreEvolutionMoves(PKM pkm, int Species, IReadOnlyList <EvoCriteria> evoChain, int Generation, GameVersion Version)
        {
            var preevomoves = new List <int>();
            var evomoves    = new List <int>();
            var index       = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, Species);

            for (int i = 0; i < evoChain.Count; i++)
            {
                var evo   = evoChain[i];
                var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation);
                var list  = i >= index ? preevomoves : evomoves;
                list.AddRange(moves);
            }
            return(preevomoves.Except(evomoves).Distinct());
        }