From 361f272fefea40784fe088b4e1ff6908e1d6dc8d Mon Sep 17 00:00:00 2001 From: ScarlettHaze <74013844+ScarlettHaze@users.noreply.github.com> Date: Fri, 7 Aug 2026 04:20:26 +0100 Subject: [PATCH] Exclude same gender rival in PokeGear callers for HGSS (#4848) Added functionality to exclude the opposite-gender rival (self) from PokeGear callers. * Remove Bike Shop from Pokegear callers list: It's not legally obtainable you only get called once you've used the Bike enough you never get to save it. * Exclude bike shop in caller list logic Updated logic to exclude both the rival and bike shop from the caller list. --- PKHeX.Core/Saves/SAV4HGSS.cs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Saves/SAV4HGSS.cs b/PKHeX.Core/Saves/SAV4HGSS.cs index 0a47a8764..1307dd08d 100644 --- a/PKHeX.Core/Saves/SAV4HGSS.cs +++ b/PKHeX.Core/Saves/SAV4HGSS.cs @@ -221,10 +221,27 @@ public Span GetPokeGearRoloDex() public void SetPokeGearRoloDex(ReadOnlySpan value) => value.CopyTo(GetPokeGearRoloDex()); + /// + /// Returns the player's own on-screen character (Ethan/Lyra), which should not appear as a phone contact. + /// + private PokegearNumber PlayerCharacterRival => Gender == 0 ? PokegearNumber.Ethan : PokegearNumber.Lyra; + public void PokeGearUnlockAllCallers() { + var excluded = PlayerCharacterRival; + var dex = GetPokeGearRoloDex(); + + int index = 0; for (int i = 0; i < GearCallerCount; i++) - SetCallerAtIndex(i, (PokegearNumber)i); + { + var caller = (PokegearNumber)i; + if (caller == excluded || caller == PokegearNumber.Bike_Shop) + continue; + dex[index++] = caller; + } + + // clear remaining callers + PokeGearClearAllCallers(index); } public void PokeGearClearAllCallers(int start = 0) @@ -244,17 +261,24 @@ public void PokeGearClearAllCallers(int start = 0) PokegearNumber.Daycare_Man, PokegearNumber.Daycare_Lady, PokegearNumber.Bill, - PokegearNumber.Bike_Shop, PokegearNumber.Baoba, ]; public void PokeGearUnlockAllCallersNoTrainers() { + var excluded = PlayerCharacterRival; var dex = GetPokeGearRoloDex(); - NotTrainers.CopyTo(dex); + + int index = 0; + foreach (var caller in NotTrainers) + { + if (caller == excluded) + continue; + dex[index++] = caller; + } // clear remaining callers - PokeGearClearAllCallers(NotTrainers.Length); + PokeGearClearAllCallers(index); } public Pokeathlon4 Pokeathlon => new(GeneralBuffer.Slice(0xD9D4, Pokeathlon4.SIZE)); // 0xB80