private LegalityCheck verifyHandlerMemories() { if (!Encounter.Valid) { return(new LegalityCheck(Severity.Valid, "Skipped Memory check due to other check being invalid.")); } WC6 MatchedWC6 = EncounterMatch as WC6; if (MatchedWC6?.OT.Length > 0) // Has Event OT -- null propagation yields false if MatchedWC6=null { if (pk6.OT_Friendship != PKX.getBaseFriendship(pk6.Species)) { return(new LegalityCheck(Severity.Invalid, "Event OT Friendship does not match base friendship.")); } if (pk6.OT_Affection != 0) { return(new LegalityCheck(Severity.Invalid, "Event OT Affection should be zero.")); } if (pk6.CurrentHandler != 1) { return(new LegalityCheck(Severity.Invalid, "Current handler should not be Event OT.")); } } if (!pk6.WasEvent && (pk6.HT_Name.Length == 0 || pk6.Geo1_Country == 0)) // Is not Traded { if (pk6.HT_Name.Length != 0) { return(new LegalityCheck(Severity.Invalid, "GeoLocation -- HT Name present but has no previous Country.")); } if (pk6.Geo1_Country != 0) { return(new LegalityCheck(Severity.Invalid, "GeoLocation -- Previous country of residence but no Handling Trainer.")); } if (pk6.HT_Memory != 0) { return(new LegalityCheck(Severity.Invalid, "Memory -- Handling Trainer memory present but no Handling Trainer.")); } if (pk6.CurrentHandler != 0) // Badly edited; PKHeX doesn't trip this. { return(new LegalityCheck(Severity.Invalid, "Untraded -- Current handler should not be the Handling Trainer.")); } if (pk6.HT_Friendship != 0) { return(new LegalityCheck(Severity.Invalid, "Untraded -- Handling Trainer Friendship should be zero.")); } if (pk6.HT_Affection != 0) { return(new LegalityCheck(Severity.Invalid, "Untraded -- Handling Trainer Affection should be zero.")); } if (pk6.XY && pk6.CNTs.Any(stat => stat > 0)) { return(new LegalityCheck(Severity.Invalid, "Untraded -- Contest stats on XY should be zero.")); } // We know it is untraded (HT is empty), if it must be trade evolved flag it. if (Legal.getHasTradeEvolved(pk6)) { if (pk6.Species != 350) // Milotic { return(new LegalityCheck(Severity.Invalid, "Untraded -- requires a trade evolution.")); } if (pk6.CNT_Beauty < 170) // Beauty Contest Stat Requirement { return(new LegalityCheck(Severity.Invalid, "Untraded -- Beauty is not high enough for Levelup Evolution.")); } } } else // Is Traded { if (pk6.HT_Memory == 0) { return(new LegalityCheck(Severity.Invalid, "Memory -- missing Handling Trainer Memory.")); } } // Memory Checks if (pk6.IsEgg) { if (pk6.HT_Memory != 0) { return(new LegalityCheck(Severity.Invalid, "Memory -- has Handling Trainer Memory.")); } if (pk6.OT_Memory != 0) { return(new LegalityCheck(Severity.Invalid, "Memory -- has Original Trainer Memory.")); } } else if (EncounterType != typeof(WC6)) { if (pk6.OT_Memory == 0 ^ !pk6.Gen6) { return(new LegalityCheck(Severity.Invalid, "Memory -- missing Original Trainer Memory.")); } if (!pk6.Gen6 && pk6.OT_Affection != 0) { return(new LegalityCheck(Severity.Invalid, "OT Affection should be zero.")); } } // Unimplemented: Ingame Trade Memories return(new LegalityCheck(Severity.Valid, "History is valid.")); }