private LegalityCheck verifyBall() { if (!pk6.Gen6) { return(new LegalityCheck()); } if (!Encounter.Valid) { return(new LegalityCheck(Severity.Valid, "Skipped Ball check due to other check being invalid.")); } if (EncounterType == typeof(WC6)) { return(pk6.Ball != ((WC6)EncounterMatch).Pokéball ? new LegalityCheck(Severity.Invalid, "Ball does not match specified Wonder Card Ball.") : new LegalityCheck(Severity.Valid, "Ball matches Wonder Card.")); } if (EncounterType == typeof(EncounterLink)) { return(((EncounterLink)EncounterMatch).Ball != pk6.Ball ? new LegalityCheck(Severity.Invalid, "Incorrect ball on Link gift.") : new LegalityCheck(Severity.Valid, "Correct ball on Link gift.")); } if (EncounterType == typeof(EncounterTrade)) { return(pk6.Ball != 4 // Pokeball ? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame trade encounter.") : new LegalityCheck(Severity.Valid, "Correct ball on ingame trade encounter.")); } if (pk6.Ball == 0x04) // Poké Ball { return(new LegalityCheck(Severity.Valid, "Standard Poké Ball.")); } if (EncounterType == typeof(EncounterStatic)) { return(!Legal.WildPokeballs.Contains(pk6.Ball) ? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame static encounter.") : new LegalityCheck(Severity.Valid, "Correct ball on ingame static encounter.")); } if (EncounterType == typeof(EncounterSlot[])) { return(!Legal.WildPokeballs.Contains(pk6.Ball) ? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame encounter.") : new LegalityCheck(Severity.Valid, "Correct ball on ingame encounter.")); } if (pk6.WasEgg) { if (pk6.Ball == 0x01) // Master Ball { return(new LegalityCheck(Severity.Invalid, "Master Ball on egg origin.")); } if (pk6.Ball == 0x10) // Cherish Ball { return(new LegalityCheck(Severity.Invalid, "Cherish Ball on non-event.")); } if (pk6.Gender == 2) // Genderless { return(pk6.Ball != 0x04 // Must be Pokéball as ball can only pass via mother (not Ditto!) ? new LegalityCheck(Severity.Invalid, "Non-Pokéball on genderless egg.") : new LegalityCheck(Severity.Valid, "Pokéball on genderless egg.")); } if (Legal.BreedMaleOnly.Contains(pk6.Species)) { return(pk6.Ball != 0x04 // Must be Pokéball as ball can only pass via mother (not Ditto!) ? new LegalityCheck(Severity.Invalid, "Non-Pokéball on Male-Only egg.") : new LegalityCheck(Severity.Valid, "Pokéball on Male-Only egg.")); } if (pk6.Ball == 0x05) // Safari Ball { if (Legal.getLineage(pk6).All(e => !Legal.Inherit_Safari.Contains(e))) { return(new LegalityCheck(Severity.Invalid, "Safari Ball not possible for species.")); } if (pk6.AbilityNumber == 4) { return(new LegalityCheck(Severity.Invalid, "Safari Ball with Hidden Ability.")); } return(new LegalityCheck(Severity.Valid, "Safari Ball possible for species.")); } if (0x10 < pk6.Ball && pk6.Ball < 0x18) // Apricorn Ball { if (Legal.getLineage(pk6).All(e => !Legal.Inherit_Apricorn.Contains(e))) { return(new LegalityCheck(Severity.Invalid, "Apricorn Ball not possible for species.")); } if (pk6.AbilityNumber == 4) { return(new LegalityCheck(Severity.Invalid, "Apricorn Ball with Hidden Ability.")); } return(new LegalityCheck(Severity.Valid, "Apricorn Ball possible for species.")); } if (pk6.Ball == 0x18) // Sport Ball { if (Legal.getLineage(pk6).All(e => !Legal.Inherit_Sport.Contains(e))) { return(new LegalityCheck(Severity.Invalid, "Sport Ball not possible for species.")); } if (pk6.AbilityNumber == 4) { return(new LegalityCheck(Severity.Invalid, "Sport Ball with Hidden Ability.")); } return(new LegalityCheck(Severity.Valid, "Sport Ball possible for species.")); } if (pk6.Ball == 0x19) // Dream Ball { if (Legal.getLineage(pk6).All(e => !Legal.Inherit_Dream.Contains(e))) { return(new LegalityCheck(Severity.Invalid, "Dream Ball not possible for species.")); } return(new LegalityCheck(Severity.Valid, "Dream Ball possible for species.")); } if (pk6.Species > 650 && pk6.Species != 700) // Sylveon { return(!Legal.WildPokeballs.Contains(pk6.Ball) ? new LegalityCheck(Severity.Invalid, "Unobtainable ball for Kalos origin.") : new LegalityCheck(Severity.Valid, "Obtainable ball for Kalos origin.")); } if (0x0D <= pk6.Ball && pk6.Ball <= 0x0F) { if (Legal.Ban_Gen4Ball.Contains(pk6.Species)) { return(new LegalityCheck(Severity.Invalid, "Unobtainable capture for Gen4 Ball.")); } return(new LegalityCheck(Severity.Valid, "Obtainable capture for Gen4 Ball.")); } if (0x02 <= pk6.Ball && pk6.Ball <= 0x0C) // Don't worry, Ball # 0x05 was already checked. { if (Legal.Ban_Gen3Ball.Contains(pk6.Species)) { return(new LegalityCheck(Severity.Invalid, "Unobtainable capture for Gen4 Ball.")); } return(new LegalityCheck(Severity.Valid, "Obtainable capture for Gen4 Ball.")); } } return(new LegalityCheck(Severity.Invalid, "No ball check satisfied, assuming illegal.")); }