namespace PKHeX.Core;
///
/// Nature ID values for the corresponding English nature name.
///
public enum Nature : byte
{
Hardy = 0,
Lonely = 1,
Brave = 2,
Adamant = 3,
Naughty = 4,
Bold = 5,
Docile = 6,
Relaxed = 7,
Impish = 8,
Lax = 9,
Timid = 10,
Hasty = 11,
Serious = 12,
Jolly = 13,
Naive = 14,
Modest = 15,
Mild = 16,
Quiet = 17,
Bashful = 18,
Rash = 19,
Calm = 20,
Gentle = 21,
Sassy = 22,
Careful = 23,
Quirky = 24,
Random = 25,
}
///
/// Extension methods for .
///
public static class NatureUtil
{
///
/// Gets the value that corresponds to the provided .
///
/// Actual nature values will be unchanged; only out-of-bounds values re-map to .
public static Nature GetNature(int value) => value switch
{
< 0 or >= (int)Nature.Random => Nature.Random,
_ => (Nature)value,
};
///
/// Checks if the provided is a valid stored value.
///
/// True if value is an actual nature.
public static bool IsFixed(this Nature value) => value is >= 0 and < Nature.Random;
///
/// Checks if the provided is a possible mint nature.
///
public static bool IsMint(this Nature value) => (value.IsFixed() && (byte)value % 6 != 0) || value == Nature.Serious;
///
/// Checks if the provided is a neutral nature which has no stat amps applied.
///
public static bool IsNeutral(this Nature value) => value.IsFixed() && (byte)value % 6 == 0;
}