From 75801e22e027e369e457dbdea616afd02ff2dcae Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 26 Jul 2018 14:55:45 -0700 Subject: [PATCH] Update egg location -> encounter generating checks WasEgg only checks for EncounterEgg valid locations; check for any value instead. --- .../Generator/EncounterSlotGenerator.cs | 4 ++-- PKHeX.Core/Legality/Verifiers/CXDVerifier.cs | 2 +- .../Legality/Verifiers/EncounterTypeVerifier.cs | 2 +- PKHeX.Core/Util/Util.cs | 2 +- .../Illegal/Wild/132 - Ditto - 5CD1D273663D.pk6 | Bin 0 -> 232 bytes .../Illegal/Wild/213 - Shuckle - 55FB411103A3.pk6 | Bin 0 -> 232 bytes .../Illegal/Wild/706_-_Goodra_-_971B6773DCC2.pk7 | Bin 0 -> 232 bytes 7 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 Tests/PKHeX.Tests/Legality/Illegal/Wild/132 - Ditto - 5CD1D273663D.pk6 create mode 100644 Tests/PKHeX.Tests/Legality/Illegal/Wild/213 - Shuckle - 55FB411103A3.pk6 create mode 100644 Tests/PKHeX.Tests/Legality/Illegal/Wild/706_-_Goodra_-_971B6773DCC2.pk7 diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs index 9a193f22f..ec1df8d43 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs @@ -121,7 +121,7 @@ private static bool IsDeferred(this EncounterSlot slot, int currentSpecies, PKM public static IEnumerable GetValidFriendSafari(PKM pkm) { - if (!pkm.XY || pkm.Met_Location != 148 || pkm.Met_Level != 30) // Friend Safari + if (!pkm.XY || pkm.Met_Location != 148 || pkm.Met_Level != 30 || pkm.Egg_Location != 0) // Friend Safari return Enumerable.Empty(); var vs = EvolutionChain.GetValidPreEvolutions(pkm).Where(d => d.Level >= 30); return vs.SelectMany(z => Encounters6.FriendSafari[z.Species]); @@ -129,7 +129,7 @@ public static IEnumerable GetValidFriendSafari(PKM pkm) private static IEnumerable GetValidEncounterSlots(PKM pkm, EncounterArea loc, IEnumerable vs, bool DexNav = false, int lvl = -1, bool ignoreLevel = false) { - if (pkm.WasEgg) + if (pkm.Egg_Location != 0) return Enumerable.Empty(); if (lvl < 0) lvl = GetMinLevelEncounter(pkm); diff --git a/PKHeX.Core/Legality/Verifiers/CXDVerifier.cs b/PKHeX.Core/Legality/Verifiers/CXDVerifier.cs index 987daa1cc..e01114551 100644 --- a/PKHeX.Core/Legality/Verifiers/CXDVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/CXDVerifier.cs @@ -13,7 +13,7 @@ public override void Verify(LegalityAnalysis data) var pkm = data.pkm; if (data.EncounterMatch is EncounterStatic) VerifyCXDStarterCorrelation(data); - else if (pkm.WasEgg) // can't obtain eggs in CXD + else if (pkm.Egg_Location != 0) // can't obtain eggs in CXD data.AddLine(GetInvalid(V80, CheckIdentifier.Encounter)); // invalid encounter if (pkm.OT_Gender == 1) diff --git a/PKHeX.Core/Legality/Verifiers/EncounterTypeVerifier.cs b/PKHeX.Core/Legality/Verifiers/EncounterTypeVerifier.cs index 70d579384..3e73a0ba5 100644 --- a/PKHeX.Core/Legality/Verifiers/EncounterTypeVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/EncounterTypeVerifier.cs @@ -20,7 +20,7 @@ private static EncounterType GetEncounterTypeValue(PKM pkm, IEncounterable enc) { // Encounter type data is only stored for gen 4 encounters // All eggs have encounter type none, even if they are from static encounters - if (!pkm.Gen4 || pkm.WasEgg) + if (!pkm.Gen4 || pkm.Egg_Location != 0) return EncounterType.None; if (enc is EncounterSlot w) diff --git a/PKHeX.Core/Util/Util.cs b/PKHeX.Core/Util/Util.cs index e5f56c36d..b1ca6d8d8 100644 --- a/PKHeX.Core/Util/Util.cs +++ b/PKHeX.Core/Util/Util.cs @@ -24,7 +24,7 @@ public static uint GetHexValue(string s) } private static bool IsHex(char c) => (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); - private static string TitleCase(string word) => word[0].ToString().ToUpper() + word.Substring(1, word.Length - 1).ToLower(); + private static string TitleCase(string word) => char.ToUpper(word[0]) + word.Substring(1, word.Length - 1).ToLower(); /// /// Filters the string down to only valid hex characters, returning a new string. diff --git a/Tests/PKHeX.Tests/Legality/Illegal/Wild/132 - Ditto - 5CD1D273663D.pk6 b/Tests/PKHeX.Tests/Legality/Illegal/Wild/132 - Ditto - 5CD1D273663D.pk6 new file mode 100644 index 0000000000000000000000000000000000000000..100674a3f4b4420164adf9497e435ca568e9ad04 GIT binary patch literal 232 zcmcCbE55|Qa51KZfq_9N_Ue3rLI#FuEDQ|iy<9#pvv2}M@dFozOokF5%*RkR0V=|U zA>$bS%RZbTm7$m+2S`?;%QNa5su&^!-53~I_!wX=aRlqBKuE(`z6>mUEexDO>{7fu UEDT``Qy7@!7$gl<7@0sy0P-9aHUIzs literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Tests/Legality/Illegal/Wild/213 - Shuckle - 55FB411103A3.pk6 b/Tests/PKHeX.Tests/Legality/Illegal/Wild/213 - Shuckle - 55FB411103A3.pk6 new file mode 100644 index 0000000000000000000000000000000000000000..bda15c1d93693fcf13b92ba1b1017949a6b0da47 GIT binary patch literal 232 zcmZ3?Ea=F<@H_M>0|SHX#K`^-Q3eK9Mh1q(KyeNrO$Y=tWH6L6Br{|)tw a48m}O^M%-@fNaB377+%1Lw!ajkOTnCl@p8r literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Tests/Legality/Illegal/Wild/706_-_Goodra_-_971B6773DCC2.pk7 b/Tests/PKHeX.Tests/Legality/Illegal/Wild/706_-_Goodra_-_971B6773DCC2.pk7 new file mode 100644 index 0000000000000000000000000000000000000000..154904c6d3e8c48ea44a952f2d717029f5e9618e GIT binary patch literal 232 zcmX?fr#PK~L3;WjrUs^UFYIkE2njR9GKI4GZ{9A!!@$7shv5$kkirSv8S;TJg`tQc z5lu}f!yX1xhG~ov0ulnuK!A{z|MTA-!6S_o#83&eDG!S#Wr&y%yA%*HIL?V;U=e0e LFcf5D0!aV>Vt^LT literal 0 HcmV?d00001