mirror of
https://github.com/kwsch/PKHeX
synced 2025-01-07 01:58:46 +00:00
5bcccc6d92
* Revises legality checks to account for traveling between the three game islands (PLA/BDSP/SWSH) * Adds conversion mechanisms between the three formats, as well as flexible conversion options to backfill missing data (thanks GameFreak/ILCA for opting for lossy conversion instead of updating the games). * Adds API abstractions for HOME data storage format (EKH/PKH format 1, aka EH1/PH1). * Revises some APIs for better usage: - `PKM` now exposes a `Context` to indicate the isolation context for legality purposes. - Some method signatures have changed to accept `Context` or `GameVersion` instead of a vague `int` for Generation. - Evolution History is now tracked in the Legality parse for specific contexts, rather than only per generation.
33 lines
1 KiB
C#
33 lines
1 KiB
C#
using static PKHeX.Core.Species;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Dynamax Level used by <see cref="GameVersion.SWSH"/> format entity data.
|
|
/// </summary>
|
|
public interface IDynamaxLevel
|
|
{
|
|
byte DynamaxLevel { get; set; }
|
|
}
|
|
|
|
public static class DynamaxLevelExtensions
|
|
{
|
|
/// <summary>
|
|
/// Checks if the species is allowed to have a non-zero value for <see cref="IDynamaxLevel.DynamaxLevel"/>.
|
|
/// </summary>
|
|
public static bool CanHaveDynamaxLevel(this IDynamaxLevel _, PKM pkm)
|
|
{
|
|
if (pkm.IsEgg)
|
|
return false;
|
|
return pkm is PK8 && CanHaveDynamaxLevel(pkm.Species);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checks if the species is prevented from gaining any <see cref="IDynamaxLevel.DynamaxLevel"/> via candy in <see cref="GameVersion.SWSH"/>.
|
|
/// </summary>
|
|
private static bool CanHaveDynamaxLevel(int species)
|
|
{
|
|
return species is not ((int)Zacian or (int)Zamazenta or (int)Eternatus);
|
|
}
|
|
}
|
|
}
|