mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-13 23:50:25 -05:00
Handle more evolution/form checks
Closes #2726 1. Add variant evolutions to form-match cases 2. Ban LGPE origin alolan raichu 3. Add egg form check for unavailable regional forms 4. Previous commit fixed mew (remove ribbon interface from WB7) Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
This commit is contained in:
parent
4771158194
commit
509e2f1fa3
|
|
@ -28,7 +28,7 @@ void CachePressureSlot(EncounterSlot s)
|
|||
slotMax = s;
|
||||
}
|
||||
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species)) // match form if same species, else form 0.
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(species)) // match form if same species, else form 0.
|
||||
{
|
||||
foreach (var slot in slots)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ void CachePressureSlot(EncounterSlot s)
|
|||
if (slotMax == null)
|
||||
yield break;
|
||||
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species)) // match form if same species, else form 0.
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(species)) // match form if same species, else form 0.
|
||||
{
|
||||
if (species == slotMax.Species ? slotMax.Form == form : slotMax.Form == 0)
|
||||
yield return GetPressureSlot(slotMax, pkm);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ protected override IEnumerable<EncounterSlot> GetFilteredSlots(PKM pkm, IEnumera
|
|||
int species = pkm.Species;
|
||||
|
||||
int form = pkm.AltForm;
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species)) // match form if same species, else form 0.
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(species)) // match form if same species, else form 0.
|
||||
{
|
||||
if (pkm.AltForm != 0 && pkm is PB7)
|
||||
yield break; // can't get Alolan forms from wild
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ protected override IEnumerable<EncounterSlot> GetFilteredSlots(PKM pkm, IEnumera
|
|||
int species = pkm.Species;
|
||||
int form = pkm.AltForm;
|
||||
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species)) // match form if same species, else form 0.
|
||||
if (Legal.AlolanVariantEvolutions12.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(species)) // match form if same species, else form 0.
|
||||
{
|
||||
foreach (var slot in slots)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ private static bool IsEvolvedFormChange(PKM pkm)
|
|||
if (pkm.IsEgg)
|
||||
return false;
|
||||
|
||||
if (pkm.Format >= 7 && AlolanVariantEvolutions12.Contains(pkm.Species))
|
||||
if (pkm.Format >= 7 && (AlolanVariantEvolutions12.Contains(pkm.Species) || GalarVariantFormEvolutions.Contains(pkm.Species)))
|
||||
return pkm.AltForm == 1;
|
||||
if (pkm.Format >= 8)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public static IEnumerable<EncounterEgg> GenerateEggs(PKM pkm, IReadOnlyList<EvoC
|
|||
int max = GetMaxSpeciesOrigin(gen);
|
||||
|
||||
var e = GetBaseSpecies(vs, 0);
|
||||
if (e.Species <= max)
|
||||
if (e.Species <= max && !NoHatchFromEggFormGen(e.Species, e.Form, ver))
|
||||
{
|
||||
yield return new EncounterEgg(e.Species, e.Form, lvl) { Version = ver };
|
||||
if (gen > 5 && (pkm.WasTradedEgg || all) && HasOtherGamePair(ver))
|
||||
|
|
@ -45,7 +45,7 @@ public static IEnumerable<EncounterEgg> GenerateEggs(PKM pkm, IReadOnlyList<EvoC
|
|||
yield break; // no other possible species
|
||||
|
||||
var o = GetBaseSpecies(vs, 1);
|
||||
if (o.Species <= max)
|
||||
if (o.Species <= max && !NoHatchFromEggFormGen(o.Species, o.Form, ver))
|
||||
{
|
||||
yield return new EncounterEggSplit(o.Species, o.Form, lvl, e.Species) { Version = ver };
|
||||
if (gen > 5 && (pkm.WasTradedEgg || all) && HasOtherGamePair(ver))
|
||||
|
|
@ -66,6 +66,14 @@ private static bool NoHatchFromEggForm(int species, int form, int gen)
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool NoHatchFromEggFormGen(int species, int form, GameVersion game)
|
||||
{
|
||||
// Sanity check form for origin
|
||||
var gameInfo = GameData.GetPersonal(game);
|
||||
var entry = gameInfo.GetFormeEntry(species, form);
|
||||
return form >= entry.FormeCount;
|
||||
}
|
||||
|
||||
// Gen6+ update the origin game when hatched. Quick manip for X.Y<->A.O | S.M<->US.UM, ie X->A
|
||||
private static GameVersion GetOtherTradePair(GameVersion ver)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ private void FixEvoTreeSS()
|
|||
{
|
||||
// Gigantamax Pikachu, Meowth-0, and Eevee are prevented from evolving.
|
||||
BanEvo((int)Species.Raichu, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo((int)Species.Raichu, 1, pkm => pkm is IGigantamax g && g.CanGigantamax || pkm.Gen8);
|
||||
BanEvo((int)Species.Raichu, 1, pkm => pkm is IGigantamax g && g.CanGigantamax || pkm.Gen8 || pkm.GG);
|
||||
BanEvo((int)Species.Persian, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
|
||||
BanEvo((int)Species.Weezing, 0, pkm => pkm.Gen8);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user