From 819f6009bfa827a64b28ec7078cc82e146d2e2de Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 12 Mar 2024 00:03:09 -0500 Subject: [PATCH] Fix some gen4 fish slot check inaccuracies Pt doesn't do Sticky Hold/Suction Cups right for fishing (not just D/P) HGSS has a follower boost that is now implemented lol at my GetSuperRod comparing range wrong for slot4 For HGSS follower boost, don't bother indicating differently even though it's not entirely transparent. We just assume the most permissive case (+50) even though people looking to replicate in-game might not have >= 250 friendship. --- .../Legality/RNG/ClassicEra/Gen4/MethodJ.cs | 31 ++----------------- .../Legality/RNG/ClassicEra/Gen4/MethodK.cs | 17 +++++++--- .../RNG/ClassicEra/Gen4/SlotMethodK.cs | 2 +- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs index a481cab1b..e214afe6f 100644 --- a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs +++ b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs @@ -102,10 +102,8 @@ private static bool CheckEncounterActivation(T enc, ref LeadSeed result) if (!IsValidCoronetB1F(s4, ref result.Seed)) return false; } - // D/P don't reference Suction Cups or Sticky Hold. - return enc is IVersion { Version: Pt } - ? IsFishPossible(enc.Type, ref result.Seed, ref result.Lead) - : IsFishPossible(enc.Type, ref result.Seed); + // D/P/Pt don't update the rod rate boost for Suction Cups or Sticky Hold correctly. + return IsFishPossible(enc.Type, ref result.Seed); } // Can sweet scent trigger. return true; @@ -471,31 +469,6 @@ private static bool IsFishPossible(SlotType4 encType, ref uint seed) return false; } - private static bool IsFishPossible(SlotType4 encType, ref uint seed, ref LeadRequired lead) - { - var rodRate = GetRodRate(encType); - var u16 = seed >> 16; - var roll = u16 / 656; - if (roll < rodRate) - { - seed = LCRNG.Prev(seed); - return true; - } - - if (lead != None) - return false; - - // Suction Cups / Sticky Hold - if (roll < rodRate * 2) - { - seed = LCRNG.Prev(seed); - lead = SuctionCups; - return true; - } - - return false; - } - private static byte GetRodRate(SlotType4 type) => type switch { Old_Rod => 25, diff --git a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodK.cs b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodK.cs index 0e272884a..fec5ead12 100644 --- a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodK.cs +++ b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodK.cs @@ -498,12 +498,16 @@ private static bool IsFishPossible(SlotType4 encType, ref uint seed, ref LeadReq var rodRate = GetRodRate(encType); var u16 = seed >> 16; var roll = u16 % 100; - if (roll < rodRate) + + // HG/SS: Lead (Following) Pokémon with >= 250 adds +50 to the rate. Assume the best case. + rodRate += 50; // This happens before Suction Cups / Sticky Hold, can be compounded. + if (roll < rodRate) // This will always succeed for Good/Super rod due to the base+bonus being >=100 { seed = LCRNG.Prev(seed); return true; } + // Old Rod might reach here (75% < 100%) if (lead != None) return false; @@ -514,20 +518,25 @@ private static bool IsFishPossible(SlotType4 encType, ref uint seed, ref LeadReq lead = SuctionCups; return true; } - return false; } + // Lead is something else, and cannot be changed. Does the same as the above method without a ref LeadRequired. private static bool IsFishPossible(SlotType4 encType, ref uint seed) { - var rate = GetRodRate(encType); + var rodRate = GetRodRate(encType); var u16 = seed >> 16; var roll = u16 % 100; - if (roll < rate) + + // HG/SS: Lead (Following) Pokémon with >= 250 adds +50 to the rate. Assume the best case. + rodRate += 50; // This happens before Suction Cups / Sticky Hold, can be compounded. + if (roll < rodRate) // This will always succeed for Good/Super rod due to the base+bonus being >=100 { seed = LCRNG.Prev(seed); return true; } + + // Old Rod might reach here (75% < 100%) return false; } diff --git a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/SlotMethodK.cs b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/SlotMethodK.cs index 2d5c2d474..f3ba41f58 100644 --- a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/SlotMethodK.cs +++ b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/SlotMethodK.cs @@ -59,7 +59,7 @@ public static class SlotMethodK < 70 => 1, // 40,69 (30%) < 85 => 2, // 70,84 (15%) < 95 => 3, // 85,94 (10%) - 99 => 4, // 95 ( 5%) + <100 => 4, // 95 ( 5%) _ => Invalid, };