mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
f632aedd15
We implement simple state machine iterators to iterate through every split type encounter array, and more finely control the path we iterate through. And, by using generics, we can have the compiler generate optimized code to avoid virtual calls. In addition to this, we shift away from the big-5 encounter types and not inherit from an abstract class. This allows for creating a PK* of a specific type and directly writing properties (no virtual calls). Plus we can now fine-tune each encounter type to call specific code, and not have to worry about future game encounter types bothering the generation routines.
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary> Severity indication of the associated <see cref="CheckResult"/> </summary>
|
|
/// <remarks>
|
|
/// Severity >= <see cref="Valid"/> is green
|
|
/// Severity == <see cref="Fishy"/> is yellow
|
|
/// Severity <= <see cref="Invalid"/> is red
|
|
/// </remarks>
|
|
public enum Severity : sbyte
|
|
{
|
|
/// <summary>
|
|
/// Definitively not valid.
|
|
/// </summary>
|
|
Invalid = -1,
|
|
|
|
/// <summary>
|
|
/// Suspicious values, but still valid.
|
|
/// </summary>
|
|
Fishy = 0,
|
|
|
|
/// <summary>
|
|
/// Values are valid.
|
|
/// </summary>
|
|
Valid = 1,
|
|
}
|
|
|
|
public static partial class Extensions
|
|
{
|
|
/// <summary>
|
|
/// Converts a Check result Severity determination (Valid/Invalid/etc) to the localized string.
|
|
/// </summary>
|
|
/// <param name="s"><see cref="Severity"/> value to convert to string.</param>
|
|
/// <returns>Localized <see cref="string"/>.</returns>
|
|
public static string Description(this Severity s) => s switch
|
|
{
|
|
Severity.Invalid => L_SInvalid,
|
|
Severity.Fishy => L_SFishy,
|
|
Severity.Valid => L_SValid,
|
|
_ => L_SNotImplemented,
|
|
};
|
|
}
|