From 4c73f1c592767153eaf71b37acf50abb21432409 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 5 May 2022 20:21:21 -0700 Subject: [PATCH] More strict alpha move check for statics --- .../EncounterStatic/EncounterStatic8a.cs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8a.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8a.cs index e81c1eaf8..06729dc18 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8a.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8a.cs @@ -51,6 +51,8 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve if (pk is PA8 pa) { + if (IsAlpha && Moves.Count != 0) + pa.AlphaMove = (ushort)Moves[0]; if (pa.AlphaMove != 0) pk.PushMove(pa.AlphaMove); pa.SetMasteryFlags(); @@ -125,9 +127,9 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve if (Mastery is not { } m) return true; - if (Species == (int)Core.Species.Kricketune && Level == 12) + if (IsAlpha && Moves.Count != 0) { - if (pkm is PA8 { AlphaMove: not (ushort)Move.FalseSwipe }) + if (pkm is PA8 pa && pa.AlphaMove != Moves[0]) return false; } @@ -151,9 +153,7 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve private OverworldParam8a GetParams() { - var pt = PersonalTable.LA; - var entry = pt.GetFormEntry(Species, Form); - var gender = (byte)entry.Gender; + var gender = GetGenderRatio(); return new OverworldParam8a { IsAlpha = IsAlpha, @@ -163,6 +163,21 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve GenderRatio = gender, }; } + + private byte GetGenderRatio() => Gender switch + { + 0 => PersonalInfo.RatioMagicMale, + 1 => PersonalInfo.RatioMagicFemale, + 2 => PersonalInfo.RatioMagicGenderless, + _ => GetGenderRatioPersonal(), + }; + + private byte GetGenderRatioPersonal() + { + var pt = PersonalTable.LA; + var entry = pt.GetFormEntry(Species, Form); + return (byte)entry.Gender; + } } public enum EncounterStatic8aCorrelation : byte