From 4d60a5a64ed332b0c2c23c2691826622faedbbbb Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 7 May 2018 22:53:36 -0700 Subject: [PATCH] More generator updates * first case of EncounterLink, now works (version, ability, OT memory) * handle gen2 gb events (not even sure if they pop up, just in case) * handle gen3 ereader shadow mons * handle gen4 spiky pichu PID type * handle gen2 crystal egg met level --- PKHeX.Core/Legality/Encounters/EncounterLink.cs | 10 +++++++--- PKHeX.Core/Legality/Encounters/EncounterStatic.cs | 6 +++++- .../Encounters/Information/EncounterSuggestion.cs | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/EncounterLink.cs b/PKHeX.Core/Legality/Encounters/EncounterLink.cs index 43c2678ce..06728c8a3 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterLink.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterLink.cs @@ -58,19 +58,23 @@ public PKM ConvertToPKM(ITrainerInfo SAV) }; SAV.ApplyToPKM(pk); + pk.Version = (int)version; pk.Language = lang; - var moves = Moves.Length != 0 ? Moves : Legal.GetEncounterMoves(pk, Level, (GameVersion)version); + var moves = 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); - pk.RefreshAbility(Ability); + pk.RefreshAbility(Ability >> 1); if (RelearnMoves != null) pk.RelearnMoves = RelearnMoves; if (RibbonClassic) pk.RibbonClassic = true; - if (!OT) + + if (OT) + pk.SetRandomMemory6(); + else SAV.ApplyHandlingTrainerInfo(pk); return pk; diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic.cs index b85c3f3f8..d81541996 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic.cs @@ -99,8 +99,8 @@ public PKM ConvertToPKM(ITrainerInfo SAV) if (EggEncounter) { bool traded = (int)Version == SAV.Game; - pk.Met_Level = EncounterSuggestion.GetSuggestedEncounterEggMetLevel(pk); pk.Met_Location = Math.Max(0, EncounterSuggestion.GetSuggestedEggMetLocation(pk)); + pk.Met_Level = EncounterSuggestion.GetSuggestedEncounterEggMetLevel(pk); if (pk.GenNumber >= 4) { pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk, traded); @@ -177,6 +177,9 @@ private int GetEdgeCaseLanguage(PKM pk, int lang) pk.TID = 22796; pk.OT_Name = lang == 1 ? "ゲーフリ" : "GF"; return lang; + case 1 when Version == GameVersion.EventsGBGen1: + case 2 when Version == GameVersion.EventsGBGen2: + case 3 when this is EncounterStaticShadow s && s.EReader: case 3 when Species == 151: pk.OT_Name = "ゲーフリ"; return 1; // Old Sea Map was only distributed to Japanese games. @@ -194,6 +197,7 @@ private PIDType GetPIDType() return PIDType.Method_1_Roamer; case 4 when Shiny == Shiny.Always: // Lake of Rage Gyarados return PIDType.ChainShiny; + case 4 when Species == 172: // Spiky Eared Pichu case 4 when Location == 233: // Pokéwalker return PIDType.Pokewalker; case 5 when Shiny == Shiny.Always: diff --git a/PKHeX.Core/Legality/Encounters/Information/EncounterSuggestion.cs b/PKHeX.Core/Legality/Encounters/Information/EncounterSuggestion.cs index fcb7e2ce0..4b1a37d0e 100644 --- a/PKHeX.Core/Legality/Encounters/Information/EncounterSuggestion.cs +++ b/PKHeX.Core/Legality/Encounters/Information/EncounterSuggestion.cs @@ -43,7 +43,7 @@ public static int GetSuggestedEncounterEggMetLevel(PKM pkm) if (!pkm.IsNative && pkm.GenNumber < 5) return pkm.CurrentLevel; // be generous with transfer conditions if (pkm.Format < 5) // and native - return 0; + return pkm.Format == 2 && pkm.Met_Location != 0 ? 1 : 0; return 1; // gen5+ }