mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 11:36:40 -05:00
Cast the array a little safer
bad hacks with invalid future gen evolutions yield no evolution data, which results in empty arrays.
This commit is contained in:
@@ -21,8 +21,8 @@ public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict, IEncounterable
|
||||
{
|
||||
var level = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false);
|
||||
|
||||
if (encounter is IGeneration g)
|
||||
AddEdgeCaseMoves((List<int>)level[g.Generation], encounter, pkm);
|
||||
if (encounter is IGeneration g && level[g.Generation] is List<int> x)
|
||||
AddEdgeCaseMoves(x, encounter, pkm);
|
||||
|
||||
LevelUpMoves = level;
|
||||
TMHMMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Tutor: false, MoveReminder: false, RemoveTransferHM: false);
|
||||
|
||||
Reference in New Issue
Block a user