private static bool IsEvolvedFormChange(PKM pkm) { if (pkm.IsEgg) { return(false); } if (pkm.Format >= 7 && AlolanVariantEvolutions12.Contains(pkm.Species)) { return(pkm.AltForm == 1); } if (pkm.Species == 678 && pkm.Gender == 1) { return(pkm.AltForm == 1); } return(pkm.Species == 773); }
public static bool IsEvolvedChangedFormValid(int species, int currentForm, int originalForm) { switch (currentForm) { case 0 when Legal.GalarForm0Evolutions.TryGetValue(species, out var val): return(originalForm == val); case 1 when Legal.AlolanVariantEvolutions12.Contains(species): case 1 when Legal.GalarVariantFormEvolutions.Contains(species): return(originalForm == 0); case 2 when species == (int)Species.Darmanitan: return(originalForm == 1); default: return(false); } }
private static IEnumerable <EncounterSlot> GetFilteredSlots67(PKM pkm, IEnumerable <EncounterSlot> encounterSlots) { int species = pkm.Species; int form = pkm.AltForm; // Edge Case Handling switch (species) { case 744 when form == 1: // Rockruff Event case 745 when form == 2: // Lycanroc Event yield break; } EncounterSlot slotMax = null; void CachePressureSlot(EncounterSlot s) { if (slotMax != null && s.LevelMax > slotMax.LevelMax) { slotMax = s; } } if (AlolanVariantEvolutions12.Contains(species)) // match form if same species, else form 0. { foreach (var slot in encounterSlots) { if (species == slot.Species ? slot.Form == form : slot.Form == 0) { yield return(slot); } CachePressureSlot(slot); } } else if (ShouldMatchSlotForm()) // match slot form { foreach (var slot in encounterSlots) { if (slot.Form == form) { yield return(slot); } CachePressureSlot(slot); } } else { foreach (var slot in encounterSlots) { yield return(slot); // no form checking CachePressureSlot(slot); } } // Filter for Form Specific // Pressure Slot if (slotMax == null) { yield break; } if (AlolanVariantEvolutions12.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)); } } else if (ShouldMatchSlotForm()) // match slot form { if (slotMax.Form == form) { yield return(GetPressureSlot(slotMax, pkm)); } } else { yield return(GetPressureSlot(slotMax, pkm)); } bool ShouldMatchSlotForm() => WildForms.Contains(species) || AlolanOriginForms.Contains(species) || FormConverter.IsTotemForm(species, form); }