using System; namespace PKHeX.Core; /// /// Logic for checking if an entity can freely change . /// public static class FormChangeUtil { /// /// Checks if all forms should be iterated when checking for moves. /// /// Entity species /// Entity form /// Generation we're checking in /// Conditions we're checking with public static bool ShouldIterateForms(ushort species, byte form, byte generation, LearnOption option) { if (option.IsPast()) return IsFormChangeDifferentMoves(species, generation); return IterateAllForms(species); } private static bool IterateAllForms(ushort species) => FormChangeMovesRetain.Contains(species); /// /// Species that can change between their forms and get access to form-specific moves. /// private static ReadOnlySpan FormChangeMovesRetain => [ (int)Species.Deoxys, (int)Species.Giratina, (int)Species.Shaymin, (int)Species.Hoopa, ]; /// /// Species that can change between their forms and get access to form-specific moves. /// private static bool IsFormChangeDifferentMoves(ushort species, byte generation) => species switch { (int)Species.Deoxys => generation >= 6, (int)Species.Giratina => generation >= 6, (int)Species.Shaymin => generation >= 6, (int)Species.Rotom => generation >= 6, (int)Species.Hoopa => generation >= 6, (int)Species.Tornadus => generation >= 6, (int)Species.Thundurus => generation >= 6, (int)Species.Landorus => generation >= 6, (int)Species.Urshifu => generation >= 8, (int)Species.Enamorus => generation >= 8, // Fuse (int)Species.Kyurem => generation >= 6, (int)Species.Necrozma => generation >= 8, (int)Species.Calyrex => generation >= 8, (int)Species.Pikachu => generation == 6, _ => false, }; }