mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
Have separate encounter yielder for gen8
the "Strong" static encounters can be near-matches with wild encounter slots; example is a evolved Cutiefly->Ribombee with Quiver Dance. Remove unnecessary IsLink/FriendSafari check for this gen8 method https://github.com/kwsch/PKHeX/issues/2573#issuecomment-569126371
This commit is contained in:
parent
420307d4bf
commit
4740fab5ec
1 changed files with 31 additions and 0 deletions
|
@ -34,6 +34,7 @@ namespace PKHeX.Core
|
|||
case 2: return GetEncounters12(pkm, info);
|
||||
case 3: return GetEncounters3(pkm, info);
|
||||
case 4: return GetEncounters4(pkm, info);
|
||||
case 8: return GenerateRawEncounters8(pkm);
|
||||
default: return GenerateRawEncounters(pkm);
|
||||
}
|
||||
}
|
||||
|
@ -335,6 +336,36 @@ namespace PKHeX.Core
|
|||
{ yield return z; ++ctr; }
|
||||
}
|
||||
|
||||
private static IEnumerable<IEncounterable> GenerateRawEncounters8(PKM pkm)
|
||||
{
|
||||
// Static Encounters can collide with wild encounters (close match); don't break if a Static Encounter is yielded.
|
||||
int ctr = 0;
|
||||
|
||||
if (pkm.WasEvent || pkm.WasEventEgg)
|
||||
{
|
||||
foreach (var z in GetValidGifts(pkm))
|
||||
{ yield return z; ++ctr; }
|
||||
if (ctr != 0) yield break;
|
||||
}
|
||||
|
||||
if (pkm.WasBredEgg)
|
||||
{
|
||||
foreach (var z in GenerateEggs(pkm))
|
||||
{ yield return z; ++ctr; }
|
||||
if (ctr == 0) yield break;
|
||||
}
|
||||
|
||||
foreach (var z in GetValidStaticEncounter(pkm))
|
||||
{ yield return z; ++ctr; }
|
||||
// if (ctr != 0) yield break;
|
||||
foreach (var z in GetValidWildEncounters(pkm))
|
||||
{ yield return z; ++ctr; }
|
||||
|
||||
if (ctr != 0) yield break;
|
||||
foreach (var z in GetValidEncounterTrades(pkm))
|
||||
{ yield return z; ++ctr; }
|
||||
}
|
||||
|
||||
private static IEnumerable<IEncounterable> GenerateRawEncounters4(PKM pkm, LegalInfo info)
|
||||
{
|
||||
bool wasEvent = pkm.WasEvent || pkm.WasEventEgg; // egg events?
|
||||
|
|
Loading…
Reference in a new issue