mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 00:48:49 -05:00
Move soup to gmax class (extension methods), fix home gmax starters
Directly accessing CanEatMaxSoup is now forbidden :) Fixes home galar starters being flagged when gmax-final evos
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -246,41 +246,6 @@ public static partial class Legal
|
||||
798, 802,
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> CanEatMaxSoup = new HashSet<int>
|
||||
{
|
||||
(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<int> GalarOriginForms = new HashSet<int>
|
||||
{
|
||||
(int)Species.Meowth,
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace PKHeX.Core
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface that exposes an indication if the Pokémon can Gigantamax.
|
||||
@@ -13,10 +15,64 @@ public interface IGigantamax
|
||||
|
||||
public static class GigantamaxExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if either of the input Species can consume the Gigantamax soup, toggling the <see cref="IGigantamax.CanGigantamax"/> flag.
|
||||
/// </summary>
|
||||
/// <param name="_">Unnecessary, just needed for extension method usage.</param>
|
||||
/// <param name="currentSpecies">The current species</param>
|
||||
/// <param name="originSpecies">The original species (what species it was encountered as)</param>
|
||||
/// <returns>True if either species can toggle Gigantamax potential</returns>
|
||||
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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Don't use this method. Use the other overload with multi-species input.
|
||||
/// </summary>
|
||||
/// <param name="_">Unnecessary, just needed for extension method usage.</param>
|
||||
/// <param name="currentSpecies">The current species</param>
|
||||
/// <returns>True if the species can toggle Gigantamax potential</returns>
|
||||
public static bool CanToggleGigantamax(this IGigantamax _, int currentSpecies)
|
||||
{
|
||||
var soup = CanEatMaxSoup;
|
||||
return soup.Contains(currentSpecies);
|
||||
}
|
||||
|
||||
private static readonly HashSet<int> CanEatMaxSoup = new HashSet<int>
|
||||
{
|
||||
(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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user