using System;
using System.Collections.Generic;
using static PKHeX.Core.Species;
using static PKHeX.Core.Move;
namespace PKHeX.Core
{
public static partial class Legal
{
///
/// Species that can change between their forms and get access to form-specific moves.
///
public static readonly HashSet FormChangeMovesRetain = new()
{
(int)Deoxys,
(int)Giratina,
(int)Shaymin,
(int)Hoopa,
};
///
/// Species that can change between their forms and get access to form-specific moves.
///
public static readonly Dictionary> 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},
};
///
/// Generation 3 & 4 Battle Frontier Species banlist. When referencing this in context to generation 4, be sure to disallow with Form 1 (Spiky).
///
public static readonly HashSet 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,
};
///
/// Generation 7 Z Moves
///
public static readonly HashSet Z_Moves = new()
{
(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,
};
public static bool IsDynamaxMove(int move) => move is >= (int)MaxFlare and <= (int)MaxSteelspike;
///
/// Moves that can not be obtained by using Sketch with Smeargle in any game.
///
private static readonly HashSet InvalidSketch = new(Z_Moves)
{
// Can't Sketch
(int)Struggle,
(int)Chatter,
// Unreleased
(int)LightofRuin,
};
///
/// Checks if Sketch can obtain the in the requested
///
/// Doesn't bounds check the for max move ID.
/// Move ID
/// Generation to check
/// True if can be sketched, false if not available.
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;
if (generation is 8 && (SignatureSketch_BDSP.Contains(move) || DummiedMoves_BDSP.Contains(move))) // can't Sketch unusable moves in BDSP
return false;
return move <= GetMaxMoveID(generation);
}
///
/// Species that are from Mythical Distributions (disallowed species for competitive rulesets)
///
public static readonly HashSet 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,
};
///
/// Species classified as "Legend" by the game code.
///
public static readonly HashSet Legends = 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)Zacian, (int)Zamazenta, (int)Eternatus, (int)Zarude, (int)Calyrex,
};
///
/// Species classified as "SubLegend" by the game code.
///
public static readonly HashSet 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)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,
};
///
/// Species that evolve from a Bi-Gendered species into a Single-Gender.
///
public static readonly HashSet 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
};
private static bool[] GetPermitList(int max, IEnumerable held)
{
var result = new bool[max + 1];
foreach (var item in held)
result[item] = true;
return result;
}
private static bool[] GetPermitList(int max, IEnumerable held, IEnumerable unreleased)
{
var result = GetPermitList(max, held);
foreach (var u in unreleased)
result[u] = false;
return result;
}
}
}