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];
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)

View file

@ -281,13 +281,15 @@ namespace PKHeX.Core
foreach (var z in GetValidEncounterTrades(pkm))
yield return z;
var deferred = new List<IEncounterable>();
bool safariSport = pkm.Ball == 0x05 || pkm.Ball == 0x18; // never static encounters
var deferred = new LinkedList<IEncounterable>();
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 @@ namespace PKHeX.Core
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<IEncounterable> GenerateRawEncounters3(PKM pkm, LegalInfo info)
{
@ -317,13 +326,13 @@ namespace PKHeX.Core
foreach (var z in GetValidEncounterTrades(pkm))
yield return z;
var deferred = new List<IEncounterable>();
var deferred = new Queue<IEncounterable>();
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 @@ namespace PKHeX.Core
if (frame != null)
yield return z;
else
deferred.Add(z);
deferred.Enqueue(z);
}
info.FrameMatches = false;
@ -342,12 +351,12 @@ namespace PKHeX.Core
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