예제 #1
0
        /// <summary>
        /// Yields an enumerable list of seeds until another valid PID breaks the chain.
        /// </summary>
        /// <param name="pidiv">Seed and RNG data</param>
        /// <param name="info">Verification information</param>
        /// <param name="form">Unown Form lock value</param>
        /// <returns>Seed information data, which needs to be unrolled once for the nature call.</returns>
        public static IEnumerable <SeedInfo> GetSeedsUntilUnownForm(PIDIV pidiv, FrameGenerator info, int form)
        {
            var seed = pidiv.OriginSeed;

            yield return(new SeedInfo(seed));

            var s1 = seed;
            var s2 = RNG.LCRNG.Prev(s1);

            while (true)
            {
                var a = s2 >> 16;
                var b = s1 >> 16;
                // PID is in reverse for FRLG Unown
                var pid = a << 16 | b;

                // Process Conditions
                if (PKX.GetUnownForm(pid) == form) // matches form, does it match nature?
                {
                    switch (VerifyPIDCriteria(pid, info))
                    {
                    case LockInfo.Pass:     // yes
                        yield break;
                    }
                }

                s1 = RNG.LCRNG.Prev(s2);
                s2 = RNG.LCRNG.Prev(s1);

                yield return(new SeedInfo(s1));
            }
        }