Minor tweaks

verify relearn: move split check before method call
movelist: don't capture pkm in local method; meowstic ID
pkm: flip argument for easier understanding
This commit is contained in:
Kurt 2020-07-19 18:30:46 -05:00
parent a6a3c6eaaa
commit d3863f9c63
3 changed files with 9 additions and 11 deletions

View file

@ -118,8 +118,8 @@ namespace PKHeX.Core
// Inherited moves appear after the required base moves.
// If the pkm is capable of split-species breeding and any inherited move is from the other split scenario, flag accordingly.
bool splitInvalid = FlagInvalidInheritedMoves(result, reqBase, RelearnMoves, inheritMoves, splitMoves);
if (splitInvalid)
FlagSplitbreedMoves(result, reqBase, e, pkm);
if (splitInvalid && e is EncounterEggSplit x)
FlagSplitbreedMoves(result, reqBase, x);
info.RelearnBase = baseMoves;
return result;
@ -167,17 +167,15 @@ namespace PKHeX.Core
return splitInvalid;
}
private static void FlagSplitbreedMoves(CheckResult[] res, int required, EncounterEgg e, PKM pkm)
private static void FlagSplitbreedMoves(CheckResult[] res, int required, EncounterEggSplit x)
{
if (!(e is EncounterEggSplit x))
return;
var other = x.OtherSpecies;
for (int i = required; i < 4; i++)
{
if (res[i] != null)
continue;
string message = string.Format(LMoveEggFIncompatible0_1, SpeciesStrings[other], SpeciesStrings[e.Species]);
string message = string.Format(LMoveEggFIncompatible0_1, SpeciesStrings[other], SpeciesStrings[x.Species]);
res[i] = new CheckResult(Severity.Invalid, message, CheckIdentifier.RelearnMove);
}
}

View file

@ -18,7 +18,7 @@ namespace PKHeX.Core
var r = new List<int>();
r.AddRange(MoveEgg.GetRelearnLVLMoves(pkm, species, 1, form, version));
if (pkm.Format == 6 && pkm.Species != 678)
if (pkm.Format == 6 && pkm.Species != (int)Species.Meowstic)
form = 0;
r.AddRange(MoveEgg.GetEggMoves(pkm, species, form, version));
@ -59,13 +59,13 @@ namespace PKHeX.Core
case GameVersion.GSC:
case GameVersion.GS:
// If checking back-transfer specimen (GSC->RBY), remove moves that must be deleted prior to transfer
int[] getRBYCompatibleMoves(int[] moves) => pkm.Format == 1 ? moves.Where(m => m <= MaxMoveID_1).ToArray() : moves;
static int[] getRBYCompatibleMoves(int format, int[] moves) => format == 1 ? moves.Where(m => m <= MaxMoveID_1).ToArray() : moves;
if (pkm.InhabitedGeneration(2))
return getRBYCompatibleMoves(LevelUpGS[species].GetMoves(lvl));
return getRBYCompatibleMoves(pkm.Format, LevelUpGS[species].GetMoves(lvl));
break;
case GameVersion.C:
if (pkm.InhabitedGeneration(2))
return getRBYCompatibleMoves(LevelUpC[species].GetMoves(lvl));
return getRBYCompatibleMoves(pkm.Format, LevelUpC[species].GetMoves(lvl));
break;
case GameVersion.R:

View file

@ -638,7 +638,7 @@ namespace PKHeX.Core
return false;
// Sanity Check Species ID
if (Legal.GetMaxSpeciesOrigin(generation) < species && !Legal.GetFutureGenEvolutions(generation).Contains(species))
if (species > Legal.GetMaxSpeciesOrigin(generation) && !Legal.GetFutureGenEvolutions(generation).Contains(species))
return false;
// Trade generation 1 -> 2