2021-08-15 03:20:13 +00:00
using System ;
using System.Collections.Generic ;
2021-01-01 23:01:22 +00:00
using static PKHeX . Core . Species ;
2021-01-13 06:38:18 +00:00
using static PKHeX . Core . Move ;
2017-02-13 07:08:39 +00:00
namespace PKHeX.Core
2016-10-25 03:04:47 +00:00
{
public static partial class Legal
{
2020-11-02 21:11:51 +00:00
/// <summary>
/// Species that trigger Light Ball yielding Volt Tackle
/// </summary>
2021-01-01 23:01:22 +00:00
public static readonly HashSet < int > LightBall = new ( ) { ( int ) Pikachu , ( int ) Raichu , ( int ) Pichu } ;
2018-09-15 05:37:47 +00:00
2020-10-24 18:11:05 +00:00
/// <summary>
/// Species that can change between their forms and get access to form-specific moves.
/// </summary>
2021-08-15 03:20:13 +00:00
public static readonly HashSet < int > FormChangeMovesRetain = new ( )
2016-11-09 05:43:22 +00:00
{
2021-01-01 23:01:22 +00:00
( int ) Deoxys ,
( int ) Giratina ,
( int ) Shaymin ,
( int ) Hoopa ,
2016-11-09 05:43:22 +00:00
} ;
2021-08-15 03:20:13 +00:00
/// <summary>
/// Species that can change between their forms and get access to form-specific moves.
/// </summary>
public static readonly Dictionary < int , Func < int , int , bool > > FormChangeMoves = new ( )
{
{ ( int ) Deoxys , ( g , _ ) = > g > = 6 } ,
{ ( int ) Giratina , ( g , _ ) = > g > = 6 } ,
{ ( int ) Shaymin , ( g , _ ) = > g > = 6 } ,
{ ( int ) Rotom , ( g , _ ) = > g > = 6 } ,
{ ( int ) Hoopa , ( g , _ ) = > g > = 6 } ,
{ ( int ) Tornadus , ( g , _ ) = > g > = 6 } ,
{ ( int ) Thundurus , ( g , _ ) = > g > = 6 } ,
{ ( int ) Landorus , ( g , _ ) = > g > = 6 } ,
{ ( int ) Urshifu , ( g , _ ) = > g > = 8 } ,
// Fused
{ ( int ) Kyurem , ( g , _ ) = > g > = 6 } ,
{ ( int ) Necrozma , ( g , _ ) = > g > = 8 } ,
{ ( int ) Calyrex , ( g , _ ) = > g > = 8 } ,
{ ( int ) Pikachu , ( g , f ) = > g = = 6 & & f ! = 0 } ,
} ;
2020-09-18 23:23:17 +00:00
/// <summary>
2021-01-01 23:01:22 +00:00
/// 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).
2020-09-18 23:23:17 +00:00
/// </summary>
2020-12-22 01:17:56 +00:00
public static readonly HashSet < int > BattleFrontierBanlist = new ( )
2017-06-21 04:57:00 +00:00
{
2021-01-13 06:38:18 +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 ,
2017-06-21 04:57:00 +00:00
} ;
2016-11-09 05:43:22 +00:00
2021-03-14 18:28:46 +00:00
/// <summary>
/// Generation 7 Z Moves
/// </summary>
2020-12-22 01:17:56 +00:00
public static readonly HashSet < int > Z_Moves = new ( )
2016-11-11 05:49:08 +00:00
{
2021-01-13 06:38:18 +00:00
( int ) BreakneckBlitzP , ( int ) BreakneckBlitzS ,
( int ) AllOutPummelingP , ( int ) AllOutPummelingS ,
( int ) SupersonicSkystrikeP , ( int ) SupersonicSkystrikeS ,
( int ) AcidDownpourP , ( int ) AcidDownpourS ,
( int ) TectonicRageP , ( int ) TectonicRageS ,
( int ) ContinentalCrushP , ( int ) ContinentalCrushS ,
( int ) SavageSpinOutP , ( int ) SavageSpinOutS ,
( int ) NeverEndingNightmareP , ( int ) NeverEndingNightmareS ,
( int ) CorkscrewCrashP , ( int ) CorkscrewCrashS ,
( int ) InfernoOverdriveP , ( int ) InfernoOverdriveS ,
( int ) HydroVortexP , ( int ) HydroVortexS ,
( int ) BloomDoomP , ( int ) BloomDoomS ,
( int ) GigavoltHavocP , ( int ) GigavoltHavocS ,
( int ) ShatteredPsycheP , ( int ) ShatteredPsycheS ,
( int ) SubzeroSlammerP , ( int ) SubzeroSlammerS ,
( int ) DevastatingDrakeP , ( int ) DevastatingDrakeS ,
( int ) BlackHoleEclipseP , ( int ) BlackHoleEclipseS ,
( int ) TwinkleTackleP , ( int ) TwinkleTackleS ,
( int ) Catastropika ,
( int ) SinisterArrowRaid ,
( int ) MaliciousMoonsault ,
( int ) OceanicOperetta ,
( int ) GuardianofAlola ,
( int ) SoulStealing7StarStrike ,
( int ) StokedSparksurfer ,
( int ) PulverizingPancake ,
( int ) ExtremeEvoboost ,
( int ) GenesisSupernova ,
( int ) TenMVoltThunderbolt ,
( int ) LightThatBurnstheSky ,
( int ) SearingSunrazeSmash ,
( int ) MenacingMoonrazeMaelstrom ,
( int ) LetsSnuggleForever ,
( int ) SplinteredStormshards ,
( int ) ClangorousSoulblaze ,
2016-11-11 05:49:08 +00:00
} ;
2017-12-29 20:00:06 +00:00
2021-08-29 22:56:09 +00:00
public static bool IsDynamaxMove ( int move ) = > move is > = ( int ) MaxFlare and < = ( int ) MaxSteelspike ;
2020-10-24 18:11:05 +00:00
/// <summary>
2021-06-07 06:36:59 +00:00
/// Moves that can not be obtained by using Sketch with Smeargle in any game.
2020-10-24 18:11:05 +00:00
/// </summary>
2021-06-07 06:36:59 +00:00
private static readonly HashSet < int > InvalidSketch = new ( Z_Moves )
2020-10-24 18:11:05 +00:00
{
// Can't Sketch
2021-01-13 06:38:18 +00:00
( int ) Struggle ,
( int ) Chatter ,
2016-11-11 05:49:08 +00:00
2020-10-24 18:11:05 +00:00
// Unreleased
2021-01-13 06:38:18 +00:00
( int ) LightofRuin ,
2020-10-24 18:11:05 +00:00
} ;
2021-06-07 06:36:59 +00:00
/// <summary>
/// Checks if Sketch can obtain the <see cref="move"/> in the requested <see cref="generation"/>
/// </summary>
/// <remarks>Doesn't bounds check the <see cref="generation"/> for max move ID.</remarks>
/// <param name="move">Move ID</param>
/// <param name="generation">Generation to check</param>
/// <returns>True if can be sketched, false if not available.</returns>
public static bool IsValidSketch ( int move , int generation )
{
if ( InvalidSketch . Contains ( move ) )
return false ;
if ( generation is 6 & & move is ( ( int ) ThousandArrows or ( int ) ThousandWaves ) )
return false ;
return true ;
}
2021-02-17 05:42:36 +00:00
/// <summary>
/// Species that are from Mythical Distributions (disallowed species for competitive rulesets)
/// </summary>
public static readonly HashSet < int > 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 ,
} ;
2020-10-24 18:11:05 +00:00
/// <summary>
/// Species classified as "Legend" by the game code.
/// </summary>
2020-12-22 01:17:56 +00:00
public static readonly HashSet < int > Legends = new ( )
2016-11-27 17:26:58 +00:00
{
2021-01-01 23:01:22 +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 ,
( int ) Zacian , ( int ) Zamazenta , ( int ) Eternatus , ( int ) Zarude , ( int ) Calyrex ,
2016-11-27 17:26:58 +00:00
} ;
2018-09-15 05:37:47 +00:00
2020-10-24 18:11:05 +00:00
/// <summary>
/// Species classified as "SubLegend" by the game code.
/// </summary>
2020-12-22 01:17:56 +00:00
public static readonly HashSet < int > SubLegends = new ( )
2016-11-27 17:26:58 +00:00
{
2021-01-01 23:01:22 +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 ) Nihilego , ( int ) Buzzwole , ( int ) Pheromosa , ( int ) Xurkitree , ( int ) Celesteela , ( int ) Kartana , ( int ) Guzzlord ,
( int ) Poipole , ( int ) Naganadel , ( int ) Stakataka , ( int ) Blacephalon ,
( int ) Kubfu , ( int ) Urshifu , ( int ) Regieleki , ( int ) Regidrago , ( int ) Glastrier , ( int ) Spectrier ,
2016-11-27 17:26:58 +00:00
} ;
2020-11-02 21:11:51 +00:00
/// <summary>
/// Species that evolve from a Bi-Gendered species into a Single-Gender.
/// </summary>
2020-12-22 01:17:56 +00:00
public static readonly HashSet < int > FixedGenderFromBiGender = new ( )
2017-08-12 21:11:30 +00:00
{
2021-01-01 23:01:22 +00:00
( int ) Nincada ,
( int ) Shedinja , // (G)
2017-09-15 01:52:31 +00:00
2021-01-01 23:01:22 +00:00
( int ) Burmy ,
( int ) Wormadam , //(F)
( int ) Mothim , // (M)
2017-09-15 01:52:31 +00:00
2021-01-01 23:01:22 +00:00
( int ) Ralts ,
( int ) Gallade , // (M)
2017-09-15 01:52:31 +00:00
2021-01-01 23:01:22 +00:00
( int ) Snorunt ,
( int ) Froslass , // (F)
2017-10-20 03:56:59 +00:00
2021-01-01 23:01:22 +00:00
( int ) Espurr ,
( int ) Meowstic , // (M/F) form specific
2017-08-12 21:11:30 +00:00
} ;
2021-01-13 06:38:18 +00:00
private static bool [ ] GetPermitList ( int max , IEnumerable < ushort > held )
{
var result = new bool [ max + 1 ] ;
foreach ( var item in held )
result [ item ] = true ;
return result ;
}
private static bool [ ] GetPermitList ( int max , IEnumerable < ushort > held , IEnumerable < ushort > unreleased )
{
var result = GetPermitList ( max , held ) ;
foreach ( var u in unreleased )
result [ u ] = false ;
return result ;
}
2016-10-25 03:04:47 +00:00
}
}