From 8136d33c15e05a7bdef339f7f4145dc2e2a0e5e7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 20 Feb 2017 21:19:25 -0800 Subject: [PATCH] Add zygarde forme change->core ability in gen7 Closes #868 --- PKHeX/Legality/Core.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 845f2bcfc..506e7dac0 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -302,7 +302,7 @@ internal static EncounterStatic getValidStaticEncounter(PKM pkm, bool gen1Encoun continue; if (e.Gender != -1 && e.Gender != pkm.Gender) continue; - if (e.Form != pkm.AltForm && !FormChange.Contains(pkm.Species) && !e.SkipFormCheck) + if (e.Form != pkm.AltForm && !e.SkipFormCheck && !getCanFormChange(pkm, e.Species)) continue; // Defer to EC/PID check @@ -450,7 +450,7 @@ private static IEnumerable getMatchingWC6(PKM pkm, IEnumerable !FormChange.Contains(dl.Species)) && !getHasEvolvedFormChange(pkm)) continue; + if (wc.Form != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue; if (wc.MetLocation != pkm.Met_Location) continue; if (wc.EggLocation != pkm.Egg_Location) continue; if (wc.Level != pkm.Met_Level) continue; @@ -498,7 +498,7 @@ private static IEnumerable getMatchingWC7(PKM pkm, IEnumerable !FormChange.Contains(dl.Species)) && getHasEvolvedFormChange(pkm)) continue; + if (wc.Form != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue; if (wc.MetLocation != pkm.Met_Location) continue; if (wc.EggLocation != pkm.Egg_Location) continue; if (wc.MetLevel != pkm.Met_Level) continue; @@ -647,6 +647,16 @@ internal static bool getEvolutionValid(PKM pkm) return curr.Count() >= poss.Count() - 1; return curr.Count() >= poss.Count(); } + internal static bool getCanFormChange(PKM pkm, int species) + { + if (FormChange.Contains(species)) + return true; + if (getHasEvolvedFormChange(pkm)) + return true; + if (pkm.Species == 718 && pkm.InhabitedGeneration(7) && pkm.AltForm > 1) + return true; + return false; + } internal static EncounterArea getCaptureLocation(PKM pkm) {