2020-06-21 00:44:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using static PKHeX.Core.Legal;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
using static PKHeX.Core.GameVersion;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2020-06-22 00:46:06 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logic for obtaining a list of moves.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal static class MoveList
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2021-03-14 18:28:46 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidRelearn(PKM pkm, int species, int form, bool inheritlvlmoves, GameVersion version = Any)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2021-01-01 23:01:22 +00:00
|
|
|
|
int generation = pkm.Generation;
|
|
|
|
|
if (generation < 6)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return Array.Empty<int>();
|
|
|
|
|
|
|
|
|
|
var r = new List<int>();
|
2020-12-23 04:50:33 +00:00
|
|
|
|
r.AddRange(MoveEgg.GetRelearnLVLMoves(pkm, species, form, 1, version));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
2020-07-19 23:30:46 +00:00
|
|
|
|
if (pkm.Format == 6 && pkm.Species != (int)Species.Meowstic)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
form = 0;
|
|
|
|
|
|
2021-01-01 23:01:22 +00:00
|
|
|
|
r.AddRange(MoveEgg.GetEggMoves(pkm.PersonalInfo, species, form, version, Math.Max(2, generation)));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (inheritlvlmoves)
|
2020-12-23 04:50:33 +00:00
|
|
|
|
r.AddRange(MoveEgg.GetRelearnLVLMoves(pkm, species, form, 100, version));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static int[] GetShedinjaEvolveMoves(PKM pkm, int generation, int lvl)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Species != (int)Species.Shedinja || lvl < 20)
|
|
|
|
|
return Array.Empty<int>();
|
|
|
|
|
|
|
|
|
|
// If Nincada evolves into Ninjask and learns a move after evolution from Ninjask's LevelUp data, Shedinja would appear with that move.
|
|
|
|
|
// Only one move above level 20 is allowed; check the count of Ninjask moves elsewhere.
|
|
|
|
|
return generation switch
|
|
|
|
|
{
|
|
|
|
|
3 when pkm.InhabitedGeneration(3) => LevelUpE[(int)Species.Ninjask].GetMoves(lvl, 20), // Same LevelUp data in all Gen3 games
|
|
|
|
|
4 when pkm.InhabitedGeneration(4) => LevelUpPt[(int)Species.Ninjask].GetMoves(lvl, 20), // Same LevelUp data in all Gen4 games
|
|
|
|
|
_ => Array.Empty<int>(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static int GetShedinjaMoveLevel(int species, int move, int generation)
|
|
|
|
|
{
|
|
|
|
|
var src = generation == 4 ? LevelUpPt : LevelUpE;
|
|
|
|
|
var moves = src[species];
|
|
|
|
|
return moves.GetLevelLearnMove(move);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static int[] GetBaseEggMoves(PKM pkm, int species, int form, GameVersion gameSource, int lvl)
|
|
|
|
|
{
|
2021-03-14 18:28:46 +00:00
|
|
|
|
if (gameSource == Any)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
gameSource = (GameVersion)pkm.Version;
|
|
|
|
|
|
|
|
|
|
switch (gameSource)
|
|
|
|
|
{
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case GSC or GS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
// If checking back-transfer specimen (GSC->RBY), remove moves that must be deleted prior to transfer
|
2021-08-06 05:39:38 +00:00
|
|
|
|
static int[] getRBYCompatibleMoves(int format, int[] moves) => format == 1 ? Array.FindAll(moves, m => m <= MaxMoveID_1) : moves;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(2))
|
2020-07-19 23:30:46 +00:00
|
|
|
|
return getRBYCompatibleMoves(pkm.Format, LevelUpGS[species].GetMoves(lvl));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
break;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case C:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(2))
|
2020-07-19 23:30:46 +00:00
|
|
|
|
return getRBYCompatibleMoves(pkm.Format, LevelUpC[species].GetMoves(lvl));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case R or S or RS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
|
|
|
|
return LevelUpRS[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case E:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
|
|
|
|
return LevelUpE[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case FR or LG or FRLG:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
// The only difference in FR/LG is Deoxys, which doesn't breed.
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
|
|
|
|
return LevelUpFR[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case D or P or DP:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpDP[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case Pt:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpPt[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case HG or SS or HGSS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpHGSS[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case B or W or BW:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpBW[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case B2 or W2 or B2W2:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpB2W2[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case X or Y or XY:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
|
|
|
|
return LevelUpXY[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case AS or OR or ORAS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
|
|
|
|
return LevelUpAO[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case SN or MN or SM:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (species > MaxSpeciesID_7)
|
|
|
|
|
break;
|
|
|
|
|
if (pkm.InhabitedGeneration(7))
|
|
|
|
|
{
|
2020-12-11 04:42:30 +00:00
|
|
|
|
int index = PersonalTable.SM.GetFormIndex(species, form);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return LevelUpSM[index].GetMoves(lvl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case US or UM or USUM:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(7))
|
|
|
|
|
{
|
2020-12-11 04:42:30 +00:00
|
|
|
|
int index = PersonalTable.USUM.GetFormIndex(species, form);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return LevelUpUSUM[index].GetMoves(lvl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
case SW or SH or SWSH:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(8))
|
|
|
|
|
{
|
2020-12-11 04:42:30 +00:00
|
|
|
|
int index = PersonalTable.SWSH.GetFormIndex(species, form);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return LevelUpSWSH[index].GetMoves(lvl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-11-20 02:23:49 +00:00
|
|
|
|
|
2022-02-05 01:35:15 +00:00
|
|
|
|
case PLA:
|
|
|
|
|
if (pkm.InhabitedGeneration(8))
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.LA.GetFormIndex(species, form);
|
|
|
|
|
return LevelUpLA[index].GetMoves(lvl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2021-11-20 02:23:49 +00:00
|
|
|
|
case BD or SP or BDSP:
|
|
|
|
|
if (pkm.InhabitedGeneration(8))
|
|
|
|
|
{
|
2022-02-05 01:35:15 +00:00
|
|
|
|
int index = PersonalTable.BDSP.GetFormIndex(species, form);
|
2021-11-20 02:23:49 +00:00
|
|
|
|
return LevelUpBDSP[index].GetMoves(lvl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
return Array.Empty<int>();
|
|
|
|
|
}
|
2020-06-27 18:06:28 +00:00
|
|
|
|
|
2022-05-08 01:29:36 +00:00
|
|
|
|
internal static IReadOnlyList<int>[] GetValidMovesAllGens(PKM pkm, EvoCriteria[][] evoChains, MoveSourceType types = MoveSourceType.ExternalSources, bool RemoveTransferHM = true)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2020-06-27 18:06:28 +00:00
|
|
|
|
var result = new IReadOnlyList<int>[evoChains.Length];
|
|
|
|
|
for (int i = 0; i < result.Length; i++)
|
|
|
|
|
result[i] = Array.Empty<int>();
|
|
|
|
|
|
2021-01-01 23:01:22 +00:00
|
|
|
|
var min = pkm is IBattleVersion b ? Math.Max(0, b.GetMinGeneration()) : 1;
|
2020-06-27 18:06:28 +00:00
|
|
|
|
for (int i = min; i < evoChains.Length; i++)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2022-01-14 08:11:33 +00:00
|
|
|
|
var evos = evoChains[i];
|
2022-05-08 01:29:36 +00:00
|
|
|
|
if (evos.Length == 0)
|
2020-06-27 18:06:28 +00:00
|
|
|
|
continue;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
2022-01-14 08:11:33 +00:00
|
|
|
|
result[i] = GetValidMoves(pkm, evos, i, types, RemoveTransferHM).ToList();
|
2020-06-27 18:06:28 +00:00
|
|
|
|
}
|
|
|
|
|
return result;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-08 01:29:36 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidMoves(PKM pkm, EvoCriteria[] evoChain, int generation, MoveSourceType types = MoveSourceType.ExternalSources, bool RemoveTransferHM = true)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
GameVersion version = (GameVersion)pkm.Version;
|
2021-11-24 06:58:41 +00:00
|
|
|
|
if (!pkm.IsMovesetRestricted(generation))
|
2021-03-14 18:28:46 +00:00
|
|
|
|
version = Any;
|
2021-07-23 04:25:15 +00:00
|
|
|
|
return GetValidMoves(pkm, version, evoChain, generation, types: types, RemoveTransferHM: RemoveTransferHM);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-14 18:28:46 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidRelearn(PKM pkm, int species, int form, GameVersion version = Any)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2020-12-08 04:54:55 +00:00
|
|
|
|
return GetValidRelearn(pkm, species, form, Breeding.GetCanInheritMoves(species), version);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-23 04:25:15 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ONLY CALL FOR GEN2 EGGS
|
|
|
|
|
/// </summary>
|
2022-04-24 04:33:17 +00:00
|
|
|
|
internal static IEnumerable<int> GetExclusivePreEvolutionMoves(PKM pkm, int Species, EvoCriteria[] evoChain, int generation, GameVersion Version)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
var preevomoves = new List<int>();
|
|
|
|
|
var evomoves = new List<int>();
|
2022-04-24 04:33:17 +00:00
|
|
|
|
var index = Array.FindIndex(evoChain, z => z.Species == Species);
|
|
|
|
|
for (int i = 0; i < evoChain.Length; i++)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2021-07-23 04:25:15 +00:00
|
|
|
|
int minLvLG2;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
var evo = evoChain[i];
|
2021-07-23 04:25:15 +00:00
|
|
|
|
if (ParseSettings.AllowGen2MoveReminder(pkm))
|
|
|
|
|
minLvLG2 = 0;
|
2022-04-24 04:33:17 +00:00
|
|
|
|
else if (i == evoChain.Length - 1) // minimum level, otherwise next learnable level
|
2021-07-23 04:25:15 +00:00
|
|
|
|
minLvLG2 = 5;
|
|
|
|
|
else if (evo.RequiresLvlUp)
|
2022-04-24 04:33:17 +00:00
|
|
|
|
minLvLG2 = evo.LevelMax + 1;
|
2021-07-23 04:25:15 +00:00
|
|
|
|
else
|
2022-04-24 04:33:17 +00:00
|
|
|
|
minLvLG2 = evo.LevelMax;
|
2021-07-23 04:25:15 +00:00
|
|
|
|
|
2022-04-24 04:33:17 +00:00
|
|
|
|
var moves = GetMoves(pkm, evo.Species, evo.Form, evo.LevelMax, 0, minLvLG2, Version: Version, types: MoveSourceType.ExternalSources, RemoveTransferHM: false, generation: generation);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
var list = i >= index ? preevomoves : evomoves;
|
|
|
|
|
list.AddRange(moves);
|
|
|
|
|
}
|
|
|
|
|
return preevomoves.Except(evomoves).Distinct();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-08 01:29:36 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidMoves(PKM pkm, GameVersion version, EvoCriteria[] chain, int generation, MoveSourceType types = MoveSourceType.Reminder, bool RemoveTransferHM = true)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
var r = new List<int> { 0 };
|
|
|
|
|
int species = pkm.Species;
|
|
|
|
|
|
2021-08-15 03:20:13 +00:00
|
|
|
|
if (FormChangeMovesRetain.Contains(species)) // Deoxys & Shaymin & Giratina (others don't have extra but whatever)
|
|
|
|
|
return GetValidMovesAllForms(pkm, chain, version, generation, types, RemoveTransferHM, species, r);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
2021-07-23 04:25:15 +00:00
|
|
|
|
// Generation 1 & 2 do not always have move relearning capability, so the bottom bound for learnable indexes needs to be determined.
|
|
|
|
|
var minLvLG1 = 0;
|
|
|
|
|
var minLvLG2 = 0;
|
2022-05-08 01:29:36 +00:00
|
|
|
|
for (var i = 0; i < chain.Length; i++)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2020-06-28 03:18:29 +00:00
|
|
|
|
var evo = chain[i];
|
2022-05-08 01:29:36 +00:00
|
|
|
|
bool encounteredEvo = i == chain.Length - 1;
|
2022-01-14 08:11:33 +00:00
|
|
|
|
|
2021-07-23 04:25:15 +00:00
|
|
|
|
if (generation <= 2)
|
|
|
|
|
{
|
|
|
|
|
if (encounteredEvo) // minimum level, otherwise next learnable level
|
2022-04-24 04:33:17 +00:00
|
|
|
|
minLvLG1 = evo.LevelMin + 1;
|
2022-01-14 08:11:33 +00:00
|
|
|
|
else // learns level up moves immediately after evolving
|
2022-04-24 04:33:17 +00:00
|
|
|
|
minLvLG1 = evo.LevelMin;
|
2021-07-23 04:25:15 +00:00
|
|
|
|
|
|
|
|
|
if (!ParseSettings.AllowGen2MoveReminder(pkm))
|
|
|
|
|
minLvLG2 = minLvLG1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-24 04:33:17 +00:00
|
|
|
|
var maxLevel = evo.LevelMax;
|
2022-01-14 08:11:33 +00:00
|
|
|
|
if (!encounteredEvo) // evolution
|
2021-08-05 02:07:20 +00:00
|
|
|
|
++maxLevel; // allow lvlmoves from the level it evolved to the next species
|
|
|
|
|
var moves = GetMoves(pkm, evo.Species, evo.Form, maxLevel, minLvLG1, minLvLG2, version, types, RemoveTransferHM, generation);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
r.AddRange(moves);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pkm.Format <= 3)
|
|
|
|
|
return r.Distinct();
|
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.LevelUp))
|
2020-06-21 00:44:05 +00:00
|
|
|
|
MoveTutor.AddSpecialFormChangeMoves(r, pkm, generation, species);
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.SpecialTutor))
|
2020-06-21 00:44:05 +00:00
|
|
|
|
MoveTutor.AddSpecialTutorMoves(r, pkm, generation, species);
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.RelearnMoves) && generation >= 6)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
r.AddRange(pkm.RelearnMoves);
|
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-08 01:29:36 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidMovesAllForms(PKM pkm, EvoCriteria[] chain, GameVersion version, int generation, MoveSourceType types, bool RemoveTransferHM, int species, List<int> r)
|
2021-08-15 03:20:13 +00:00
|
|
|
|
{
|
|
|
|
|
// These don't evolve, so don't bother iterating for all entries in the evolution chain (should always be count==1).
|
|
|
|
|
int formCount;
|
|
|
|
|
|
|
|
|
|
// In gen 3 deoxys has different forms depending on the current game, in the PersonalInfo there is no alternate form info
|
|
|
|
|
if (pkm.Format == 3 && species == (int) Species.Deoxys)
|
|
|
|
|
formCount = 4;
|
|
|
|
|
else
|
|
|
|
|
formCount = pkm.PersonalInfo.FormCount;
|
|
|
|
|
|
|
|
|
|
for (int form = 0; form < formCount; form++)
|
2022-04-24 04:33:17 +00:00
|
|
|
|
r.AddRange(GetMoves(pkm, species, form, chain[0].LevelMax, 0, 0, version, types, RemoveTransferHM, generation));
|
2021-08-15 03:20:13 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.RelearnMoves))
|
|
|
|
|
r.AddRange(pkm.RelearnMoves);
|
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-23 04:25:15 +00:00
|
|
|
|
private static IEnumerable<int> GetMoves(PKM pkm, int species, int form, int maxLevel, int minlvlG1, int minlvlG2, GameVersion Version, MoveSourceType types, bool RemoveTransferHM, int generation)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
var r = new List<int>();
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.LevelUp))
|
2021-07-23 04:25:15 +00:00
|
|
|
|
r.AddRange(MoveLevelUp.GetMovesLevelUp(pkm, species, form, maxLevel, minlvlG1, minlvlG2, Version, types.HasFlagFast(MoveSourceType.Reminder), generation));
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.Machine))
|
2020-06-21 00:44:05 +00:00
|
|
|
|
r.AddRange(MoveTechnicalMachine.GetTMHM(pkm, species, form, generation, Version, RemoveTransferHM));
|
2020-12-22 17:10:10 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.TechnicalRecord))
|
|
|
|
|
r.AddRange(MoveTechnicalMachine.GetRecords(pkm, species, form, generation));
|
2020-12-22 05:24:16 +00:00
|
|
|
|
if (types.HasFlagFast(MoveSourceType.AllTutors))
|
|
|
|
|
r.AddRange(MoveTutor.GetTutorMoves(pkm, species, form, types.HasFlagFast(MoveSourceType.SpecialTutor), generation));
|
2020-06-21 00:44:05 +00:00
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-22 05:24:16 +00:00
|
|
|
|
|
|
|
|
|
[Flags]
|
2020-12-23 17:34:29 +00:00
|
|
|
|
#pragma warning disable RCS1154 // Sort enum members.
|
2020-12-22 05:24:16 +00:00
|
|
|
|
public enum MoveSourceType
|
2020-12-23 17:34:29 +00:00
|
|
|
|
#pragma warning restore RCS1154 // Sort enum members.
|
2020-12-22 05:24:16 +00:00
|
|
|
|
{
|
|
|
|
|
None,
|
|
|
|
|
LevelUp = 1 << 0,
|
|
|
|
|
RelearnMoves = 1 << 1,
|
|
|
|
|
Machine = 1 << 2,
|
|
|
|
|
TypeTutor = 1 << 3,
|
|
|
|
|
SpecialTutor = 1 << 4,
|
|
|
|
|
EnhancedTutor = 1 << 5,
|
|
|
|
|
SharedEggMove = 1 << 6,
|
2020-12-22 17:10:10 +00:00
|
|
|
|
TechnicalRecord = 1 << 7,
|
2020-12-22 05:24:16 +00:00
|
|
|
|
|
|
|
|
|
AllTutors = TypeTutor | SpecialTutor | EnhancedTutor,
|
2020-12-22 17:10:10 +00:00
|
|
|
|
AllMachines = Machine | TechnicalRecord,
|
2020-12-22 05:24:16 +00:00
|
|
|
|
|
2020-12-22 17:10:10 +00:00
|
|
|
|
Reminder = LevelUp | RelearnMoves | TechnicalRecord,
|
2020-12-22 05:24:16 +00:00
|
|
|
|
Encounter = LevelUp | RelearnMoves,
|
2020-12-22 17:10:10 +00:00
|
|
|
|
ExternalSources = Reminder | AllMachines | AllTutors,
|
2020-12-22 05:24:16 +00:00
|
|
|
|
All = ExternalSources | SharedEggMove | RelearnMoves,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class MoveSourceTypeExtensions
|
|
|
|
|
{
|
|
|
|
|
public static bool HasFlagFast(this MoveSourceType value, MoveSourceType flag) => (value & flag) != 0;
|
|
|
|
|
public static MoveSourceType ClearNonEggSources(this MoveSourceType value) => value & MoveSourceType.Encounter;
|
|
|
|
|
}
|
2020-06-27 18:06:28 +00:00
|
|
|
|
}
|