From 9fa2c135c6682a55185fd3e7fbed890eb770bced Mon Sep 17 00:00:00 2001 From: javierhimura Date: Sat, 15 Apr 2017 00:10:19 +0200 Subject: [PATCH] Fix Bug Contest Butterfree error reported in issue #1011 There is in the national park a butterfree encounter as a normal wild pokemon and another with the same levels in the bug contest, that means even in format 4 it could be more than one type encounters in the list, it should be filtered --- PKHeX/Legality/Core.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 5dce207ca..e8bf12b68 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -1148,10 +1148,10 @@ internal static EncounterSlot[] getValidWildEncounters(PKM pkm, GameVersion game foreach (var area in getEncounterAreas(pkm, gameSource)) s.AddRange(getValidEncounterSlots(pkm, area, DexNav: pkm.AO, gameSource: gameSource)); - if (s.Count <= 1 || 3 > pkm.GenNumber || pkm.GenNumber > 4 || pkm.HasOriginalMetLocation) + if (s.Count <= 1 || 3 > pkm.GenNumber || pkm.GenNumber > 4 || (pkm.Gen3 && pkm.HasOriginalMetLocation)) return s.Any() ? s.ToArray() : null; - // If has original met location or there is only one possible slot does not check safari zone nor BCC + // If has original met location or there is only one possible slot does not check safari zone // defer to ball legality var IsSafariBall = pkm.Ball == 5; var s_Safari = IsSafariBall @@ -1164,6 +1164,8 @@ internal static EncounterSlot[] getValidWildEncounters(PKM pkm, GameVersion game if (s.Count <= 1 || pkm.GenNumber != 4) return s.Any() ? s.ToArray() : null; + // BCC should be checked even if the pokemon have original met location, there are encounters of the same species + // in the national park as both normal wild encounters and contest encounters var IsSportsBall = pkm.Ball == 0x18; var s_BugContest = IsSportsBall ? s.Where(slot => slot.Type == SlotType.BugContest).ToList()