mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 09:04:09 -05:00
Fix gen1 VC legality checking error
GetGenMovesCheckOrder doesn't respect generation restrictions, while EncounterMoves does; filter afterwards. Add compiler flags in the Analysis file to toggle try/catch off for easier debugging. Just uncomment the #define SUPPRESS line. Closes #1345
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
#define SUPPRESS
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using static PKHeX.Core.LegalityCheckStrings;
|
||||
@@ -55,7 +56,9 @@ private IEnumerable<int> AllSuggestedRelearnMoves
|
||||
|
||||
public LegalityAnalysis(PKM pk)
|
||||
{
|
||||
#if SUPPRESS
|
||||
try
|
||||
#endif
|
||||
{
|
||||
switch (pk.Format) // prior to storing GameVersion
|
||||
{
|
||||
@@ -90,14 +93,16 @@ public LegalityAnalysis(PKM pk)
|
||||
AddLine(Severity.Indeterminate, V188, CheckIdentifier.Fateful);
|
||||
}
|
||||
}
|
||||
#if SUPPRESS
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
System.Diagnostics.Debug.WriteLine(e.Message);
|
||||
Valid = false;
|
||||
AddLine(Severity.Invalid, V190, CheckIdentifier.Misc);
|
||||
pkm = pk;
|
||||
Error = true;
|
||||
}
|
||||
#endif
|
||||
Parsed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -256,6 +256,8 @@ private static CheckMoveResult[] ParseMoves(PKM pkm, int[] moves, int[] special,
|
||||
var IncenseMovesLearned = new List<int>();
|
||||
// Check moves going backwards, marking the move valid in the most current generation when it can be learned
|
||||
int[] generations = GetGenMovesCheckOrder(pkm);
|
||||
if (pkm.Format <= 2)
|
||||
generations = generations.Where(z => z < info.EncounterMoves.LevelUpMoves.Length).ToArray();
|
||||
foreach (var gen in generations)
|
||||
{
|
||||
var HMLearned = new int[0];
|
||||
@@ -290,7 +292,7 @@ private static CheckMoveResult[] ParseMoves(PKM pkm, int[] moves, int[] special,
|
||||
else if (gen == pkm.GenNumber && special.Contains(moves[m]))
|
||||
res[m] = new CheckMoveResult(MoveSource.Special, gen, Severity.Valid, V175, CheckIdentifier.Move);
|
||||
|
||||
if (res[m] == null || gen < 3)
|
||||
if (res[m] == null || gen >= 3)
|
||||
continue;
|
||||
|
||||
if (res[m].Valid && gen == 2 && NonTradebackLvlMoves.Contains(m))
|
||||
|
||||
Reference in New Issue
Block a user