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); }
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); } }