PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8U.cs
Kurt ef3cb34387
Refactor EvoCriteria to be a struct, reduce allocation (#3483)
* Make EvolutionCriteria struct

8 bytes per object instead of 26
Unify LevelMin/LevelMax to match EncounterTemplate
bubble up precise array type for better iteration

* Inline queue operations, less allocation

* Inline some logic

* Update EvolutionChain.cs

* Improve clarity on duplicate move check

* Search reverse

For a dual stage chain, finds it first iteration rather than second.
2022-04-23 21:33:17 -07:00

33 lines
1 KiB
C#

using static PKHeX.Core.Encounters8Nest;
namespace PKHeX.Core
{
/// <summary>
/// Generation 8 Nest Encounter (Max Raid) Underground
/// </summary>
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
public sealed record EncounterStatic8U : EncounterStatic8Nest<EncounterStatic8U>
{
public override int Location { get => MaxLair; init { } }
public EncounterStatic8U(ushort species, byte form, byte level) : base(GameVersion.SWSH) // no difference in met location for hosted raids
{
Species = species;
Form = form;
Level = level;
DynamaxLevel = 8;
FlawlessIVCount = 4;
}
public override bool IsMatchExact(PKM pkm, IDexLevel evo)
{
if (pkm.FlawlessIVCount < FlawlessIVCount)
return false;
return base.IsMatchExact(pkm, evo);
}
// no downleveling, unlike all other raids
protected override bool IsMatchLevel(PKM pkm, IDexLevel evo) => pkm.Met_Level == Level;
}
}