PKHeX/PKHeX.Core/Legality/Tables/Tables.cs
Kurt 88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
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)
2023-01-21 20:02:33 -08:00

136 lines
5.4 KiB
C#

using System;
using System.Collections.Generic;
using static PKHeX.Core.Species;
namespace PKHeX.Core;
public static partial class Legal
{
/// <summary>
/// Generation 3 &amp; 4 Battle Frontier Species banlist. When referencing this in context to generation 4, be sure to disallow <see cref="Pichu"/> with Form 1 (Spiky).
/// </summary>
public static readonly HashSet<ushort> BattleFrontierBanlist = new()
{
(int)Mewtwo, (int)Mew,
(int)Lugia, (int)HoOh, (int)Celebi,
(int)Kyogre, (int)Groudon, (int)Rayquaza, (int)Jirachi, (int)Deoxys,
(int)Dialga, (int)Palkia, (int)Giratina, (int)Phione, (int)Manaphy, (int)Darkrai, (int)Shaymin, (int)Arceus,
(int)Victini, (int)Reshiram, (int)Zekrom, (int)Kyurem, (int)Keldeo, (int)Meloetta, (int)Genesect,
(int)Xerneas, (int)Yveltal, (int)Zygarde, (int)Diancie, (int)Hoopa, (int)Volcanion,
(int)Cosmog, (int)Cosmoem, (int)Solgaleo, (int)Lunala, (int)Necrozma, (int)Magearna, (int)Marshadow, (int)Zeraora,
(int)Meltan, (int)Melmetal,
(int)Koraidon, (int)Miraidon,
};
/// <summary>
/// Species that are from Mythical Distributions (disallowed species for competitive rulesets)
/// </summary>
public static readonly HashSet<ushort> Mythicals = new()
{
(int)Mew,
(int)Celebi,
(int)Jirachi, (int)Deoxys,
(int)Phione, (int)Manaphy, (int)Darkrai, (int)Shaymin, (int)Arceus,
(int)Victini, (int)Keldeo, (int)Meloetta, (int)Genesect,
(int)Diancie, (int)Hoopa, (int)Volcanion,
(int)Magearna, (int)Marshadow,
(int)Zeraora, (int)Meltan, (int)Melmetal,
(int)Zarude,
};
/// <summary>
/// Species classified as "Legend" by the game code.
/// </summary>
/// <remarks>Previous games may have included Mythicals in this species list, but that list should be considered separately.</remarks>
public static readonly HashSet<ushort> Legends = new()
{
(int)Mewtwo,
(int)Lugia, (int)HoOh,
(int)Kyogre, (int)Groudon, (int)Rayquaza,
(int)Dialga, (int)Palkia, (int)Giratina,
(int)Reshiram, (int)Zekrom, (int)Kyurem,
(int)Xerneas, (int)Yveltal, (int)Zygarde,
(int)Cosmog, (int)Cosmoem, (int)Solgaleo, (int)Lunala, (int)Necrozma,
(int)Zacian, (int)Zamazenta, (int)Eternatus, (int)Calyrex,
(int)Koraidon, (int)Miraidon,
};
/// <summary>
/// Species classified as "SubLegend" by the game code.
/// </summary>
public static readonly HashSet<ushort> SubLegends = new()
{
(int)Articuno, (int)Zapdos, (int)Moltres,
(int)Raikou, (int)Entei, (int)Suicune,
(int)Regirock, (int)Regice, (int)Registeel, (int)Latias, (int)Latios,
(int)Uxie, (int)Mesprit, (int)Azelf, (int)Heatran, (int)Regigigas, (int)Cresselia,
(int)Cobalion, (int)Terrakion, (int)Virizion, (int)Tornadus, (int)Thundurus, (int)Landorus,
(int)TypeNull, (int)Silvally, (int)TapuKoko, (int)TapuLele, (int)TapuBulu, (int)TapuFini,
(int)Kubfu, (int)Urshifu, (int)Regieleki, (int)Regidrago, (int)Glastrier, (int)Spectrier, (int)Enamorus,
(int)TingLu, (int)ChienPao, (int)WoChien, (int)ChiYu,
};
/// <summary>
/// Checks if the <see cref="species"/> is an Ultra Beast Pokémon.
/// </summary>
public static bool IsUltraBeast(ushort species) => species is
(int)Nihilego or (int)Buzzwole or (int)Pheromosa or (int)Xurkitree or (int)Celesteela or (int)Kartana or (int)Guzzlord or
(int)Poipole or (int)Naganadel or (int)Stakataka or (int)Blacephalon;
/// <summary>
/// Checks if the <see cref="species"/> is a Paradox Pokémon.
/// </summary>
public static bool IsParadox(ushort species) => species is (>= (int)GreatTusk and <= (int)IronThorns) or (int)RoaringMoon or (int)IronValiant;
/// <summary>
/// Species that evolve from a Bi-Gendered species into a Single-Gender.
/// </summary>
public static readonly HashSet<ushort> FixedGenderFromBiGender = new()
{
(int)Nincada,
(int)Shedinja, // (G)
(int)Burmy,
(int)Wormadam, //(F)
(int)Mothim, // (M)
(int)Ralts,
(int)Gallade, // (M)
(int)Snorunt,
(int)Froslass, // (F)
(int)Espurr,
(int)Meowstic, // (M/F) form specific
(int)Lechonk,
(int)Oinkologne, // (M/F) form specific
};
/// <summary>
/// Gets a permit list with the permitted indexes, then un-flags the indexes that are not permitted.
/// </summary>
/// <param name="max">Maximum index expected to allow</param>
/// <param name="allowed">Allowed indexes</param>
private static bool[] GetPermitList(int max, ReadOnlySpan<ushort> allowed)
{
var result = new bool[max + 1];
foreach (var index in allowed)
result[index] = true;
return result;
}
/// <summary>
/// Gets a permit list with the permitted indexes, then un-flags the indexes that are not permitted.
/// </summary>
/// <param name="max">Maximum index expected to allow</param>
/// <param name="allowed">Allowed indexes (may have some disallowed)</param>
/// <param name="disallow">Disallowed indexes</param>
private static bool[] GetPermitList(int max, ReadOnlySpan<ushort> allowed, ReadOnlySpan<ushort> disallow)
{
var result = GetPermitList(max, allowed);
foreach (var index in disallow)
result[index] = false;
return result;
}
}