diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterSlot3.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterSlot3.cs index 3c0b87ec0..f4099f934 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterSlot3.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterSlot3.cs @@ -32,6 +32,7 @@ public record EncounterSlot3(EncounterArea3 Parent, ushort Species, byte Form, b public PK3 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria) { int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)tr.Language); + var version = Version != GameVersion.RSE ? Version : GameVersion.RSE.Contains(tr.Game) ? (GameVersion)tr.Game : GameVersion.E; var pk = new PK3 { Species = Species, @@ -40,7 +41,7 @@ public record EncounterSlot3(EncounterArea3 Parent, ushort Species, byte Form, b Met_Location = Location, Met_Level = LevelMin, - Version = (byte)Version, + Version = (byte)version, Ball = (byte)GetRequiredBall(Ball.Poke), Language = lang, diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs index 7f1bee1fb..b2495693a 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs @@ -108,7 +108,7 @@ public sealed record EncounterSlot6AO(EncounterArea6AO Parent, ushort Species, b pk.Nature = (int)criteria.GetNature(Nature.Random); pk.Gender = criteria.GetGender(-1, PersonalTable.AO.GetFormEntry(Species, Form)); pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability)); - pk.SetRandomIVs(); + criteria.SetRandomIVs(pk); } #endregion diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterSlot8.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterSlot8.cs index b776268a7..747c83bca 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterSlot8.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterSlot8.cs @@ -97,11 +97,19 @@ public sealed record EncounterSlot8(EncounterArea8 Parent, ushort Species, byte var req = GetRequirement(pk); if (req != MustHave) { - pk.EncryptionConstant = Util.Rand32(); + var pi = PersonalTable.SWSH[Species, Form]; + var rand = Util.Rand; + pk.EncryptionConstant = rand.Rand32(); + pk.PID = rand.Rand32(); + criteria.SetRandomIVs(pk); + pk.Gender = criteria.GetGender(-1, pi); + pk.Nature = pk.StatNature = (int)criteria.GetNature(Nature.Random); + pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability)); return; } // Don't bother honoring shiny state. Overworld8RNG.ApplyDetails(pk, c, Shiny.Random); + pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability)); } public OverworldCorrelation8Requirement GetRequirement(PKM pk) diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8.cs index c47085ee5..b00a089b2 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8.cs @@ -115,11 +115,19 @@ public sealed record EncounterStatic8(GameVersion Version = GameVersion.SWSH) var req = GetRequirement(pk); if (req != MustHave) { - pk.EncryptionConstant = Util.Rand32(); + var pi = PersonalTable.SWSH[Species, Form]; + var rand = Util.Rand; + pk.EncryptionConstant = rand.Rand32(); + pk.PID = rand.Rand32(); + criteria.SetRandomIVs(pk); + pk.Gender = criteria.GetGender(-1, pi); + pk.Nature = pk.StatNature = (int)criteria.GetNature(Nature.Random); + pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability)); return; } var shiny = Shiny == Shiny.Random ? Shiny.FixedValue : Shiny; Overworld8RNG.ApplyDetails(pk, criteria, shiny, FlawlessIVCount); + pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability)); } #endregion diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8a/EncounterSlot8a.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8a/EncounterSlot8a.cs index 45c39c093..4a7510302 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8a/EncounterSlot8a.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8a/EncounterSlot8a.cs @@ -42,13 +42,17 @@ public sealed record EncounterSlot8a(EncounterArea8a Parent, ushort Species, byt Species = Species, Form = Form, CurrentLevel = LevelMin, - OT_Friendship = PersonalTable.LA[Species, Form].BaseFriendship, Met_Location = Location, Met_Level = LevelMin, - Version = (int)Version, + Version = (byte)GameVersion.PLA, IsAlpha = IsAlpha, Ball = (int)Ball.LAPoke, + OT_Name = tr.OT, + OT_Gender = tr.Gender, + ID32 = tr.ID32, + OT_Friendship = PersonalTable.LA[Species, Form].BaseFriendship, + HeightScalar = IsAlpha ? (byte)255 : PokeSizeUtil.GetRandomScalar(), WeightScalar = IsAlpha ? (byte)255 : PokeSizeUtil.GetRandomScalar(), Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation), diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterStatic8b.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterStatic8b.cs index 52fa5c0c9..c0a4a01b6 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterStatic8b.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterStatic8b.cs @@ -16,7 +16,7 @@ public sealed record EncounterStatic8b(GameVersion Version) public bool EggEncounter => EggLocation != None; private const ushort None = Locations.Default8bNone; public byte Form => 0; - public bool IsShiny => Shiny != Shiny.Never; + public bool IsShiny => Shiny == Shiny.Always; public byte LevelMin => Level; public byte LevelMax => Level; diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs index 1e5d22700..f1b95c02d 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs @@ -90,6 +90,7 @@ public sealed record EncounterSlot9(EncounterArea9 Parent, ushort Species, byte { int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)tr.Language); var form = GetWildForm(Form); + var version = Version != GameVersion.SV ? Version : GameVersion.SV.Contains(tr.Game) ? (GameVersion)tr.Game : GameVersion.SL; var pk = new PK9 { Species = Species, @@ -97,7 +98,7 @@ public sealed record EncounterSlot9(EncounterArea9 Parent, ushort Species, byte CurrentLevel = LevelMin, Met_Location = Location, Met_Level = LevelMin, - Version = (byte)Version, + Version = (byte)version, Ball = (byte)Ball.Poke, MetDate = EncounterDate.GetDateSwitch(), @@ -129,7 +130,7 @@ public sealed record EncounterSlot9(EncounterArea9 Parent, ushort Species, byte { pk.PID = Util.Rand32(); pk.EncryptionConstant = Util.Rand32(); - pk.SetRandomIVs(); + criteria.SetRandomIVs(pk); pk.Nature = pk.StatNature = (int)criteria.GetNature(Nature.Random); pk.Gender = criteria.GetGender(Gender, PersonalTable.SV[pk.Species, pk.Form]);