44 lines
925 B
C#
44 lines
925 B
C#
using System;
|
|
using System.Globalization;
|
|
|
|
namespace NightclubArcadia.Skills
|
|
{
|
|
public enum DcBand
|
|
{
|
|
Trivial = 5,
|
|
Easy = 8,
|
|
Standard = 11,
|
|
Hard = 14,
|
|
Formidable = 17,
|
|
Legendary = 20,
|
|
}
|
|
|
|
public static class DcBands
|
|
{
|
|
public static bool TryParse(string input, out int dc)
|
|
{
|
|
dc = 0;
|
|
if (string.IsNullOrWhiteSpace(input))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
input = input.Trim();
|
|
|
|
if (int.TryParse(input, NumberStyles.Integer, CultureInfo.InvariantCulture, out var numeric))
|
|
{
|
|
dc = numeric;
|
|
return true;
|
|
}
|
|
|
|
if (Enum.TryParse<DcBand>(input, ignoreCase: true, out var band))
|
|
{
|
|
dc = (int)band;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|