More gb restriction relocations

This commit is contained in:
Kurt
2018-10-10 16:32:02 -07:00
parent 2db8daa07b
commit e8552affca
6 changed files with 54 additions and 60 deletions

View File

@@ -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)

View File

@@ -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<int> Stadium_GiftSpecies = new HashSet<int>
{
001, // Bulbasaur
004, // Charmander
007, // Squirtle
054, // Psyduck (Amnesia)
106, // Hitmonlee
107, // Hitmonchan
133, // Eevee
138, // Omanyte
140, // Kabuto
};
internal static readonly HashSet<int> SpecialMinMoveSlots = new HashSet<int>
{
25, 26, 29, 30, 31, 32, 33, 34, 36, 38, 40, 59, 91, 103, 114, 121,
};
internal static readonly HashSet<int> Types_Gen1 = new HashSet<int>
{
0, 1, 2, 3, 4, 5, 7, 8, 20, 21, 22, 23, 24, 25, 26
};
internal static readonly HashSet<int> Species_NotAvailable_CatchRate = new HashSet<int>
{
12, 18, 31, 34, 38, 45, 53, 59, 62, 65, 68, 71, 78, 91, 103, 121
};
internal static readonly HashSet<int> Trade_Evolution1 = new HashSet<int>
{
064,
067,
075,
093
};
private static int[] GetMinLevelLearnMoveG1(int species, List<int> moves)
{
var r = new int[moves.Count];

View File

@@ -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<int> FutureEvolutionsGen1 = new HashSet<int>
@@ -74,47 +67,5 @@ public static partial class Legal
// Crobat Espeon Umbreon Blissey
169,196,197,242
};
internal static readonly HashSet<int> SpecialMinMoveSlots = new HashSet<int>
{
25, 26, 29, 30, 31, 32, 33, 34, 36, 38, 40, 59, 91, 103, 114, 121,
};
internal static readonly HashSet<int> Types_Gen1 = new HashSet<int>
{
0, 1, 2, 3, 4, 5, 7, 8, 20, 21, 22, 23, 24, 25, 26
};
internal static readonly HashSet<int> Species_NotAvailable_CatchRate = new HashSet<int>
{
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<int> Stadium_GiftSpecies = new HashSet<int>
{
001, // Bulbasaur
004, // Charmander
007, // Squirtle
054, // Psyduck (Amnesia)
106, // Hitmonlee
107, // Hitmonchan
133, // Eevee
138, // Omanyte
140, // Kabuto
};
internal static readonly HashSet<int> Trade_Evolution1 = new HashSet<int>
{
064,
067,
075,
093
};
}
}

View File

@@ -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<int> TransferSpeciesDefaultAbility_2 = new HashSet<int>
{

View File

@@ -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);
}

View File

@@ -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);