mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-25 08:10:48 -05:00
Fix check order for Pressure/Hustle/Vital Spirit
what a silly set of conditions for it to matter -- we need to permit matching of boosted slots, then enforce that the boosting is valid for the slot, and disallow any other lead. If it couldn't be boosted, then ignore the slot. https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=288731
This commit is contained in:
parent
5b89b279d1
commit
7ac5da37b3
|
|
@ -75,7 +75,7 @@ public byte GetPressureMax(ushort species, byte levelMax)
|
|||
{
|
||||
if (slot.Species != species)
|
||||
continue;
|
||||
if (slot.LevelMax < levelMax)
|
||||
if (slot.LevelMax <= levelMax)
|
||||
continue;
|
||||
levelMax = slot.LevelMax;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,10 @@ public bool IsMatchExact(PKM pk, EvoCriteria evo)
|
|||
{
|
||||
// Must match level exactly.
|
||||
if (!this.IsLevelWithinRange(pk.MetLevel))
|
||||
return false;
|
||||
{
|
||||
if ((Type is not Grass || pk.MetLevel != PressureLevel) || ParseSettings.RNGFrameNotFound4 != Severity.Invalid)
|
||||
return false; // Only allow Pressure Slots through if they'll be checked by the later Lead verification.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ private static bool TryGetMatch<T>(T enc, byte levelMin, byte levelMax, uint see
|
|||
return TryGetMatchNoSync(ctx, out result);
|
||||
}
|
||||
var syncProc = IsSyncPass(p0);
|
||||
if (syncProc)
|
||||
if (syncProc && !(enc.Type is Grass && enc.LevelMax < levelMin))
|
||||
{
|
||||
var ctx = new FrameCheckDetails<T>(enc, seed, levelMin, levelMax, format);
|
||||
if (IsSlotValidRegular(ctx, out seed))
|
||||
|
|
@ -278,6 +278,21 @@ private static bool IsSlotValidHustleVitalFail<T>(in FrameCheckDetails<T> ctx, o
|
|||
private static bool TryGetMatchNoSync<T>(in FrameCheckDetails<T> ctx, out LeadSeed result)
|
||||
where T : IEncounterSlot4
|
||||
{
|
||||
if (ctx.Encounter.Type is Grass)
|
||||
{
|
||||
if (ctx.Encounter.LevelMax > ctx.LevelMin) // Must be boosted via Pressure/Hustle/Vital Spirit
|
||||
{
|
||||
if (IsSlotValidHustleVital(ctx, out var pressure))
|
||||
{ result = new(pressure, PressureHustleSpirit); return true; }
|
||||
result = default; return false;
|
||||
}
|
||||
if (ctx.Encounter.PressureLevel <= ctx.LevelMax) // Can be boosted, or not.
|
||||
{
|
||||
if (IsSlotValidHustleVital(ctx, out var pressure))
|
||||
{ result = new(pressure, PressureHustleSpirit); return true; }
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSlotValidRegular(ctx, out uint seed))
|
||||
{ result = new(seed, None); return true; }
|
||||
|
||||
|
|
@ -293,8 +308,6 @@ private static bool TryGetMatchNoSync<T>(in FrameCheckDetails<T> ctx, out LeadSe
|
|||
|
||||
if (IsSlotValidStaticMagnet(ctx, out seed, out var lead))
|
||||
{ result = new(seed, lead); return true; }
|
||||
if (IsSlotValidHustleVital(ctx, out seed))
|
||||
{ result = new(seed, PressureHustleSpirit); return true; }
|
||||
if (IsSlotValidIntimidate(ctx, out seed))
|
||||
{ result = new(seed, IntimidateKeenEyeFail); return true; }
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ private static bool TryGetMatch<T>(T enc, byte levelMin, byte levelMax, uint see
|
|||
if (depth != 4 && enc is EncounterSlot4 s && (s.IsBugContest || s.IsSafariHGSS))
|
||||
return Recurse4x(enc, levelMin, levelMax, seed, nature, format, out result, ++depth);
|
||||
}
|
||||
else if (IsSyncPass(p0))
|
||||
else if (IsSyncPass(p0) && !(enc.Type is Grass && enc.LevelMax < levelMin))
|
||||
{
|
||||
var ctx = new FrameCheckDetails<T>(enc, seed, levelMin, levelMax, format);
|
||||
if (IsSlotValidRegular(ctx, out seed))
|
||||
|
|
@ -300,6 +300,21 @@ private static bool IsSlotValidHustleVitalFail<T>(in FrameCheckDetails<T> ctx, o
|
|||
private static bool TryGetMatchNoSync<T>(in FrameCheckDetails<T> ctx, out LeadSeed result)
|
||||
where T : IEncounterSlot4
|
||||
{
|
||||
if (ctx.Encounter.Type is Grass)
|
||||
{
|
||||
if (ctx.Encounter.LevelMax < ctx.LevelMin) // Must be boosted via Pressure/Hustle/Vital Spirit
|
||||
{
|
||||
if (IsSlotValidHustleVital(ctx, out var pressure))
|
||||
{ result = new(pressure, PressureHustleSpirit); return true; }
|
||||
result = default; return false;
|
||||
}
|
||||
if (ctx.Encounter.PressureLevel <= ctx.LevelMax) // Can be boosted, or not.
|
||||
{
|
||||
if (IsSlotValidHustleVital(ctx, out var pressure))
|
||||
{ result = new(pressure, PressureHustleSpirit); return true; }
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSlotValidRegular(ctx, out uint seed))
|
||||
{ result = new(seed, None); return true; }
|
||||
|
||||
|
|
@ -315,8 +330,6 @@ private static bool TryGetMatchNoSync<T>(in FrameCheckDetails<T> ctx, out LeadSe
|
|||
|
||||
if (IsSlotValidStaticMagnet(ctx, out seed, out var sm))
|
||||
{ result = new(seed, sm); return true; }
|
||||
if (IsSlotValidHustleVital(ctx, out seed))
|
||||
{ result = new(seed, PressureHustleSpirit); return true; }
|
||||
if (IsSlotValidIntimidate(ctx, out seed))
|
||||
{ result = new(seed, IntimidateKeenEyeFail); return true; }
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user