2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
2017-10-24 06:12:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Nature ID values for the corresponding English nature name.
|
|
|
|
|
/// </summary>
|
2018-04-21 16:18:28 +00:00
|
|
|
|
public enum Nature : byte
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
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,
|
2018-04-21 16:18:28 +00:00
|
|
|
|
|
|
|
|
|
Random = 25,
|
2016-11-08 16:43:57 +00:00
|
|
|
|
}
|
2021-02-01 18:45:53 +00:00
|
|
|
|
|
|
|
|
|
public static class NatureUtil
|
|
|
|
|
{
|
|
|
|
|
public static Nature GetNature(int value) => value switch
|
|
|
|
|
{
|
|
|
|
|
< 0 or >= (int)Nature.Random => Nature.Random,
|
2021-08-20 20:49:20 +00:00
|
|
|
|
_ => (Nature)value,
|
2021-02-01 18:45:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static bool IsFixed(this Nature value) => value is >= 0 and < Nature.Random;
|
2021-05-08 15:29:20 +00:00
|
|
|
|
|
|
|
|
|
public static bool IsNeutral(this Nature value) => value.IsFixed() && (byte)value % 6 == 0;
|
2021-02-01 18:45:53 +00:00
|
|
|
|
}
|
2016-11-08 16:43:57 +00:00
|
|
|
|
}
|