Add current level property for met:X current:Y

This commit is contained in:
Kurt 2020-10-07 15:35:12 -07:00
parent dad01cb522
commit e3ef9bbbff

View file

@ -19,6 +19,8 @@ namespace PKHeX.Core
/// <summary> Trainer ID for the event. </summary>
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;