mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 13:28:35 +00:00
Handle Gift method2 eggs better
Set PID correctly Defer on fateful (wynaut egg clash, hot springs)
This commit is contained in:
parent
c8726c4e2d
commit
e4e3d929a0
1 changed files with 18 additions and 3 deletions
|
@ -195,6 +195,7 @@ public sealed class EncounterGift3 : IEncounterable, IEncounterMatch, IMoveset,
|
|||
Shiny.Never when Method is BACD_U_AX => GetAntishiny(ref seed, idXor),
|
||||
Shiny.Never => GetRegularAntishiny(ref seed, idXor),
|
||||
Shiny.Always => GetForceShiny(ref seed, idXor),
|
||||
_ when Method is Method_2 => GetMethod2(ref seed),
|
||||
_ => GetRegular(ref seed),
|
||||
};
|
||||
if (criteria.IsSpecifiedNature() && criteria.Nature != (Nature)(pid % 25))
|
||||
|
@ -210,6 +211,15 @@ public sealed class EncounterGift3 : IEncounterable, IEncounterMatch, IMoveset,
|
|||
}
|
||||
}
|
||||
|
||||
private static uint GetMethod2(ref uint seed)
|
||||
{
|
||||
var a = LCRNG.Next16(ref seed);
|
||||
var b = LCRNG.Next16(ref seed);
|
||||
var pid = GenerateMethodH.GetPIDRegular(a, b);
|
||||
seed = LCRNG.Next(seed); // VBlank
|
||||
return pid;
|
||||
}
|
||||
|
||||
private static uint SetPINGAChannel(PK3 pk, EncounterCriteria criteria)
|
||||
{
|
||||
while (true)
|
||||
|
@ -330,7 +340,12 @@ public sealed class EncounterGift3 : IEncounterable, IEncounterMatch, IMoveset,
|
|||
return true;
|
||||
}
|
||||
|
||||
public EncounterMatchRating GetMatchRating(PKM pk) => EncounterMatchRating.Match;
|
||||
public EncounterMatchRating GetMatchRating(PKM pk)
|
||||
{
|
||||
if (IsEgg && pk.IsEgg && FatefulEncounter != pk.FatefulEncounter)
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
return EncounterMatchRating.Match;
|
||||
}
|
||||
|
||||
public bool IsTrainerMatch(PKM pk, ReadOnlySpan<char> trainer, int language) => true; // checked in explicit match
|
||||
|
||||
|
@ -349,7 +364,7 @@ public sealed class EncounterGift3 : IEncounterable, IEncounterMatch, IMoveset,
|
|||
|
||||
return Method switch
|
||||
{
|
||||
BACD_U => true,
|
||||
BACD_U => type is BACD_U,
|
||||
BACD_R => IsRestrictedSimple(ref value, type),
|
||||
BACD_R_A => IsRestrictedAnti(ref value, type),
|
||||
BACD_U_AX => IsUnrestrictedAntiX(ref value, type),
|
||||
|
@ -359,7 +374,7 @@ public sealed class EncounterGift3 : IEncounterable, IEncounterMatch, IMoveset,
|
|||
BACD_RBCD => IsBerryFixShiny(ref value, type),
|
||||
BACD_M => IsMystryMew(ref value, type),
|
||||
Channel => IsChannelJirachi(ref value, type),
|
||||
Method_2 => true,
|
||||
Method_2 => type is Method_2,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue