diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index b98029b02..ea11dad7c 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -303,14 +303,12 @@ namespace PKHeX.Core return preevomoves.Except(evomoves).Distinct(); } - internal static bool GetWasEgg23(PKM pkm) + internal static bool GetCanBeEgg23(PKM pkm) { if (pkm.IsEgg) return true; if (pkm.Format > 2 && pkm.Ball != 4) return false; - if (pkm.Format == 3) - return pkm.WasEgg; int lvl = pkm.CurrentLevel; if (lvl < 5) diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic.cs index 3dac7f00a..0eda7dcaf 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic.cs @@ -245,7 +245,7 @@ namespace PKHeX.Core if (Nature != Nature.Random && pkm.Nature != (int)Nature) return false; - if (pkm.WasEgg != EggEncounter && pkm.Egg_Location == 0 && pkm.Format > 3 && Generation > 3 && !pkm.IsEgg) + if (Generation > 3 && pkm.Format > 3 && pkm.WasEgg != EggEncounter && pkm.Egg_Location == 0 && !pkm.IsEgg) return false; if (this is EncounterStaticPID p && p.PID != pkm.PID) return false; diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs index 701dbd83e..0cc20c013 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs @@ -47,7 +47,6 @@ namespace PKHeX.Core foreach (var z in GenerateFilteredEncounters12(pkm)) { - pkm.WasEgg = z.EggEncounter; info.Generation = z is IGeneration g ? g.Generation : 2; info.Game = ((IVersion)z).Version; yield return z; @@ -179,10 +178,6 @@ namespace PKHeX.Core } yield return s; } - // clear egg flag - // necessary for static egg gifts which appear in wild, level 8 GS clefairy - // GetValidWildEncounters immediately returns empty otherwise - pkm.WasEgg = false; foreach (var e in GetValidWildEncounters12(pkm, vs, game)) { yield return e; @@ -190,17 +185,8 @@ namespace PKHeX.Core if (gsc) { - bool WasEgg = !pkm.Gen1_NotTradeback && GetWasEgg23(pkm) && !NoHatchFromEgg.Contains(pkm.Species); - if (WasEgg) - { - // Further Filtering - if (pkm.Format < 3) - { - WasEgg &= pkm.Met_Location == 0 || pkm.Met_Level == 1; // 2->1->2 clears met info - WasEgg &= pkm.CurrentLevel >= 5; - } - } - if (WasEgg) + var canBeEgg = GetCanBeEgg(pkm); + if (canBeEgg) { int eggspec = GetBaseEggSpecies(pkm); if (ParseSettings.AllowGen2Crystal(pkm)) @@ -213,6 +199,22 @@ namespace PKHeX.Core yield return d; } + private static bool GetCanBeEgg(PKM pkm) + { + bool canBeEgg = !pkm.Gen1_NotTradeback && GetCanBeEgg23(pkm) && !NoHatchFromEgg.Contains(pkm.Species); + if (!canBeEgg) + return false; + + // Further Filtering + if (pkm.Format < 3) + { + canBeEgg &= pkm.Met_Location == 0 || pkm.Met_Level == 1; // 2->1->2 clears met info + canBeEgg &= pkm.CurrentLevel >= 5; + } + + return canBeEgg; + } + private static IEnumerable GenerateFilteredEncounters12(PKM pkm) { bool crystal = (pkm.Format == 2 && pkm.Met_Location != 0) || (pkm.Format >= 7 && pkm.OT_Gender == 1); @@ -430,7 +432,6 @@ namespace PKHeX.Core int species = pkm.Species; var deferNoFrame = new Queue(); var deferFrame = new Queue(); - pkm.WasEgg = false; // clear flag if set from static var slots = FrameFinder.GetFrames(info.PIDIV, pkm).ToList(); foreach (var z in GetValidWildEncounters34(pkm)) { diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs b/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs index 046211064..35badec24 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs @@ -43,7 +43,6 @@ namespace PKHeX.Core var EncounterMatch = info.EncounterMatch; if (EncounterMatch.EggEncounter) { - pkm.WasEgg = true; return VerifyEncounterEgg(pkm); } if (EncounterMatch is EncounterSlot1 l) @@ -119,7 +118,6 @@ namespace PKHeX.Core // Eggs private static CheckResult VerifyEncounterEgg(PKM pkm) { - pkm.WasEgg = true; // Check Species if (Legal.NoHatchFromEgg.Contains(pkm.Species)) return new CheckResult(Severity.Invalid, LEggSpecies, CheckIdentifier.Encounter); diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs index 2f85f95be..857d925ae 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs @@ -37,9 +37,6 @@ namespace PKHeX.Core var restrict = new LevelUpRestriction(pkm, info); info.EncounterMoves = new ValidEncounterMoves(pkm, restrict); - if (info.Generation <= 3) - pkm.WasEgg = info.EncounterMatch.EggEncounter; - List defaultG1LevelMoves = null; List defaultG2LevelMoves = null; var defaultTradeback = pkm.TradebackStatus; diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 238e1631f..2f491646b 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -524,7 +524,6 @@ namespace PKHeX.Core public bool Gen1_NotTradeback => TradebackStatus == TradebackType.Gen1_NotTradeback; public bool Gen2_NotTradeback => TradebackStatus == TradebackType.Gen2_NotTradeback; public virtual bool WasLink => false; - private bool _WasEgg; public bool WasEgg { @@ -539,9 +538,8 @@ namespace PKHeX.Core case 7: return Legal.EggLocations7.Contains(loc); } // Gen 1/2 and pal park Gen 3 - return _WasEgg; + return false; } - set => _WasEgg = value; } public bool WasBredEgg @@ -555,10 +553,9 @@ namespace PKHeX.Core case 5: return loc == Locations.Daycare5 || loc == Locations.LinkTrade5; case 6: case 7: return loc == Locations.Daycare5 || loc == Locations.LinkTrade6; - default: return _WasEgg; // Gen 1/2 and pal park Gen 3 + default: return false; // Gen 1/2 and pal park Gen 3 } } - set => _WasEgg = value; } public virtual bool WasGiftEgg