2020-01-04 19:44:16 +00:00
|
|
|
|
using static PKHeX.Core.Encounters8Nest;
|
2019-11-24 06:23:43 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
2019-11-19 03:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generation 8 Nest Encounter (Distributed Data)
|
|
|
|
|
/// </summary>
|
2020-11-27 19:51:02 +00:00
|
|
|
|
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
2020-12-24 04:40:59 +00:00
|
|
|
|
public sealed record EncounterStatic8ND : EncounterStatic8Nest<EncounterStatic8ND>
|
2019-11-19 03:23:01 +00:00
|
|
|
|
{
|
2021-01-04 00:49:49 +00:00
|
|
|
|
public EncounterStatic8ND(byte lvl, byte dyna, byte flawless, GameVersion game = GameVersion.SWSH) : base(game)
|
2019-11-24 06:23:43 +00:00
|
|
|
|
{
|
|
|
|
|
Level = lvl;
|
|
|
|
|
DynamaxLevel = dyna;
|
|
|
|
|
FlawlessIVCount = flawless;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-26 17:31:21 +00:00
|
|
|
|
protected override bool IsMatchLevel(PKM pkm, DexLevel evo)
|
|
|
|
|
{
|
|
|
|
|
var lvl = pkm.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 (lvl % 5 != 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// shared nests can be down-leveled to any
|
|
|
|
|
if (pkm.Met_Location == SharedNest)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// native down-levels: only allow 1 rank down (1 badge 2star -> 25), (3badge 3star -> 35)
|
|
|
|
|
var badges = (lvl - 20) / 5;
|
|
|
|
|
return badges is 1 or 3 && !pkm.IsShiny;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-24 06:23:43 +00:00
|
|
|
|
protected override bool IsMatchLocation(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
var loc = pkm.Met_Location;
|
2020-10-24 18:16:01 +00:00
|
|
|
|
return loc == SharedNest || EncounterArea8.IsWildArea(loc);
|
2019-11-24 06:23:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
public override bool IsMatch(PKM pkm, DexLevel evo)
|
2019-11-19 03:23:01 +00:00
|
|
|
|
{
|
2019-11-24 06:23:43 +00:00
|
|
|
|
if (pkm.FlawlessIVCount < FlawlessIVCount)
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
return base.IsMatch(pkm, evo);
|
2019-11-19 03:23:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-22 15:07:50 +00:00
|
|
|
|
}
|