The last commit was reverted because the change should not apply to base moves from was egg pokemon, unlike egg moves base level moves are not equal among all generations.

Also for generation 2 check if pokemon have crystal location for the was egg base moves
This commit is contained in:
javierhimura 2017-03-26 18:42:20 +02:00
parent b950879065
commit 59750b8cfe

View file

@ -2100,29 +2100,37 @@ namespace PKHeX.Core
return res;
}
private GameVersion[] getBaseMovesIsEggGames()
private GameVersion[] getBaseGamesWasEggGen2()
{
if (pkm.Format != 2)
return new[] { GameVersion.GS, GameVersion.C };
if (pkm.HasOriginalMetLocation)
return new[] { GameVersion.C };
if (pkm.Species > 151 && !Legal.FutureEvolutionsGen1.Contains(pkm.Species))
return new[] { GameVersion.GS };
return new[] { GameVersion.GS, GameVersion.C };
}
private GameVersion getBaseGamesWasEgg()
{
GameVersion[] Games = { };
switch (pkm.GenNumber)
{
case 1:
case 2:
Games = new[] { GameVersion.GS, GameVersion.C };
break;
// Every egg move from Gold/Silver is included in Crystal
return GameVersion.C;
case 3:
switch((GameVersion)pkm.Version)
switch ((GameVersion)pkm.Version)
{
case GameVersion.R:
case GameVersion.S:
Games = new[] { GameVersion.RS};
break;
return GameVersion.RS;
case GameVersion.E:
Games = new[] { GameVersion.E };
break;
return GameVersion.E;
case GameVersion.FR:
case GameVersion.LG:
Games = new[] { GameVersion.FRLG };
break;
return GameVersion.FRLG;
}
break;
case 4:
@ -2130,15 +2138,12 @@ namespace PKHeX.Core
{
case GameVersion.D:
case GameVersion.P:
Games = new[] { GameVersion.DP };
break;
return GameVersion.DP;
case GameVersion.Pt:
Games = new[] { GameVersion.Pt };
break;
return GameVersion.Pt;
case GameVersion.HG:
case GameVersion.SS:
Games = new[] { GameVersion.HGSS };
break;
return GameVersion.HGSS;
}
break;
case 5:
@ -2146,29 +2151,22 @@ namespace PKHeX.Core
{
case GameVersion.B:
case GameVersion.W:
Games = new[] { GameVersion.BW };
break;
case GameVersion.Pt:
Games = new[] { GameVersion.Pt };
break;
return GameVersion.BW;
case GameVersion.B2:
case GameVersion.W2:
Games = new[] { GameVersion.B2W2 };
break;
return GameVersion.B2W2;
}
break;
}
return Games;
return GameVersion.Any;
}
private CheckResult[] verifyMovesIsEggPreRelearn(int[] Moves, int[] SpecialMoves, bool allowinherited)
{
CheckResult[] res = new CheckResult[4];
var ValidSpecialMoves = SpecialMoves.Where(m => m > 0);
// Some games can have different egg movepools. Have to check all situations.
GameVersion[] Games = getBaseMovesIsEggGames();
GameVersion ver = getBaseGamesWasEgg();
int splitctr = Legal.getSplitBreedGeneration(pkm).Contains(pkm.Species) ? 1 : 0;
foreach (var ver in Games)
{
for (int i = 0; i <= splitctr; i++)
{
var baseEggMoves = Legal.getBaseEggMoves(pkm, i, ver, pkm.GenNumber < 4 ? 5 : 1)?.ToList() ?? new List<int>();
@ -2195,7 +2193,6 @@ namespace PKHeX.Core
return res;
}
}
}
return res;
}
private CheckResult[] verifyMovesWasEggPreRelearn(int[] Moves, List<int>[] validLevelMoves, List<int>[] validTMHM, List<int>[] validTutor)
@ -2208,10 +2205,10 @@ namespace PKHeX.Core
{
case 1:
case 2:
Games = new[] { GameVersion.GS, GameVersion.C };
Games = getBaseGamesWasEggGen2();
break;
case 3: // Generation 3 does not overwrite source game after pokemon hatched
Games = getBaseMovesIsEggGames();
Games = new[] { getBaseGamesWasEgg() };
break;
case 4:
Games = new[] { GameVersion.DP, GameVersion.Pt, GameVersion.HGSS };