public PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria) { int gen = Version.GetGeneration(); if (gen < 2) { gen = 2; Version = GameVersion.C; } var pk = PKMConverter.GetBlank(gen, Version); SAV.ApplyToPKM(pk); pk.Species = Species; pk.Nickname = PKX.GetSpeciesNameGeneration(Species, SAV.Language, gen); pk.CurrentLevel = Level; pk.Version = (int)Version; pk.Ball = 4; int[] moves = GetCurrentEggMoves(pk); pk.Moves = moves; pk.SetMaximumPPCurrent(moves); pk.OT_Friendship = pk.PersonalInfo.BaseFriendship; pk.SetRandomIVs(flawless: 3); if (pk.Format <= 2 && Version != GameVersion.C) { return(pk); } SetMetData(pk); if (pk.Format < 3) { return(pk); } SetNatureGenderAbility(pk, criteria); if (pk.GenNumber >= 4) { pk.SetEggMetData(Version, (GameVersion)SAV.Game); } if (pk.Format < 6) { return(pk); } if (pk.Gen6) { pk.SetHatchMemory6(); } SetAltForm(pk, SAV); pk.SetRandomEC(); pk.RelearnMoves = moves; return(pk); }
public PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria) { int gen = Version.GetGeneration(); var version = Version; if (gen < 2) { gen = 2; version = GameVersion.C; } var pk = PKMConverter.GetBlank(gen, version); SAV.ApplyToPKM(pk); pk.Species = Species; pk.Nickname = PKX.GetSpeciesNameGeneration(Species, SAV.Language, gen); pk.CurrentLevel = Level; pk.Version = (int)version; pk.Ball = 4; pk.OT_Friendship = pk.PersonalInfo.BaseFriendship; int[] moves = SetEncounterMoves(pk, version); SetPINGA(pk, criteria); if (pk.Format <= 2 && version != GameVersion.C) { return(pk); } SetMetData(pk); if (pk.Format < 3) { return(pk); } if (pk.GenNumber >= 4) { pk.SetEggMetData(version, (GameVersion)SAV.Game); } if (pk.Format < 6) { return(pk); } if (pk.Format == 6) { pk.SetHatchMemory6(); } SetAltForm(pk, SAV); pk.SetRandomEC(); pk.RelearnMoves = moves; return(pk); }
public PKM ConvertToPKM(ITrainerInfo SAV) { int gen = Math.Max(2, Version.GetGeneration()); var pk = PKMConverter.GetBlank(gen); SAV.ApplyToPKM(pk); pk.Species = Species; pk.Nickname = PKX.GetSpeciesNameGeneration(Species, SAV.Language, gen); pk.CurrentLevel = Level; pk.Version = (int)Version; var moves = Legal.GetEggMoves(pk, Species, pk.AltForm, Version); if (moves.Length == 0) { moves = Legal.GetEncounterMoves(pk, Level, Version); } pk.Moves = moves; pk.SetMaximumPPCurrent(moves); pk.OT_Friendship = pk.PersonalInfo.BaseFriendship; pk.SetRandomIVs(flawless: 3); if (pk.Format <= 2 && Version != GameVersion.C) { return(pk); } pk.Met_Level = EncounterSuggestion.GetSuggestedEncounterEggMetLevel(pk); pk.Met_Location = Math.Max(0, EncounterSuggestion.GetSuggestedEggMetLocation(pk)); if (pk.Format < 3) { return(pk); } pk.Ball = 4; int gender = Util.Rand.Next(2); int nature = Util.Rand.Next(25); gender = pk.GetSaneGender(gender); if (pk.Format <= 5) { pk.SetPIDGender(gender); pk.SetPIDNature(nature); pk.RefreshAbility(pk.PIDAbility); } else { pk.PID = Util.Rand32(); pk.Nature = nature; pk.Gender = gender; pk.RefreshAbility(Util.Rand.Next(2)); } bool traded = (int)Version == SAV.Game; var today = pk.MetDate = DateTime.Today; if (pk.GenNumber >= 4) { pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk, traded); pk.EggMetDate = today; } if (pk.Format < 6) { return(pk); } if (pk.Gen6) { pk.SetHatchMemory6(); } pk.SetRandomEC(); pk.RelearnMoves = moves; return(pk); }
public PKM ConvertToPKM(ITrainerInfo SAV) { int gen = Version.GetGeneration(); if (gen < 2) { gen = 2; Version = GameVersion.C; } var pk = PKMConverter.GetBlank(gen); SAV.ApplyToPKM(pk); pk.Species = Species; pk.Nickname = PKX.GetSpeciesNameGeneration(Species, SAV.Language, gen); pk.CurrentLevel = Level; pk.Version = (int)Version; int[] moves = GetCurrentEggMoves(pk); pk.Moves = moves; pk.SetMaximumPPCurrent(moves); pk.OT_Friendship = pk.PersonalInfo.BaseFriendship; pk.SetRandomIVs(flawless: 3); if (pk.Format <= 2 && Version != GameVersion.C) { return(pk); } pk.Met_Level = EncounterSuggestion.GetSuggestedEncounterEggMetLevel(pk); pk.Met_Location = Math.Max(0, EncounterSuggestion.GetSuggestedEggMetLocation(pk)); if (pk.Format < 3) { return(pk); } pk.Ball = 4; int gender = pk.PersonalInfo.RandomGender; int nature = Util.Rand.Next(25); if (pk.Format <= 5) { pk.SetPIDGender(gender); pk.Gender = gender; pk.SetPIDNature(nature); pk.Nature = nature; pk.RefreshAbility(pk.PIDAbility); } else { pk.PID = Util.Rand32(); pk.Nature = nature; pk.Gender = gender; pk.RefreshAbility(Util.Rand.Next(2)); } bool traded = (int)Version == SAV.Game; var today = pk.MetDate = DateTime.Today; if (pk.GenNumber >= 4) { pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk, traded); pk.EggMetDate = today; } if (pk.Format < 6) { return(pk); } if (pk.Gen6) { pk.SetHatchMemory6(); } switch (Species) { case 774: // Minior pk.AltForm = Util.Rand.Next(7, 14); break; case 664: // Scatterbug pk.AltForm = Legal.GetVivillonPattern(SAV.Country, SAV.SubRegion); break; } pk.SetRandomEC(); pk.RelearnMoves = moves; return(pk); }