mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Revert "There is no need to check egg moves both times for gold/silver and crystal, gold/silver egg moves is a subset of crystal egg moves, every legal combination from g/s is also a legal combination in crystal"
This reverts commit 620df347f0
.
This commit is contained in:
parent
620df347f0
commit
b950879065
1 changed files with 52 additions and 38 deletions
|
@ -2100,25 +2100,29 @@ namespace PKHeX.Core
|
|||
|
||||
return res;
|
||||
}
|
||||
private GameVersion getBaseMovesIsEggGames()
|
||||
private GameVersion[] getBaseMovesIsEggGames()
|
||||
{
|
||||
GameVersion[] Games = { };
|
||||
switch (pkm.GenNumber)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
// Every egg move from Gold/Silver is included in Crystal
|
||||
return GameVersion.C ;
|
||||
Games = new[] { GameVersion.GS, GameVersion.C };
|
||||
break;
|
||||
case 3:
|
||||
switch((GameVersion)pkm.Version)
|
||||
{
|
||||
case GameVersion.R:
|
||||
case GameVersion.S:
|
||||
return GameVersion.RS;
|
||||
Games = new[] { GameVersion.RS};
|
||||
break;
|
||||
case GameVersion.E:
|
||||
return GameVersion.E;
|
||||
Games = new[] { GameVersion.E };
|
||||
break;
|
||||
case GameVersion.FR:
|
||||
case GameVersion.LG:
|
||||
return GameVersion.FRLG;
|
||||
Games = new[] { GameVersion.FRLG };
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
@ -2126,12 +2130,15 @@ namespace PKHeX.Core
|
|||
{
|
||||
case GameVersion.D:
|
||||
case GameVersion.P:
|
||||
return GameVersion.DP;
|
||||
Games = new[] { GameVersion.DP };
|
||||
break;
|
||||
case GameVersion.Pt:
|
||||
return GameVersion.Pt;
|
||||
Games = new[] { GameVersion.Pt };
|
||||
break;
|
||||
case GameVersion.HG:
|
||||
case GameVersion.SS:
|
||||
return GameVersion.HGSS;
|
||||
Games = new[] { GameVersion.HGSS };
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
@ -2139,48 +2146,56 @@ namespace PKHeX.Core
|
|||
{
|
||||
case GameVersion.B:
|
||||
case GameVersion.W:
|
||||
return GameVersion.BW;
|
||||
Games = new[] { GameVersion.BW };
|
||||
break;
|
||||
case GameVersion.Pt:
|
||||
Games = new[] { GameVersion.Pt };
|
||||
break;
|
||||
case GameVersion.B2:
|
||||
case GameVersion.W2:
|
||||
return GameVersion.B2W2;
|
||||
Games = new[] { GameVersion.B2W2 };
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return GameVersion.Any;
|
||||
return Games;
|
||||
}
|
||||
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 Game = getBaseMovesIsEggGames();
|
||||
GameVersion[] Games = getBaseMovesIsEggGames();
|
||||
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, Game, pkm.GenNumber < 4 ? 5 : 1)?.ToList() ?? new List<int>();
|
||||
var InheritedLvlMoves = Legal.getBaseEggMoves(pkm, i, Game, 100) ?? new List<int>();
|
||||
var EggMoves = Legal.getEggMoves(pkm, Game)?.ToList() ?? new List<int>();
|
||||
var InheritedTutorMoves = (Game == GameVersion.C) ? Legal.getTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2) : new int[0];
|
||||
var baseEggMoves = Legal.getBaseEggMoves(pkm, i, ver, pkm.GenNumber < 4 ? 5 : 1)?.ToList() ?? new List<int>();
|
||||
var InheritedLvlMoves = Legal.getBaseEggMoves(pkm, i, ver, 100) ?? new List<int>();
|
||||
var EggMoves = Legal.getEggMoves(pkm, ver)?.ToList() ?? new List<int>();
|
||||
var InheritedTutorMoves = (ver == GameVersion.C) ? Legal.getTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2) : new int[0];
|
||||
// Only TM Hm moves from the source game of the egg, not any other games from the same generation
|
||||
var InheritedTMHMMoves = Legal.getTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, Game, false);
|
||||
var InheritedTMHMMoves = Legal.getTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, ver, false);
|
||||
InheritedLvlMoves = InheritedLvlMoves.Except(baseEggMoves);
|
||||
|
||||
if (pkm.Format > 2 || SpecialMoves.Any())
|
||||
{
|
||||
// For gen 2 is not possible to difference normal eggs from event eggs
|
||||
// If there is no special moves assume normal egg
|
||||
res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, ValidSpecialMoves, allowinherited, Game);
|
||||
res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, ValidSpecialMoves, allowinherited, ver);
|
||||
if (res.All(r => r.Valid)) // moves is satisfactory
|
||||
return res;
|
||||
}
|
||||
if(pkm.Format == 2)
|
||||
{
|
||||
// For gen 2 if does not match special egg check for normal egg too
|
||||
res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, new List<int>(), true, Game);
|
||||
res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, new List<int>(), true, ver);
|
||||
if (res.All(r => r.Valid)) // moves is satisfactory
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private CheckResult[] verifyMovesWasEggPreRelearn(int[] Moves, List<int>[] validLevelMoves, List<int>[] validTMHM, List<int>[] validTutor)
|
||||
|
@ -2193,11 +2208,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
case 1:
|
||||
case 2:
|
||||
// Every egg move from Gold/Silver is included in Crystal
|
||||
Games = new[] { GameVersion.C };
|
||||
Games = new[] { GameVersion.GS, GameVersion.C };
|
||||
break;
|
||||
case 3: // Generation 3 does not overwrite source game after pokemon hatched
|
||||
Games = new[] { getBaseMovesIsEggGames() };
|
||||
Games = getBaseMovesIsEggGames();
|
||||
break;
|
||||
case 4:
|
||||
Games = new[] { GameVersion.DP, GameVersion.Pt, GameVersion.HGSS };
|
||||
|
|
Loading…
Reference in a new issue