diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs index ddebd3f41..7eb679e62 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs @@ -43,7 +43,7 @@ public override bool IsMatchDeferred(PKM pkm) { if (base.IsMatchDeferred(pkm)) return true; - if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !Legal.CanEatMaxSoup.Contains(Species)) + if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, Species)) return true; if (Species == (int)Core.Species.Alcremie && pkm is IFormArgument a && a.FormArgument != 0) return true; diff --git a/PKHeX.Core/Legality/Tables/Tables8.cs b/PKHeX.Core/Legality/Tables/Tables8.cs index ae9d9539a..cdb60fa7e 100644 --- a/PKHeX.Core/Legality/Tables/Tables8.cs +++ b/PKHeX.Core/Legality/Tables/Tables8.cs @@ -246,41 +246,6 @@ public static partial class Legal 798, 802, }; - public static readonly HashSet CanEatMaxSoup = new HashSet - { - (int)Species.Venusaur, - (int)Species.Charizard, - (int)Species.Blastoise, - (int)Species.Rillaboom, - (int)Species.Cinderace, - (int)Species.Inteleon, - (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.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 - }; - internal static readonly HashSet GalarOriginForms = new HashSet { (int)Species.Meowth, diff --git a/PKHeX.Core/MysteryGifts/WC8.cs b/PKHeX.Core/MysteryGifts/WC8.cs index b2d6245d6..82f988964 100644 --- a/PKHeX.Core/MysteryGifts/WC8.cs +++ b/PKHeX.Core/MysteryGifts/WC8.cs @@ -562,7 +562,7 @@ protected override bool IsMatchExact(PKM pkm) if (Nature != -1 && pkm.Nature != Nature) return false; if (Gender != 3 && Gender != pkm.Gender) return false; - if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !Legal.CanEatMaxSoup.Contains(Species)) + if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, Species)) return false; if (!(pkm is IDynamaxLevel dl && dl.DynamaxLevel >= DynamaxLevel)) diff --git a/PKHeX.Core/PKM/Shared/IGigantamax.cs b/PKHeX.Core/PKM/Shared/IGigantamax.cs index 376a1542a..551527242 100644 --- a/PKHeX.Core/PKM/Shared/IGigantamax.cs +++ b/PKHeX.Core/PKM/Shared/IGigantamax.cs @@ -1,4 +1,6 @@ -namespace PKHeX.Core +using System.Collections.Generic; + +namespace PKHeX.Core { /// /// Interface that exposes an indication if the Pokémon can Gigantamax. @@ -13,10 +15,64 @@ public interface IGigantamax 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 original species (what species it was encountered as) + /// True if either species can toggle Gigantamax potential public static bool CanToggleGigantamax(this IGigantamax _, int currentSpecies, int originSpecies) { - var soup = Legal.CanEatMaxSoup; - return soup.Contains(currentSpecies) || soup.Contains(originSpecies); + 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 + /// True if the species can toggle Gigantamax potential + public static bool CanToggleGigantamax(this IGigantamax _, int currentSpecies) + { + var soup = CanEatMaxSoup; + return soup.Contains(currentSpecies); + } + + private static readonly HashSet CanEatMaxSoup = new HashSet + { + (int)Species.Venusaur, + (int)Species.Charizard, + (int)Species.Blastoise, + (int)Species.Rillaboom, + (int)Species.Cinderace, + (int)Species.Inteleon, + (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.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 + }; } }