Fix MethodJ enc->pkm nature check

silly differences; MethodJ should have been /A3E not %25
Make GetNature public, and have the MethodK esv modulo be uint instead of long for better clarity.
This commit is contained in:
Kurt 2024-11-09 21:37:03 -06:00
parent 38756b44c7
commit d77d6b7ce6
4 changed files with 6 additions and 6 deletions

View file

@ -37,11 +37,11 @@ public static class GenerateMethodJ
continue;
}
}
var esv = LCRNG.Next16(ref seed) / 656;
var esv = LCRNG.Next16(ref seed) / 656u;
if (esv < min || esv > max)
continue;
var lv = randLevel ? LCRNG.Next16(ref seed) : 0;
var nature = LCRNG.Next16(ref seed) % 25;
var nature = MethodJ.GetNature(LCRNG.Next16(ref seed));
if (criteria.IsSpecifiedNature() && nature != (byte)criteria.Nature)
continue;

View file

@ -23,7 +23,7 @@ public static class GenerateMethodK
var ability = criteria.GetAbilityFromNumber(AbilityPermission.Any12);
var (min, max) = SlotMethodK.GetRange(enc.Type, enc.SlotNumber);
bool randLevel = MethodK.IsLevelRand(enc);
var modulo = enc.Type.IsSafari() ? 10 : 100;
var modulo = enc.Type.IsSafari() ? 10u : 100u;
bool checkProc = MethodK.IsEncounterCheckApplicable(enc.Type);
// Generate Method K correlated PID and IVs, no lead (keep things simple).
@ -42,7 +42,7 @@ public static class GenerateMethodK
if (esv < min || esv > max)
continue;
var lv = randLevel ? LCRNG.Next16(ref seed) : 0;
var nature = LCRNG.Next16(ref seed) % 25;
var nature = MethodK.GetNature(LCRNG.Next16(ref seed));
if (criteria.IsSpecifiedNature() && nature != (byte)criteria.Nature)
continue;

View file

@ -64,7 +64,7 @@ public static class MethodJ
private static bool IsFeebasChance(uint rand) => (rand >> 15) == 1;
private static uint GetNature(uint rand) => rand / 0xA3Eu;
public 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.
/// <summary>

View file

@ -65,7 +65,7 @@ public static class MethodK
//private static bool IsIntimidateKeenEyeFail(uint rand) => (rand & 1) != 1;
private static bool IsIntimidateKeenEyePass(uint rand) => (rand & 1) == 1;
private static uint GetNature(uint rand) => rand % 25;
public static uint GetNature(uint rand) => rand % 25;
/// <summary>
/// Gets the first possible origin seed and lead for the input encounter &amp; constraints.