using static PKHeX.Core.Species;
namespace PKHeX.Core;
public interface IDynamaxLevelReadOnly
{
///
/// Dynamax Level used by format entity data.
///
byte DynamaxLevel { get; }
}
public static class DynamaxLevelExtensions
{
///
/// Checks if the species is allowed to have a non-zero value for .
///
public static bool CanHaveDynamaxLevel(this IDynamaxLevelReadOnly _, PKM pk)
{
if (pk.IsEgg)
return false;
return pk is PK8 && CanHaveDynamaxLevel(pk.Species);
}
public static byte GetSuggestedDynamaxLevel(this IDynamaxLevelReadOnly _, PKM pk, byte requested = 10) => _.CanHaveDynamaxLevel(pk) ? requested : (byte)0;
///
/// Checks if the species is prevented from gaining any via candy in .
///
private static bool CanHaveDynamaxLevel(ushort species)
{
return species is not ((int)Zacian or (int)Zamazenta or (int)Eternatus);
}
}