mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
Finish fix for gameversion passing
This commit is contained in:
parent
4c477de985
commit
db8d5cb5e0
2 changed files with 23 additions and 23 deletions
|
@ -944,11 +944,11 @@ namespace PKHeX
|
|||
if (!Legal.getCanLearnMachineMove(new PK6 {Species = t, EXP = PKX.getEXP(100, t)}, 19))
|
||||
return new CheckResult(Severity.Invalid, resultPrefix + "Memory: Argument Species cannot learn Fly.", CheckIdentifier.Memory);
|
||||
}
|
||||
if ((m == 16 || m == 48) && (t == 0 || !Legal.getCanKnowMove(pkm, t, 1)))
|
||||
if ((m == 16 || m == 48) && (t == 0 || !Legal.getCanKnowMove(pkm, t, GameVersion.Any)))
|
||||
{
|
||||
return new CheckResult(Severity.Invalid, resultPrefix + "Memory: Species cannot know this move.", CheckIdentifier.Memory);
|
||||
}
|
||||
if (m == 49 && (t == 0 || !Legal.getCanRelearnMove(pkm, t, 1))) // {0} was able to remember {2} at {1}'s instruction. {4} that {3}.
|
||||
if (m == 49 && (t == 0 || !Legal.getCanRelearnMove(pkm, t, GameVersion.Any))) // {0} was able to remember {2} at {1}'s instruction. {4} that {3}.
|
||||
{
|
||||
return new CheckResult(Severity.Invalid, resultPrefix + "Memory: Species cannot relearn this move.", CheckIdentifier.Memory);
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ namespace PKHeX
|
|||
return;
|
||||
|
||||
case 14:
|
||||
if (!Legal.getCanBeCaptured(pkm.OT_TextVar, pkm.GenNumber, pkm.Version))
|
||||
if (!Legal.getCanBeCaptured(pkm.OT_TextVar, pkm.GenNumber, (GameVersion)pkm.Version))
|
||||
AddLine(Severity.Invalid, "OT Memory: Captured Species can not be captured in game.", CheckIdentifier.Memory);
|
||||
else
|
||||
AddLine(Severity.Valid, "OT Memory: Captured Species can be captured in game.", CheckIdentifier.Memory);
|
||||
|
|
|
@ -150,9 +150,9 @@ namespace PKHeX
|
|||
// Moves
|
||||
internal static IEnumerable<int> getValidMoves(PKM pkm)
|
||||
{
|
||||
int version = pkm.Version;
|
||||
GameVersion version = (GameVersion)pkm.Version;
|
||||
if (!pkm.IsUntraded)
|
||||
version = -1;
|
||||
version = GameVersion.Any;
|
||||
return getValidMoves(pkm, version, LVL: true, Relearn: false, Tutor: true, Machine: true);
|
||||
}
|
||||
internal static IEnumerable<int> getValidRelearn(PKM pkm, int skipOption)
|
||||
|
@ -453,25 +453,25 @@ namespace PKHeX
|
|||
return curr.Count() >= poss.Count();
|
||||
}
|
||||
|
||||
internal static bool getCanBeCaptured(int species, int gen, int version = -1)
|
||||
internal static bool getCanBeCaptured(int species, int gen, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
switch (gen)
|
||||
{
|
||||
case 6:
|
||||
switch (version)
|
||||
{
|
||||
case -1:
|
||||
case GameVersion.Any:
|
||||
return getCanBeCaptured(species, SlotsX, StaticX, XY:true)
|
||||
|| getCanBeCaptured(species, SlotsY, StaticY, XY:true)
|
||||
|| getCanBeCaptured(species, SlotsA, StaticA)
|
||||
|| getCanBeCaptured(species, SlotsO, StaticO);
|
||||
case (int)GameVersion.X:
|
||||
case GameVersion.X:
|
||||
return getCanBeCaptured(species, SlotsX, StaticX, XY:true);
|
||||
case (int)GameVersion.Y:
|
||||
case GameVersion.Y:
|
||||
return getCanBeCaptured(species, SlotsY, StaticY, XY:true);
|
||||
case (int)GameVersion.AS:
|
||||
case GameVersion.AS:
|
||||
return getCanBeCaptured(species, SlotsA, StaticA);
|
||||
case (int)GameVersion.OR:
|
||||
case GameVersion.OR:
|
||||
return getCanBeCaptured(species, SlotsO, StaticO);
|
||||
|
||||
default:
|
||||
|
@ -480,12 +480,12 @@ namespace PKHeX
|
|||
case 7:
|
||||
switch (version)
|
||||
{
|
||||
case -1:
|
||||
case GameVersion.Any:
|
||||
return getCanBeCaptured(species, SlotsSN, StaticSN)
|
||||
|| getCanBeCaptured(species, SlotsMN, StaticMN);
|
||||
case (int)GameVersion.SN:
|
||||
case GameVersion.SN:
|
||||
return getCanBeCaptured(species, SlotsSN, StaticSN);
|
||||
case (int)GameVersion.MN:
|
||||
case GameVersion.MN:
|
||||
return getCanBeCaptured(species, SlotsMN, StaticMN);
|
||||
|
||||
default:
|
||||
|
@ -506,19 +506,19 @@ namespace PKHeX
|
|||
return false;
|
||||
}
|
||||
|
||||
internal static bool getCanLearnMachineMove(PKM pkm, int move, int version = -1)
|
||||
internal static bool getCanLearnMachineMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
return getValidMoves(pkm, version, Machine: true).Contains(move);
|
||||
}
|
||||
internal static bool getCanRelearnMove(PKM pkm, int move, int version = -1)
|
||||
internal static bool getCanRelearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
return getValidMoves(pkm, version, LVL: true, Relearn: true).Contains(move);
|
||||
}
|
||||
internal static bool getCanLearnMove(PKM pkm, int move, int version = -1)
|
||||
internal static bool getCanLearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
return getValidMoves(pkm, version, Tutor: true, Machine: true).Contains(move);
|
||||
}
|
||||
internal static bool getCanKnowMove(PKM pkm, int move, int version = -1)
|
||||
internal static bool getCanKnowMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
if (pkm.Species == 235 && !InvalidSketch.Contains(move))
|
||||
return true;
|
||||
|
@ -698,14 +698,14 @@ namespace PKHeX
|
|||
IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm);
|
||||
return table.Where(e => dl.Any(d => d.Species == e.Species));
|
||||
}
|
||||
private static IEnumerable<int> getValidMoves(PKM pkm, int Version, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false)
|
||||
private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false)
|
||||
{
|
||||
List<int> r = new List<int> { 0 };
|
||||
int species = pkm.Species;
|
||||
int lvl = pkm.CurrentLevel;
|
||||
|
||||
// Special (non Type) Tutor Availability
|
||||
bool moveTutor = Version == -1 || pkm.Format != pkm.GenNumber;
|
||||
bool moveTutor = Version == GameVersion.Any || pkm.Format != pkm.GenNumber;
|
||||
// Add extra cases where tutors
|
||||
moveTutor |= pkm.AO;
|
||||
moveTutor |= pkm.XY && !pkm.IsUntraded;
|
||||
|
@ -735,18 +735,18 @@ namespace PKHeX
|
|||
if (Relearn) r.AddRange(pkm.RelearnMoves);
|
||||
return r.Distinct().ToArray();
|
||||
}
|
||||
private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, int Version, bool LVL, bool Tutor, bool Machine)
|
||||
private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool Tutor, bool Machine)
|
||||
{
|
||||
List<int> r = new List<int> { 0 };
|
||||
for (int gen = pkm.GenNumber; gen <= pkm.Format; gen++)
|
||||
r.AddRange(getMoves(pkm, species, lvl, form, moveTutor, Version, LVL, Tutor, Machine, gen));
|
||||
return r.Distinct();
|
||||
}
|
||||
private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, int Version, bool LVL, bool Tutor, bool Machine, int Generation)
|
||||
private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool Tutor, bool Machine, int Generation)
|
||||
{
|
||||
List<int> r = new List<int>();
|
||||
|
||||
var ver = (GameVersion) Version;
|
||||
var ver = Version;
|
||||
switch (Generation)
|
||||
{
|
||||
case 6:
|
||||
|
|
Loading…
Reference in a new issue