mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-15 05:35:33 -05:00
Add encounter static deferral oop
We've already been doing something similar for the deferral check; just merge the logic into the base object Closes #2489
This commit is contained in:
@@ -425,5 +425,14 @@ protected virtual bool IsMatchLevel(PKM pkm, int lvl)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IsMatchDeferred(PKM pkm)
|
||||
{
|
||||
if (pkm.FatefulEncounter != Fateful)
|
||||
return true;
|
||||
if (Ability == 4 && pkm.AbilityNumber != 4) // BW/2 Jellicent collision with wild surf slot, resolved by duplicating the encounter with any abil
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,5 +70,15 @@ public override bool IsMatch(PKM pkm, int lvl)
|
||||
|
||||
return base.IsMatch(pkm, lvl);
|
||||
}
|
||||
|
||||
public override bool IsMatchDeferred(PKM pkm)
|
||||
{
|
||||
if (base.IsMatchDeferred(pkm))
|
||||
return true;
|
||||
if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ private static IEnumerable<EncounterStatic> GetMatchingStaticEncounters(PKM pkm,
|
||||
if (!GetIsMatchStatic(pkm, e, lvl))
|
||||
continue;
|
||||
|
||||
if (GetIsMatchDeferred(pkm, e))
|
||||
if (e.IsMatchDeferred(pkm))
|
||||
deferred.Add(e);
|
||||
else
|
||||
yield return e;
|
||||
@@ -75,15 +75,6 @@ private static IEnumerable<EncounterStatic> GetMatchingStaticEncounters(PKM pkm,
|
||||
yield return e;
|
||||
}
|
||||
|
||||
private static bool GetIsMatchDeferred(PKM pkm, EncounterStatic e)
|
||||
{
|
||||
if (pkm.FatefulEncounter != e.Fateful)
|
||||
return true;
|
||||
if (e.Ability == 4 && pkm.AbilityNumber != 4) // BW/2 Jellicent collision with wild surf slot, resolved by duplicating the encounter with any abil
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool GetIsMatchStatic(PKM pkm, EncounterStatic e, int lvl)
|
||||
{
|
||||
if (!e.IsMatch(pkm, lvl))
|
||||
|
||||
Reference in New Issue
Block a user