mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add GameVersion compare method
Recognize game grouping in encounter tables (DP as D or P, for example) Also for future use.
This commit is contained in:
parent
6a0d824b31
commit
1edde07418
2 changed files with 48 additions and 1 deletions
|
@ -42,4 +42,51 @@
|
|||
Gen1, Gen2, Gen3, Gen4, Gen5, Gen6, Gen7,
|
||||
SPECIAL, // Stadium
|
||||
}
|
||||
|
||||
public static class Extension
|
||||
{
|
||||
public static bool Contains(this GameVersion g1, GameVersion g2)
|
||||
{
|
||||
if (g1 == g2 || g1 == GameVersion.Any) return true;
|
||||
|
||||
switch (g1)
|
||||
{
|
||||
case GameVersion.RBY:
|
||||
case GameVersion.Gen1:
|
||||
return (g2 == GameVersion.RD || g2 == GameVersion.BU || g2 == GameVersion.YW || g2 == GameVersion.GN);
|
||||
|
||||
case GameVersion.GS: return (g2 == GameVersion.GD || g2 == GameVersion.SV);
|
||||
case GameVersion.GSC:
|
||||
case GameVersion.Gen2:
|
||||
return (GameVersion.GS.Contains(g2) || g2 == GameVersion.C);
|
||||
|
||||
case GameVersion.RS: return (g2 == GameVersion.R || g2 == GameVersion.S);
|
||||
case GameVersion.FRLG: return (g2 == GameVersion.FR || g2 == GameVersion.LG);
|
||||
case GameVersion.CXD: return (g2 == GameVersion.COLO || g2 == GameVersion.XD);
|
||||
case GameVersion.Gen3:
|
||||
return (GameVersion.RS.Contains(g2) || g2 == GameVersion.E || GameVersion.FRLG.Contains(g2) || GameVersion.CXD.Contains(g2));
|
||||
|
||||
case GameVersion.DP: return (g2 == GameVersion.D || g2 == GameVersion.P);
|
||||
case GameVersion.HGSS: return (g2 == GameVersion.HG || g2 == GameVersion.SS);
|
||||
case GameVersion.Gen4:
|
||||
return (GameVersion.DP.Contains(g2) || g2 == GameVersion.Pt || GameVersion.HGSS.Contains(g2));
|
||||
|
||||
case GameVersion.BW: return (g2 == GameVersion.B || g2 == GameVersion.W);
|
||||
case GameVersion.B2W2: return (g2 == GameVersion.B2 || g2 == GameVersion.W2);
|
||||
case GameVersion.Gen5:
|
||||
return (GameVersion.BW.Contains(g2) || GameVersion.B2W2.Contains(g2));
|
||||
|
||||
case GameVersion.XY: return (g2 == GameVersion.X || g2 == GameVersion.Y);
|
||||
case GameVersion.ORAS: return (g2 == GameVersion.OR || g2 == GameVersion.AS);
|
||||
case GameVersion.Gen6:
|
||||
return (GameVersion.XY.Contains(g2) || GameVersion.ORAS.Contains(g2));
|
||||
|
||||
case GameVersion.SM:
|
||||
case GameVersion.Gen7:
|
||||
return (g2 == GameVersion.SN || g2 == GameVersion.MN);
|
||||
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace PKHeX.Core
|
|||
|
||||
default: return null;
|
||||
}
|
||||
return table?.Where(s => s.Version == GameVersion.Any || s.Version == Game).ToArray();
|
||||
return table?.Where(s => s.Version.Contains(Game)).ToArray();
|
||||
}
|
||||
private static EncounterArea[] getEncounterTables(GameVersion Game)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue