Exemple #1
0
        /// <summary>
        /// Gets possible encounters that allow all moves requested to be learned.
        /// </summary>
        /// <param name="pk">Rough Pokémon data which contains the requested species, gender, and form.</param>
        /// <param name="needs">Moves which cannot be taught by the player.</param>
        /// <param name="version">Specific version to iterate for. Necessary for retrieving possible Egg Moves.</param>
        /// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns>
        private static IEnumerable <EncounterEgg> GetEggs(PKM pk, IReadOnlyCollection <int> needs, GameVersion version)
        {
            if (GameVersion.CXD.Contains(version) || GameVersion.GG.Contains(version))
            {
                yield break; // no eggs from these games
            }
            var eggs = EncounterEggGenerator.GenerateEggs(pk, all: true);

            foreach (var egg in eggs)
            {
                if (needs.Count == 0)
                {
                    yield return(egg);

                    continue;
                }

                IEnumerable <int> em = MoveEgg.GetEggMoves(pk, egg.Species, pk.AltForm, version);
                if (Legal.LightBall.Contains(egg.Species) && needs.Contains(344))
                {
                    em = em.Concat(new[] { 344 }); // Volt Tackle
                }
                if (!needs.Except(em).Any())
                {
                    yield return(egg);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets possible encounters that allow all moves requested to be learned.
        /// </summary>
        /// <param name="pk">Rough Pokémon data which contains the requested species, gender, and form.</param>
        /// <param name="needs">Moves which cannot be taught by the player.</param>
        /// <param name="version">Specific version to iterate for. Necessary for retrieving possible Egg Moves.</param>
        /// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns>
        private static IEnumerable <EncounterEgg> GetEggs(PKM pk, IReadOnlyCollection <int> needs, GameVersion version)
        {
            var eggs = EncounterEggGenerator.GenerateEggs(pk, all: true);

            foreach (var egg in eggs)
            {
                if (needs.Count == 0)
                {
                    yield return(egg);

                    continue;
                }

                var em = Legal.GetEggMoves(pk, egg.Species, pk.AltForm, version);
                if (!needs.Except(em).Any())
                {
                    yield return(egg);
                }
            }
        }