diff --git a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs index e214afe6f..a485f6dee 100644 --- a/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs +++ b/PKHeX.Core/Legality/RNG/ClassicEra/Gen4/MethodJ.cs @@ -65,6 +65,7 @@ public static LeadSeed GetSeed(TEnc enc, uint seed, byte format) private static bool IsFeebasChance(uint rand) => (rand >> 15) == 1; private static uint GetNature(uint rand) => rand / 0xA3Eu; + public static uint GetHoneyTreeLevel(uint rand) => 5 + (rand / 0x1745); // 5957; rand(11) using the pre-compiled rand function. /// /// Gets the first possible origin seed and lead for the input encounter & constraints. @@ -105,6 +106,13 @@ private static bool CheckEncounterActivation(T enc, ref LeadSeed result) // D/P/Pt don't update the rod rate boost for Suction Cups or Sticky Hold correctly. return IsFishPossible(enc.Type, ref result.Seed); } + if (enc.Type is HoneyTree) + { + // Doesn't actually consume the Encounter Slot call, we return true when comparing ESV. + // Roll forward once here rather than add a branch in each method. + ref var seed = ref result.Seed; + seed = LCRNG.Next(seed); + } // Can sweet scent trigger. return true; } @@ -122,6 +130,12 @@ private static bool CheckEncounterActivation(T enc, ref uint result) } return IsFishPossible(enc.Type, ref result); } + if (enc.Type is HoneyTree) + { + // Doesn't actually consume the Encounter Slot call, we return true when comparing ESV. + // Roll forward once here rather than add a branch in each method. + result = LCRNG.Next(result); + } // Can sweet scent trigger. return true; } @@ -414,9 +428,9 @@ private static bool IsSlotValid(T enc, uint u16SlotRand) return slot == enc.SlotNumber; } - private static bool IsLevelValid(T enc, byte min, byte max, byte format, uint u16LevelRand) where T : ILevelRange + private static bool IsLevelValid(T enc, byte min, byte max, byte format, uint u16LevelRand) where T : IEncounterSlot4 { - var level = GetExpectedLevel(enc, u16LevelRand); + var level = enc.Type is HoneyTree ? GetHoneyTreeLevel(u16LevelRand) : GetExpectedLevel(enc, u16LevelRand); return IsOriginalLevelValid(min, max, format, level); } diff --git a/PKHeX.Core/Legality/RNG/Frame/LeadRequired.cs b/PKHeX.Core/Legality/RNG/Frame/LeadRequired.cs index 03bddcbb1..f69b03542 100644 --- a/PKHeX.Core/Legality/RNG/Frame/LeadRequired.cs +++ b/PKHeX.Core/Legality/RNG/Frame/LeadRequired.cs @@ -27,7 +27,7 @@ public enum LeadRequired : byte /// or failed to activate. IntimidateKeenEyeFail, - /// or + /// or or Illuminate, /// or SuctionCups,