mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-25 16:35:02 -05:00
Like move validation, evolutions are the earliest thing we wish to traverse when determining what encounters may have originated the current Pokémon. To determine the permitted species-form-levels a Pokémon could originate with, we must devolve a Pokémon by traveling down-generation to origin. Once we have an encounter, we can then evolve it to the current species, traversing upwards from origin to the current format.
27 lines
817 B
C#
27 lines
817 B
C#
using static PKHeX.Core.EntityContext;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Utility logic for getting an <see cref="IEvolutionGroup"/> based on the input.
|
|
/// </summary>
|
|
public static class EvolutionGroupUtil
|
|
{
|
|
/// <summary>
|
|
/// Gets the <see cref="IEvolutionGroup"/> for the <see cref="EntityContext"/>.
|
|
/// </summary>
|
|
public static IEvolutionGroup GetGroup(EntityContext context) => context switch
|
|
{
|
|
Gen1 => EvolutionGroup1.Instance,
|
|
Gen2 => EvolutionGroup2.Instance,
|
|
Gen3 => EvolutionGroup3.Instance,
|
|
Gen4 => EvolutionGroup4.Instance,
|
|
Gen5 => EvolutionGroup5.Instance,
|
|
Gen6 => EvolutionGroup6.Instance,
|
|
Gen7 => EvolutionGroup7.Instance,
|
|
Gen7b => EvolutionGroup7b.Instance,
|
|
|
|
_ => EvolutionGroupHOME.Instance,
|
|
};
|
|
}
|