Remove unnecessary logic

Encounters are thoroughly checked for their origins; don't need to check again if it's possible to have it in an egg.
This commit is contained in:
Kurt 2021-01-01 19:45:40 -08:00
parent 2648560684
commit a7b9fafb69

View file

@ -86,13 +86,7 @@ namespace PKHeX.Core
}
// Eggs
private static CheckResult VerifyEncounterEgg(PKM pkm, int gen, bool checkSpecies = true)
{
// Check Species
if (checkSpecies && !Breeding.CanHatchAsEgg(pkm.Species))
return new CheckResult(Severity.Invalid, LEggSpecies, CheckIdentifier.Encounter);
return gen switch
private static CheckResult VerifyEncounterEgg(PKM pkm, int gen) => gen switch
{
2 => new CheckResult(CheckIdentifier.Encounter), // valid -- no met location info
3 => pkm.Format != 3 ? VerifyEncounterEgg3Transfer(pkm) : VerifyEncounterEgg3(pkm),
@ -103,7 +97,6 @@ namespace PKHeX.Core
8 => pkm.IsEgg ? VerifyUnhatchedEgg(pkm, Locations.LinkTrade6) : VerifyEncounterEgg8(pkm),
_ => new CheckResult(Severity.Invalid, LEggLocationInvalid, CheckIdentifier.Encounter)
};
}
private static CheckResult VerifyEncounterEgg3(PKM pkm)
{
@ -317,7 +310,7 @@ namespace PKHeX.Core
}
if (!pkm.IsEgg && gift.IsEgg) // hatched
{
var hatchCheck = VerifyEncounterEgg(pkm, gift.Generation, false);
var hatchCheck = VerifyEncounterEgg(pkm, gift.Generation);
if (!hatchCheck.Valid)
return hatchCheck;
}