2020-06-21 00:44:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using static PKHeX.Core.Legal;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
internal static IEnumerable<int> GetValidRelearn(PKM pkm, int species, int form, bool inheritlvlmoves, GameVersion version = GameVersion.Any)
|
|
|
|
|
{
|
2020-12-11 04:42:30 +00:00
|
|
|
|
if (pkm.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;
|
|
|
|
|
|
|
|
|
|
r.AddRange(MoveEgg.GetEggMoves(pkm, species, form, version));
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion)pkm.Version;
|
|
|
|
|
|
|
|
|
|
switch (gameSource)
|
|
|
|
|
{
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.GSC or GameVersion.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
|
2020-07-19 23:30:46 +00:00
|
|
|
|
static int[] getRBYCompatibleMoves(int format, int[] moves) => format == 1 ? moves.Where(m => m <= MaxMoveID_1).ToArray() : 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;
|
|
|
|
|
case GameVersion.C:
|
|
|
|
|
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;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.R or GameVersion.S or GameVersion.RS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
|
|
|
|
return LevelUpRS[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
case GameVersion.E:
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
|
|
|
|
return LevelUpE[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.FR or GameVersion.LG or GameVersion.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;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.D or GameVersion.P or GameVersion.DP:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpDP[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
case GameVersion.Pt:
|
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpPt[species].GetMoves(lvl);
|
|
|
|
|
break;
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.HG or GameVersion.SS or GameVersion.HGSS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
|
|
|
|
return LevelUpHGSS[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.B or GameVersion.W or GameVersion.BW:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpBW[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.B2 or GameVersion.W2 or GameVersion.B2W2:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpB2W2[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.X or GameVersion.Y or GameVersion.XY:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
|
|
|
|
return LevelUpXY[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.AS or GameVersion.OR or GameVersion.ORAS:
|
2020-06-21 00:44:05 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
|
|
|
|
return LevelUpAO[species].GetMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.SN or GameVersion.MN or GameVersion.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;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.US or GameVersion.UM or GameVersion.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;
|
|
|
|
|
|
2020-12-25 18:58:33 +00:00
|
|
|
|
case GameVersion.SW or GameVersion.SH or GameVersion.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;
|
|
|
|
|
}
|
|
|
|
|
return Array.Empty<int>();
|
|
|
|
|
}
|
2020-06-27 18:06:28 +00:00
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
internal static IReadOnlyList<int>[] GetValidMovesAllGens(PKM pkm, IReadOnlyList<EvoCriteria>[] evoChains, int minLvLG1 = 1, int minLvLG2 = 1, 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>();
|
|
|
|
|
|
|
|
|
|
var min = pkm is IBattleVersion b ? b.GetMinGeneration() : 1;
|
|
|
|
|
for (int i = min; i < evoChains.Length; i++)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2020-06-27 18:06:28 +00:00
|
|
|
|
if (evoChains[i].Count == 0)
|
|
|
|
|
continue;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
result[i] = GetValidMoves(pkm, evoChains[i], i, minLvLG1, minLvLG2, types, RemoveTransferHM).ToList();
|
2020-06-27 18:06:28 +00:00
|
|
|
|
}
|
|
|
|
|
return result;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidMoves(PKM pkm, IReadOnlyList<EvoCriteria> evoChain, int generation, int minLvLG1 = 1, int minLvLG2 = 1, MoveSourceType types = MoveSourceType.ExternalSources, bool RemoveTransferHM = true)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
GameVersion version = (GameVersion)pkm.Version;
|
|
|
|
|
if (!pkm.IsUntraded)
|
|
|
|
|
version = GameVersion.Any;
|
2020-12-22 05:24:16 +00:00
|
|
|
|
return GetValidMoves(pkm, version, evoChain, generation, minLvLG1: minLvLG1, minLvLG2: minLvLG2, types: types, RemoveTransferHM: RemoveTransferHM);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IEnumerable<int> GetValidRelearn(PKM pkm, int species, int form, GameVersion version = GameVersion.Any)
|
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static List<int> GetValidPostEvolutionMoves(PKM pkm, int species, IReadOnlyList<EvoCriteria>[] evoChains, GameVersion Version)
|
|
|
|
|
{
|
|
|
|
|
// Return moves that the pokemon could learn after evolving
|
|
|
|
|
var moves = new List<int>();
|
|
|
|
|
for (int i = 1; i < evoChains.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (evoChains[i].Count != 0)
|
|
|
|
|
moves.AddRange(GetValidPostEvolutionMoves(pkm, species, evoChains[i], i, Version));
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-11 04:42:30 +00:00
|
|
|
|
if (pkm.Generation >= 6)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
moves.AddRange(pkm.RelearnMoves.Where(m => m != 0));
|
|
|
|
|
return moves.Distinct().ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<int> GetValidPostEvolutionMoves(PKM pkm, int species, IReadOnlyList<EvoCriteria> evoChain, int generation, GameVersion Version)
|
|
|
|
|
{
|
|
|
|
|
var evomoves = new List<int>();
|
|
|
|
|
var index = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, species);
|
|
|
|
|
for (int i = 0; i <= index; i++)
|
|
|
|
|
{
|
|
|
|
|
var evo = evoChain[i];
|
2020-12-22 05:24:16 +00:00
|
|
|
|
var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, evo.Form, Version: Version, types: MoveSourceType.ExternalSources, RemoveTransferHM: false, generation: generation);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
// Moves from Species or any species after in the evolution phase
|
|
|
|
|
evomoves.AddRange(moves);
|
|
|
|
|
}
|
|
|
|
|
return evomoves;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static IEnumerable<int> GetExclusivePreEvolutionMoves(PKM pkm, int Species, IReadOnlyList<EvoCriteria> evoChain, int generation, GameVersion Version)
|
|
|
|
|
{
|
|
|
|
|
var preevomoves = new List<int>();
|
|
|
|
|
var evomoves = new List<int>();
|
|
|
|
|
var index = EvolutionChain.GetEvoChainSpeciesIndex(evoChain, Species);
|
|
|
|
|
for (int i = 0; i < evoChain.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var evo = evoChain[i];
|
2020-12-22 05:24:16 +00:00
|
|
|
|
var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, evo.Form, 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();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
internal static IEnumerable<int> GetValidMoves(PKM pkm, GameVersion version, IReadOnlyList<EvoCriteria> chain, int generation, int minLvLG1 = 1, int minLvLG2 = 1, 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;
|
|
|
|
|
|
|
|
|
|
if (FormChangeMoves.Contains(species)) // Deoxys & Shaymin & Giratina (others don't have extra but whatever)
|
|
|
|
|
{
|
|
|
|
|
// 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
|
2020-12-11 04:42:30 +00:00
|
|
|
|
formCount = pkm.PersonalInfo.FormCount;
|
2020-06-21 00:44:05 +00:00
|
|
|
|
|
|
|
|
|
for (int form = 0; form < formCount; form++)
|
2020-12-22 05:24:16 +00:00
|
|
|
|
r.AddRange(GetMoves(pkm, species, minLvLG1, minLvLG2, chain[0].Level, form, version, types, RemoveTransferHM, generation));
|
|
|
|
|
if (types.HasFlagFast(MoveSourceType.RelearnMoves))
|
2020-06-21 00:44:05 +00:00
|
|
|
|
r.AddRange(pkm.RelearnMoves);
|
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-28 03:18:29 +00:00
|
|
|
|
for (var i = 0; i < chain.Count; i++)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
2020-06-28 03:18:29 +00:00
|
|
|
|
var evo = chain[i];
|
2020-12-22 05:24:16 +00:00
|
|
|
|
var moves = GetEvoMoves(pkm, version, types, chain, generation, minLvLG1, minLvLG2, RemoveTransferHM, i, evo);
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
private static IEnumerable<int> GetEvoMoves(PKM pkm, GameVersion Version, MoveSourceType types, IReadOnlyList<EvoCriteria> chain, int generation, int minLvLG1, int minLvLG2, bool RemoveTransferHM, int i, EvoCriteria evo)
|
2020-06-21 00:44:05 +00:00
|
|
|
|
{
|
|
|
|
|
int minlvlevo1 = GetEvoMoveMinLevel1(pkm, generation, minLvLG1, evo);
|
|
|
|
|
int minlvlevo2 = GetEvoMoveMinLevel2(pkm, generation, minLvLG2, evo);
|
|
|
|
|
var maxLevel = evo.Level;
|
2020-06-28 03:18:29 +00:00
|
|
|
|
if (i != 0 && chain[i - 1].RequiresLvlUp) // evolution
|
2020-06-21 00:44:05 +00:00
|
|
|
|
++maxLevel; // allow lvlmoves from the level it evolved to the next species
|
2020-12-22 05:24:16 +00:00
|
|
|
|
return GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, maxLevel, evo.Form, Version, types, RemoveTransferHM, generation);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the minimum level the move can be learned at based on the species encounter level.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static int GetEvoMoveMinLevel1(PKM pkm, int generation, int minLvLG1, EvoCriteria evo)
|
|
|
|
|
{
|
|
|
|
|
if (generation != 1)
|
|
|
|
|
return 1;
|
|
|
|
|
// For evolutions, return the lower of the two; current level should legally be >=
|
|
|
|
|
if (evo.MinLevel > 1)
|
|
|
|
|
return Math.Min(pkm.CurrentLevel, evo.MinLevel);
|
|
|
|
|
return minLvLG1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static int GetEvoMoveMinLevel2(PKM pkm, int generation, int minLvLG2, EvoCriteria evo)
|
|
|
|
|
{
|
|
|
|
|
if (generation != 2 || ParseSettings.AllowGen2MoveReminder(pkm))
|
|
|
|
|
return 1;
|
|
|
|
|
// For evolutions, return the lower of the two; current level should legally be >=
|
|
|
|
|
if (evo.MinLevel > 1)
|
|
|
|
|
return Math.Min(pkm.CurrentLevel, evo.MinLevel);
|
|
|
|
|
return minLvLG2;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 05:24:16 +00:00
|
|
|
|
private static IEnumerable<int> GetMoves(PKM pkm, int species, int minlvlG1, int minlvlG2, int lvl, int form, 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))
|
|
|
|
|
r.AddRange(MoveLevelUp.GetMovesLevelUp(pkm, species, minlvlG1, minlvlG2, lvl, form, Version, types.HasFlagFast(MoveSourceType.Reminder), generation));
|
|
|
|
|
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
|
|
|
|
}
|