From aaa96d66dfb0a79fb3d5ee575dd9b05426dedcdc Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 9 Oct 2017 10:44:13 -0700 Subject: [PATCH] fix expansion / forced type mega 8d85460 --- pk3DS/Subforms/Gen6/RSTE.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pk3DS/Subforms/Gen6/RSTE.cs b/pk3DS/Subforms/Gen6/RSTE.cs index b2ebe42..2504fff 100644 --- a/pk3DS/Subforms/Gen6/RSTE.cs +++ b/pk3DS/Subforms/Gen6/RSTE.cs @@ -656,9 +656,8 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, ushort[] itemv if (p == last && mevo) { int tries = 0; - while (!megaEvos.Contains(species) && tries++ < 0x10000) - species = rSpeciesRand.GetRandomSpeciesType(pk.Species, type); - stones = MegaDictionary[species]; + do { stones = GetRandomMega(out species); } + while (Main.Config.Personal[species].Types.All(z => z != type) && tries++ < 100); } } else if (p == last && mevo) @@ -701,10 +700,14 @@ private static void InitializeTrainerTeamInfo(trdata6 t, bool important) int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0) t.NumPokemon = 6; + Array.Resize(ref t.Team, t.NumPokemon); for (int f = lastPKM + 1; f < t.NumPokemon; f++) { - t.Team[f].Species = t.Team[lastPKM].Species; - t.Team[f].Level = (ushort)Math.Min(t.Team[f - 1].Level + 1, 100); + t.Team[f] = // clone last pkm then increment level by 1 + new trdata6.Pokemon(t.Team[lastPKM].Write(t.Item, t.Moves), t.Item, t.Moves) + { + Level = (ushort) Math.Min(t.Team[f - 1].Level + 1, 100) + }; } } private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass)