From 9a39f818f9544e58b98ff3e41396eb033bd72693 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 13 Dec 2017 16:17:02 -0800 Subject: [PATCH] Misc fixes #1700 dp personal: add wormadam/deoxys manual forme count values generator: bcc handling for pkm present in & out of bcc, and static/wild duplicates util: fix incorrect variable reference --- .../Legality/Encounters/Data/EncounterUtil.cs | 2 +- .../Legality/Encounters/EncounterGenerator.cs | 31 +++++++++++------- PKHeX.Core/Resources/byte/personal_dp | Bin 22044 -> 22044 bytes 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs b/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs index 5279c5444..d8f14ddab 100644 --- a/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs +++ b/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs @@ -96,7 +96,7 @@ internal static void MarkEncountersStaticMagnetPull(IEnumerable g { var slot = m[i]; slot.Permissions.MagnetPullIndex = i; - slot.Permissions.MagnetPullCount = s.Count; + slot.Permissions.MagnetPullCount = m.Count; } } internal static void MarkEncountersStaticMagnetPullPermutation(IEnumerable grp, PersonalTable t, List permuted) diff --git a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs index ee295bf18..ef77da790 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs @@ -281,13 +281,15 @@ private static IEnumerable GenerateRawEncounters4(PKM pkm, Legal foreach (var z in GetValidEncounterTrades(pkm)) yield return z; - var deferred = new List(); - bool safariSport = pkm.Ball == 0x05 || pkm.Ball == 0x18; // never static encounters + var deferred = new LinkedList(); + bool sport = pkm.Ball == 0x18; // never static encounters (conflict with non bcc / bcc) + bool safari = pkm.Ball == 0x05; // never static encounters + bool safariSport = safari || sport; if (!safariSport) foreach (var z in GetValidStaticEncounter(pkm)) { if (z.Gift && pkm.Ball != 4) - deferred.Add(z); + deferred.AddLast(z); else yield return z; } @@ -295,20 +297,27 @@ private static IEnumerable GenerateRawEncounters4(PKM pkm, Legal var slots = FrameFinder.GetFrames(info.PIDIV, pkm).ToList(); foreach (var z in GetValidWildEncounters(pkm)) { + if (sport != z.Type.HasFlag(SlotType.BugContest)) + { + deferred.AddLast(z); + continue; + } + var frame = slots.FirstOrDefault(s => s.IsSlotCompatibile(z, pkm)); if (frame != null || pkm.Species == 201) // Unown -- don't really care to figure this out yield return z; else - deferred.Add(z); + deferred.AddFirst(z); } info.FrameMatches = false; + foreach (var z in deferred) + yield return z; + // do static encounters if they were deferred to end, spit out any possible encounters for invalid pkm if (safariSport) foreach (var z in GetValidStaticEncounter(pkm)) yield return z; - foreach (var z in deferred) - yield return z; } private static IEnumerable GenerateRawEncounters3(PKM pkm, LegalInfo info) { @@ -317,13 +326,13 @@ private static IEnumerable GenerateRawEncounters3(PKM pkm, Legal foreach (var z in GetValidEncounterTrades(pkm)) yield return z; - var deferred = new List(); + var deferred = new Queue(); bool safari = pkm.Ball == 0x05; // never static encounters if (!safari) foreach (var z in GetValidStaticEncounter(pkm)) { if (z.Gift && pkm.Ball != 4) - deferred.Add(z); + deferred.Enqueue(z); else yield return z; } @@ -334,7 +343,7 @@ private static IEnumerable GenerateRawEncounters3(PKM pkm, Legal if (frame != null) yield return z; else - deferred.Add(z); + deferred.Enqueue(z); } info.FrameMatches = false; @@ -342,12 +351,12 @@ private static IEnumerable GenerateRawEncounters3(PKM pkm, Legal foreach (var z in GenerateEggs(pkm)) yield return z; + foreach (var z in deferred) + yield return z; // do static encounters if they were deferred to end, spit out any possible encounters for invalid pkm if (safari) foreach (var z in GetValidStaticEncounter(pkm)) yield return z; - foreach (var z in deferred) - yield return z; } // EncounterStatic diff --git a/PKHeX.Core/Resources/byte/personal_dp b/PKHeX.Core/Resources/byte/personal_dp index 4962a7a18a59c9108729c7e95124f9ded64a7c4f..bbc6f343d41e107f6132dc9f35a99b5c0e7da08e 100644 GIT binary patch delta 37 ncmbQUhH=gs#toUFj4YG0LbZY9G%$GxNHR};7pl$7%)kHu@b?QA delta 37 lcmbQUhH=gs#toUFj0}^rLbZY9G%$GxOuh@%W@cbu008gT3j_cF