PKHeX/PKHeX.Core/Editing/Pokerus.cs
Kurt a601180821 Extract Pokerus util logic
Simplify some GUI interactions when changing strain. Changing the day selection will update the visibility, no need to manually do it again.
2022-04-09 12:27:16 -07:00

17 lines
507 B
C#

namespace PKHeX.Core;
public static class Pokerus
{
public static int GetMaxDuration(int strain) => (strain & 3) + 1;
public static bool IsObtainable(PKM pkm) => pkm is not PA8; // don't care about PK1
public static bool IsStrainValid(PKM pkm, int strain, int days) => IsObtainable(pkm) && IsStrainValid(strain, days);
public static bool IsStrainValid(int strain, int days) => strain switch
{
0 when days is not 0 => false,
8 => false,
_ => true,
};
}