From 6d2de333bfe895d3d35a3e96819fd78754bbfb7d Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 22 Jan 2024 18:51:55 -0800 Subject: [PATCH] Add formarg deferral for wild annihilape/kingambit Closes #4167 Also add form bypass for Gen6 Deerling slot that changed form in SV. --- .../Encounters/Templates/Gen6/EncounterSlot6AO.cs | 9 ++++++++- .../Encounters/Templates/Gen9/EncounterSlot9.cs | 10 ++++++++++ ...★ - Deerling - 11D0C90A7F2F pk6 formchange.pk9 | Bin 0 -> 344 bytes .../FormArg/0979 - Second Wind - F595DB8A1056.pk9 | Bin 0 -> 344 bytes .../0983 - Kingambit - 6BE42E9A9EF4 0 asKing.pk9 | Bin 0 -> 344 bytes ...983 - Kingambit - 6BE72E9A9EF4 3 asBisharp.pk9 | Bin 0 -> 344 bytes 6 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/0585-01 ★ - Deerling - 11D0C90A7F2F pk6 formchange.pk9 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0979 - Second Wind - F595DB8A1056.pk9 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE42E9A9EF4 0 asKing.pk9 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE72E9A9EF4 3 asBisharp.pk9 diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs index 320ef92c0..0c863964e 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterSlot6AO.cs @@ -127,7 +127,14 @@ public bool IsMatchExact(PKM pk, EvoCriteria evo) return false; if (evo.Form != Form && !IsRandomUnspecificForm) - return false; + { + if (Species is not ((ushort)Core.Species.Deerling or (ushort)Core.Species.Sawsbuck)) + return false; + + // Deerling can change between forms if imported to a future Gen8+ game. + if (pk.Format < 8 || evo.Form >= 4) + return false; + } return true; } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs index ebc974a4b..c3a053a85 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterSlot9.cs @@ -238,7 +238,17 @@ public EncounterMatchRating GetMatchRating(PKM pk) if (m.RibbonMarkDawn && !CanSpawnAtTime(RibbonIndex.MarkDawn)) return EncounterMatchRating.DeferredErrors; } + + if (IsFormArgDeferralRelevant(pk.Species) && pk is IFormArgument f) + { + bool isFormArg0 = f.FormArgument == 0; + bool mustBeZero = IsFormArgDeferralRelevant(Species); + if (isFormArg0 != mustBeZero) + return EncounterMatchRating.DeferredErrors; + } return EncounterMatchRating.Match; + + static bool IsFormArgDeferralRelevant(ushort species) => species is (ushort)Core.Species.Kingambit or (ushort)Core.Species.Annihilape; } #endregion } diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/0585-01 ★ - Deerling - 11D0C90A7F2F pk6 formchange.pk9 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/0585-01 ★ - Deerling - 11D0C90A7F2F pk6 formchange.pk9 new file mode 100644 index 0000000000000000000000000000000000000000..7944c585a720e99c46a7e593bf85c1a947d0aa1e GIT binary patch literal 344 zcmdO|=Q_#2a6!UY~6Tnr3z8GsxhSjTVloQsQzff3BZPc-W{qbP7;NCmePE3Y(qO^=5a+`cU}HD|%}NEDlmaymp~j7okwF*C6=&z=V_L% literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0979 - Second Wind - F595DB8A1056.pk9 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0979 - Second Wind - F595DB8A1056.pk9 new file mode 100644 index 0000000000000000000000000000000000000000..dd7f47cc141614395584dfa7ae4c17e84dd780a6 GIT binary patch literal 344 zcmWF&=(^3oF!k#vW(`L5C%y3wPW%iF3@i*Fz*B0Q$;Zb8Wc~RAB-lV=2;hKV0$FN? zYAF0*hE#@RhJ1!Rh7<+`hH!>VFbkxlk~y6rm~kc}mxc%zvX&K$D*G4B0*NpRBa4&5 zHUcX)138%h2mrdu1?Z|2Agn}DdlJqQ=Mi^hU|7Py>5!RX0&gyAhi J2g6~YA^=*M9wPt% literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE42E9A9EF4 0 asKing.pk9 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE42E9A9EF4 0 asKing.pk9 new file mode 100644 index 0000000000000000000000000000000000000000..f47ccf53b22b7a8e1660fd9dea8291d7f9af9db0 GIT binary patch literal 344 zcmew|ZGEzI~f8P;u%_issK5i7~KE> literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE72E9A9EF4 3 asBisharp.pk9 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 9/FormArg/0983 - Kingambit - 6BE72E9A9EF4 3 asBisharp.pk9 new file mode 100644 index 0000000000000000000000000000000000000000..a015b8df51b146955e6f246ad29cedd6c778aad9 GIT binary patch literal 344 zcmew|Z