示例#1
0
        /// <summary>
        /// Checks a <see cref="PIDIV"/> to see if any encounter frames can generate the spread. Requires further filtering against matched Encounter Slots and generation patterns.
        /// </summary>
        /// <param name="pidiv">Matched <see cref="PIDIV"/> containing <see cref="PIDIV.RNG"/> info and <see cref="PIDIV.OriginSeed"/>.</param>
        /// <param name="pk"><see cref="PKM"/> object containing various accessible information required for the encounter.</param>
        /// <returns><see cref="IEnumerable{Frame}"/> to yield possible encounter details for further filtering</returns>
        public static IEnumerable <Frame> GetFrames(PIDIV pidiv, PKM pk)
        {
            FrameGenerator info = new FrameGenerator(pidiv, pk);

            if (info.FrameType == FrameType.None)
            {
                yield break;
            }

            info.Nature = pk.EncryptionConstant % 25;

            // gather possible nature determination seeds until a same-nature PID breaks the unrolling
            IEnumerable <SeedInfo> seeds = SeedInfo.GetSeedsUntilNature(pidiv, info);

            var frames = pidiv.Type == PIDType.CuteCharm
                ? FilterCuteCharm(seeds, pidiv, info)
                : FilterNatureSync(seeds, pidiv, info);

            var refined = RefineFrames(frames, info);

            foreach (var z in refined)
            {
                yield return(z);
            }
        }
示例#2
0
文件: FrameFinder.cs 项目: hnjm/PKHeX
        /// <summary>
        /// Checks a <see cref="PIDIV"/> to see if any encounter frames can generate the spread. Requires further filtering against matched Encounter Slots and generation patterns.
        /// </summary>
        /// <param name="pidiv">Matched <see cref="PIDIV"/> containing <see cref="PIDIV.RNG"/> info and <see cref="PIDIV.OriginSeed"/>.</param>
        /// <param name="pk"><see cref="PKM"/> object containing various accessible information required for the encounter.</param>
        /// <returns><see cref="IEnumerable{Frame}"/> to yield possible encounter details for further filtering</returns>
        public static IEnumerable <Frame> GetFrames(PIDIV pidiv, PKM pk)
        {
            if (pidiv.RNG == null)
            {
                return(Enumerable.Empty <Frame>());
            }
            FrameGenerator info = new FrameGenerator(pidiv, pk);

            if (info.FrameType == FrameType.None)
            {
                return(Enumerable.Empty <Frame>());
            }

            info.Nature = pk.EncryptionConstant % 25;

            // gather possible nature determination seeds until a same-nature PID breaks the unrolling
            var seeds = pk.Species == 201 && pk.FRLG // reversed await case
                ? SeedInfo.GetSeedsUntilUnownForm(pidiv, info, pk.AltForm)
                : SeedInfo.GetSeedsUntilNature(pidiv, info);

            var frames = pidiv.Type == PIDType.CuteCharm
                ? FilterCuteCharm(seeds, pidiv, info)
                : FilterNatureSync(seeds, pidiv, info);

            var refined = RefineFrames(frames, info);

            if (pk.Gen4 && pidiv.Type == PIDType.CuteCharm) // only permit cute charm successful frames
            {
                return(refined.Where(z => (z.Lead & ~LeadRequired.UsesLevelCall) == LeadRequired.CuteCharm));
            }
            return(refined);
        }
示例#3
0
 // gather possible nature determination seeds until a same-nature PID breaks the unrolling
 private static IEnumerable <SeedInfo> GetSeeds(PIDIV pidiv, FrameGenerator info, PKM pk)
 {
     if (pk.Species == (int)Species.Unown && pk.FRLG) // Gen3 FRLG Unown: reversed await case
     {
         return(SeedInfo.GetSeedsUntilUnownForm(pidiv, info, pk.Form));
     }
     if (pidiv.Type == PIDType.CuteCharm && info.FrameType != FrameType.MethodH) // Gen4: ambiguous seed due to gender-buffered PID
     {
         return(SeedInfo.GetSeedsUntilNature4Cute(pk));
     }
     return(SeedInfo.GetSeedsUntilNature(pidiv, info));
 }
示例#4
0
 public bool Equals(SeedInfo s) => s.Charm3 == Charm3 && s.Seed == Seed;