diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index 911348b9c..0c1c68a61 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -1085,10 +1085,11 @@ private void VerifyAbilityMG456(int[] abilities, int cardtype) AddLine(Severity.Invalid, V110, CheckIdentifier.Ability); } #region VerifyBall - private void VerifyBallEquals(params int[] balls) + private void VerifyBallEquals(int ball) => AddBallLine(ball == pkm.Ball); + private void VerifyBallEquals(ICollection balls) => AddBallLine(balls.Contains(pkm.Ball)); + private void AddBallLine(bool valid) { - int ball = pkm.Ball; - if (balls.Any(b => b == ball)) + if (valid) AddLine(Severity.Valid, V119, CheckIdentifier.Ball); else AddLine(Severity.Invalid, V118, CheckIdentifier.Ball); diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 2a7ea2490..378cb956c 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -1027,7 +1027,7 @@ internal static IEnumerable GetLineage(PKM pkm) var lineage = table.GetValidPreEvolutions(pkm, maxLevel: pkm.CurrentLevel); return lineage.Select(evolution => evolution.Species); } - internal static int[] GetWildBalls(PKM pkm) + internal static ICollection GetWildBalls(PKM pkm) { switch (pkm.GenNumber) { @@ -1051,22 +1051,22 @@ internal static int[] GetWildBalls(PKM pkm) } } internal static int GetEggHatchLevel(PKM pkm) => pkm.Format <= 3 ? 5 : 1; - internal static int[] GetSplitBreedGeneration(PKM pkm) + internal static ICollection GetSplitBreedGeneration(PKM pkm) { return GetSplitBreedGeneration(pkm.GenNumber); } - private static int[] GetSplitBreedGeneration(int generation) + private static ICollection GetSplitBreedGeneration(int generation) { switch (generation) { - case 1: return new int[0]; - case 2: return new int[0]; + case 1: return Empty; + case 2: return Empty; case 3: return SplitBreed_3; case 4: return SplitBreed; case 5: return SplitBreed; case 6: return SplitBreed; case 7: return SplitBreed; - default: return new int[0]; + default: return Empty; } } internal static int GetMaxSpeciesOrigin(PKM pkm) diff --git a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs index 05ea82798..f2868dc4a 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs @@ -579,7 +579,7 @@ private static IEnumerable GetValidFriendSafari(PKM pkm) yield break; IEnumerable vs = GetValidPreEvolutions(pkm); - foreach (DexLevel d in vs.Where(d => FriendSafari.Contains(d.Species) && d.Level >= 30)) + foreach (DexLevel d in vs.Where(d => d.Level >= 30 && FriendSafari.Contains(d.Species))) { yield return new EncounterSlot { diff --git a/PKHeX.Core/Legality/Encounters/EncounterVerifier.cs b/PKHeX.Core/Legality/Encounters/EncounterVerifier.cs index 2b9cabad0..4d0beae3e 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterVerifier.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterVerifier.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using static PKHeX.Core.LegalityCheckStrings; @@ -224,7 +225,7 @@ private static CheckResult VerifyEncounterEgg7(PKM pkm) // no other games return new CheckResult(Severity.Invalid, V51, CheckIdentifier.Encounter); } - private static CheckResult VerifyEncounterEggLevelLoc(PKM pkm, int eggLevel, int[] MetLocations) + private static CheckResult VerifyEncounterEggLevelLoc(PKM pkm, int eggLevel, ICollection MetLocations) { if (pkm.Met_Level != eggLevel) return new CheckResult(Severity.Invalid, string.Format(V52, eggLevel), CheckIdentifier.Encounter); diff --git a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs index 45c435335..7ac74e8d1 100644 --- a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs @@ -632,7 +632,7 @@ private static void GetHMCompatibility(PKM pkm, int[] moves, int gen, IReadOnlyL if (gen == 3 && pkm.Format > 3) IsHMSource(ref HMLearned, Legal.HM_3); - void IsHMSource(ref bool[] flags, int[] source) + void IsHMSource(ref bool[] flags, ICollection source) { for (int i = 0; i < 4; i++) flags[i] = IsCheckInvalid(res[i]) && source.Contains(moves[i]); diff --git a/PKHeX.Core/Legality/Tables.cs b/PKHeX.Core/Legality/Tables.cs index a3b2d01ff..905522920 100644 --- a/PKHeX.Core/Legality/Tables.cs +++ b/PKHeX.Core/Legality/Tables.cs @@ -5,29 +5,24 @@ namespace PKHeX.Core { public static partial class Legal { + public static readonly HashSet Empty = new HashSet(); public static readonly int[] Items_Ball = { 000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 492, 493, 494, 495, 496, 497, 498, 499, 576, 851 }; - public static readonly int[] Items_CommonBall = { 4, 3, 2, 1 }; - public static readonly int[] Items_UncommonBall = - { - 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, - 12, 15, 9, 5, 499, 10, 16 - }; public static readonly int[] Gen4EncounterTypes = { 1, 2, 4, 5, 7, 9, 10, 12, 23, 24 }; - public static readonly int[] LightBall = { 25, 26, 172 }; + public static readonly HashSet LightBall = new HashSet { 25, 26, 172 }; public static readonly int[] Fossils = { 138, 140, 142, 345, 347, 408, 410, 564, 566, 696, 698 }; public static readonly int[] RotomMoves = { 0, 315, 056, 059, 403, 437 }; - public static readonly int[] WildForms = + public static readonly HashSet WildForms = new HashSet { 422, 423, // Shellos 550, // Basculin 669, 670, 671 // Flabébé }; - public static readonly int[] SplitBreed = + public static readonly HashSet SplitBreed = new HashSet { // Incense 113, 242, // Chansey @@ -40,7 +35,7 @@ public static partial class Legal 315, 407, // Roselia 358, // Chimecho }; - public static readonly int[] FormChange = // Pokémon that can change form and retain it + public static readonly HashSet FormChange = new HashSet // Pokémon that can change form and retain it { 386, // Deoxys 412, // Burmy @@ -60,14 +55,14 @@ public static partial class Legal 741, // Oricorio 773, // Silvally }; - public static readonly int[] FormChangeMoves = + public static readonly HashSet FormChangeMoves = new HashSet { 386, // Deoxys 487, // Giratina 492, // Shaymin 720, // Hoopa }; - public static readonly int[] BreedMaleOnly = + public static readonly HashSet BreedMaleOnly = new HashSet { 128, // Tauros 627, 628, // Rufflet @@ -75,7 +70,7 @@ public static partial class Legal 538, 539, // Sawk & Throh }; - public static readonly int[] NoHatchFromEgg = + public static readonly HashSet NoHatchFromEgg = new HashSet { 132, // Ditto 144, // Articuno @@ -202,7 +197,7 @@ public static partial class Legal 802, // Marshadow }; - public static readonly int[] BattleForms = + public static readonly HashSet BattleForms = new HashSet { 351, // Castform 421, // Cherrim @@ -213,7 +208,7 @@ public static partial class Legal 746, // Wishiwashi 778, // Mimikyu }; - public static readonly int[] BattleMegas = + public static readonly HashSet BattleMegas = new HashSet { // XY 3,6,9,65,80, @@ -230,24 +225,24 @@ public static partial class Legal 531, 719 }; - public static readonly int[] BattlePrimals = { 382, 383 }; + public static readonly HashSet BattlePrimals = new HashSet { 382, 383 }; - public static readonly int[] Z_Moves = + public static readonly HashSet Z_Moves = new HashSet { 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 695, 696, 697, 698, 699, 700, 701, 702, 703, 719, }; - internal static readonly int[] InvalidSketch = new[] { 165, 448 }.Concat(Z_Moves).ToArray(); // Struggle & Chatter + internal static readonly HashSet InvalidSketch = new HashSet(new[] { 165, 448 }.Concat(Z_Moves)); // Struggle & Chatter - public static readonly int[] Legends = + public static readonly HashSet Legends = new HashSet { 150, 151, 249, 250, 251, 382, 383, 384, 385, 386, 483, 484, 487, 489, 490, 491, 492, 493, 494, 643, 644, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, 789, 790, 791, 792, 800, 801, 802 }; - public static readonly int[] SubLegends = + public static readonly HashSet SubLegends = new HashSet { 144, 145, 146, 243, 244, 245, 377, 378, 379, 380, 381, 480, 481, 482, 485, 486, 488, 638, 639, 640, 641, 642, diff --git a/PKHeX.Core/Legality/Tables1.cs b/PKHeX.Core/Legality/Tables1.cs index 8dc32f2af..90370b04a 100644 --- a/PKHeX.Core/Legality/Tables1.cs +++ b/PKHeX.Core/Legality/Tables1.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -9,14 +10,22 @@ public static partial class Legal internal const int MaxItemID_1 = 255; internal const int MaxAbilityID_1 = 0; - internal static readonly ushort[] Pouch_Items_RBY = Enumerable.Range(0, 7) // 0-6 - .Concat(Enumerable.Range(10, 11)) // 10-20 - .Concat(Enumerable.Range(29, 15)) // 29-43 - .Concat(Enumerable.Range(45, 5)) // 45-49 - .Concat(Enumerable.Range(51, 8)) // 51-58 - .Concat(Enumerable.Range(60, 24)) // 60-83 - .Concat(Enumerable.Range(196, 55)) // 196-250 - .Select(i => (ushort)i).ToArray(); + internal static readonly ushort[] Pouch_Items_RBY = + { + 000,001,002,003,004,005,006, 010,011,012,013,014,015, + 016,017,018,019,020, 029,030,031, + 032,033,034,035,036,037,038,039,040,041,042,043, 045,046,047, + 048,049, 051,052,053,054,055,056,057,058, 060,061,062,063, + 064,065,066,067,068,069,070,071,072,073,074,075,076,077,078,079, + 080,081,082,083, + + // ... + + 196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250, + }; internal static readonly int[] MovePP_RBY = { @@ -29,7 +38,7 @@ public static partial class Legal 00, 00, 00, 00, 00, 00 }; - internal static readonly int[] TransferSpeciesDefaultAbility_1 = {92, 93, 94, 109, 110, 151}; + internal static readonly HashSet TransferSpeciesDefaultAbility_1 = new HashSet {92, 93, 94, 109, 110, 151}; internal static readonly int[] TMHM_RBY = { @@ -50,25 +59,25 @@ public static partial class Legal internal static readonly int[] WildPokeBalls1 = {4}; - internal static readonly int[] FutureEvolutionsGen1 = + internal static readonly HashSet FutureEvolutionsGen1 = new HashSet { 169,182,186,196,197,199,208,212,230,233,242,462,463,464,465,466,467,470,471,474,700 }; - internal static readonly int[] FutureEvolutionsGen1_Gen2LevelUp = + internal static readonly HashSet FutureEvolutionsGen1_Gen2LevelUp = new HashSet { // Crobat Espeon Umbreon Blissey 169,196,197,242 }; - internal static readonly int[] SpecialMinMoveSlots = + internal static readonly HashSet SpecialMinMoveSlots = new HashSet { 25, 26, 29, 30, 31, 32, 33, 34, 36, 38, 40, 59, 91, 103, 114, 121, }; - internal static readonly int[] Types_Gen1 = + internal static readonly HashSet Types_Gen1 = new HashSet { 0, 1, 2, 3, 4, 5, 7, 8, 20, 21, 22, 23, 24, 25, 26 }; - internal static readonly int[] Species_NotAvailable_CatchRate = + internal static readonly HashSet Species_NotAvailable_CatchRate = new HashSet { 12, 18, 31, 34, 36, 38, 45, 53, 59, 62, 65, 68, 71, 78, 91, 103, 121 }; @@ -77,7 +86,7 @@ public static partial class Legal 167, // Normal Box 168, // Gorgeous Box }; - internal static readonly int[] Stadium_GiftSpecies = + internal static readonly HashSet Stadium_GiftSpecies = new HashSet { 001, // Bulbasaur 004, // Charmander @@ -89,7 +98,7 @@ public static partial class Legal 138, // Omanyte 140, // Kabuto }; - internal static readonly int[] Trade_Evolution1 = + internal static readonly HashSet Trade_Evolution1 = new HashSet { 064, 067, diff --git a/PKHeX.Core/Legality/Tables2.cs b/PKHeX.Core/Legality/Tables2.cs index f8d9d655a..236bc2d2a 100644 --- a/PKHeX.Core/Legality/Tables2.cs +++ b/PKHeX.Core/Legality/Tables2.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -48,7 +49,7 @@ public static partial class Legal internal static readonly int[] Tutors_GSC = {53, 85, 58}; // Flamethrower, Thunderbolt & Ice Beam internal static readonly int[] WildPokeBalls2 = { 4 }; - internal static readonly int[] FutureEvolutionsGen2 = + internal static readonly HashSet FutureEvolutionsGen2 = new HashSet { 424,429,430,461,462,463,464,465,466,467,468,469,470,471,472,473,474,700 }; @@ -57,6 +58,6 @@ public static partial class Legal // todo }; internal static readonly bool[] ReleasedHeldItems_2 = Enumerable.Range(0, MaxItemID_2+1).Select(i => HeldItems_GSC.Contains((ushort)i) && !UnreleasedItems_2.Contains(i)).ToArray(); - internal static readonly int[] TransferSpeciesDefaultAbility_2 = {92, 93, 94, 109, 110, 151, 200, 201, 247, 251}; // todo VC2: 247 (pupitar) + internal static readonly HashSet TransferSpeciesDefaultAbility_2 = new HashSet { 92, 93, 94, 109, 110, 151, 200, 201, 247, 251}; // todo VC2: 247 (pupitar) } } diff --git a/PKHeX.Core/Legality/Tables3.cs b/PKHeX.Core/Legality/Tables3.cs index 1bb07ceee..113dfff59 100644 --- a/PKHeX.Core/Legality/Tables3.cs +++ b/PKHeX.Core/Legality/Tables3.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -11,7 +12,7 @@ public static partial class Legal internal const int MaxAbilityID_3 = 77; internal const int MaxBallID_3 = 0xC; - public static readonly int[] SplitBreed_3 = + public static readonly HashSet SplitBreed_3 = new HashSet { // Incense 183, 184, // Marill @@ -89,25 +90,25 @@ public static partial class Legal 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593 }; - internal static readonly int[] WildPokeBalls3 = {1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12}; + internal static readonly HashSet WildPokeBalls3 = new HashSet { 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12}; - internal static readonly int[] FutureEvolutionsGen3 = + internal static readonly HashSet FutureEvolutionsGen3 = new HashSet { 407,424,429,430,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,700 }; - internal static readonly int[] FutureEvolutionsGen3_LevelUpGen4 = + internal static readonly HashSet FutureEvolutionsGen3_LevelUpGen4 = new HashSet { + // Ambipom Weavile Magnezone Lickilicky Tangrowth + // Yanmega Leafeon Glaceon Mamoswine Gliscor Probopass 424, 461, 462, 463, 465, 469, 470, 471, 472, 473, 476 }; - // Ambipom Weavile Magnezone Lickilicky Tangrowth - // Yanmega Leafeon Glaceon Mamoswine Gliscor Probopass internal static readonly int[] UnreleasedItems_3 = { 005, // Safari Ball }; internal static readonly bool[] ReleasedHeldItems_3 = Enumerable.Range(0, MaxItemID_3+1).Select(i => HeldItems_RS.Contains((ushort)i) && !UnreleasedItems_3.Contains(i)).ToArray(); - internal static readonly string[] EReaderBerriesNames_USA = + internal static readonly HashSet EReaderBerriesNames_USA = new HashSet { // USA Series 1 "PUMKIN", @@ -117,7 +118,7 @@ public static partial class Legal "CHILAN", "NUTPEA", }; - internal static readonly string[] EReaderBerriesNames_JP = + internal static readonly HashSet EReaderBerriesNames_JP = new HashSet { // JP Series 1 "カチャ", // PUMKIN @@ -143,7 +144,7 @@ public static partial class Legal 280, 104, 115, 351, 053, 188, 201, 126, 317, 332, 259, 263, 290, 156, 213, 168, 211, 285, 289, 315, }; - internal static readonly int[] HM_3 = {15, 19, 57, 70, 148, 249, 127, 291}; + internal static readonly HashSet HM_3 = new HashSet { 15, 19, 57, 70, 148, 249, 127, 291}; internal static readonly int[] TypeTutor3 = {338, 307, 308}; internal static readonly int[] Tutor_3Mew = { @@ -234,7 +235,7 @@ public static partial class Legal }; // 064 is an unused location for metor falls // 084 is Inside of a truck, no possible pokemon can be hatched there - internal static readonly int[] ValidMet_RS = + internal static readonly HashSet ValidMet_RS = new HashSet { 000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, @@ -244,7 +245,7 @@ public static partial class Legal }; // 155 - 158 Sevii Isle 6-9 Unused // 171 - 173 Sevii Isle 22-24 Unused - internal static readonly int[] ValidMet_FRLG = + internal static readonly HashSet ValidMet_FRLG = new HashSet { 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, @@ -253,9 +254,9 @@ public static partial class Legal 164, 165, 166, 167, 168, 169, 170, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196 }; - internal static readonly int[] ValidMet_E = ValidMet_RS.Concat(new[] + internal static readonly HashSet ValidMet_E = new HashSet(ValidMet_RS.Concat(new[] { 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - }).ToArray(); + })); } } diff --git a/PKHeX.Core/Legality/Tables4.cs b/PKHeX.Core/Legality/Tables4.cs index 4f754e2ea..3eb396e69 100644 --- a/PKHeX.Core/Legality/Tables4.cs +++ b/PKHeX.Core/Legality/Tables4.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -120,18 +121,18 @@ public static partial class Legal 430, 433, }; - internal static readonly int[] HM_HGSS = + internal static readonly HashSet HM_HGSS = new HashSet { 015, 019, 057, 070, 250, 249, 127, 431 // Whirlpool(HGSS) }; - internal static readonly int[] HM_DPPt = + internal static readonly HashSet HM_DPPt = new HashSet { 015, 019, 057, 070, 432, 249, 127, 431 // Defog(DPPt) }; - internal static readonly int[] HM_4_RemovePokeTransfer = + internal static readonly HashSet HM_4_RemovePokeTransfer = new HashSet { 015, 019, 057, 070, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) excluded }; @@ -150,12 +151,12 @@ public static partial class Legal 10, 15, 20, 15, 10, 10, 10, 20, 05, 30, 05, 10, 15, 10, 10, 05, 20, 30, 10, 30, 15, 15, 15, 15, 30, 10, 20, 15, 10, 10, 20, 15, 05, 05, 15, 15, 05, 10, 05, 20, 05, 15, 20, 05, 20, 20, 20, 20, 10, 20, 10, 15, 20, 15, 10, 10, 05, 10, 05, 05, 10, 05, 05, 10, 05, 05, 05, }; - internal static readonly int[] WildPokeBalls4_DPPt = + internal static readonly HashSet WildPokeBalls4_DPPt = new HashSet { 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Cherish ball not usable }; - internal static readonly int[] WildPokeBalls4_HGSS = + internal static readonly HashSet WildPokeBalls4_HGSS = new HashSet { 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Cherish ball not usable @@ -167,7 +168,7 @@ public static partial class Legal { 700 }; - internal static readonly int[] UnreleasedItems_4 = + internal static readonly HashSet UnreleasedItems_4 = new HashSet { 005, // Safari Ball 016, // Cherish Ball @@ -176,7 +177,7 @@ public static partial class Legal 500, // Park Ball }; internal static readonly bool[] ReleasedHeldItems_4 = Enumerable.Range(0, MaxItemID_4_HGSS+1).Select(i => HeldItems_HGSS.Contains((ushort)i) && !UnreleasedItems_4.Contains(i)).ToArray(); - internal static readonly int[] CrownBeasts = {251, 243, 244, 245}; + internal static readonly HashSet CrownBeasts = new HashSet { 251, 243, 244, 245}; internal static readonly int[] Tutors_4 = { @@ -209,7 +210,7 @@ public static partial class Legal internal static readonly int[] Slot4_Radar = { 4, 5, 10, 11 }; internal static readonly int[] Slot4_Dual = { 8, 9 }; - internal static readonly int[] ValidMet_DP = + internal static readonly HashSet ValidMet_DP = new HashSet { // 063: Flower Paradise unreleased DP event // 079: Newmoon Island unreleased DP event @@ -222,11 +223,11 @@ public static partial class Legal 081, 082, 083, 084, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, }; - internal static readonly int[] ValidMet_Pt = ValidMet_DP.Concat(new[] + internal static readonly HashSet ValidMet_Pt = new HashSet(ValidMet_DP.Concat(new[] { 63, 79, 85, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - }).ToArray(); - internal static readonly int[] ValidMet_HGSS = + })); + internal static readonly HashSet ValidMet_HGSS = new HashSet { 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, @@ -235,11 +236,11 @@ public static partial class Legal 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 234, //233: Pokéwalker }; - internal static readonly int[] GiftEggLocation4 = + internal static readonly HashSet GiftEggLocation4 = new HashSet { 2009, 2010, 2011, 2013, 2014 }; - internal static readonly int[] EggLocations4 = + internal static readonly HashSet EggLocations4 = new HashSet { 2000, 2002, 2009, 2010, 2011, 2013, 2014 }; diff --git a/PKHeX.Core/Legality/Tables5.cs b/PKHeX.Core/Legality/Tables5.cs index 56adea734..b154df0ad 100644 --- a/PKHeX.Core/Legality/Tables5.cs +++ b/PKHeX.Core/Legality/Tables5.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -99,20 +100,20 @@ public static partial class Legal 15, 15, 15, 15, 10, 10, 10, 10, 10, 15, 15, 15, 15, 05, 05, 15, 05, 10, 10, 10, 20, 20, 20, 10, 10, 30, 15, 15, 10, 15, 25, 10, 20, 10, 10, 10, 20, 10, 10, 10, 10, 10, 15, 15, 05, 05, 10, 10, 10, 05, 05, 10, 05, 05, 15, 10, 05, 05, 05, }; - internal static readonly int[] WildPokeBalls5 = + internal static readonly HashSet WildPokeBalls5 = new HashSet { 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Cherish ball not usable // HGSS balls not usable // Dream ball not usable in wild }; - internal static readonly int[] DreamWorldBalls = WildPokeBalls5.Concat(new[] { 25 }).ToArray(); + internal static readonly HashSet DreamWorldBalls = new HashSet (WildPokeBalls5.Concat(new[] { 25 })); internal static readonly int[] FutureEvolutionsGen5 = { 700 }; - internal static readonly int[] UnreleasedItems_5 = + internal static readonly HashSet UnreleasedItems_5 = new HashSet { 005, // Safari Ball 016, // Cherish Ball @@ -141,7 +142,7 @@ public static partial class Legal new[] { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 } // Nacrene City }; - internal static readonly int[] ValidMet_BW = + internal static readonly HashSet ValidMet_BW = new HashSet { 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, 040, @@ -151,7 +152,7 @@ public static partial class Legal 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, }; - internal static readonly int[] ValidMet_B2W2 = + internal static readonly HashSet ValidMet_B2W2 = new HashSet { 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 017, 018, 019, 020, 021, 022, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, //023 Route 10, 040->134 Victory Road @@ -162,7 +163,7 @@ public static partial class Legal 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 139, 140, //138 --- 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, }; - internal static readonly int[] EggLocations5 = + internal static readonly HashSet EggLocations5 = new HashSet { 30002, // Link Trade (NPC) 30003, // Link Trade diff --git a/PKHeX.Core/Legality/Tables6.cs b/PKHeX.Core/Legality/Tables6.cs index 8820960b1..ec69f643f 100644 --- a/PKHeX.Core/Legality/Tables6.cs +++ b/PKHeX.Core/Legality/Tables6.cs @@ -228,7 +228,7 @@ public static partial class Legal #endregion internal static readonly int[] EggLocations6 = {60002, 30002}; - internal static readonly int[] ValidMet_XY = + internal static readonly HashSet ValidMet_XY = new HashSet { 006, 008, 009, 010, 012, 013, 014, 016, 017, 018, 020, 021, 022, 024, 026, 028, 029, 030, 032, 034, 035, 036, 038, 039, 040, 042, 043, 044, 046, 047, 048, 050, 051, 052, 054, 055, 056, 058, 060, 062, 063, 064, 066, 067, @@ -236,7 +236,7 @@ public static partial class Legal 100, 101, 102, 103, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 135, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168 }; - internal static readonly int[] ValidMet_AO = + internal static readonly HashSet ValidMet_AO = new HashSet { 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, @@ -244,7 +244,7 @@ public static partial class Legal 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354 }; - internal static readonly int[] FriendSafari = + internal static readonly HashSet FriendSafari = new HashSet { 190, 206, 216, 506, 294, 352, 531, 572, 113, 132, 133, 235, 012, 046, 165, 415, 267, 284, 313, 314, 049, 127, 214, 666, diff --git a/PKHeX.Core/Legality/Tables7.cs b/PKHeX.Core/Legality/Tables7.cs index b6eb45d97..d2444ce89 100644 --- a/PKHeX.Core/Legality/Tables7.cs +++ b/PKHeX.Core/Legality/Tables7.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; namespace PKHeX.Core { @@ -103,12 +104,12 @@ public static partial class Legal }; internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); - private static readonly int[] WildPokeballs7 = { + private static readonly HashSet WildPokeballs7 = new HashSet { 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, // Johto Balls 0x1A, // Beast }; - internal static readonly int[] AlolanOriginForms = + internal static readonly HashSet AlolanOriginForms = new HashSet { 019, // Rattata 020, // Raticate @@ -133,7 +134,7 @@ public static partial class Legal 105, // Marowak }.Concat(AlolanOriginForms).ToArray(); - public static readonly int[] PastGenAlolanNatives = + public static readonly HashSet PastGenAlolanNatives = new HashSet { 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, @@ -147,13 +148,13 @@ public static partial class Legal 582, 583, 584, 587, 594, 627, 628, 629, 630, 661, 662, 663, 674, 675, 700, 703, 704, 705, 706, 707, 708, 709, 718 }; - public static readonly int[] PastGenAlolanNativesUncapturable = + public static readonly HashSet PastGenAlolanNativesUncapturable = new HashSet { 142, // Aerodacyl 137, 233, 474 // Porygon++ }; - internal static readonly int[] PastGenAlolanScans = + internal static readonly HashSet PastGenAlolanScans = new HashSet { 069, // Bellsprout 111, // Rhyhorn @@ -187,7 +188,7 @@ public static partial class Legal 540, // [542] Leavanny (Sewaddle) 602, // [604] Eelektross (Tynamo) }; - internal static readonly int[] Inherit_Apricorn6 = + internal static readonly HashSet Inherit_Apricorn6 = new HashSet { 010, 013, 016, 019, 021, 023, 025, 027, 029, 035, 037, 039, 041, 043, 046, 048, 050, 052, 054, 056, 058, 060, 063, 066, 069, 072, 074, 077, 079, 083, 084, 086, 088, 090, 092, @@ -214,7 +215,7 @@ public static partial class Legal 173, // Via Clefairy 174, // Via Jigglypuff }; - internal static readonly int[] AlolanCaptureOffspring = + internal static readonly HashSet AlolanCaptureOffspring = new HashSet { 010, 019, 021, 025, 027, 035, 037, 039, 041, 046, 050, 052, 054, 056, 058, 060, 063, 066, 072, 074, @@ -233,8 +234,8 @@ public static partial class Legal 769, 771, 774, 775, 776, 777, 778, 779, 780, 781, 782 }; - internal static readonly int[] AlolanCaptureNoHeavyBall = {374, 785, 786, 787, 788}; // Beldum & Tapus - internal static readonly int[] Inherit_ApricornMale7 = + internal static readonly HashSet AlolanCaptureNoHeavyBall = new HashSet { 374, 785, 786, 787, 788}; // Beldum & Tapus + internal static readonly HashSet Inherit_ApricornMale7 = new HashSet { 100, // Voltorb 343, // Baltoy @@ -243,8 +244,8 @@ public static partial class Legal // Others are capturable in the Alola region // Magnemite, Staryu, Tauros }; - internal static readonly int[] Inherit_Apricorn7 = Inherit_Apricorn6.Concat(Inherit_ApricornMale7).Concat(PastGenAlolanScans).Concat(AlolanCaptureOffspring).Distinct().ToArray(); - internal static readonly int[] Inherit_SafariMale = + internal static readonly HashSet Inherit_Apricorn7 = new HashSet (Inherit_Apricorn6.Concat(Inherit_ApricornMale7).Concat(PastGenAlolanScans).Concat(AlolanCaptureOffspring).Distinct()); + internal static readonly HashSet Inherit_SafariMale = new HashSet { 128, // Tauros @@ -255,7 +256,7 @@ public static partial class Legal 374, // Beldum 436, // Bronzor }; - internal static readonly int[] Inherit_DreamMale = + internal static readonly HashSet Inherit_DreamMale = new HashSet { // Starting with Gen7, Males pass Ball via breeding with Ditto. 001, 004, 007, // Gen1 Starters @@ -283,15 +284,15 @@ public static partial class Legal 599, // Klink 622, // Golett }; - internal static readonly int[] Ban_Gen3Ball_7 = + internal static readonly HashSet Ban_Gen3Ball_7 = new HashSet { 566, 567, 696, 697, 698, 699 // Fossil Only obtain }; - internal static readonly int[] Ban_Gen4Ball_7 = + internal static readonly HashSet Ban_Gen4Ball_7 = new HashSet { 566, 567, 696, 697, 698, 699 // Fossil Only obtain }; - internal static readonly int[] Ban_SafariBallHidden_7 = + internal static readonly HashSet Ban_SafariBallHidden_7 = new HashSet { 029, 030, 031, 032, 033, 034, // Nidos 313, 314, // Volbeat/Illumise @@ -307,7 +308,7 @@ public static partial class Legal }; internal static readonly int[] EggLocations7 = {60002, 30002}; - internal static readonly int[] ValidMet_SM = + internal static readonly HashSet ValidMet_SM = new HashSet { 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, @@ -316,7 +317,7 @@ public static partial class Legal 30016 // Poké Pelago }; - internal static readonly int[] ValidMet_USUM = + internal static readonly HashSet ValidMet_USUM = new HashSet { }; @@ -356,7 +357,7 @@ public static partial class Legal 01, 01, 01, 05, 05, 10, 10, 10, 20, 10, 10, 10, 05, 05, 20, 10, 10, 10, 01 }; - internal static readonly int[] Ban_NoHidden7 = + internal static readonly HashSet Ban_NoHidden7 = new HashSet { // Summon only other Pokemon 765, // Oranguru @@ -391,701 +392,9 @@ public static partial class Legal 710 + (2 << 11), //Pumpkaboo-Large 711 + (2 << 11), //Gourgeist-Large }; - #region Pre-Bank Illegality - internal static readonly int[] Bank_NoHidden7 = - { - // Gifts - 137, // Porygon - 233, // Porygon2 - 474, // Porygon-Z - - // No SOS slots - 142, // Aerodactyl - 408, // Cranidos - 409, // Rampardos - 410, // Shieldon - 411, // Bastiodon - 564, // Tirtouga - 565, // Carracosta - 566, // Archen - 567, // Archeops - - // Island Scan - 069, // Bellsprout - 070, // Weepinbell - 071, // Victreebel - 111, // Rhyhorn - 112, // Rhydon - 464, // Rhyperior - 116, // Horsea - 117, // Seadra - 230, // Kingdra - 152, // Chikorita - 153, // Bayleef - 154, // Meganium - 155, // Cyndaquil - 156, // Quilava - 157, // Typhlosion - 158, // Totodile - 159, // Croconaw - 160, // Feraligatr - 175, // Togepi - 176, // Togetic - 468, // Togekiss - 183, // Marill - 184, // Azumarill - 220, // Swinub - 221, // Piloswine - 287, // Slakoth - 288, // Vigoroth - 289, // Slaking - 473, // Mamoswine - 298, // Azurill - 363, // Spheal - 364, // Sealeo - 365, // Walrein - 396, // Starly - 397, // Staravia - 398, // Staraptor - 403, // Shinx - 404, // Luxio - 405, // Luxray - 406, // Budew - 407, // Roserade - 315, // Roselia - 495, // Snivy - 496, // Servine - 497, // Serperior - 498, // Tepig - 499, // Pignite - 500, // Emboar - 501, // Oshawott - 502, // Dewott - 503, // Samurott - 532, // Timburr - 533, // Gurdurr - 534, // Conkeldurr - 540, // Sewaddle - 541, // Swadloon - 542, // Leavanny - 543, // Venipede - 544, // Whirlipede - 545, // Scolipede - 574, // Gothita - 575, // Gothorita - 576, // Gothitelle - 577, // Solosis - 578, // Duosion - 579, // Reuniclus - 599, // Klink - 600, // Klang - 601, // Klinklang - 602, // Tynamo - 603, // Eelektrik - 604, // Eelektross - 607, // Litwick - 608, // Lampent - 609, // Chandelure - 610, // Axew - 611, // Fraxure - 612, // Haxorus - 633, // Deino - 634, // Zweilous - 635, // Hydreigon - 679, // Honedge - 680, // Doublade - 681, // Aegislash - }; - internal static readonly int[] Bank_NotAvailable7 = // Unobtainable Species - { - 001, // Bulbasaur - 002, // Ivysaur - 003, // Venusaur - 004, // Charmander - 005, // Charmeleon - 006, // Charizard - 007, // Squirtle - 008, // Wartortle - 009, // Blastoise - 013, // Weedle - 014, // Kakuna - 015, // Beedrill - 016, // Pidgey - 017, // Pidgeotto - 018, // Pidgeot - 023, // Ekans - 024, // Arbok - 026, // Raichu - 029, // Nidoran♀ - 030, // Nidorina - 031, // Nidoqueen - 032, // Nidoran♂ - 033, // Nidorino - 034, // Nidoking - 043, // Oddish - 044, // Gloom - 045, // Vileplume - 048, // Venonat - 049, // Venomoth - 077, // Ponyta - 078, // Rapidash - 083, // Farfetch'd - 084, // Doduo - 085, // Dodrio - 086, // Seel - 087, // Dewgong - 095, // Onix - 098, // Krabby - 099, // Kingler - 100, // Voltorb - 101, // Electrode - 103, // Exeggutor - 105, // Marowak - 106, // Hitmonlee - 107, // Hitmonchan - 108, // Lickitung - 109, // Koffing - 110, // Weezing - 114, // Tangela - 122, // Mr. Mime - 124, // Jynx - 138, // Omanyte - 139, // Omastar - 140, // Kabuto - 141, // Kabutops - 144, // Articuno - 145, // Zapdos - 146, // Moltres - 150, // Mewtwo - 151, // Mew - 161, // Sentret - 162, // Furret - 163, // Hoothoot - 164, // Noctowl - 177, // Natu - 178, // Xatu - 179, // Mareep - 180, // Flaaffy - 181, // Ampharos - 182, // Bellossom - 187, // Hoppip - 188, // Skiploom - 189, // Jumpluff - 190, // Aipom - 191, // Sunkern - 192, // Sunflora - 193, // Yanma - 194, // Wooper - 195, // Quagsire - 201, // Unown - 202, // Wobbuffet - 203, // Girafarig - 204, // Pineco - 205, // Forretress - 206, // Dunsparce - 207, // Gligar - 208, // Steelix - 211, // Qwilfish - 213, // Shuckle - 214, // Heracross - 216, // Teddiursa - 217, // Ursaring - 218, // Slugma - 219, // Magcargo - 223, // Remoraid - 224, // Octillery - 226, // Mantine - 228, // Houndour - 229, // Houndoom - 231, // Phanpy - 232, // Donphan - 234, // Stantler - 236, // Tyrogue - 237, // Hitmontop - 238, // Smoochum - 243, // Raikou - 244, // Entei - 245, // Suicune - 246, // Larvitar - 247, // Pupitar - 248, // Tyranitar - 249, // Lugia - 250, // Ho-Oh - 251, // Celebi - 252, // Treecko - 253, // Grovyle - 254, // Sceptile - 255, // Torchic - 256, // Combusken - 257, // Blaziken - 258, // Mudkip - 259, // Marshtomp - 260, // Swampert - 261, // Poochyena - 262, // Mightyena - 263, // Zigzagoon - 264, // Linoone - 265, // Wurmple - 266, // Silcoon - 267, // Beautifly - 268, // Cascoon - 269, // Dustox - 270, // Lotad - 271, // Lombre - 272, // Ludicolo - 273, // Seedot - 274, // Nuzleaf - 275, // Shiftry - 276, // Taillow - 277, // Swellow - 280, // Ralts - 281, // Kirlia - 282, // Gardevoir - 285, // Shroomish - 286, // Breloom - 290, // Nincada - 291, // Ninjask - 292, // Shedinja - 293, // Whismur - 294, // Loudred - 295, // Exploud - 300, // Skitty - 301, // Delcatty - 303, // Mawile - 304, // Aron - 305, // Lairon - 306, // Aggron - 307, // Meditite - 308, // Medicham - 309, // Electrike - 310, // Manectric - 311, // Plusle - 312, // Minun - 313, // Volbeat - 314, // Illumise - 316, // Gulpin - 317, // Swalot - 322, // Numel - 323, // Camerupt - 325, // Spoink - 326, // Grumpig - 331, // Cacnea - 332, // Cacturne - 333, // Swablu - 334, // Altaria - 335, // Zangoose - 336, // Seviper - 337, // Lunatone - 338, // Solrock - 341, // Corphish - 342, // Crawdaunt - 343, // Baltoy - 344, // Claydol - 345, // Lileep - 346, // Cradily - 347, // Anorith - 348, // Armaldo - 352, // Kecleon - 353, // Shuppet - 354, // Banette - 355, // Duskull - 356, // Dusclops - 357, // Tropius - 358, // Chimecho - 360, // Wynaut - 366, // Clamperl - 367, // Huntail - 368, // Gorebyss - 377, // Regirock - 378, // Regice - 379, // Registeel - 380, // Latias - 381, // Latios - 382, // Kyogre - 383, // Groudon - 384, // Rayquaza - 385, // Jirachi - 386, // Deoxys - 387, // Turtwig - 388, // Grotle - 389, // Torterra - 390, // Chimchar - 391, // Monferno - 392, // Infernape - 393, // Piplup - 394, // Prinplup - 395, // Empoleon - 399, // Bidoof - 400, // Bibarel - 401, // Kricketot - 402, // Kricketune - 412, // Burmy - 413, // Wormadam - 414, // Mothim - 415, // Combee - 416, // Vespiquen - 417, // Pachirisu - 418, // Buizel - 419, // Floatzel - 420, // Cherubi - 421, // Cherrim - 424, // Ambipom - 427, // Buneary - 428, // Lopunny - 431, // Glameow - 432, // Purugly - 433, // Chingling - 434, // Stunky - 435, // Skuntank - 436, // Bronzor - 437, // Bronzong - 439, // Mime Jr. - 441, // Chatot - 442, // Spiritomb - 449, // Hippopotas - 450, // Hippowdon - 451, // Skorupi - 452, // Drapion - 453, // Croagunk - 454, // Toxicroak - 455, // Carnivine - 458, // Mantyke - 459, // Snover - 460, // Abomasnow - 463, // Lickilicky - 465, // Tangrowth - 469, // Yanmega - 472, // Gliscor - 475, // Gallade - 477, // Dusknoir - 479, // Rotom - 480, // Uxie - 481, // Mesprit - 482, // Azelf - 483, // Dialga - 484, // Palkia - 485, // Heatran - 486, // Regigigas - 487, // Giratina - 488, // Cresselia - 489, // Phione - 490, // Manaphy - 491, // Darkrai - 492, // Shaymin - 493, // Arceus - 494, // Victini - 504, // Patrat - 505, // Watchog - 509, // Purrloin - 510, // Liepard - 511, // Pansage - 512, // Simisage - 513, // Pansear - 514, // Simisear - 515, // Panpour - 516, // Simipour - 517, // Munna - 518, // Musharna - 519, // Pidove - 520, // Tranquill - 521, // Unfezant - 522, // Blitzle - 523, // Zebstrika - 527, // Woobat - 528, // Swoobat - 529, // Drilbur - 530, // Excadrill - 531, // Audino - 535, // Tympole - 536, // Palpitoad - 537, // Seismitoad - 538, // Throh - 539, // Sawk - 550, // Basculin - 554, // Darumaka - 555, // Darmanitan - 556, // Maractus - 557, // Dwebble - 558, // Crustle - 559, // Scraggy - 560, // Scrafty - 561, // Sigilyph - 562, // Yamask - 563, // Cofagrigus - 570, // Zorua - 571, // Zoroark - 572, // Minccino - 573, // Cinccino - 580, // Ducklett - 581, // Swanna - 585, // Deerling - 586, // Sawsbuck - 588, // Karrablast - 589, // Escavalier - 590, // Foongus - 591, // Amoonguss - 592, // Frillish - 593, // Jellicent - 595, // Joltik - 596, // Galvantula - 597, // Ferroseed - 598, // Ferrothorn - 605, // Elgyem - 606, // Beheeyem - 613, // Cubchoo - 614, // Beartic - 615, // Cryogonal - 616, // Shelmet - 617, // Accelgor - 618, // Stunfisk - 619, // Mienfoo - 620, // Mienshao - 621, // Druddigon - 622, // Golett - 623, // Golurk - 624, // Pawniard - 625, // Bisharp - 626, // Bouffalant - 631, // Heatmor - 632, // Durant - 636, // Larvesta - 637, // Volcarona - 638, // Cobalion - 639, // Terrakion - 640, // Virizion - 641, // Tornadus - 642, // Thundurus - 643, // Reshiram - 644, // Zekrom - 645, // Landorus - 646, // Kyurem - 647, // Keldeo - 648, // Meloetta - 649, // Genesect - 650, // Chespin - 651, // Quilladin - 652, // Chesnaught - 653, // Fennekin - 654, // Braixen - 655, // Delphox - 656, // Froakie - 657, // Frogadier - 658, // Greninja - 659, // Bunnelby - 660, // Diggersby - 664, // Scatterbug - 665, // Spewpa - 666, // Vivillon - 667, // Litleo - 668, // Pyroar - 669, // Flabébé - 670, // Floette - 671, // Florges - 672, // Skiddo - 673, // Gogoat - 676, // Furfrou - 677, // Espurr - 678, // Meowstic - 682, // Spritzee - 683, // Aromatisse - 684, // Swirlix - 685, // Slurpuff - 686, // Inkay - 687, // Malamar - 688, // Binacle - 689, // Barbaracle - 690, // Skrelp - 691, // Dragalge - 692, // Clauncher - 693, // Clawitzer - 694, // Helioptile - 695, // Heliolisk - 696, // Tyrunt - 697, // Tyrantrum - 698, // Amaura - 699, // Aurorus - 701, // Hawlucha - 702, // Dedenne - 710, // Pumpkaboo - 711, // Gourgeist - 712, // Bergmite - 713, // Avalugg - 714, // Noibat - 715, // Noivern - 716, // Xerneas - 717, // Yveltal - 719, // Diancie - 720, // Hoopa - 721, // Volcanion - }; - internal static readonly EncounterStatic[] Bank_Egg7 = // Unobtainable Egg Moves - { - // Regular - - new EncounterStatic { Species = 722, Relearn = new[] {466,174}}, // Rowlet: Ominous Wind, Curse - new EncounterStatic { Species = 731, Relearn = new[] {586,253}}, // Pikipek: Boomburst, Uproar - new EncounterStatic { Species = 165, Relearn = new[] {227,282,264,409,146}}, // Ledyba: Encore, Knock Off, Focus Punch, Drain Punch, Dizzy Punch - new EncounterStatic { Species = 167, Relearn = new[] {50,324,527}}, // Spinarak: Disable, Signal Beam, Electroweb - new EncounterStatic { Species = 736, Relearn = new[] {527}}, // Grubbin: Electroweb - new EncounterStatic { Species = 185, Relearn = new[] {328,174,203}}, // Sudowoodo: Sand Tomb, Curse, Endure - new EncounterStatic { Species = 440, Relearn = new[] {426,68,69}}, // Happiny: Mud Bomb, Counter, Seismic Toss - new EncounterStatic { Species = 143, Relearn = new[] {120,495,18,204,562}}, // Snorlax: Self-Destruct, After You, Whirlwind, Charm, Belch - new EncounterStatic { Species = 446, Relearn = new[] {120,495,18,204,562}}, // Munchlax: Self-Destruct, After You, Whirlwind, Charm, Belch - new EncounterStatic { Species = 079, Relearn = new[] {562}}, // Slowpoke: Belch - new EncounterStatic { Species = 278, Relearn = new[] {282}}, // Wingull: Knock Off - new EncounterStatic { Species = 063, Relearn = new[] {112,379,385,285,8,375}}, // Abra: Barrier, Power Trick, Guard Swap, Skill Swap, Ice Punch, Psycho Shift - new EncounterStatic { Species = 052, Relearn = new[] {274}}, // Meowth: Assist - new EncounterStatic { Species = 088, Form = 1, Relearn = new[] {184,228,372}}, // Grimer1: Scary Face, Pursuit, Assurance - new EncounterStatic { Species = 088, Relearn = new[] {184}}, // Grimer: Scary Face - new EncounterStatic { Species = 096, Relearn = new[] {112,274,385,290,285,8}}, // Drowzee: Barrier, Assist, Guard Swap, Secret Power, Skill Swap, Ice Punch - new EncounterStatic { Species = 296, Relearn = new[] {270}}, // Makuhita: Helping Hand - new EncounterStatic { Species = 739, Relearn = new[] {276}}, // Crabrawler: Superpower - new EncounterStatic { Species = 092, Relearn = new[] {114,184,513,9,8,7}}, // Gastly: Haze, Scary Face, Reflect Type, Thunder Punch, Ice Punch, Fire Punch - new EncounterStatic { Species = 425, Relearn = new[] {366,432,114}}, // Drifloon: Tailwind, Defog, Haze - new EncounterStatic { Species = 200, Relearn = new[] {382,417}}, // Misdreavus: Me First, Nasty Plot - new EncounterStatic { Species = 041, Relearn = new[] {599,202,428,95,174}}, // Zubat: Venom Drench, Giga Drain, Zen Headbutt, Hypnosis, Curse - new EncounterStatic { Species = 021, Relearn = new[] {161}}, // Spearow: Tri Attack - new EncounterStatic { Species = 629, Relearn = new[] {282,313}}, // Vullaby: Knock Off, Fake Tears - new EncounterStatic { Species = 742, Relearn = new[] {285}}, // Cutiefly: Skill Swap - new EncounterStatic { Species = 548, Relearn = new[] {361,117}}, // Petilil: Healing Wish, Bide - new EncounterStatic { Species = 546, Relearn = new[] {262,251,415}}, // Cottonee: Memento, Beat Up, Switcheroo - new EncounterStatic { Species = 066, Relearn = new[] {27,8,379}}, // Machop: Rolling Kick, Ice Punch, Power Trick - new EncounterStatic { Species = 524, Relearn = new[] {222,174}}, // Roggenrola: Magnitude, Curse - new EncounterStatic { Species = 302, Relearn = new[] {236,445,368,286}}, // Sableye: Moonlight, Captivate, Metal Burst, Imprison - new EncounterStatic { Species = 327, Relearn = new[] {274,375}}, // Spinda: Assist, Psycho Shift - new EncounterStatic { Species = 072, Relearn = new[] {229,114,282,367,330,321}},// Tentacool: Rapid Spin, Haze, Knock Off, Acupressure, Muddy Water, Tickle - new EncounterStatic { Species = 456, Relearn = new[] {62,60}}, // Finneon: Aurora Beam, Psybeam - new EncounterStatic { Species = 370, Relearn = new[] {494}}, // Luvdisc: Entrainment - new EncounterStatic { Species = 222, Relearn = new[] {275,267,293}}, // Corsola: Ingrain, Nature Power, Camoflage - new EncounterStatic { Species = 090, Relearn = new[] {41,341,229,36}}, // Shellder: Twineedle, Mud Shot, Rapid Spin, Take Down - new EncounterStatic { Species = 371, Relearn = new[] {111}}, // Bagon: Defense Curl - new EncounterStatic { Species = 174, Relearn = new[] {445,386,581,505,343} }, // Igglybuff: Captivate, Punishment, Misty Terrain, Heal Pulse, Covet - new EncounterStatic { Species = 283, Relearn = new[] {471}}, // Surskit: Power Split - new EncounterStatic { Species = 751, Relearn = new[] {471}}, // Dewpider: Power Split - new EncounterStatic { Species = 753, Relearn = new[] {432}}, // Fomantis: Defog - new EncounterStatic { Species = 755, Relearn = new[] {133}}, // Morelull: Amnesia - new EncounterStatic { Species = 046, Relearn = new[] {563}}, // Paras: Rototiller - new EncounterStatic { Species = 060, Relearn = new[] {283}}, // Poliwag: Endeavor - new EncounterStatic { Species = 118, Relearn = new[] {114,60}}, // Goldeen: Haze, Psybeam - new EncounterStatic { Species = 661, Relearn = new[] {289}}, // Fletchling: Snatch - new EncounterStatic { Species = 757, Relearn = new[] {562,282,289,252}}, // Salandit: Belch, Knock Off, Snatch, Fake Out - new EncounterStatic { Species = 104, Relearn = new[] {24,197}}, // Cubone: Double Kick, Detect - new EncounterStatic { Species = 115, Relearn = new[] {264,253,509}}, // Kangaskhan: Focus Punch, Uproar, Circle Throw - new EncounterStatic { Species = 126, Relearn = new[] {562,384,231,394,183,112,5}},// Magmar: Belch, Power Swap, Iron Tail, Flare Blitz, Mach Punch, Barrier, Mega Punch - new EncounterStatic { Species = 761, Relearn = new[] {364,367}}, // Bounsweet: Feint, Acupressure - new EncounterStatic { Species = 764, Relearn = new[] {495,381,133}}, // Comfey: After You, Lucky Chant, Amnesia - new EncounterStatic { Species = 127, Relearn = new[] {382}}, // Pinsir: Me First - new EncounterStatic { Species = 704, Relearn = new[] {151,174,342,68}}, // Goomy: Acid Armor, Curse, Poison Tail, Counter - new EncounterStatic { Species = 351, Relearn = new[] {513,385}}, // Castform: Reflect Type, Guard Swap - new EncounterStatic { Species = 769, Relearn = new[] {246}}, // Sandygast: Ancient Power - new EncounterStatic { Species = 408, Relearn = new[] {18,21}}, // Cranidos: Whirlwind, Slam - new EncounterStatic { Species = 410, Relearn = new[] {469,446}}, // Shieldon: Wide Guard, Stealth Rock - new EncounterStatic { Species = 566, Relearn = new[] {282,415,502}}, // Archen: Knock Off, Switcheroo, Ally Switch - new EncounterStatic { Species = 564, Relearn = new[] {282,385}}, // Tirtouga: Knock Off, Guard Swap - new EncounterStatic { Species = 170, Relearn = new[] {60,351}}, // Chinchou: Psybeam, Shock Wave - new EncounterStatic { Species = 568, Relearn = new[] {114,174}}, // Trubbish: Haze, Curse - new EncounterStatic { Species = 227, Relearn = new[] {203,446,385,174} }, // Skarmory: Endure, Stealth Rock, Guard Swap, Curse - new EncounterStatic { Species = 173, Relearn = new[] {505,581,343,150}}, // Cleffa: Heal Pulse, Misty Terrain, Covet, Splash - new EncounterStatic { Species = 776, Relearn = new[] {469,279,83}}, // Turtonator: Wide Guard, Revenge, Fire Spin - new EncounterStatic { Species = 239, Relearn = new[] {8,27,112}}, // Elekid: Ice Punch, Rolling Kick, Barrier - new EncounterStatic { Species = 074, Relearn = new[] {203,103,431,264,174}}, // Geodude: Endure, Screech, Rock Climb, Focus Punch, Curse - new EncounterStatic { Species = 707, Relearn = new[] {415}}, // Klefki: Switcheroo - new EncounterStatic { Species = 780, Relearn = new[] {583,13}}, // Drampa: Play Rough, Razor Wind - new EncounterStatic { Species = 361, Relearn = new[] {415}}, // Snorunt: Switcheroo - new EncounterStatic { Species = 215, Relearn = new[] {274}}, // Sneasel: Assist - new EncounterStatic { Species = 037, Relearn = new[] {541,290}}, // Vulpix: Tail Slap, Secret Power - new EncounterStatic { Species = 582, Relearn = new[] {352,363}}, // Vanillite: Water Pulse, Natural Gift - new EncounterStatic { Species = 422, Relearn = new[] {124}}, // Shellos: Sludge - new EncounterStatic { Species = 131, Relearn = new[] {419}}, // Lapras: Avalanche - new EncounterStatic { Species = 102, Relearn = new[] {335,285,384,381,267,246}},// Exeggcute: Block, Skill Swap, Power Swap, Lucky Chant, Nature Power, Ancient Power - new EncounterStatic { Species = 123, Relearn = new[] {211,501,432,179,68}}, // Scyther: Steel Wing, Quick Guard, Defog, Reversal, Counter - new EncounterStatic { Species = 198, Relearn = new[] {375,260,195}}, // Murkrow: Psycho Shift, Flatter, Perish Song - new EncounterStatic { Species = 447, Relearn = new[] {299}}, // Riolu: Blaze Kick - new EncounterStatic { Species = 147, Relearn = new[] {245}}, // Dratini: Extreme Speed - new EncounterStatic { Species = 142, Relearn = new[] {174}}, // Aerodactyl: Curse - - // Island Scan - - new EncounterStatic {Species = 069, Relearn = new[] {562, 438, 499}}, // Bellsprout: Belch, Power Whip, Clear Smog - new EncounterStatic {Species = 158, Relearn = new[] {313, 260}}, // Totodile: Fake Tears, Flatter - new EncounterStatic {Species = 183, Relearn = new[] {293, 383}}, // Marill: Camouflage, Copycat - new EncounterStatic {Species = 298, Relearn = new[] {293, 383}}, // Azurill: Camouflage, Copycat - new EncounterStatic {Species = 116, Relearn = new[] {13, 190}}, // Horsea: Razor Wind, Octazooka - new EncounterStatic {Species = 406, Relearn = new[] {170}}, // Budew: Mind Reader - new EncounterStatic {Species = 315, Relearn = new[] {170}}, // Roselia: Mind Reader - new EncounterStatic {Species = 396, Relearn = new[] {279, 197}}, // Starly: Revenge, Detect - new EncounterStatic {Species = 175, Relearn = new[] {375, 234, 290, 326}}, // Togepi: Psycho Shift, Morning Sun, Secret Power, Extrasensory - new EncounterStatic {Species = 577, Relearn = new[] {271, 290, 270}}, // Solosis: Trick, Secret Power, Helping Hand - new EncounterStatic {Species = 607, Relearn = new[] {257, 114, 203, 445, 471}}, // Litwick: Heat Wave, Haze, Endure, Captivate, Power Split - new EncounterStatic {Species = 543, Relearn = new[] {36}}, // Venipede: Take Down - new EncounterStatic {Species = 532, Relearn = new[] {183}}, // Timburr: Mach Punch - new EncounterStatic {Species = 574, Relearn = new[] {243, 445}}, // Gothita: Mirror Coat, Captivate - new EncounterStatic {Species = 540, Relearn = new[] {170, 293}}, // Sewaddle: Mind Reader, Camouflage - new EncounterStatic {Species = 633, Relearn = new[] {310, 414}}, // Deino: Astonish, Earth Power - }; - internal static readonly int[] Bank_Sketch7 = // Unobtainable Sketch Moves prior to Bank making moves available. - { - 367, // Acupressure - 177, // Aeroblast - 274, // Assist - 454, // Attack Order - 299, // Blaze Kick - 551, // Blue Flare - 550, // Bolt Strike - 464, // Dark Void - 455, // Defend Order - 591, // Diamond Storm - 353, // Doom Desire - 582, // Electrify - 552, // Fiery Dance - 560, // Flying Press - 559, // Fusion Bolt - 558, // Fusion Flare - 601, // Geomancy - 549, // Glaciate - 543, // Head Charge - 456, // Heal Order - 607, // Hold Hands - 593, // Hyperspace Hole - 621, // Hyperspace Fury - 617, // Light of Ruin - 461, // Lunar Dance - 295, // Luster Purge - 463, // Magma Storm - 296, // Mist Ball - 302, // Needle Arm - 613, // Oblivion Wing - 190, // Octazooka - 618, // Origin Pulse - 570, // Parabolic Charge - 600, // Powder - 619, // Precipice Blades - 354, // Psycho Boost - 375, // Psycho Shift - 540, // Psystrike - 547, // Relic Song - 459, // Roar of Time - 027, // Rolling Kick - 221, // Sacred Fire - 545, // Searing Shot - 290, // Secret Power - 548, // Secret Sword - 465, // Seed Flare - 467, // Shadow Force - 493, // Simple Beam - 460, // Spacial Rend - 592, // Steam Eruption - 541, // Tail Slap - 546, // Techno Blast - 576, // Topsy-Turvy - 567, // Trick-or-Treat - 557, // V-create - }; - - #endregion #region Unreleased Items - internal static readonly int[] UnreleasedHeldItems_7 = + internal static readonly HashSet UnreleasedHeldItems_7 = new HashSet { 005, // Safari Ball 016, // Cherish Ball diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs index 0251a6eb9..737d8d36b 100644 --- a/PKHeX.Core/PKM/PK3.cs +++ b/PKHeX.Core/PKM/PK3.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; namespace PKHeX.Core { @@ -275,7 +274,7 @@ public PK4 ConvertToPK4() // Yay for reusing string buffers! StringConverter.G4TransferTrashBytes[pk4.Language].CopyTo(pk4.Data, 0x48 + 4); pk4.Nickname = IsEgg ? PKX.GetSpeciesNameGeneration(pk4.Species, pk4.Language, pk4.Format) : Nickname; - Array.Copy(pk4.Data, 0x48, pk4.Data, 0x68, 0x10); + Buffer.BlockCopy(pk4.Data, 0x48, pk4.Data, 0x68, 0x10); pk4.OT_Name = OT_Name; // Set Final Data diff --git a/PKHeX.Core/PKM/PK4.cs b/PKHeX.Core/PKM/PK4.cs index c3d336caf..5f85b0057 100644 --- a/PKHeX.Core/PKM/PK4.cs +++ b/PKHeX.Core/PKM/PK4.cs @@ -429,7 +429,7 @@ public PK5 ConvertToPK5() BitConverter.GetBytes((uint)0).CopyTo(pk5.Data, 0x44); // Met / Crown Data Detection - pk5.Met_Location = pk5.Gen4 && pk5.FatefulEncounter && Array.IndexOf(Legal.CrownBeasts, pk5.Species) >= 0 + pk5.Met_Location = pk5.Gen4 && pk5.FatefulEncounter && Legal.CrownBeasts.Contains(pk5.Species) ? (pk5.Species == 251 ? 30010 : 30012) // Celebi : Beast : 30001; // Pokétransfer (not Crown) pk5.Egg_Location = Egg_Location;