mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-21 01:43:10 +00:00
25 lines
727 B
C#
25 lines
727 B
C#
namespace PKHeX.Core
|
|
{
|
|
public interface IEncounterable
|
|
{
|
|
int Species { get; }
|
|
string Name { get; }
|
|
bool EggEncounter { get; }
|
|
int LevelMin { get; }
|
|
int LevelMax { get; }
|
|
}
|
|
|
|
public static partial class Extensions
|
|
{
|
|
private static bool IsWithinRange(this IEncounterable encounter, int lvl)
|
|
{
|
|
return encounter.LevelMin <= lvl && lvl <= encounter.LevelMax;
|
|
}
|
|
public static bool IsWithinRange(this IEncounterable encounter, PKM pkm)
|
|
{
|
|
if (pkm.HasOriginalMetLocation)
|
|
return pkm.CurrentLevel == pkm.Met_Level;
|
|
return encounter.IsWithinRange(pkm.CurrentLevel);
|
|
}
|
|
}
|
|
}
|