mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
509e2f1fa3
Closes #2726 1. Add variant evolutions to form-match cases 2. Ban LGPE origin alolan raichu 3. Add egg form check for unavailable regional forms 4. Previous commit fixed mew (remove ribbon interface from WB7) Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
48 lines
No EOL
1.7 KiB
C#
48 lines
No EOL
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <inheritdoc />
|
|
/// <summary>
|
|
/// <see cref="GameVersion.GG"/> encounter area
|
|
/// </summary>
|
|
public sealed class EncounterArea7b : EncounterArea32
|
|
{
|
|
private const int CatchComboBonus = 1;
|
|
|
|
protected override IEnumerable<EncounterSlot> GetMatchFromEvoLevel(PKM pkm, IEnumerable<EvoCriteria> vs, int minLevel)
|
|
{
|
|
var slots = Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= (slot.LevelMin - CatchComboBonus)));
|
|
|
|
// Get slots where pokemon can exist with respect to level constraints
|
|
return slots.Where(s => s.IsLevelWithinRange(minLevel, minLevel, 0, CatchComboBonus));
|
|
}
|
|
|
|
protected override IEnumerable<EncounterSlot> GetFilteredSlots(PKM pkm, IEnumerable<EncounterSlot> slots, int minLevel)
|
|
{
|
|
int species = pkm.Species;
|
|
|
|
int form = pkm.AltForm;
|
|
if (Legal.AlolanVariantEvolutions12.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(species)) // match form if same species, else form 0.
|
|
{
|
|
if (pkm.AltForm != 0 && pkm is PB7)
|
|
yield break; // can't get Alolan forms from wild
|
|
|
|
foreach (var slot in slots)
|
|
{
|
|
if (species == slot.Species ? slot.Form == form : slot.Form == 0)
|
|
yield return slot;
|
|
}
|
|
}
|
|
else if (form == 0)
|
|
{
|
|
// enforce no form
|
|
foreach (var slot in slots)
|
|
{
|
|
yield return slot;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |