mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Update ereader 0IV detection
the ereader mons are nature/gender locked too, so unroll a little prior to rechecking the overall team (with ereader mon included). Have to do it this way as a lock can pop if the ereader data matches a prior spread before the prior teammate can be generated.
This commit is contained in:
parent
272a29a641
commit
90e5776dbc
3 changed files with 45 additions and 7 deletions
|
@ -49,9 +49,10 @@
|
|||
public static readonly TeamLock ETogepi = new TeamLock {
|
||||
Species = 175, // Togepi
|
||||
Locks = new[] {
|
||||
new NPCLock(302, 23, 0, 025), // Sableye (M) (Careful)
|
||||
new NPCLock(302, 23, 0, 127), // Sableye (M) (Careful)
|
||||
new NPCLock(088, 08, 0, 127), // Grimer (M) (Impish)
|
||||
new NPCLock(316, 24, 0, 127), // Gulpin (M) (Quirky)
|
||||
new NPCLock(175, 22, 1, 031), // Togepi (F) (Sassy) -- itself!
|
||||
}};
|
||||
|
||||
public static readonly TeamLock EMareep = new TeamLock {
|
||||
|
@ -60,6 +61,7 @@
|
|||
new NPCLock(300, 04, 1, 191), // Skitty (F) (Naughty)
|
||||
new NPCLock(211, 10, 1, 127), // Qwilfish (F) (Timid)
|
||||
new NPCLock(355, 12, 1, 127), // Duskull (F) (Serious)
|
||||
new NPCLock(179, 16, 1, 127), // Mareep (F) (Mild) -- itself!
|
||||
}};
|
||||
|
||||
public static readonly TeamLock EScizor = new TeamLock {
|
||||
|
@ -68,6 +70,7 @@
|
|||
new NPCLock(198, 13, 1, 191), // Murkrow (F) (Jolly)
|
||||
new NPCLock(344, 02, 2, 256), // Claydol (-) (Brave)
|
||||
new NPCLock(208, 03, 0, 127), // Steelix (M) (Adamant)
|
||||
new NPCLock(212, 11, 0, 127), // Scizor (M) (Hasty) -- itself!
|
||||
}};
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -61,17 +61,38 @@ namespace PKHeX.Core
|
|||
var deferred = new List<IEncounterable>();
|
||||
foreach (var z in GenerateRawEncounters3(pkm, info))
|
||||
{
|
||||
if (pkm.Version == 15)
|
||||
if (pkm.Version == (int)GameVersion.CXD) // C/XD
|
||||
{
|
||||
if (z is EncounterSlot w)
|
||||
{
|
||||
var seeds = MethodFinder.GetPokeSpotSeeds(pkm, w.SlotNumber).FirstOrDefault();
|
||||
info.PIDIV = seeds ?? info.PIDIV;
|
||||
}
|
||||
else if (z is EncounterStaticShadow s && !LockFinder.IsAllShadowLockValid(s, info.PIDIV, pkm))
|
||||
else if (z is EncounterStaticShadow s)
|
||||
{
|
||||
deferred.Add(s);
|
||||
continue;
|
||||
bool valid = false;
|
||||
if (s.IVs == null) // not ereader
|
||||
{
|
||||
valid = !LockFinder.IsAllShadowLockValid(s, info.PIDIV, pkm);
|
||||
}
|
||||
else
|
||||
{
|
||||
var possible = MethodFinder.GetColoEReaderMatches(pkm.EncryptionConstant);
|
||||
foreach (var poss in possible)
|
||||
{
|
||||
if (!LockFinder.IsAllShadowLockValid(s, poss, pkm))
|
||||
continue;
|
||||
valid = true;
|
||||
info.PIDIV = poss;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
deferred.Add(s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info.PIDIV.Type.IsCompatible3(z, pkm))
|
||||
|
|
|
@ -628,6 +628,22 @@ namespace PKHeX.Core
|
|||
return val;
|
||||
}
|
||||
|
||||
public static IEnumerable<PIDIV> GetColoEReaderMatches(uint PID)
|
||||
{
|
||||
var top = PID >> 16;
|
||||
var bot = (ushort)PID;
|
||||
var xdc = GetSeedsFromPIDEuclid(RNG.XDRNG, top, bot);
|
||||
foreach (var seed in xdc)
|
||||
{
|
||||
var B = RNG.XDRNG.Prev(seed);
|
||||
var A = RNG.XDRNG.Prev(B);
|
||||
|
||||
var C = RNG.XDRNG.Advance(A, 7);
|
||||
|
||||
yield return new PIDIV { OriginSeed = RNG.XDRNG.Prev(C), RNG = RNG.XDRNG, Type = PIDType.CXD };
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<PIDIV> GetPokeSpotSeeds(PKM pkm, int slot)
|
||||
{
|
||||
// Activate (rand % 3)
|
||||
|
@ -694,8 +710,6 @@ namespace PKHeX.Core
|
|||
return true;
|
||||
// forced shiny eggs, when hatched, can lose their detectable correlation.
|
||||
return g.IsEgg && !pkm.IsEgg && val == PIDType.None && (g.Method == PIDType.BACD_R_S || g.Method == PIDType.BACD_U_S);
|
||||
case EncounterStaticShadow d when d.EReader:
|
||||
return val == PIDType.None; // All IVs are 0
|
||||
case EncounterStatic s:
|
||||
switch (pkm.Version)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue