mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
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:
parent
2648560684
commit
a7b9fafb69
1 changed files with 11 additions and 18 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue