mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Sanity check nature for Criteria parameter
This commit is contained in:
parent
afbf1d997b
commit
8a2d115df3
2 changed files with 12 additions and 1 deletions
|
@ -33,4 +33,15 @@
|
|||
|
||||
Random = 25,
|
||||
}
|
||||
|
||||
public static class NatureUtil
|
||||
{
|
||||
public static Nature GetNature(int value) => value switch
|
||||
{
|
||||
< 0 or >= (int)Nature.Random => Nature.Random,
|
||||
_ => (Nature)value
|
||||
};
|
||||
|
||||
public static bool IsFixed(this Nature value) => value is >= 0 and < Nature.Random;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
IV_SPD = s.IVs[5],
|
||||
HPType = s.HiddenPowerType,
|
||||
|
||||
Nature = (Nature)s.Nature,
|
||||
Nature = NatureUtil.GetNature(s.Nature),
|
||||
Shiny = s.Shiny ? Shiny.Always : Shiny.Never,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue