From 82f305cd36aeed66adc9c853872954b0a544dc55 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 12 Jul 2019 23:43:12 -0700 Subject: [PATCH] Fix dex gender set again Closes #2356 update test case to actually set a genderless gender --- PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs | 2 +- Tests/PKHeX.Core.Tests/Saves/PokeDex.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs index 5db344a0c..e98aa103a 100644 --- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs +++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs @@ -118,7 +118,7 @@ namespace PKHeX.Core protected void SetDexFlags(int baseBit, int formBit, int gender, int shiny, bool value = true) { - int shift = gender | (shiny << 1); + int shift = (gender & 1) | (shiny << 1); // Set the [Species/Gender/Shiny] Seen Flag SetFlag(OFS_SEEN + (shift * BitSeenSize), baseBit, value); diff --git a/Tests/PKHeX.Core.Tests/Saves/PokeDex.cs b/Tests/PKHeX.Core.Tests/Saves/PokeDex.cs index eaf4b1f63..0ee816931 100644 --- a/Tests/PKHeX.Core.Tests/Saves/PokeDex.cs +++ b/Tests/PKHeX.Core.Tests/Saves/PokeDex.cs @@ -1,7 +1,8 @@ using Xunit; using FluentAssertions; +using PKHeX.Core; -namespace PKHeX.Core.Tests.Saves +namespace PKHeX.Tests.Saves { public static class PokeDex { @@ -27,6 +28,7 @@ namespace PKHeX.Core.Tests.Saves private static void SetDexSpecies(SaveFile sav, int species, int regionSize) { var pk5 = new PK5 {Species = species, TID = 1337}; // non-shiny + pk5.Gender = pk5.GetSaneGender(); int boxofs = sav.GetBoxSlotOffset(0, 0); sav.SetStoredSlot(pk5, boxofs);