Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
using System;
|
2021-04-05 01:30:01 +00:00
|
|
|
using System.Runtime.CompilerServices;
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
using System.Runtime.InteropServices;
|
2021-04-05 01:30:01 +00:00
|
|
|
using static PKHeX.Core.EggSource34;
|
|
|
|
using static PKHeX.Core.GameVersion;
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
using static PKHeX.Core.LearnSource4;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Inheritance logic for Generation 4.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>Refer to <see cref="EggSource34"/> for inheritance ordering.</remarks>
|
|
|
|
public static class MoveBreed4
|
2021-04-05 01:30:01 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
private const int level = 1;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
/// <inheritdoc cref="MoveBreed.Validate"/>
|
2022-08-27 06:43:36 +00:00
|
|
|
public static bool Validate(ushort species, GameVersion version, ReadOnlySpan<ushort> moves, Span<byte> origins)
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
2022-08-27 06:43:36 +00:00
|
|
|
var count = moves.IndexOf((ushort)0);
|
2022-06-18 18:04:24 +00:00
|
|
|
if (count == 0)
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
return false;
|
2022-06-18 18:04:24 +00:00
|
|
|
if (count == -1)
|
|
|
|
count = moves.Length;
|
|
|
|
|
2023-09-11 04:17:47 +00:00
|
|
|
var learnset = version switch
|
|
|
|
{
|
|
|
|
HG or SS => LearnSource4HGSS.Instance.GetLearnset(species, 0),
|
|
|
|
D or P => LearnSource4DP.Instance.GetLearnset(species, 0),
|
|
|
|
_ => LearnSource4Pt.Instance.GetLearnset(species, 0),
|
|
|
|
};
|
2023-01-22 04:02:33 +00:00
|
|
|
var table = version switch
|
|
|
|
{
|
|
|
|
HG or SS => PersonalTable.HGSS,
|
|
|
|
D or P => PersonalTable.DP,
|
|
|
|
_ => PersonalTable.Pt,
|
|
|
|
};
|
2022-06-18 18:04:24 +00:00
|
|
|
var pi = table[species];
|
|
|
|
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
var actual = MemoryMarshal.Cast<byte, EggSource34>(origins);
|
2022-06-18 18:04:24 +00:00
|
|
|
Span<byte> possible = stackalloc byte[count];
|
|
|
|
var value = new BreedInfo<EggSource34>(actual, possible, learnset, moves, level);
|
|
|
|
if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle)
|
|
|
|
actual[--count] = VoltTackle;
|
|
|
|
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
bool valid;
|
2022-06-18 18:04:24 +00:00
|
|
|
if (count == 0)
|
|
|
|
{
|
|
|
|
valid = VerifyBaseMoves(value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool inherit = Breeding.GetCanInheritMoves(species);
|
2023-04-21 04:23:15 +00:00
|
|
|
var eggMoves = version is HG or SS
|
|
|
|
? LearnSource4HGSS.Instance.GetEggMoves(species, 0)
|
|
|
|
: LearnSource4DP.Instance.GetEggMoves(species, 0);
|
|
|
|
MarkMovesForOrigin(value, eggMoves, count, inherit, pi, version);
|
2022-06-18 18:04:24 +00:00
|
|
|
valid = RecurseMovesForOrigin(value, count - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!valid)
|
|
|
|
CleanResult(actual, possible);
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
return valid;
|
2022-06-18 18:04:24 +00:00
|
|
|
}
|
2021-04-05 01:30:01 +00:00
|
|
|
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
private static void CleanResult(Span<EggSource34> valueActual, Span<byte> valuePossible)
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
for (int i = 0; i < valuePossible.Length; i++)
|
2021-04-08 22:58:09 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
var poss = valuePossible[i];
|
|
|
|
if (poss == 0)
|
|
|
|
continue;
|
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves
In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.
The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.
The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.
* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 23:15:27 +00:00
|
|
|
if (valueActual[i] != 0)
|
|
|
|
continue;
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
for (int j = 0; j < (int)Max; j++)
|
2021-04-08 22:58:09 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
if ((poss & (1 << j)) == 0)
|
2021-04-08 22:58:09 +00:00
|
|
|
continue;
|
2022-06-18 18:04:24 +00:00
|
|
|
valueActual[i] = (EggSource34)j;
|
|
|
|
break;
|
2021-04-08 22:58:09 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
}
|
2021-04-08 22:58:09 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private static bool RecurseMovesForOrigin(in BreedInfo<EggSource34> info, int start, EggSource34 type = Max - 1)
|
|
|
|
{
|
|
|
|
int i = start;
|
|
|
|
do
|
2021-04-05 01:30:01 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
var unpeel = type - 1;
|
|
|
|
if (unpeel != 0 && RecurseMovesForOrigin(info, i, unpeel))
|
|
|
|
return true;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var permit = info.Possible[i];
|
|
|
|
if ((permit & (1 << (int)type)) == 0)
|
|
|
|
return false;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
info.Actual[i] = type;
|
|
|
|
} while (--i >= 0);
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
return VerifyBaseMoves(info);
|
|
|
|
}
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
private static bool VerifyBaseMoves(in BreedInfo<EggSource34> info)
|
|
|
|
{
|
|
|
|
var count = 0;
|
|
|
|
foreach (var x in info.Actual)
|
2021-04-05 01:30:01 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
if (x == Base)
|
|
|
|
count++;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var moves = info.Moves;
|
|
|
|
if (count == -1)
|
|
|
|
return moves[^1] != 0;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var baseMoves = info.Learnset.GetBaseEggMoves(info.Level);
|
|
|
|
if (baseMoves.Length < count)
|
|
|
|
return false;
|
|
|
|
if (moves[^1] == 0 && count != baseMoves.Length)
|
|
|
|
return false;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
for (int i = count - 1, b = baseMoves.Length - 1; i >= 0; i--, b--)
|
|
|
|
{
|
|
|
|
var move = moves[i];
|
|
|
|
var expect = baseMoves[b];
|
|
|
|
if (expect != move)
|
|
|
|
return false;
|
|
|
|
}
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
// A low-index base egg move may be nudged out, but can only reappear if sufficient non-base moves are before it.
|
|
|
|
if (baseMoves.Length == count)
|
|
|
|
return true;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
for (int i = count; i < info.Actual.Length; i++)
|
|
|
|
{
|
|
|
|
var isBase = (info.Possible[i] & (1 << (int)Base)) != 0;
|
|
|
|
if (!isBase)
|
|
|
|
continue;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var baseIndex = baseMoves.IndexOf(moves[i]);
|
|
|
|
var min = moves.Length - baseMoves.Length + baseIndex;
|
|
|
|
if (i < min + count)
|
|
|
|
return false;
|
2021-04-05 01:30:01 +00:00
|
|
|
}
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-01-22 04:02:33 +00:00
|
|
|
private static void MarkMovesForOrigin(in BreedInfo<EggSource34> value, ReadOnlySpan<ushort> eggMoves, int count, bool inheritLevelUp, PersonalInfo4 info, GameVersion gameVersion)
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
var possible = value.Possible;
|
|
|
|
var learn = value.Learnset;
|
|
|
|
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
|
2023-03-26 00:55:55 +00:00
|
|
|
var tmlist = TM_4;
|
|
|
|
var hmlist = gameVersion is HG or SS ? HM_HGSS : HM_DPPt;
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
var moves = value.Moves;
|
|
|
|
for (int i = 0; i < count; i++)
|
2021-04-05 01:30:01 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
var move = moves[i];
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2024-05-01 05:49:43 +00:00
|
|
|
if (baseEgg.Contains(move))
|
2022-06-18 18:04:24 +00:00
|
|
|
possible[i] |= 1 << (int)Base;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2023-04-10 08:26:54 +00:00
|
|
|
if (inheritLevelUp && learn.GetIsLearn(move))
|
2022-06-18 18:04:24 +00:00
|
|
|
possible[i] |= 1 << (int)ParentLevelUp;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
if (eggMoves.Contains(move))
|
|
|
|
possible[i] |= 1 << (int)FatherEgg;
|
2021-04-05 01:30:01 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var tmIndex = tmlist.IndexOf(move);
|
2023-01-22 04:02:33 +00:00
|
|
|
if (tmIndex != -1 && info.GetIsLearnTM(tmIndex))
|
2022-06-18 18:04:24 +00:00
|
|
|
possible[i] |= 1 << (int)FatherTM;
|
2021-08-28 20:54:58 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
var hmIndex = hmlist.IndexOf(move);
|
2023-01-22 04:02:33 +00:00
|
|
|
if (hmIndex != -1 && info.GetIsLearnHM(hmIndex))
|
2022-06-18 18:04:24 +00:00
|
|
|
possible[i] |= 1 << (int)FatherTM;
|
2021-04-05 01:30:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|