diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index cbbe2386e..9aabfd4ff 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -850,11 +850,11 @@ private void verifyEggBallGen6() if (0x02 <= pkm.Ball && pkm.Ball <= 0x0C) // Don't worry, Ball # 0x05 was already checked. { if (Legal.Ban_Gen3Ball.Contains(pkm.Species)) - AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball); + AddLine(Severity.Invalid, "Unobtainable capture for Gen3 Ball.", CheckIdentifier.Ball); else if (pkm.AbilityNumber == 4 && 152 <= pkm.Species && pkm.Species <= 160) AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball); else - AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball); + AddLine(Severity.Valid, "Obtainable capture for Gen3 Ball.", CheckIdentifier.Ball); return; } @@ -872,6 +872,108 @@ private void verifyEggBallGen6() private void verifyEggBallGen7() { + var Lineage = Legal.getLineage(pkm).ToArray(); + if (pkm.Ball == 0x05) // Safari Ball + { + if (Lineage.Any(e => Legal.Inherit_Safari.Contains(e))) + AddLine(Severity.Valid, "Safari Ball possible from Female parent.", CheckIdentifier.Ball); + else if (Lineage.Any(e => Legal.Inherit_SafariMale.Contains(e))) + AddLine(Severity.Valid, "Safari Ball possible from Male parent.", CheckIdentifier.Ball); + else + AddLine(Severity.Invalid, "Safari Ball not possible for species.", CheckIdentifier.Ball); + + if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Safari Ball with Hidden Ability.", CheckIdentifier.Ball); + + return; + } + if (0x10 < pkm.Ball && pkm.Ball < 0x18) // Apricorn Ball + { + if (Lineage.Any(e => Legal.PastGenAlolanNatives.Contains(e))) + { + AddLine(Severity.Valid, "Apricorn Ball possible for species.", CheckIdentifier.Ball); + return; + } + if (Lineage.Any(e => Legal.PastGenAlolanScans.Contains(e))) + { + AddLine(Severity.Valid, "Apricorn Ball possible for species.", CheckIdentifier.Ball); + if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Apricorn Ball with Hidden Ability.", CheckIdentifier.Ball); + } + if (Lineage.Any(e => Legal.Inherit_Apricorn.Contains(e))) + { + AddLine(Severity.Valid, "Apricorn Ball possible for species.", CheckIdentifier.Ball); + if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Apricorn Ball with Hidden Ability.", CheckIdentifier.Ball); + } + else + AddLine(Severity.Invalid, "Apricorn Ball not possible for species.", CheckIdentifier.Ball); + + return; + } + if (pkm.Ball == 0x18) // Sport Ball + { + if (Lineage.All(e => !Legal.Inherit_Sport.Contains(e))) + AddLine(Severity.Invalid, "Sport Ball not possible for species.", CheckIdentifier.Ball); + else + AddLine(Severity.Valid, "Sport Ball possible for species.", CheckIdentifier.Ball); + + if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Sport Ball with Hidden Ability.", CheckIdentifier.Ball); + + return; + } + if (pkm.Ball == 0x19) // Dream Ball + { + if (Lineage.Any(e => Legal.Inherit_Dream.Contains(e))) + AddLine(Severity.Valid, "Dream Ball inheritance possible from Female species.", CheckIdentifier.Ball); + else if (Lineage.Any(e => Legal.InheritDreamMale.Contains(e))) + { + if (pkm.AbilityNumber != 4) + AddLine(Severity.Valid, "Dream Ball inheritance possible from Male/Genderless species.", CheckIdentifier.Ball); + else + AddLine(Severity.Invalid, "Dream Ball not possible for species.", CheckIdentifier.Ball); + } + + else + AddLine(Severity.Invalid, "Dream Ball not possible for species.", CheckIdentifier.Ball); + + return; + } + if (0x0D <= pkm.Ball && pkm.Ball <= 0x0F) + { + if (Legal.Ban_Gen4Ball.Contains(pkm.Species)) + { + if (!Legal.Ban_Gen4Ball_AllowG7.Contains(pkm.Species)) + AddLine(Severity.Invalid, "Unobtainable capture for Gen4 Ball.", CheckIdentifier.Ball); + else if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball); + else + AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball); + } + else + AddLine(Severity.Valid, "Obtainable capture for Gen4 Ball.", CheckIdentifier.Ball); + + return; + } + if (0x02 <= pkm.Ball && pkm.Ball <= 0x0C) // Don't worry, Ball # 0x05 was already checked. + { + if (Legal.Ban_Gen3Ball_AllowG7.Contains(pkm.Species)) + { + if (pkm.AbilityNumber == 4) + AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball); + else + AddLine(Severity.Valid, "Obtainable capture for Gen3Ball.", CheckIdentifier.Ball); + } + else if (Legal.Ban_Gen3Ball.Contains(pkm.Species)) + AddLine(Severity.Invalid, "Unobtainable capture for Gen3 Ball.", CheckIdentifier.Ball); + else if (pkm.AbilityNumber == 4 && 152 <= pkm.Species && pkm.Species <= 160) + AddLine(Severity.Invalid, "Ball not possible for species with hidden ability.", CheckIdentifier.Ball); + else + AddLine(Severity.Valid, "Obtainable capture for Gen3Ball.", CheckIdentifier.Ball); + + return; + } if (pkm.Format == 7 && pkm.Species > 721) { if (!Legal.getWildBalls(pkm).Contains(pkm.Ball)) diff --git a/PKHeX/Legality/Tables7.cs b/PKHeX/Legality/Tables7.cs index 445581693..0bae725ab 100644 --- a/PKHeX/Legality/Tables7.cs +++ b/PKHeX/Legality/Tables7.cs @@ -13,6 +13,7 @@ public static partial class Legal internal static readonly int[] Met_SM_0 = { + 002, 004, // Invalid 006, 008, 010, 012, 014, 016, 018, 020, 022, 024, 026, 028, 030, 032, 034, 036, 038, 040, 042, 044, 046, 048, 050, 052, 054, 056, 058, 060, 062, 064, 066, 068, 070, 072, 074, 076, 078, 082, 084, 086, 088, 090, 092, 094, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, @@ -266,14 +267,89 @@ public static partial class Legal 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, // Johto Balls 0x1A, // Beast }; - - internal static readonly int[] ValidMet_SM = + internal static readonly int[] PastGenAlolanNatives = { - // TODO - 006, 008, 010, 012, 014, 016, 018, 020, 022, 024, 026, 028, 030, 034, 036, 038, 040, 042, 044, 046, 048, - 050, 052, 054, 056, 058, 060, 062, 064, 068, 070, 072, 074, 076, 078, 082, 084, 086, 088, 090, 092, 094, - 100, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, - 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 192 + 010, 011, 012, 019, 020, 021, 022, 025, 026, 027, 028, 035, 036, 037, 038, 039, 040, 041, 042, 046, 047, 050, + 051, 052, 053, 054, 055, 056, 057, 058, 059, 060, 061, 062, 063, 064, 065, 066, 067, 068, 072, 073, 074, 075, + 076, 079, 080, 081, 082, 088, 089, 090, 091, 092, 093, 094, 096, 097, 102, 103, 104, 105, 113, 115, 118, 119, + 120, 121, 123, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 142, 143, 147, 148, 149, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 185, 186, 196, 197, 198, 199, 200, 209, 210, 212, 215, 222, 225, + 227, 233, 235, 239, 240, 241, 242, 278, 279, 283, 284, 296, 297, 299, 302, 318, 319, 320, 321, 324, 327, 328, + 329, 330, 339, 340, 349, 350, 351, 359, 361, 362, 369, 370, 371, 372, 373, 374, 375, 376, 408, 409, 410, 411, + 422, 423, 425, 426, 429, 430, 438, 440, 443, 444, 445, 446, 447, 448, 456, 457, 461, 462, 466, 467, 470, 471, + 474, 476, 478, 506, 507, 508, 524, 525, 526, 546, 547, 548, 549, 551, 552, 553, 564, 565, 566, 567, 568, 569, + 582, 583, 584, 587, 594, 627, 628, 629, 630, 661, 662, 663, 674, 675, 700, 703, 704, 705, 706, 707, 708, 709, + 718 + }; + + internal static readonly int[] PastGenAlolanScans = + { + 152, // Chikorita + 155, // Cyndaquil + 158, // Totodile + + 069, // Bellsprout + 111, // Rhyhorn + 116, // Horsea + 183, // Marill + 220, // Swinub + 315, // Roselia + 363, // Spheal + 404, // Luxio + 543, // Venipede + 574, // Gothita + 578, // Duosion + 599, // Klink + 607, // Litwick + 610, // Axew + 633, // Deino + 679, // Honedge + + 175, // [468] Togekiss (Togepi) + 287, // [288] Vigoroth (Slakoth) + 396, // [397] Staravia (Starly) + 495, // [497] Serperior (Snivy) + + 498, // [500] Emboar (Tepig) + 501, // [503] Samurott (Oshawott) + 532, // [534] Conkeldurr (Timburr) + 540, // [542] Leavanny (Sewaddle) + 602, // [604] Eelektross (Tynamo) + }; + internal static readonly int[] Inherit_SafariMale = + { + 081, 100, 128, 337, 338, 374, 436, + }; + internal static readonly int[] InheritDreamMale = + { + 001, 004, 007, 25, 81, 100, 236, 120, 128, 137, + 172, + 252, 255, 258, 337, 338, 343, 374, + 387, 390, 393, 436, 479, + 511, 513, 515, 538, 539, 574, 599, 622, + }; + internal static readonly int[] Ban_Gen3Ball_AllowG7 = + { + 495, 498, 501, //1 - Snivy, Tepig, Oshawott + 496, 499, 502, //2 + 497, 500, 503, //3 + }; + internal static readonly int[] Ban_Gen4Ball_AllowG7 = + { + 152, 155, 158, //1 - Chikorita, Cyndaquil, Totodile + 153, 156, 159, //2 + 154, 157, 160, //3 + 495, 498, 501, //1 - Snivy, Tepig, Oshawott + 496, 499, 502, //2 + 497, 500, 503, //3 + }; + + internal static readonly int[] ValidMet_SM = + { + 006, 008, 010, 012, 014, 016, 018, 020, 022, 024, 026, 028, 030, 032, 034, 036, 038, 040, 042, 044, 046, 048, + 050, 052, 054, 056, 058, 060, 062, 064, 066, 068, 070, 072, 074, 076, 078, 082, 084, 086, 088, 090, 092, 094, + 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, + 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192 }; private static readonly int[] TMHM_SM =