PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5DR.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

30 lines
934 B
C#

namespace PKHeX.Core
{
/// <summary>
/// Generation 5 Dream Radar gift encounters
/// </summary>
/// <inheritdoc cref="EncounterStatic"/>
public sealed record EncounterStatic5DR : EncounterStatic5
{
public EncounterStatic5DR(int species, int form, AbilityPermission ability = AbilityPermission.OnlyHidden) : base(GameVersion.B2W2)
{
Species = species;
Form = form;
Ability = ability;
Location = 30015;
Gift = true;
Ball = 25;
Level = 5; // to 40
Shiny = Shiny.Never;
}
protected override bool IsMatchLevel(PKM pkm, IDexLevel evo)
{
// Level from 5->40 depends on the number of badges
var met = pkm.Met_Level;
if (met % 5 != 0)
return false;
return (uint) (met - 5) <= 35; // 5 <= x <= 40
}
}
}