Ejemplo n.º 1
0
        private static IEnumerable <IEncounterable> GetEncounters3(PKM pkm, LegalInfo info)
        {
            info.PIDIV = MethodFinder.Analyze(pkm);
            var deferred = new List <IEncounterable>();

            foreach (var z in GenerateRawEncounters3(pkm, info))
            {
                if (pkm.Version == 15)
                {
                    if (z is EncounterSlot w)
                    {
                        var seeds = MethodFinder.GetPokeSpotSeeds(pkm, w.SlotNumber).FirstOrDefault();
                        info.PIDIV = seeds ?? info.PIDIV;
                    }
                    else if (z is EncounterStaticShadow s && !LockFinder.IsAllShadowLockValid(s, info.PIDIV, pkm))
                    {
                        deferred.Add(s);
                        continue;
                    }
                }
                if (info.PIDIV.Type.IsCompatible3(z, pkm))
                {
                    yield return(z);
                }
                else
                {
                    deferred.Add(z);
                }
            }
            if (deferred.Count == 0)
            {
                yield break;
            }

            info.PIDIVMatches = false;
            foreach (var z in deferred)
            {
                yield return(z);
            }
        }
Ejemplo n.º 2
0
        private static bool GetIsShadowLockValid(PKM pkm, LegalInfo info, EncounterStaticShadow s)
        {
            if (s.IVs.Count == 0) // not E-Reader
            {
                return(LockFinder.IsAllShadowLockValid(s, info.PIDIV, pkm));
            }

            // E-Reader have fixed IVs, and aren't recognized as CXD (no PID-IV correlation).
            var possible = MethodFinder.GetColoEReaderMatches(pkm.EncryptionConstant);

            foreach (var poss in possible)
            {
                if (!LockFinder.IsAllShadowLockValid(s, poss, pkm))
                {
                    continue;
                }
                info.PIDIV = poss;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        private static IEnumerable <IEncounterable> GetEncounters3(PKM pkm, LegalInfo info)
        {
            info.PIDIV = MethodFinder.Analyze(pkm);
            var deferred = new List <IEncounterable>();

            foreach (var z in GenerateRawEncounters3(pkm, info))
            {
                if (pkm.Version == (int)GameVersion.CXD) // C/XD
                {
                    if (z is EncounterSlot w)
                    {
                        var seeds = MethodFinder.GetPokeSpotSeeds(pkm, w.SlotNumber).FirstOrDefault();
                        info.PIDIV = seeds ?? info.PIDIV;
                    }
                    else if (z is EncounterStaticShadow s)
                    {
                        bool valid = false;
                        if (s.IVs == null) // not ereader
                        {
                            valid = LockFinder.IsAllShadowLockValid(s, info.PIDIV, pkm);
                        }
                        else
                        {
                            var possible = MethodFinder.GetColoEReaderMatches(pkm.EncryptionConstant);
                            foreach (var poss in possible)
                            {
                                if (!LockFinder.IsAllShadowLockValid(s, poss, pkm))
                                {
                                    continue;
                                }
                                valid      = true;
                                info.PIDIV = poss;
                                break;
                            }
                        }

                        if (!valid)
                        {
                            deferred.Add(s);
                            continue;
                        }
                    }
                }
                if (info.PIDIV.Type.IsCompatible3(z, pkm))
                {
                    yield return(z);
                }
                else
                {
                    deferred.Add(z);
                }
            }
            if (deferred.Count == 0)
            {
                yield break;
            }

            info.PIDIVMatches = false;
            foreach (var z in deferred)
            {
                yield return(z);
            }
        }