public static IEnumerable <EncounterSlot> GetPossible(PKM pkm, GameVersion gameSource = GameVersion.Any) { int maxspeciesorigin = GetMaxSpecies(gameSource); var chain = EvolutionChain.GetOriginChain(pkm, maxspeciesorigin: maxspeciesorigin); return(GetPossible(pkm, chain, gameSource)); }
public static IEnumerable <MysteryGift> GetPossible(PKM pkm) { int maxSpecies = Legal.GetMaxSpeciesOrigin(pkm.Format); var chain = EvolutionChain.GetOriginChain(pkm, maxSpecies); return(GetPossible(pkm, chain)); }
internal static EncounterArea?GetCaptureLocation(PKM pkm) { var chain = EvolutionChain.GetOriginChain(pkm); return((from area in GetEncounterSlots(pkm) let slots = GetValidEncounterSlots(pkm, area, chain, lvl: 0).ToArray() where slots.Length != 0 select new EncounterAreaFake { Location = area.Location, Slots = slots, }).OrderBy(area => area.Slots.Min(x => x.LevelMin)).FirstOrDefault()); }
public static IEnumerable <EncounterStatic> GetPossible(PKM pkm, GameVersion gameSource = GameVersion.Any) { int gen = pkm.GenNumber; int maxID = gen switch { 1 => MaxSpeciesID_1, 2 => MaxSpeciesID_2, _ => - 1 }; var dl = EvolutionChain.GetOriginChain(pkm, maxID); return(GetPossible(pkm, dl, gameSource)); }
public static IEnumerable <EncounterSlot> GetValidWildEncounters34(PKM pkm, GameVersion gameSource = GameVersion.Any) { int lvl = GetMaxLevelEncounter(pkm); if (lvl <= 0) { return(Enumerable.Empty <EncounterSlot>()); } if (gameSource == GameVersion.Any) { gameSource = (GameVersion)pkm.Version; } var chain = EvolutionChain.GetOriginChain(pkm); var slots = GetRawEncounterSlots(pkm, lvl, chain, gameSource); return(slots); // defer deferrals to the method consuming this collection }
public static IEnumerable <EncounterSlot> GetPossible(PKM pkm, GameVersion gameSource = GameVersion.Any) { var chain = EvolutionChain.GetOriginChain(pkm, gameSource); return(GetPossible(pkm, chain, gameSource)); }
public static IEnumerable <EncounterTrade> GetPossible(PKM pkm, GameVersion gameSource = GameVersion.Any) { var p = EvolutionChain.GetOriginChain(pkm); return(GetPossible(pkm, p, gameSource)); }
public static IEnumerable <MysteryGift> GetPossible(PKM pkm) { var chain = EvolutionChain.GetOriginChain(pkm); return(GetPossible(pkm, chain)); }
private static IEnumerable <IEncounterable> GenerateRawEncounters12(PKM pkm, GameVersion game) { bool gsc = GameVersion.GSC.Contains(game); // Since encounter matching is super weak due to limited stored data in the structure // Calculate all 3 at the same time and pick the best result (by species). // Favor special event move gifts as Static Encounters when applicable var maxspeciesorigin = gsc ? MaxSpeciesID_2 : MaxSpeciesID_1; var chain = EvolutionChain.GetOriginChain(pkm, maxspeciesorigin: maxspeciesorigin); var deferred = new List <IEncounterable>(); foreach (var t in GetValidEncounterTrades(pkm, chain, game)) { // some OTs are longer than the keyboard entry; don't defer these if (pkm.Format >= 7 && pkm.OT_Name.Length <= (pkm.Japanese || pkm.Korean ? 5 : 7)) { deferred.Add(t); continue; } yield return(t); } foreach (var s in GetValidStaticEncounter(pkm, chain, game)) { // Valid stadium and non-stadium encounters, return only non-stadium encounters, they are less restrictive switch (s.Version) { case GameVersion.Stadium: case GameVersion.Stadium2: deferred.Add(s); continue; case GameVersion.EventsGBGen2: if (!s.EggEncounter && !pkm.HasOriginalMetLocation) { continue; } if (pkm.Japanese) { deferred.Add(s); } continue; case GameVersion.C when gsc && pkm.Format == 2: // Crystal specific data needs to be present if (!s.EggEncounter && !pkm.HasOriginalMetLocation) { continue; } if (s.Species == 251 && ParseSettings.AllowGBCartEra) // no celebi, the GameVersion.EventsGBGen2 will pass thru { continue; } break; } yield return(s); } foreach (var e in GetValidWildEncounters12(pkm, chain, game)) { yield return(e); } if (gsc) { var canBeEgg = GetCanBeEgg(pkm); if (canBeEgg) { int species = EvoBase.GetBaseSpecies(pkm, generation: pkm.Format == 1 ? 2 : -1, maxSpeciesOrigin: MaxSpeciesID_2).Species; if (ParseSettings.AllowGen2Crystal(pkm)) { yield return(new EncounterEgg(species, 0, 5, 2, GameVersion.C)); // gen2 egg } yield return(new EncounterEgg(species, 0, 5, 2, GameVersion.GS)); // gen2 egg } } foreach (var d in deferred) { yield return(d); } }