PKHeX/PKHeX.Core/Legality/Evolutions/EvolutionGroup/EvolutionGroupUtil.cs
Kurt dcc0e79435
Evotree: Evolution Traversal Enhancements (#3936)
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.
2023-07-05 21:14:09 -07:00

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,
};
}