From 53e0046a48869e1bed39b7dc92b2bc722bff41a9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 22 Dec 2020 09:09:49 -0800 Subject: [PATCH] SWSH has some form entries with different base friendship (stunfisk) --- PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs index 54b2324e0..255afe169 100644 --- a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs @@ -81,7 +81,7 @@ private void VerifyOTFriendship(LegalityAnalysis data, bool neverOT, int origin, const int vc = 7; // VC transfers use SM personal info var evos = data.Info.EvoChainsAllGens[vc]; var fs = pkm.OT_Friendship; - if (evos.All(z => GetBaseFriendship(vc, z.Species) != fs)) + if (evos.All(z => GetBaseFriendship(vc, z.Species, z.Form) != fs)) data.AddLine(GetInvalid(LegalityCheckStrings.LMemoryStatFriendshipOTBaseEvent)); } else if (neverOT) @@ -89,7 +89,8 @@ private void VerifyOTFriendship(LegalityAnalysis data, bool neverOT, int origin, // Verify the original friendship value since it cannot change from the value it was assigned in the original generation. // If none match, then it is not a valid OT friendship. var fs = pkm.OT_Friendship; - if (GetBaseFriendship(origin, data.Info.EncounterMatch.Species) != fs) + var enc = data.Info.EncounterMatch; + if (GetBaseFriendship(origin, enc.Species, enc.Form) != fs) data.AddLine(GetInvalid(LegalityCheckStrings.LMemoryStatFriendshipOTBaseEvent)); } } @@ -186,7 +187,7 @@ public static bool GetCanOTHandle(IEncounterable enc, PKM pkm, int gen) }; } - private static int GetBaseFriendship(int gen, int species) + private static int GetBaseFriendship(int gen, int species, int form) { return gen switch { @@ -195,7 +196,7 @@ private static int GetBaseFriendship(int gen, int species) 6 => PersonalTable.AO[species].BaseFriendship, 7 => PersonalTable.USUM[species].BaseFriendship, - 8 => PersonalTable.SWSH[species].BaseFriendship, + 8 => PersonalTable.SWSH.GetFormEntry(species, form).BaseFriendship, _ => throw new IndexOutOfRangeException(), }; }