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.
This commit is contained in:
Kurt 2024-03-12 00:03:09 -05:00
parent 4435f032a5
commit 819f6009bf
3 changed files with 16 additions and 34 deletions

View file

@ -102,10 +102,8 @@ public static class MethodJ
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 @@ public static class MethodJ
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,

View file

@ -498,12 +498,16 @@ public static class MethodK
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 @@ public static class MethodK
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;
}

View file

@ -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,
};