From 74f185591a1fd0af4793bf3222ea9daaa2def6d5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 28 Jan 2018 23:40:57 -0800 Subject: [PATCH] Fix shiny/nonshiny egg mysterygift link trade checks thanks @Admiral-Fish for finding this case --- PKHeX.Core/Legality/Checks.cs | 2 +- .../Legality/Encounters/EncounterGenerator.cs | 27 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index c46879a21..8207d8773 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -2314,7 +2314,7 @@ private void VerifyFatefulMysteryGift(MysteryGift g) if (g is PGF p && p.IsShiny) { Info.PIDIV = MethodFinder.Analyze(pkm); - if (Info.PIDIV.Type != PIDType.G5MGShiny) + if (Info.PIDIV.Type != PIDType.G5MGShiny && pkm.Egg_Location != 30003) AddLine(Severity.Invalid, V411, CheckIdentifier.PID); } diff --git a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs index 47f0e212e..9a18054af 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs @@ -1316,8 +1316,13 @@ private static bool GetIsMatchPGF(PKM pkm, PGF wc, IEnumerable vs) } else { - if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30003) // traded - return false; + if (wc.EggLocation != pkm.Egg_Location) // traded + { + if (pkm.Egg_Location != 30003) + return false; + } + else if (wc.PIDType == 0 && pkm.IsShiny) + return false; // can't be traded away for unshiny if (pkm.IsEgg && !pkm.IsNative) return false; } @@ -1357,8 +1362,13 @@ private static bool GetIsMatchWC6(PKM pkm, WC6 wc, IEnumerable vs) if (wc.IsEgg) { - if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30002) // traded - return false; + if (wc.EggLocation != pkm.Egg_Location) // traded + { + if (pkm.Egg_Location != 30002) + return false; + } + else if (wc.PIDType == 0 && pkm.IsShiny) + return false; // can't be traded away for unshiny if (pkm.IsEgg && !pkm.IsNative) return false; } @@ -1410,8 +1420,13 @@ private static bool GetIsMatchWC7(PKM pkm, WC7 wc, IEnumerable vs) if (wc.IsEgg) { - if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30002) // traded - return false; + if (wc.EggLocation != pkm.Egg_Location) // traded + { + if (pkm.Egg_Location != 30002) + return false; + } + else if (wc.PIDType == 0 && pkm.IsShiny) + return false; // can't be traded away for unshiny if (pkm.IsEgg && !pkm.IsNative) return false; }