using System.Collections.Generic; namespace PKHeX.Core { /// /// Interface that exposes an indication if the Pokémon can Gigantamax. /// public interface IGigantamax { /// /// Indicates if the Pokémon is capable of Gigantamax as opposed to regular Dynamax. /// bool CanGigantamax { get; set; } } public static class GigantamaxExtensions { /// /// Checks if either of the input Species can consume the Gigantamax soup, toggling the flag. /// /// Unnecessary, just needed for extension method usage. /// The current species /// The current form of the species /// The original species (what species it was encountered as) /// The original form of the original species /// True if either species can toggle Gigantamax potential public static bool CanToggleGigantamax(this IGigantamax _, int currentSpecies, int currentForm, int originSpecies, int originForm) { if (currentSpecies is (int)Species.Meowth or (int)Species.Pikachu) return currentForm == 0; var soup = CanEatMaxSoup; return soup.Contains(currentSpecies) || (currentSpecies != originSpecies && soup.Contains(originSpecies)); } /// /// Don't use this method. Use the other overload with multi-species input. /// /// Unnecessary, just needed for extension method usage. /// The current species /// The current form of the species /// True if the species can toggle Gigantamax potential public static bool CanToggleGigantamax(this IGigantamax _, int currentSpecies, int currentForm) { if (currentSpecies is (int)Species.Meowth or (int)Species.Pikachu) return currentForm == 0; var soup = CanEatMaxSoup; return soup.Contains(currentSpecies); } private static readonly HashSet CanEatMaxSoup = new() { (int)Species.Venusaur, (int)Species.Charizard, (int)Species.Blastoise, (int)Species.Butterfree, (int)Species.Pikachu, (int)Species.Meowth, (int)Species.Machamp, (int)Species.Gengar, (int)Species.Lapras, (int)Species.Eevee, (int)Species.Snorlax, (int)Species.Garbodor, (int)Species.Rillaboom, (int)Species.Cinderace, (int)Species.Inteleon, (int)Species.Drednaw, (int)Species.Corviknight, (int)Species.Toxtricity, (int)Species.Alcremie, (int)Species.Duraludon, (int)Species.Orbeetle, (int)Species.Coalossal, (int)Species.Sandaconda, (int)Species.Grimmsnarl, (int)Species.Flapple, (int)Species.Appletun, (int)Species.Hatterene, (int)Species.Copperajah, (int)Species.Kingler, (int)Species.Centiskorch, (int)Species.Urshifu, }; } }