/// <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); } }
/// <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); }
// 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)); }
public bool Equals(SeedInfo s) => s.Charm3 == Charm3 && s.Seed == Seed;