Move version forcing for unavailable encounters to es4

This commit is contained in:
Kurt 2020-12-22 20:15:56 -08:00
parent dcd20a3649
commit 105e8b3818
2 changed files with 18 additions and 14 deletions

View File

@ -65,7 +65,6 @@ protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria
int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)sav.Language);
int level = GetMinimalLevel();
var version = this.GetCompatibleVersion((GameVersion)sav.Game);
SanityCheckVersion(ref version);
pk.Version = (int)version;
pk.Language = lang = GetEdgeCaseLanguage(pk, lang);
@ -150,19 +149,6 @@ private void SetEncounterMoves(PKM pk, GameVersion version, int level)
pk.SetMaximumPPCurrent(moves);
}
private void SanityCheckVersion(ref GameVersion version)
{
if (Generation != 4 || version == GameVersion.Pt)
return;
switch (Species)
{
case (int)Core.Species.Darkrai when Location == 079: // DP Darkrai
case (int)Core.Species.Shaymin when Location == 063: // DP Shaymin
version = GameVersion.Pt;
return;
}
}
protected void SetIVs(PKM pk)
{
if (IVs.Count != 0)

View File

@ -43,6 +43,24 @@ protected sealed override bool IsMatchEggLocation(PKM pkm)
return pkm.Egg_Location == Locations.Faraway4;
}
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
{
base.ApplyDetails(sav, criteria, pk);
SanityCheckVersion(pk);
}
private void SanityCheckVersion(PKM pk)
{
// Unavailable encounters in DP, morph them to Pt so they're legal.
switch (Species)
{
case (int)Core.Species.Darkrai when Location == 079: // DP Darkrai
case (int)Core.Species.Shaymin when Location == 063: // DP Shaymin
pk.Version = (int)GameVersion.Pt;
return;
}
}
protected sealed override bool IsMatchLevel(PKM pkm, DexLevel evo)
{
if (pkm.Format != 4) // Met Level lost on PK3=>PK4