mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-25 08:10:48 -05:00
Prevent setting of invalid dmax levels to set
Just an extra protection.
This commit is contained in:
parent
50a64d8beb
commit
ac17c7d4a3
|
|
@ -209,7 +209,7 @@ private bool ParseEntry(string identifier, string value)
|
|||
case "Nature": return (Nature = StringUtil.FindIndexIgnoreCase(Strings.natures, value)) >= 0;
|
||||
case "EV" or "EVs": ParseLineEVs(value); return true;
|
||||
case "IV" or "IVs": ParseLineIVs(value); return true;
|
||||
case "Dynamax Level": return (DynamaxLevel = (byte)Util.ToInt32(value)) is (>= 0 and <= 10);
|
||||
case "Dynamax Level": return ParseDynamax(value);
|
||||
case "Level":
|
||||
{
|
||||
if (!int.TryParse(value.Trim(), out int val))
|
||||
|
|
@ -229,6 +229,14 @@ private bool ParseEntry(string identifier, string value)
|
|||
}
|
||||
}
|
||||
|
||||
private bool ParseDynamax(string value)
|
||||
{
|
||||
var val = Util.ToInt32(value);
|
||||
if ((uint)val > 10)
|
||||
return false;
|
||||
return (DynamaxLevel = (byte)val) is (>= 0 and <= 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the standard Text representation of the set details.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user