/// <summary> /// Temporary Reimplementation of Kaphotics's Generator without the exception being thrown to avoid relying on the bruteforce mechanism /// </summary> /// <param name="pk">PKM to modify</param> /// <param name="info">Trainer Info for TID</param> /// <param name="moves">INT list of moves for the pkm</param> /// <param name="versions">Versions to iterate over (All in our case)</param> /// <returns></returns> public static IEnumerable <PKM> GeneratePKMs(PKM pk, ITrainerInfo info, int[] moves = null, params GameVersion[] versions) { GameVersion[] Versions = ((GameVersion[])Enum.GetValues(typeof(GameVersion))).Where(z => z < GameVersion.RB && z > 0).OrderBy(x => x.GetGeneration()).Reverse().ToArray(); pk.TID = info.TID; var m = moves ?? pk.Moves; var vers = versions?.Length >= 1 ? versions : Versions.Where(z => z <= (GameVersion)pk.MaxGameID); if (pk.Gen3) { vers = vers.Concat(new GameVersion[] { (GameVersion)15 }); } foreach (var ver in vers) { var encs = EncounterMovesetGenerator.GenerateVersionEncounters(pk, m, ver); foreach (var enc in encs) { var result = enc.ConvertToPKM(info); if (result.Version != (int)ver) { continue; } yield return(result); } } }