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
This commit is contained in:
Kurt 2017-12-13 16:17:02 -08:00
parent a9ff74059a
commit 9a39f818f9
3 changed files with 21 additions and 12 deletions

View file

@ -96,7 +96,7 @@ namespace PKHeX.Core
{ {
var slot = m[i]; var slot = m[i];
slot.Permissions.MagnetPullIndex = i; slot.Permissions.MagnetPullIndex = i;
slot.Permissions.MagnetPullCount = s.Count; slot.Permissions.MagnetPullCount = m.Count;
} }
} }
internal static void MarkEncountersStaticMagnetPullPermutation(IEnumerable<EncounterSlot> grp, PersonalTable t, List<EncounterSlot> permuted) internal static void MarkEncountersStaticMagnetPullPermutation(IEnumerable<EncounterSlot> grp, PersonalTable t, List<EncounterSlot> permuted)

View file

@ -281,13 +281,15 @@ namespace PKHeX.Core
foreach (var z in GetValidEncounterTrades(pkm)) foreach (var z in GetValidEncounterTrades(pkm))
yield return z; yield return z;
var deferred = new List<IEncounterable>(); var deferred = new LinkedList<IEncounterable>();
bool safariSport = pkm.Ball == 0x05 || pkm.Ball == 0x18; // never static encounters 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) if (!safariSport)
foreach (var z in GetValidStaticEncounter(pkm)) foreach (var z in GetValidStaticEncounter(pkm))
{ {
if (z.Gift && pkm.Ball != 4) if (z.Gift && pkm.Ball != 4)
deferred.Add(z); deferred.AddLast(z);
else else
yield return z; yield return z;
} }
@ -295,20 +297,27 @@ namespace PKHeX.Core
var slots = FrameFinder.GetFrames(info.PIDIV, pkm).ToList(); var slots = FrameFinder.GetFrames(info.PIDIV, pkm).ToList();
foreach (var z in GetValidWildEncounters(pkm)) 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)); var frame = slots.FirstOrDefault(s => s.IsSlotCompatibile(z, pkm));
if (frame != null || pkm.Species == 201) // Unown -- don't really care to figure this out if (frame != null || pkm.Species == 201) // Unown -- don't really care to figure this out
yield return z; yield return z;
else else
deferred.Add(z); deferred.AddFirst(z);
} }
info.FrameMatches = false; 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 // do static encounters if they were deferred to end, spit out any possible encounters for invalid pkm
if (safariSport) if (safariSport)
foreach (var z in GetValidStaticEncounter(pkm)) foreach (var z in GetValidStaticEncounter(pkm))
yield return z; yield return z;
foreach (var z in deferred)
yield return z;
} }
private static IEnumerable<IEncounterable> GenerateRawEncounters3(PKM pkm, LegalInfo info) private static IEnumerable<IEncounterable> GenerateRawEncounters3(PKM pkm, LegalInfo info)
{ {
@ -317,13 +326,13 @@ namespace PKHeX.Core
foreach (var z in GetValidEncounterTrades(pkm)) foreach (var z in GetValidEncounterTrades(pkm))
yield return z; yield return z;
var deferred = new List<IEncounterable>(); var deferred = new Queue<IEncounterable>();
bool safari = pkm.Ball == 0x05; // never static encounters bool safari = pkm.Ball == 0x05; // never static encounters
if (!safari) if (!safari)
foreach (var z in GetValidStaticEncounter(pkm)) foreach (var z in GetValidStaticEncounter(pkm))
{ {
if (z.Gift && pkm.Ball != 4) if (z.Gift && pkm.Ball != 4)
deferred.Add(z); deferred.Enqueue(z);
else else
yield return z; yield return z;
} }
@ -334,7 +343,7 @@ namespace PKHeX.Core
if (frame != null) if (frame != null)
yield return z; yield return z;
else else
deferred.Add(z); deferred.Enqueue(z);
} }
info.FrameMatches = false; info.FrameMatches = false;
@ -342,12 +351,12 @@ namespace PKHeX.Core
foreach (var z in GenerateEggs(pkm)) foreach (var z in GenerateEggs(pkm))
yield return z; 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 // do static encounters if they were deferred to end, spit out any possible encounters for invalid pkm
if (safari) if (safari)
foreach (var z in GetValidStaticEncounter(pkm)) foreach (var z in GetValidStaticEncounter(pkm))
yield return z; yield return z;
foreach (var z in deferred)
yield return z;
} }
// EncounterStatic // EncounterStatic