mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
88830e0d00
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now. Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes. Adds functionality for Batch Editor commands to `>`, `<` and <=/>= TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants. Main window has a new layout to account for DPI scaling (8 point grid) Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724) Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720) Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714) Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691) Added: Properties for ribbon/mark count (closes #3659) Fixed: Traded SV eggs are now checked correctly (closes #3692)
76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <inheritdoc cref="EncounterArea" />
|
|
/// <summary>
|
|
/// <see cref="GameVersion.XD"/> encounter area
|
|
/// </summary>
|
|
public sealed record EncounterArea3XD : EncounterArea
|
|
{
|
|
public readonly EncounterSlot3PokeSpot[] Slots;
|
|
|
|
protected override IReadOnlyList<EncounterSlot3PokeSpot> Raw => Slots;
|
|
|
|
public EncounterArea3XD(int loc, ushort s0, byte l0, ushort s1, byte l1, ushort s2, byte l2) : base(GameVersion.XD)
|
|
{
|
|
Location = loc;
|
|
Type = SlotType.Grass;
|
|
Slots = new[]
|
|
{
|
|
new EncounterSlot3PokeSpot(this, s0, 10, l0, 0),
|
|
new EncounterSlot3PokeSpot(this, s1, 10, l1, 1),
|
|
new EncounterSlot3PokeSpot(this, s2, 10, l2, 2),
|
|
};
|
|
}
|
|
|
|
public override IEnumerable<EncounterSlot3PokeSpot> GetMatchingSlots(PKM pk, EvoCriteria[] chain)
|
|
{
|
|
if (pk.Format != 3) // Met Location and Met Level are changed on PK3->PK4
|
|
return GetSlotsFuzzy(chain);
|
|
if (pk.Met_Location != Location)
|
|
return Array.Empty<EncounterSlot3PokeSpot>();
|
|
return GetSlotsMatching(chain, pk.Met_Level);
|
|
}
|
|
|
|
private IEnumerable<EncounterSlot3PokeSpot> GetSlotsMatching(EvoCriteria[] chain, int lvl)
|
|
{
|
|
foreach (var slot in Slots)
|
|
{
|
|
foreach (var evo in chain)
|
|
{
|
|
if (slot.Species != evo.Species)
|
|
continue;
|
|
|
|
if (slot.Form != evo.Form)
|
|
break;
|
|
if (!slot.IsLevelWithinRange(lvl))
|
|
break;
|
|
|
|
yield return slot;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private IEnumerable<EncounterSlot3PokeSpot> GetSlotsFuzzy(EvoCriteria[] chain)
|
|
{
|
|
foreach (var slot in Slots)
|
|
{
|
|
foreach (var evo in chain)
|
|
{
|
|
if (slot.Species != evo.Species)
|
|
continue;
|
|
|
|
if (slot.Form != evo.Form)
|
|
break;
|
|
if (slot.LevelMin > evo.LevelMax)
|
|
break;
|
|
|
|
yield return slot;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|