mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
Check all locks for legality checking
Single->All
This commit is contained in:
parent
b5f128f2c4
commit
1b57acc6a7
2 changed files with 28 additions and 3 deletions
|
@ -69,7 +69,7 @@ namespace PKHeX.Core
|
|||
info.PIDIV = seeds ?? info.PIDIV;
|
||||
}
|
||||
else if (ParseSettings.FlagCXDShadowFirstLockMismatch
|
||||
&& z is EncounterStaticShadow s && !LockFinder.IsFirstShadowLockValid(s, info.PIDIV))
|
||||
&& z is EncounterStaticShadow s && !LockFinder.IsAllShadowLockValid(s, info.PIDIV))
|
||||
{
|
||||
deferred.Add(s);
|
||||
continue;
|
||||
|
|
|
@ -24,9 +24,9 @@ namespace PKHeX.Core
|
|||
public static bool FindLockSeed(uint originSeed, IEnumerable<NPCLock> lockList, bool XD, out uint origin)
|
||||
{
|
||||
var locks = new Stack<NPCLock>(lockList);
|
||||
var pids = new Stack<SeedFrame>();
|
||||
var team = new Stack<SeedFrame>();
|
||||
var cache = new FrameCache(RNG.XDRNG.Reverse(originSeed, 2), RNG.XDRNG.Prev);
|
||||
var result = FindLockSeed(cache, 0, locks, null, pids, XD, out var originFrame);
|
||||
var result = FindLockSeed(cache, 0, locks, null, team, XD, out var originFrame);
|
||||
origin = cache.GetSeed(originFrame);
|
||||
return result;
|
||||
}
|
||||
|
@ -117,6 +117,30 @@ namespace PKHeX.Core
|
|||
return IsFirstShadowLockValid(pv, s.Locks, s.Version == GameVersion.XD);
|
||||
}
|
||||
|
||||
public static bool IsAllShadowLockValid(EncounterStaticShadow s, PIDIV pv)
|
||||
{
|
||||
return IsAllShadowLockValid(pv, s.Locks, s.Version == GameVersion.XD);
|
||||
}
|
||||
|
||||
public static bool IsAllShadowLockValid(PIDIV pv, TeamLock[] teams, bool XD)
|
||||
{
|
||||
if (teams.Length == 0)
|
||||
return true;
|
||||
|
||||
foreach (var t in teams)
|
||||
{
|
||||
var locks = new Stack<NPCLock>(t.Locks);
|
||||
|
||||
var team = new Stack<SeedFrame>();
|
||||
var originSeed = pv.OriginSeed;
|
||||
var cache = new FrameCache(RNG.XDRNG.Reverse(originSeed, 2), RNG.XDRNG.Prev);
|
||||
var result = FindLockSeed(cache, 0, locks, null, team, XD, out var _);
|
||||
if (result)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFirstShadowLockValid(PIDIV pv, TeamLock[] teams, bool XD)
|
||||
{
|
||||
if (teams.Length == 0)
|
||||
|
@ -126,6 +150,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var locks = new Stack<NPCLock>(1);
|
||||
locks.Push(t.Locks[t.Locks.Length - 1]);
|
||||
|
||||
var team = new Stack<SeedFrame>();
|
||||
var originSeed = pv.OriginSeed;
|
||||
var cache = new FrameCache(RNG.XDRNG.Reverse(originSeed, 2), RNG.XDRNG.Prev);
|
||||
|
|
Loading…
Reference in a new issue