2022-08-29 23:08:30 +00:00
using System ;
2021-08-15 03:20:13 +00:00
using System.Collections.Generic ;
2021-01-01 23:01:22 +00:00
using static PKHeX . Core . Species ;
2017-02-13 07:08:39 +00:00
2022-06-18 18:04:24 +00:00
namespace PKHeX.Core ;
public static partial class Legal
2016-10-25 03:04:47 +00:00
{
2022-06-18 18:04:24 +00:00
/// <summary>
/// Generation 3 & 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>
2022-08-27 06:43:36 +00:00
public static readonly HashSet < ushort > BattleFrontierBanlist = new ( )
2022-06-18 18:04:24 +00:00
{
( 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 ,
2022-11-25 01:42:17 +00:00
( int ) Koraidon , ( int ) Miraidon ,
2022-06-18 18:04:24 +00:00
} ;
/// <summary>
/// Species that are from Mythical Distributions (disallowed species for competitive rulesets)
/// </summary>
2022-08-27 06:43:36 +00:00
public static readonly HashSet < ushort > Mythicals = new ( )
2022-06-18 18:04:24 +00:00
{
( 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>
2023-01-22 04:02:33 +00:00
/// <remarks>Previous games may have included Mythicals in this species list, but that list should be considered separately.</remarks>
2022-08-27 06:43:36 +00:00
public static readonly HashSet < ushort > Legends = new ( )
2022-06-18 18:04:24 +00:00
{
2023-01-22 04:02:33 +00:00
( 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 ,
2022-11-25 01:42:17 +00:00
( int ) Koraidon , ( int ) Miraidon ,
2022-06-18 18:04:24 +00:00
} ;
/// <summary>
/// Species classified as "SubLegend" by the game code.
/// </summary>
2022-08-27 06:43:36 +00:00
public static readonly HashSet < ushort > SubLegends = new ( )
2022-06-18 18:04:24 +00:00
{
( 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 ,
2022-11-25 01:42:17 +00:00
( int ) TingLu , ( int ) ChienPao , ( int ) WoChien , ( int ) ChiYu ,
2022-06-18 18:04:24 +00:00
} ;
2023-01-22 04:02:33 +00:00
/// <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 ;
2022-06-18 18:04:24 +00:00
/// <summary>
/// Species that evolve from a Bi-Gendered species into a Single-Gender.
/// </summary>
2022-08-27 06:43:36 +00:00
public static readonly HashSet < ushort > FixedGenderFromBiGender = new ( )
2022-06-18 18:04:24 +00:00
{
( int ) Nincada ,
( int ) Shedinja , // (G)
2017-09-15 01:52:31 +00:00
2022-06-18 18:04:24 +00:00
( int ) Burmy ,
( int ) Wormadam , //(F)
( int ) Mothim , // (M)
2017-09-15 01:52:31 +00:00
2022-06-18 18:04:24 +00:00
( int ) Ralts ,
( int ) Gallade , // (M)
2017-10-20 03:56:59 +00:00
2022-06-18 18:04:24 +00:00
( int ) Snorunt ,
( int ) Froslass , // (F)
2021-01-13 06:38:18 +00:00
2022-06-18 18:04:24 +00:00
( int ) Espurr ,
( int ) Meowstic , // (M/F) form specific
2022-11-25 01:42:17 +00:00
( int ) Lechonk ,
( int ) Oinkologne , // (M/F) form specific
2022-06-18 18:04:24 +00:00
} ;
2021-01-13 06:38:18 +00:00
2022-08-30 22:00:45 +00:00
/// <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 )
2022-06-18 18:04:24 +00:00
{
var result = new bool [ max + 1 ] ;
2022-08-30 22:00:45 +00:00
foreach ( var index in allowed )
result [ index ] = true ;
2022-06-18 18:04:24 +00:00
return result ;
}
2022-08-30 22:00:45 +00:00
/// <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 )
2022-06-18 18:04:24 +00:00
{
2022-08-30 22:00:45 +00:00
var result = GetPermitList ( max , allowed ) ;
foreach ( var index in disallow )
result [ index ] = false ;
2022-06-18 18:04:24 +00:00
return result ;
2016-10-25 03:04:47 +00:00
}
}