PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8NC.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00

32 lines
929 B
C#

using static PKHeX.Core.Encounters8Nest;
namespace PKHeX.Core;
/// <summary>
/// Generation 8 Nest Encounter (Distributed Crystal Data)
/// </summary>
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
public sealed record EncounterStatic8NC(GameVersion Version) : EncounterStatic8Nest<EncounterStatic8NC>(Version)
{
protected override bool IsMatchLocation(PKM pk)
{
var loc = pk.Met_Location;
return loc is SharedNest or Watchtower;
}
protected override bool IsMatchLevel(PKM pk, EvoCriteria evo)
{
var lvl = pk.Met_Level;
if (lvl == Level)
return true;
// Check downleveled (20-55)
if (lvl > Level)
return false;
if (lvl is < 20 or > 55)
return false;
if (pk.Met_Location == Watchtower && pk.IsShiny)
return false; // host cannot downlevel and be shiny
return lvl % 5 == 0;
}
}