From 5de825de512b1f7af64fa1aacf10cb43c0181ef5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 21 Jan 2023 22:01:50 -0800 Subject: [PATCH] Disallow matching if notradeback loc wiped Closes #3710 --- .../Encounters/EncounterStatic/EncounterStatic2.cs | 9 +++++++-- .../Misc/251 - CELEBI - E96B nomet notradeback.pk2 | Bin 0 -> 73 bytes 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Tests/PKHeX.Core.Tests/Legality/Illegal/Misc/251 - CELEBI - E96B nomet notradeback.pk2 diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs index 14bad4b5b..73cc77c7f 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs @@ -71,8 +71,13 @@ protected override bool IsMatchLocation(PKM pk) return true; if (Location == 0) return true; - if (pk is ICaughtData2 {CaughtData: not 0}) - return Location == pk.Met_Location; + if (pk is ICaughtData2 c2) + { + if (c2.CaughtData is not 0) + return Location == pk.Met_Location; + if (pk.Species == (int)Core.Species.Celebi) + return false; // Cannot reset the Met data + } return true; } diff --git a/Tests/PKHeX.Core.Tests/Legality/Illegal/Misc/251 - CELEBI - E96B nomet notradeback.pk2 b/Tests/PKHeX.Core.Tests/Legality/Illegal/Misc/251 - CELEBI - E96B nomet notradeback.pk2 new file mode 100644 index 0000000000000000000000000000000000000000..160d5efead57b515ef4f72262ec76b0f79cccb51 GIT binary patch literal 73 zcmZSl{r@+^?QcJ>w`^w!Wk3Ln8c9}uRyT$Q205T$77#iyxB{UEgGb-SbpcS&)Y9G3 I*a7AM03^^AJOBUy literal 0 HcmV?d00001