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:
Kurt 2020-01-26 23:58:14 -08:00
parent 06522c2235
commit 3111a8dc62

View File

@ -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);