private LegalityCheck verifyEncounter() { if (!pk6.Gen6) { return new LegalityCheck { Judgement = Severity.NotImplemented } } ; if (pk6.WasLink) { // Should NOT be Fateful, and should be in Database EncounterLink enc = EncounterMatch as EncounterLink; if (enc == null) { return(new LegalityCheck(Severity.Invalid, "Not a valid Link gift -- unable to find matching gift.")); } if (pk6.XY && !enc.XY) { return(new LegalityCheck(Severity.Invalid, "Not a valid Link gift -- can't obtain in XY.")); } if (pk6.AO && !enc.ORAS) { return(new LegalityCheck(Severity.Invalid, "Not a valid Link gift -- can't obtain in ORAS.")); } if (enc.Shiny != null && (bool)enc.Shiny ^ pk6.IsShiny) { return(new LegalityCheck(Severity.Invalid, "Shiny Link gift mismatch.")); } return(pk6.FatefulEncounter ? new LegalityCheck(Severity.Invalid, "Not a valid Link gift -- should not be Fateful Encounter.") : new LegalityCheck(Severity.Valid, "Valid Link gift.")); } if (pk6.WasEvent || pk6.WasEventEgg) { WC6 MatchedWC6 = EncounterMatch as WC6; return(MatchedWC6 != null // Matched in RelearnMoves check. ? new LegalityCheck(Severity.Valid, $"Matches #{MatchedWC6.CardID.ToString("0000")} ({MatchedWC6.CardTitle})") : new LegalityCheck(Severity.Invalid, "Not a valid Wonder Card gift.")); } EncounterMatch = null; // Reset object if (pk6.WasEgg) { // Check Hatch Locations if (pk6.Met_Level != 1) { return(new LegalityCheck(Severity.Invalid, "Invalid met level, expected 1.")); } // Check species if (Legal.NoHatchFromEgg.Contains(pk6.Species)) { return(new LegalityCheck(Severity.Invalid, "Species cannot be hatched from an egg.")); } if (pk6.IsEgg) { if (pk6.Egg_Location == 30002) { return(new LegalityCheck(Severity.Invalid, "Egg location shouldn't be 'traded' for an un-hatched egg.")); } if (pk6.Met_Location == 30002) { return(new LegalityCheck(Severity.Valid, "Valid traded un-hatched egg.")); } return(pk6.Met_Location == 0 ? new LegalityCheck(Severity.Valid, "Valid un-hatched egg.") : new LegalityCheck(Severity.Invalid, "Invalid location for un-hatched egg (expected no met location).")); } if (pk6.XY) { return(Legal.ValidMet_XY.Contains(pk6.Met_Location) ? new LegalityCheck(Severity.Valid, "Valid X/Y hatched egg.") : new LegalityCheck(Severity.Invalid, "Invalid X/Y location for hatched egg.")); } if (pk6.AO) { return(Legal.ValidMet_AO.Contains(pk6.Met_Location) ? new LegalityCheck(Severity.Valid, "Valid OR/AS hatched egg.") : new LegalityCheck(Severity.Invalid, "Invalid OR/AS location for hatched egg.")); } return(new LegalityCheck(Severity.Invalid, "Invalid location for hatched egg.")); } EncounterMatch = Legal.getValidStaticEncounter(pk6); if (EncounterMatch != null) { return(new LegalityCheck(Severity.Valid, "Valid gift/static encounter.")); } if (Legal.getIsFossil(pk6)) { return(pk6.AbilityNumber != 4 ? new LegalityCheck(Severity.Valid, "Valid revived fossil.") : new LegalityCheck(Severity.Invalid, "Hidden ability on revived fossil.")); } EncounterMatch = Legal.getValidFriendSafari(pk6); if (EncounterMatch != null) { if (pk6.Species == 670 || pk6.Species == 671) // Floette { if (pk6.AltForm % 2 != 0) // 0/2/4 { return(new LegalityCheck(Severity.Invalid, "Friend Safari: Not valid color.")); } else if (pk6.Species == 710 || pk6.Species == 711) // Pumpkaboo { if (pk6.AltForm != 1) // Average { return(new LegalityCheck(Severity.Invalid, "Friend Safari: Not average sized.")); } else if (pk6.Species == 586) // Sawsbuck { if (pk6.AltForm != 0) { return(new LegalityCheck(Severity.Invalid, "Friend Safari: Not Spring form.")); } } } } return(new LegalityCheck(Severity.Valid, "Valid friend safari encounter.")); } EncounterMatch = Legal.getValidWildEncounters(pk6); if (EncounterMatch != null) { return(((EncounterSlot[])EncounterMatch).Any(slot => !slot.DexNav) ? new LegalityCheck(Severity.Valid, "Valid encounter at location.") : new LegalityCheck(Severity.Valid, "Valid DexNav encounter at location.")); } EncounterMatch = Legal.getValidIngameTrade(pk6); if (EncounterMatch != null) { return(new LegalityCheck(Severity.Valid, "Valid ingame trade.")); } return(new LegalityCheck(Severity.Invalid, "Not a valid encounter.")); }