mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 00:48:49 -05:00
Tweak encounter detect
DexNav only under the correct conditions (dexnav may not have an eggmove for some level boosted ones), fix for dynamic range
This commit is contained in:
@@ -95,10 +95,7 @@ private static EncounterArea[] getDexNavSlots(EncounterArea[] GameSlots, int sma
|
||||
|
||||
internal static bool getDexNavValid(PK6 pk6)
|
||||
{
|
||||
bool alpha = pk6.Version == 26;
|
||||
if (!alpha && pk6.Version != 27)
|
||||
return false;
|
||||
IEnumerable<EncounterArea> locs = (alpha ? DexNavA : DexNavO).Where(l => l.Location == pk6.Met_Location);
|
||||
IEnumerable<EncounterArea> locs = getDexNavAreas(pk6);
|
||||
return locs.Select(loc => getValidEncounterSlots(pk6, loc, DexNav: true)).Any(slots => slots.Any());
|
||||
}
|
||||
internal static IEnumerable<int> getValidMoves(PK6 pk6)
|
||||
@@ -177,8 +174,13 @@ internal static IEnumerable<WC6> getValidWC6s(PK6 pk6)
|
||||
internal static bool getWildEncounterValid(PK6 pk6)
|
||||
{
|
||||
var areas = getEncounterAreas(pk6);
|
||||
bool dexNav = pk6.RelearnMove1 != 0;
|
||||
return areas.Any(a => getValidEncounterSlots(pk6, a, dexNav).Any());
|
||||
bool slots = areas.Any(a => getValidEncounterSlots(pk6, a, DexNav: false).Any());
|
||||
if (slots) return true;
|
||||
|
||||
// Try DexNav -- quickly returns if not AO
|
||||
areas = getDexNavAreas(pk6);
|
||||
slots = areas.Any(a => getValidEncounterSlots(pk6, a, DexNav: true).Any());
|
||||
return slots;
|
||||
}
|
||||
internal static bool getHasEvolved(PK6 pk6)
|
||||
{
|
||||
@@ -270,6 +272,13 @@ internal static EncounterTrade getIngameTrade(PK6 pk6)
|
||||
return null;
|
||||
}
|
||||
|
||||
private static IEnumerable<EncounterArea> getDexNavAreas(PK6 pk6)
|
||||
{
|
||||
bool alpha = pk6.Version == 26;
|
||||
if (!alpha && pk6.Version != 27)
|
||||
return new EncounterArea[0];
|
||||
return (alpha ? DexNavA : DexNavO).Where(l => l.Location == pk6.Met_Location);
|
||||
}
|
||||
private static int getBaseSpecies(PK6 pk6, int skipOption = 0)
|
||||
{
|
||||
if (pk6.Species == 292)
|
||||
@@ -330,9 +339,10 @@ private static IEnumerable<EncounterSlot> getValidEncounterSlots(PK6 pk6, Encoun
|
||||
IEnumerable<EncounterSlot> slots = loc.Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= slot.LevelMin));
|
||||
|
||||
// Filter for Met Level
|
||||
int lvl = pk6.Met_Level;
|
||||
slots = DexNav
|
||||
? slots.Where(slot => slot.LevelMin <= pk6.Met_Level && pk6.Met_Level <= slot.LevelMax + 13) // DexNav Boost Range ??
|
||||
: slots.Where(slot => slot.LevelMin == pk6.Met_Level); // Non-boosted Level
|
||||
? slots.Where(slot => slot.LevelMin <= lvl && lvl <= slot.LevelMax + 13) // DexNav Boost Range ??
|
||||
: slots.Where(slot => slot.LevelMin <= lvl && lvl <= slot.LevelMax); // Non-boosted Level
|
||||
|
||||
// Filter for Form Specific
|
||||
if (WildForms.Contains(pk6.Species))
|
||||
|
||||
Reference in New Issue
Block a user