From dd0d1fc07a96e42d3bd62113cad658992bd282d3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 2 Mar 2026 17:36:24 -0600 Subject: [PATCH] Misc dex state fixes Closes #4739 Closes #4740 Closes #4741 Co-Authored-By: Michael Bond --- .../PokeDex/Gen9/PokeDexEntry9Paldea.cs | 12 ++++++++++-- PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Gen9/PokeDexEntry9Paldea.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Gen9/PokeDexEntry9Paldea.cs index a3fefce86..0d35e0d2f 100644 --- a/PKHeX.Core/Saves/Substructures/PokeDex/Gen9/PokeDexEntry9Paldea.cs +++ b/PKHeX.Core/Saves/Substructures/PokeDex/Gen9/PokeDexEntry9Paldea.cs @@ -60,10 +60,18 @@ namespace PKHeX.Core; public bool IsSeen => GetState() >= 2; public bool IsCaught => GetState() >= 3; - public void SetCaught(bool value) => SetState(value ? 3u : 2u); + public void SetCaught(bool value) + { + if (value) + SetState(3u); + else if (GetState() == 3u) // only lower if currently caught + SetState(2u); + // state 0 or 1 or 2: no change + } + public void SetSeen(bool value) { - var newValue = !value ? 1 : Math.Min(GetState(), 2); + var newValue = !value ? 1 : Math.Max(GetState(), 2); SetState(newValue); } diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs index fb7cd235c..efc248646 100644 --- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs +++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs @@ -211,8 +211,8 @@ private bool GetIsSpeciesFormAnyDisplayed(int baseBit, int formBit) // Bulk Manipulation public override void SeenNone() => SetDexEntriesAll(false, shinyToo: true); - public override void CaughtNone() => SetAllCaught(false, true); - public override void SeenAll(bool shinyToo = false) => SetAllSeen(shinyToo); + public override void CaughtNone() => SetAllCaught(false, shinyToo: true); + public override void SeenAll(bool shinyToo = false) => SetAllSeen(shinyToo: shinyToo); public override void CompleteDex(bool shinyToo = false) => SetDexEntriesAll(shinyToo: shinyToo); public override void CaughtAll(bool shinyToo = false)