mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 00:34:20 -05:00
enc->pk: Minor perf improvement
Move the %25 into the Criteria check method; only done in 1 method rather than across a few dozen. can potentially skip % operations depending on inputs. also inline some gender calls where gender isn't needed further in the generation pattern, so it can be skipped.
This commit is contained in:
@@ -217,6 +217,20 @@ public bool IsSatisfiedNature(Nature nature)
|
||||
return nature == Nature || Mutations.HasFlag(CanMintNature);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the Generation 3/4 PID satisfies the Nature criteria.
|
||||
/// </summary>
|
||||
/// <param name="pid">The original PID to check.</param>
|
||||
/// <returns><see langword="true"/> if the Nature satisfies the criteria; otherwise, <see langword="false"/>.</returns>
|
||||
public bool IsSatisfiedNature(uint pid)
|
||||
{
|
||||
if (Mutations.HasFlag(AllowOnlyNeutralNature))
|
||||
return ((Nature)(pid % 25)).IsNeutral;
|
||||
if (Nature == Nature.Random)
|
||||
return true;
|
||||
return Mutations.HasFlag(CanMintNature) || ((Nature)(pid % 25)) == Nature;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified level satisfies the level range criteria.
|
||||
/// </summary>
|
||||
|
||||
@@ -97,7 +97,7 @@ private uint GetRandomPID(in EncounterCriteria criteria, byte gr, uint id32)
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(gender))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedAbility() && !criteria.IsSatisfiedAbility((byte)(pid % 2)))
|
||||
continue;
|
||||
|
||||
@@ -137,7 +137,7 @@ private static bool SetRoamerPINGA(PK3 pk, in EncounterCriteria criteria)
|
||||
var rand2 = LCRNG.Prev16(ref state);
|
||||
var rand1 = LCRNG.Prev16(ref state);
|
||||
var pid = (rand2 << 16) | rand1;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
bool shiny = ShinyUtil.GetIsShiny3(id32, pid);
|
||||
if (criteria.Shiny.IsShiny() != shiny)
|
||||
@@ -166,11 +166,10 @@ private static bool TrySetMethod1(PK3 pk, in EncounterCriteria criteria, byte gr
|
||||
{
|
||||
var seed = LCRNG.Prev2(s); // Unwind the RNG to get the real origin seed for the PID/IV
|
||||
var pid = ClassicEraRNG.GetSequentialPID(seed);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(gender))
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
|
||||
var abit = (int)(pid & 1);
|
||||
@@ -179,7 +178,6 @@ private static bool TrySetMethod1(PK3 pk, in EncounterCriteria criteria, byte gr
|
||||
|
||||
pk.PID = pid;
|
||||
pk.IV32 |= iv2 << 15 | iv1;
|
||||
pk.Gender = gender;
|
||||
pk.RefreshAbility(abit);
|
||||
return true;
|
||||
}
|
||||
@@ -198,7 +196,7 @@ private static void SetMethod1(PK3 pk, in EncounterCriteria criteria, byte gr, u
|
||||
if (criteria.Shiny.IsShiny() != shiny)
|
||||
continue;
|
||||
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
|
||||
@@ -202,7 +202,7 @@ private uint SetPINGA(PK3 pk, in EncounterCriteria criteria, PersonalInfo3 pi)
|
||||
_ when Method is Method_2 => GetMethod2(ref seed),
|
||||
_ => GetRegular(ref seed),
|
||||
};
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
@@ -255,7 +255,7 @@ private static bool TrySetWishmkrShiny(PK3 pk, in EncounterCriteria criteria)
|
||||
{
|
||||
uint seed = s;
|
||||
var pid = GetRegular(ref seed);
|
||||
if (filterNature && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (filterNature && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
|
||||
var iv32 = ClassicEraRNG.GetSequentialIVs(ref seed);
|
||||
@@ -301,7 +301,7 @@ private static uint SetPINGAChannel(PK3 pk, in EncounterCriteria criteria)
|
||||
continue;
|
||||
SetValuesFromSeedChannel(pk, seed);
|
||||
var pid = pk.EncryptionConstant;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
if (criteria.Shiny.IsShiny() != ShinyUtil.GetIsShiny3(pk.ID32, pid))
|
||||
continue; // try again
|
||||
@@ -317,7 +317,7 @@ private static uint SetPINGAChannel(PK3 pk, in EncounterCriteria criteria)
|
||||
SetValuesFromSeedChannel(pk, seed);
|
||||
|
||||
var pid = pk.EncryptionConstant;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
if (criteria.Shiny.IsShiny() != ShinyUtil.GetIsShiny3(pk.ID32, pid))
|
||||
continue; // try again
|
||||
|
||||
@@ -79,7 +79,7 @@ private static void SetPINGA(PK3 pk, in EncounterCriteria criteria, PersonalInfo
|
||||
while (true)
|
||||
{
|
||||
var pid = CommonEvent3.GetRegularAntishiny(ref seed, idXor);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
|
||||
@@ -80,10 +80,9 @@ private static void SetPINGA(PK3 pk, in EncounterCriteria criteria, PersonalInfo
|
||||
while (true)
|
||||
{
|
||||
var pid = CommonEvent3.GetAntishiny(ref seed, idXor);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue; // try again
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(gender))
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
var iv32 = ClassicEraRNG.GetSequentialIVs(ref seed);
|
||||
if (criteria.IsSpecifiedHiddenPower() && !criteria.IsSatisfiedHiddenPower(iv32))
|
||||
|
||||
@@ -102,7 +102,7 @@ private uint GetRandomPID(in EncounterCriteria criteria, byte gr, uint id32, out
|
||||
gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(gender))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedAbility() && !criteria.IsSatisfiedAbility((byte)(pid % 2)))
|
||||
continue;
|
||||
|
||||
@@ -135,7 +135,7 @@ private static bool TrySetMethod1(PK4 pk, in EncounterCriteria criteria, byte gr
|
||||
{
|
||||
var seed = LCRNG.Prev2(s); // Unwind the RNG to get the real origin seed for the PID/IV
|
||||
var pid = ClassicEraRNG.GetSequentialPID(seed);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
@@ -167,7 +167,7 @@ private static void SetMethod1(PK4 pk, in EncounterCriteria criteria, byte gr, u
|
||||
if (criteria.Shiny.IsShiny() != shiny)
|
||||
continue;
|
||||
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
@@ -206,7 +206,7 @@ private static bool TrySetChainShiny(PK4 pk, in EncounterCriteria criteria, byte
|
||||
var shiny = ShinyUtil.GetIsShiny3(id32, pid);
|
||||
if (criteria.Shiny.IsShiny() != shiny)
|
||||
continue;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
@@ -234,7 +234,7 @@ private static void SetChainShiny(PK4 pk, in EncounterCriteria criteria, byte gr
|
||||
while (true)
|
||||
{
|
||||
var pid = ClassicEraRNG.GetChainShinyPID(ref seed, id32);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
|
||||
@@ -27,7 +27,7 @@ public static class MethodCXD
|
||||
// * => IV, IV, ability, PID, PID
|
||||
var s = XDRNG.Next3(seed);
|
||||
uint pid = GetPID(s, id32, noShiny);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
@@ -65,7 +65,7 @@ public static bool SetFromIVs<TEntity>(TEntity pk, in EncounterCriteria criteria
|
||||
// * => IV, IV, ability, PID, PID
|
||||
var s = XDRNG.Next3(seed);
|
||||
uint pid = GetPID(s, id32, noShiny);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gr)))
|
||||
continue;
|
||||
@@ -122,7 +122,7 @@ public static bool SetStarterFromTrainerID(CK3 pk, in EncounterCriteria criteria
|
||||
pid = GetColoStarterPID(ref s, id32);
|
||||
}
|
||||
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
// fixed gender & never shiny, ignore
|
||||
|
||||
@@ -166,7 +166,7 @@ public static bool SetStarterFirstFromIVs(CK3 pk, in EncounterCriteria criteria)
|
||||
var id32 = sid << 16 | tid;
|
||||
|
||||
uint pid = GetColoStarterPID(ref s, id32);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
// fixed gender & never shiny, ignore
|
||||
|
||||
@@ -280,7 +280,7 @@ public static bool SetStarterFromTrainerID(XK3 pk, in EncounterCriteria criteria
|
||||
var s = XDRNG.Next7(seed); // tid/sid (2), fake pid (2), ivs (2), ability (1)
|
||||
|
||||
uint pid = GetPID(s);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPID(pid, EntityGender.VM)))
|
||||
continue;
|
||||
@@ -319,7 +319,7 @@ public static bool SetStarterFromIVs(XK3 pk, in EncounterCriteria criteria)
|
||||
var s = XDRNG.Next3(seed);
|
||||
|
||||
uint pid = GetPID(s);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var tid = XDRNG.Prev3(seed) >> 16;
|
||||
@@ -359,7 +359,7 @@ public static void SetStarterRandom(XK3 pk, in EncounterCriteria criteria, uint
|
||||
// Get PID
|
||||
seed = XDRNG.Next7(seed); // tid, sid, fakePID x2, IVs x2, ability* => pid1, pid2
|
||||
var pid = GetPIDRegular(ref seed);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPID(pid, EntityGender.VM)))
|
||||
continue;
|
||||
@@ -407,7 +407,7 @@ public static void SetStarterRandom(XK3 pk, in EncounterCriteria criteria, uint
|
||||
{
|
||||
// fakePID x2, IVs x2, ability, pid1*, pid2
|
||||
var pid = GetPIDReuse(ref seed, id32, noShiny);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gender)))
|
||||
continue;
|
||||
@@ -451,7 +451,7 @@ public static void SetRandom<T>(T pk, in EncounterCriteria criteria, PersonalInf
|
||||
{
|
||||
// fakePID x2, IVs x2, ability, pid1*, pid2
|
||||
var pid = GetPIDReuse(ref seed, id32, noShiny);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gender)))
|
||||
continue;
|
||||
|
||||
@@ -258,7 +258,7 @@ public static uint GetRandomPID(uint id32, in EncounterCriteria criteria, byte g
|
||||
continue;
|
||||
}
|
||||
var pid = GetPIDRegular(ref seed);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedGender() && !criteria.IsSatisfiedGender(EntityGender.GetFromPIDAndRatio(pid, gender)))
|
||||
continue;
|
||||
|
||||
@@ -98,7 +98,7 @@ public static void SetRandomUnown<T>(this T enc, PK3 pk, in EncounterCriteria cr
|
||||
continue;
|
||||
|
||||
// Check the nature is what the user requested.
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
break;
|
||||
|
||||
var iv32 = ClassicEraRNG.GetSequentialIVs(ref seed);
|
||||
@@ -132,12 +132,12 @@ public bool SetFromIVs(PK3 pk, PersonalInfo3 pi, in EncounterCriteria criteria,
|
||||
var a = LCRNG.Next16(ref s);
|
||||
var b = LCRNG.Next16(ref s);
|
||||
var pid = GetPIDRegular(a, b);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
{
|
||||
// Try again as Method 2 (AB-DE)
|
||||
var o = seed >> 16;
|
||||
pid = GetPIDRegular(o, a);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
seed = LCRNG.Prev(seed);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public bool SetFromIVs(PK3 pk, PersonalInfo3 pi, in EncounterCriteria criteria,
|
||||
var a = LCRNG.Next16(ref s);
|
||||
var b = LCRNG.Next16(ref s);
|
||||
var pid = GetPIDRegular(a, b);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
@@ -219,12 +219,12 @@ public bool SetFromIVsUnown(PK3 pk, in EncounterCriteria criteria)
|
||||
var a = LCRNG.Next16(ref s);
|
||||
var b = LCRNG.Next16(ref s);
|
||||
var pid = GetPIDUnown(a, b);
|
||||
if ((criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25))) || EntityPID.GetUnownForm3(pid) != enc.Form)
|
||||
if ((criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid)) || EntityPID.GetUnownForm3(pid) != enc.Form)
|
||||
{
|
||||
// Try again as Method 2 (BA-DE)
|
||||
var o = seed >> 16;
|
||||
pid = GetPIDUnown(o, a);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
var form = EntityPID.GetUnownForm3(pid);
|
||||
if (form != enc.Form)
|
||||
@@ -252,7 +252,7 @@ public bool SetFromIVsUnown(PK3 pk, in EncounterCriteria criteria)
|
||||
var a = LCRNG.Next16(ref s);
|
||||
var b = LCRNG.Next16(ref s);
|
||||
var pid = GetPIDUnown(a, b);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
var form = EntityPID.GetUnownForm3(pid);
|
||||
if (form != enc.Form)
|
||||
|
||||
@@ -125,7 +125,7 @@ public bool SetFromIVsJ(PK4 pk, PersonalInfo4 pi, in EncounterCriteria criteria,
|
||||
var pid = GetPIDRegular(a, b);
|
||||
if (criteria.Shiny.IsShiny() != ShinyUtil.GetIsShiny3(id32, pid))
|
||||
continue;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
|
||||
@@ -126,7 +126,7 @@ public bool SetFromIVsK(PK4 pk, PersonalInfo4 pi, in EncounterCriteria criteria,
|
||||
var a = LCRNG.Next16(ref s);
|
||||
var b = LCRNG.Next16(ref s);
|
||||
var pid = GetPIDRegular(a, b);
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
|
||||
var gender = EntityGender.GetFromPIDAndRatio(pid, gr);
|
||||
|
||||
@@ -171,7 +171,7 @@ private static void SetPINGAManaphy(PK4 pk4, in EncounterCriteria criteria, ITra
|
||||
var a = LCRNG.Next16(ref seed);
|
||||
var b = LCRNG.Next16(ref seed);
|
||||
var pid = (b << 16) | a;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
var c = LCRNG.Next15(ref seed);
|
||||
var d = LCRNG.Next15(ref seed);
|
||||
@@ -209,7 +209,7 @@ private static bool TrySetManaphyFromIVs(PK4 pk4, in EncounterCriteria criteria,
|
||||
// Check for anti-shiny.
|
||||
var xor = (a ^ b) >> 3;
|
||||
bool arng = false;
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ private static bool TrySetManaphyFromIVs(PK4 pk4, in EncounterCriteria criteria,
|
||||
arng = true;
|
||||
break;
|
||||
}
|
||||
if (!criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (!criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ private static uint GetPID(PK4 pk4, PersonalInfo4 pi, in EncounterCriteria crite
|
||||
break;
|
||||
pid = ARNG.Next(pid);
|
||||
}
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature((Nature)(pid % 25)))
|
||||
if (criteria.IsSpecifiedNature() && !criteria.IsSatisfiedNature(pid))
|
||||
continue;
|
||||
if (EntityGender.GetFromPIDAndRatio(pid, gr) != gender)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user