mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 00:07:15 +00:00
Refine crystal egg checks
Disallow crystal eggs if met data is not present Set crystal met location more fluidly
This commit is contained in:
parent
c9499f95be
commit
54611032c9
2 changed files with 36 additions and 6 deletions
|
@ -39,9 +39,10 @@ namespace PKHeX.Core
|
|||
|
||||
sav.ApplyTo(pk);
|
||||
|
||||
int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)sav.Language, version);
|
||||
pk.Species = Species;
|
||||
pk.Form = Form;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(Species, sav.Language, gen);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, gen);
|
||||
pk.CurrentLevel = Level;
|
||||
pk.Version = (int)version;
|
||||
pk.Ball = (int)Ball.Poke;
|
||||
|
@ -51,14 +52,22 @@ namespace PKHeX.Core
|
|||
pk.HealPP();
|
||||
SetPINGA(pk, criteria);
|
||||
|
||||
if (gen <= 2 && version != GameVersion.C)
|
||||
if (gen <= 2)
|
||||
{
|
||||
if (version != GameVersion.C)
|
||||
{
|
||||
pk.OT_Gender = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pk.Met_Location = Locations.HatchLocationC;
|
||||
pk.Met_Level = 1;
|
||||
}
|
||||
return pk;
|
||||
}
|
||||
|
||||
SetMetData(pk);
|
||||
|
||||
if (gen < 3)
|
||||
return pk;
|
||||
|
||||
if (gen >= 4)
|
||||
pk.SetEggMetData(version, (GameVersion)sav.Game);
|
||||
|
||||
|
|
|
@ -37,11 +37,32 @@ namespace PKHeX.Core
|
|||
species = baseID.Species;
|
||||
if (species > Legal.MaxSpeciesID_2)
|
||||
yield break;
|
||||
if (ParseSettings.AllowGen2Crystal(pkm))
|
||||
if (GetCanBeCrystalEgg(pkm, species, all))
|
||||
yield return new EncounterEgg(species, 0, 5, 2, GameVersion.C); // gen2 egg
|
||||
yield return new EncounterEgg(species, 0, 5, 2, GameVersion.GS); // gen2 egg
|
||||
}
|
||||
|
||||
private static bool GetCanBeCrystalEgg(PKM pkm, int species, bool all)
|
||||
{
|
||||
if (!ParseSettings.AllowGen2Crystal(pkm))
|
||||
return false;
|
||||
|
||||
if (all)
|
||||
return true;
|
||||
|
||||
// Check if the met data is present or could have been erased.
|
||||
if (pkm.Format > 2)
|
||||
return true; // doesn't have original met location
|
||||
if (pkm.Met_Location != 0)
|
||||
return true; // has original met location
|
||||
if (species < Legal.MaxSpeciesID_1)
|
||||
return true; // can trade RBY to wipe location
|
||||
if (pkm.Species < Legal.MaxSpeciesID_1)
|
||||
return true; // can trade RBY to wipe location
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool GetCanBeEgg(PKM pkm)
|
||||
{
|
||||
bool canBeEgg = !pkm.Gen1_NotTradeback && GetCanBeEgg2(pkm);
|
||||
|
|
Loading…
Reference in a new issue