diff --git a/PKHeX.Core/Legality/Moves/GameData.cs b/PKHeX.Core/Legality/Moves/GameData.cs index a6728c892..005747027 100644 --- a/PKHeX.Core/Legality/Moves/GameData.cs +++ b/PKHeX.Core/Legality/Moves/GameData.cs @@ -58,7 +58,8 @@ public static Learnset GetLearnset(GameVersion game, int species, int form) Stadium => Legal.LevelUpY, Stadium2 => Legal.LevelUpGS, - _ => throw new ArgumentOutOfRangeException(nameof(game)), + + _ => throw new ArgumentOutOfRangeException(nameof(game), $"{game} is not a valid entry in the expression."), }; private static PersonalTable Personal(GameVersion game) => game switch @@ -104,7 +105,7 @@ public static Learnset GetLearnset(GameVersion game, int species, int form) Stadium => PersonalTable.Y, Stadium2 => PersonalTable.GS, - _ => throw new ArgumentOutOfRangeException(nameof(game)), + _ => throw new ArgumentOutOfRangeException(nameof(game), $"{game} is not a valid entry in the expression."), }; } } diff --git a/PKHeX.Core/MysteryGifts/PGF.cs b/PKHeX.Core/MysteryGifts/PGF.cs index 7b5c94cb2..2e2a620f9 100644 --- a/PKHeX.Core/MysteryGifts/PGF.cs +++ b/PKHeX.Core/MysteryGifts/PGF.cs @@ -52,7 +52,7 @@ public sealed class PGF : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, I public string Nickname { - get => StringConverter5.GetString(Data.AsSpan( 0x1E, 11 * 2)); + get => StringConverter5.GetString(Data.AsSpan(0x1E, 11 * 2)); set => StringConverter5.SetString(Data.AsSpan(0x1E, 11 * 2), value.AsSpan(), 11, StringConverterOption.ClearFF); } diff --git a/PKHeX.Core/MysteryGifts/WC8.cs b/PKHeX.Core/MysteryGifts/WC8.cs index 9a55c500f..f2eb1485c 100644 --- a/PKHeX.Core/MysteryGifts/WC8.cs +++ b/PKHeX.Core/MysteryGifts/WC8.cs @@ -88,6 +88,8 @@ public override Shiny Shiny var type = PIDType; if (type is not Shiny.FixedValue) return type; + if (IsHOMEGift && IsHOMEShinyPossible()) + return Shiny.Random; return GetShinyXor() switch { 0 => Shiny.AlwaysSquare, @@ -605,9 +607,9 @@ public override bool IsMatchExact(PKM pkm, DexLevel evo) if (!pkm.IsShiny) return false; } - else + else // Never or Random (HOME ID specific) { - if (pkm.IsShiny && !(TID == 0 && SID == 0 && PID != 0)) + if (pkm.IsShiny && !IsHOMEShinyPossible()) return false; } } @@ -673,6 +675,12 @@ public override bool IsMatchExact(PKM pkm, DexLevel evo) return pkm.PID == GetPID(pkm, type); } + private bool IsHOMEShinyPossible() + { + // no defined TID/SID and having a fixed PID can cause the player's TID/SID to match the PID's shiny calc. + return TID == 0 && SID == 0 && PID != 0; + } + protected override bool IsMatchDeferred(PKM pkm) => Species != pkm.Species; protected override bool IsMatchPartial(PKM pkm) => false; // no version compatibility checks yet. diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index dc4d5bde1..a74afdd1b 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -121,14 +121,13 @@ private void Initialize(GameVersion versionOverride) PokeDex = 0; } + private const int SIZE_RESERVED = 0x8000; // unpacked box data private readonly SAV1Offsets Offsets; // Event Flags protected override int EventFlagMax => 0xA00; // 320 * 8 protected override int EventConstMax => 0; - private const int SIZE_RESERVED = 0x8000; // unpacked box data - protected override byte[] GetFinalData() { var capacity = Japanese ? PokeListType.StoredJP : PokeListType.Stored;