mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
More encountertrade workarounds
probably not entirely correct, but better than flagging incorrectly
This commit is contained in:
parent
75e7965803
commit
292ea5ba44
2 changed files with 19 additions and 2 deletions
|
@ -87,6 +87,16 @@ public static class LocationsHOME
|
|||
_ => loc,
|
||||
};
|
||||
|
||||
public static int GetVersionSWSHOriginal(ushort loc) => loc switch
|
||||
{
|
||||
SWLA => (int)GameVersion.PLA,
|
||||
SWBD => (int)GameVersion.BD,
|
||||
SHSP => (int)GameVersion.SP,
|
||||
SWSL => (int)GameVersion.SL,
|
||||
SHVL => (int)GameVersion.VL,
|
||||
_ => int.MinValue,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the met location is a valid location for the input <see cref="ver"/>.
|
||||
/// </summary>
|
||||
|
|
|
@ -215,7 +215,11 @@ public abstract record EncounterTrade(GameVersion Version) : IEncounterable, IMo
|
|||
return false;
|
||||
// if (z.Ability == 4 ^ pk.AbilityNumber == 4) // defer to Ability
|
||||
// continue;
|
||||
if (!Version.Contains((GameVersion)pk.Version))
|
||||
|
||||
int version = pk.Version;
|
||||
if (Generation >= 8 && Context != EntityContext.Gen8 && pk is PK8)
|
||||
version = LocationsHOME.GetVersionSWSHOriginal((ushort)pk.Met_Location);
|
||||
if (!Version.Contains((GameVersion)version))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -235,7 +239,10 @@ public abstract record EncounterTrade(GameVersion Version) : IEncounterable, IMo
|
|||
return evo.LevelMax >= Level;
|
||||
|
||||
if (Location != pk.Met_Location)
|
||||
return false;
|
||||
{
|
||||
if (!LocationsHOME.IsMatchLocation(Context, pk.Context, pk.Met_Location, Location, LocationsHOME.GetVersionSWSHOriginal((ushort)pk.Met_Location)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pk.Format < 5)
|
||||
return evo.LevelMax >= Level;
|
||||
|
|
Loading…
Reference in a new issue