More shedinja edge cases

Don't allow shedinja evolution moves if it wasn't evolved in that generation
This commit is contained in:
Kurt
2020-04-12 11:28:03 -07:00
parent 8ac61d7ff7
commit a94c754c3f
2 changed files with 18 additions and 6 deletions

View File

@@ -275,7 +275,7 @@ private static CheckMoveResult[] ParseMoves(PKM pkm, MoveParseSource source, Leg
}
if (pkm.Species == (int)Species.Shedinja && info.Generation <= 4)
ParseShedinjaEvolveMoves(pkm, res, source.CurrentMoves);
ParseShedinjaEvolveMoves(pkm, res, source.CurrentMoves, info.EvoChainsAllGens);
for (int m = 0; m < 4; m++)
{
@@ -574,14 +574,20 @@ private static void ParseEvolutionsIncompatibleMoves(PKM pkm, IList<CheckMoveRes
}
}
private static void ParseShedinjaEvolveMoves(PKM pkm, IList<CheckMoveResult> res, int[] moves)
private static void ParseShedinjaEvolveMoves(PKM pkm, IList<CheckMoveResult> res, int[] moves, IReadOnlyList<IReadOnlyList<EvoCriteria>> evos)
{
var ShedinjaEvoMovesLearned = new List<int>();
for (int gen = Math.Min(pkm.Format, 4); gen >= 3; gen--)
var format = pkm.Format;
for (int gen = Math.Min(format, 4); gen >= 3; gen--)
{
if (evos[gen].Count != 2)
continue; // Was not evolved in this generation
if (gen == 4 && pkm.Ball != 4)
continue; // Was definitively evolved in Gen3
var maxLevel = pkm.CurrentLevel;
var ninjaskMoves = Legal.GetShedinjaEvolveMoves(pkm, gen, maxLevel);
bool native = gen == pkm.Format;
bool native = gen == format;
for (int m = 0; m < 4; m++)
{
if (IsCheckValid(res[m])) // already validated

View File

@@ -38,8 +38,14 @@ private CheckResult VerifyBall(LegalityAnalysis data)
// Capture / Inherit cases -- can be one of many balls
var pkm = data.pkm;
if (pkm.Species == (int)Species.Shedinja && Info.Generation != 3 && data.EncounterMatch.Species != (int)Species.Shedinja) // Shedinja. For gen3, copy the ball from Nincada
return VerifyBallEquals(data, (int)Poke); // Pokeball Only
if (pkm.Species == (int)Species.Shedinja && data.EncounterMatch.Species != (int)Species.Shedinja) // Shedinja. For gen3, copy the ball from Nincada
{
// Only Gen3 origin Shedinja can copy the wild ball.
// Evolution chains will indicate if it could have existed as Shedinja in Gen3.
// The special move verifier has a similar check!
if (Info.Generation != 3 || Info.EvoChainsAllGens[3].Count != 2)
return VerifyBallEquals(data, (int)Poke); // Pokeball Only
}
if (pkm.Ball == (int)Heavy && Legal.AlolanCaptureNoHeavyBall.Contains(EncounterMatch.Species) && !EncounterMatch.EggEncounter && pkm.SM)
return GetInvalid(LBallHeavy); // Heavy Ball, can inherit if from egg (USUM fixed catch rate calc)