diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs index cb4069366..c6d74206a 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs @@ -19,6 +19,8 @@ namespace PKHeX.Core /// Trainer ID for the event. public int TID { get; set; } = -1; + public int CurrentLevel { get; set; } = -1; + public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver) { } @@ -31,6 +33,16 @@ namespace PKHeX.Core if (Language != EncounterGBLanguage.Any && pkm.Japanese != (Language == EncounterGBLanguage.Japanese)) return false; + if (CurrentLevel != -1 && CurrentLevel > pkm.CurrentLevel) + return false; + + if (EggEncounter && !pkm.IsEgg) + return true; + + // Check OT Details + if (TID != -1 && pkm.TID != TID) + return false; + if (OT_Name.Length != 0) { if (pkm.OT_Name != OT_Name) @@ -42,9 +54,6 @@ namespace PKHeX.Core return false; } - if (TID != -1 && pkm.TID != TID) - return false; - return true; } @@ -55,9 +64,13 @@ namespace PKHeX.Core return !ParseSettings.AllowGBCartEra; } + protected override int GetMinimalLevel() => CurrentLevel != -1 ? base.GetMinimalLevel() : CurrentLevel; + protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk) { base.ApplyDetails(sav, criteria, pk); + if (CurrentLevel != -1) // Restore met level + pk.Met_Level = LevelMin; if (TID != -1) pk.TID = TID;