diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs index f8b01dd58..7b0c55e28 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs @@ -305,7 +305,7 @@ private static bool IsValidCatchRatePK1(EncounterStatic e, PK1 pk1) // Amnesia Psyduck has different catch rates depending on language if (e.Species == 054) return catch_rate == (pk1.Japanese ? 167 : 168); - return Stadium_CatchRate.Contains(catch_rate); + return GBRestrictions.Stadium_CatchRate.Contains(catch_rate); } // Encounters can have different Catch Rates (RBG vs Y) diff --git a/PKHeX.Core/Legality/GBRestrictions.cs b/PKHeX.Core/Legality/GBRestrictions.cs index e0e28486e..4e13fc560 100644 --- a/PKHeX.Core/Legality/GBRestrictions.cs +++ b/PKHeX.Core/Legality/GBRestrictions.cs @@ -9,6 +9,54 @@ namespace PKHeX { internal static class GBRestrictions { + internal static readonly int[] G1CaterpieMoves = { 33, 81 }; + internal static readonly int[] G1WeedleMoves = { 40, 81 }; + internal static readonly int[] G1MetapodMoves = G1CaterpieMoves.Concat(new[] { 106 }).ToArray(); + internal static readonly int[] G1KakunaMoves = G1WeedleMoves.Concat(new[] { 106 }).ToArray(); + internal static readonly int[] G1Exeggcute_IncompatibleMoves = { 78, 77, 79 }; + + internal static readonly int[] Stadium_CatchRate = + { + 167, // Normal Box + 168, // Gorgeous Box + }; + + internal static readonly HashSet Stadium_GiftSpecies = new HashSet + { + 001, // Bulbasaur + 004, // Charmander + 007, // Squirtle + 054, // Psyduck (Amnesia) + 106, // Hitmonlee + 107, // Hitmonchan + 133, // Eevee + 138, // Omanyte + 140, // Kabuto + }; + + 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 HashSet Types_Gen1 = new HashSet + { + 0, 1, 2, 3, 4, 5, 7, 8, 20, 21, 22, 23, 24, 25, 26 + }; + + internal static readonly HashSet Species_NotAvailable_CatchRate = new HashSet + { + 12, 18, 31, 34, 38, 45, 53, 59, 62, 65, 68, 71, 78, 91, 103, 121 + }; + + internal static readonly HashSet Trade_Evolution1 = new HashSet + { + 064, + 067, + 075, + 093 + }; + private static int[] GetMinLevelLearnMoveG1(int species, List moves) { var r = new int[moves.Count]; diff --git a/PKHeX.Core/Legality/Tables1.cs b/PKHeX.Core/Legality/Tables1.cs index 895952ab2..f08ad502a 100644 --- a/PKHeX.Core/Legality/Tables1.cs +++ b/PKHeX.Core/Legality/Tables1.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; namespace PKHeX.Core { @@ -56,12 +55,6 @@ public static partial class Legal 015, 019, 057, 070, 148 }; - internal static readonly int[] G1CaterpieMoves = { 33, 81 }; - internal static readonly int[] G1WeedleMoves = { 40, 81 }; - internal static readonly int[] G1MetapodMoves = G1CaterpieMoves.Concat(new[] { 106 }).ToArray(); - internal static readonly int[] G1KakunaMoves = G1WeedleMoves.Concat(new[] { 106 }).ToArray(); - internal static readonly int[] G1Exeggcute_IncompatibleMoves = { 78, 77, 79 }; - internal static readonly int[] WildPokeBalls1 = {4}; internal static readonly HashSet FutureEvolutionsGen1 = new HashSet @@ -74,47 +67,5 @@ public static partial class Legal // Crobat Espeon Umbreon Blissey 169,196,197,242 }; - - 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 HashSet Types_Gen1 = new HashSet - { - 0, 1, 2, 3, 4, 5, 7, 8, 20, 21, 22, 23, 24, 25, 26 - }; - - internal static readonly HashSet Species_NotAvailable_CatchRate = new HashSet - { - 12, 18, 31, 34, 38, 45, 53, 59, 62, 65, 68, 71, 78, 91, 103, 121 - }; - - internal static readonly int[] Stadium_CatchRate = - { - 167, // Normal Box - 168, // Gorgeous Box - }; - - internal static readonly HashSet Stadium_GiftSpecies = new HashSet - { - 001, // Bulbasaur - 004, // Charmander - 007, // Squirtle - 054, // Psyduck (Amnesia) - 106, // Hitmonlee - 107, // Hitmonchan - 133, // Eevee - 138, // Omanyte - 140, // Kabuto - }; - - internal static readonly HashSet Trade_Evolution1 = new HashSet - { - 064, - 067, - 075, - 093 - }; } } diff --git a/PKHeX.Core/Legality/Tables2.cs b/PKHeX.Core/Legality/Tables2.cs index c2501c10c..5fbec5788 100644 --- a/PKHeX.Core/Legality/Tables2.cs +++ b/PKHeX.Core/Legality/Tables2.cs @@ -65,12 +65,7 @@ public static partial class Legal 424,429,430,461,462,463,464,465,466,467,468,469,470,471,472,473,474,700 }; - internal static readonly int[] UnreleasedItems_2 = - { - // 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 bool[] ReleasedHeldItems_2 = Enumerable.Range(0, MaxItemID_2+1).Select(i => HeldItems_GSC.Contains((ushort)i)).ToArray(); internal static readonly HashSet TransferSpeciesDefaultAbility_2 = new HashSet { diff --git a/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs b/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs index 51b48f8ae..686d903a6 100644 --- a/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs @@ -81,7 +81,7 @@ public void VerifyG1(LegalityAnalysis data) // There is no way to prevent a gen1 trade evolution as held items (everstone) did not exist. // Machoke, Graveler, Haunter and Kadabra captured in the second phase evolution, excluding in-game trades, are already checked - if (pkm.Format <= 2 && !(EncounterMatch is EncounterTrade) && EncounterMatch.Species == pkm.Species && Legal.Trade_Evolution1.Contains(EncounterMatch.Species)) + if (pkm.Format <= 2 && !(EncounterMatch is EncounterTrade) && EncounterMatch.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(EncounterMatch.Species)) VerifyG1TradeEvo(data); } diff --git a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs index 1dc92dfff..e92a8b780 100644 --- a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs @@ -64,11 +64,11 @@ private void VerifyMiscG1Types(LegalityAnalysis data, PK1 pk1) if (pk1.Species == 137) // Porygon { // Can have any type combination of any species by using Conversion. - if (!Legal.Types_Gen1.Contains(Type_A)) + if (!GBRestrictions.Types_Gen1.Contains(Type_A)) { data.AddLine(GetInvalid(LG1TypePorygonFail1)); } - else if (!Legal.Types_Gen1.Contains(Type_B)) + else if (!GBRestrictions.Types_Gen1.Contains(Type_B)) { data.AddLine(GetInvalid(LG1TypePorygonFail2)); } @@ -114,7 +114,7 @@ CheckResult GetWasNotTradeback() { if ((e as EncounterStatic)?.Version == GameVersion.Stadium || e is EncounterTradeCatchRate) return GetValid(LG1CatchRateMatchPrevious); // Encounters detected by the catch rate, cant be invalid if match this encounters - if ((pk1.Species == 149 && catch_rate == PersonalTable.Y[149].CatchRate) || (Legal.Species_NotAvailable_CatchRate.Contains(pk1.Species) && catch_rate == PersonalTable.RB[pk1.Species].CatchRate)) + if ((pk1.Species == 149 && catch_rate == PersonalTable.Y[149].CatchRate) || (GBRestrictions.Species_NotAvailable_CatchRate.Contains(pk1.Species) && catch_rate == PersonalTable.RB[pk1.Species].CatchRate)) return GetInvalid(LG1CatchRateEvo); if (!data.Info.EvoChainsAllGens[1].Any(c => RateMatchesEncounter(c.Species))) return GetInvalid(pk1.Gen1_NotTradeback ? LG1CatchRateChain : LG1CatchRateNone);