mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Branch to specific iterator
Similar to fuzzy matches for gen3/4 iterators
This commit is contained in:
parent
42453bdcd8
commit
780e8bf2bf
|
|
@ -30,8 +30,15 @@ public override bool IsMatchLocation(int location)
|
|||
public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyList<EvoCriteria> chain)
|
||||
{
|
||||
// wild area gets boosted up to level 60 post-game
|
||||
bool isBoosted = pkm.Met_Level == 60 && (IsWildArea8(Location) || IsWildArea8Armor(Location));
|
||||
var met = pkm.Met_Level;
|
||||
bool isBoosted = met == 60 && (IsWildArea8(Location) || IsWildArea8Armor(Location));
|
||||
if (isBoosted)
|
||||
return GetBoostedMatches(chain);
|
||||
return GetUnboostedMatches(chain, met);
|
||||
}
|
||||
|
||||
private IEnumerable<EncounterSlot> GetUnboostedMatches(IReadOnlyList<EvoCriteria> chain, int met)
|
||||
{
|
||||
foreach (var slot in Slots)
|
||||
{
|
||||
foreach (var evo in chain)
|
||||
|
|
@ -39,7 +46,7 @@ public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyLi
|
|||
if (slot.Species != evo.Species)
|
||||
continue;
|
||||
|
||||
if (!slot.IsLevelWithinRange(pkm.Met_Level) && !isBoosted)
|
||||
if (!slot.IsLevelWithinRange(met))
|
||||
break;
|
||||
|
||||
if (slot.Form != evo.Form && !Legal.WildChangeFormAfter.Contains(evo.Species))
|
||||
|
|
@ -51,6 +58,26 @@ public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyLi
|
|||
}
|
||||
}
|
||||
|
||||
private IEnumerable<EncounterSlot> GetBoostedMatches(IReadOnlyList<EvoCriteria> chain)
|
||||
{
|
||||
foreach (var slot in Slots)
|
||||
{
|
||||
foreach (var evo in chain)
|
||||
{
|
||||
if (slot.Species != evo.Species)
|
||||
continue;
|
||||
|
||||
// Ignore met level comparison; we already know it is permissible to boost to level 60.
|
||||
|
||||
if (slot.Form != evo.Form && !Legal.WildChangeFormAfter.Contains(evo.Species))
|
||||
break;
|
||||
|
||||
yield return slot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWildArea8(int loc) => 122 <= loc && loc <= 154; // Rolling Fields -> Lake of Outrage
|
||||
public static bool IsWildArea8Armor(int loc) => 164 <= loc && loc <= 194; // Fields of Honor -> Honeycalm Island
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user