Add missing filter overrides

Were using default filter behavior, which needs to be tweaked to account
for the original met location/level not being present (ie skip the
minLevel bounds check).

Hardcode logic for HasOriginalMetLocation for simplicity

Closes #2389 , thanks @Ammako !
This commit is contained in:
Kurt 2019-09-19 16:19:07 -07:00
parent b41f2a3062
commit 7e70d83664
5 changed files with 27 additions and 0 deletions

View file

@ -124,5 +124,14 @@ namespace PKHeX.Core
{
return entries.Select(GetArea3).Where(Area => Area.Slots.Length != 0).ToArray();
}
protected override IEnumerable<EncounterSlot> GetMatchFromEvoLevel(PKM pkm, IEnumerable<DexLevel> vs, int minLevel)
{
var slots = Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= slot.LevelMin));
if (pkm.Format != 3) // transferred to Gen4+
return slots.Where(slot => slot.LevelMin <= minLevel);
return slots.Where(s => s.IsLevelWithinRange(minLevel));
}
}
}

View file

@ -58,5 +58,14 @@ namespace PKHeX.Core
{
EncounterUtil.MarkEncountersStaticMagnetPullPermutation(grp, PersonalTable.HGSS, trackPermute);
}
protected override IEnumerable<EncounterSlot> GetMatchFromEvoLevel(PKM pkm, IEnumerable<DexLevel> vs, int minLevel)
{
var slots = Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= slot.LevelMin));
if (pkm.Format != 4) // transferred to Gen5+
return slots.Where(slot => slot.LevelMin <= minLevel);
return slots.Where(s => s.IsLevelWithinRange(minLevel));
}
}
}

View file

@ -128,5 +128,14 @@ namespace PKHeX.Core
return slots;
}
}
protected override IEnumerable<EncounterSlot> GetMatchFromEvoLevel(PKM pkm, IEnumerable<DexLevel> vs, int minLevel)
{
var slots = Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= slot.LevelMin));
if (pkm.Format >= 7 || !(pkm is PK2 pk2 && pk2.CaughtData != 0)) // transferred to Gen7+, or does not have Crystal met data
return slots.Where(slot => slot.LevelMin <= minLevel);
return slots.Where(s => s.IsLevelWithinRange(minLevel));
}
}
}