misc fixes

encounterinvalid isegg no longer throws exceptions when parsing moves
dropping invalid file paths to main window are now ignored (downloads
from chrome can be manually deleted but still dragged from the downloads
bar)
add pidiv case for manaphy gift
This commit is contained in:
Kurt
2017-06-04 00:12:35 -07:00
parent 92cb651ef4
commit 14225bbc2e
3 changed files with 6 additions and 2 deletions

View File

@@ -128,12 +128,12 @@ private static CheckResult[] parseMoves3DS(PKM pkm, GameVersion game, int[] Move
}
private static CheckResult[] parseMovesPre3DS(PKM pkm, int[] Moves, LegalInfo info)
{
if (pkm.IsEgg)
if (pkm.IsEgg && info.EncounterMatch is EncounterEgg egg)
{
int[] SpecialMoves = (info.EncounterMatch as IMoveset)?.Moves;
// Gift do not have special moves but also should not have normal egg moves
var allowinherited = SpecialMoves == null && !pkm.WasGiftEgg && pkm.Species != 489 && pkm.Species != 490;
return parseMovesIsEggPreRelearn(pkm, Moves, SpecialMoves ?? new int[0], allowinherited, info.EncounterMatch as EncounterEgg);
return parseMovesIsEggPreRelearn(pkm, Moves, SpecialMoves ?? new int[0], allowinherited, egg);
}
if (pkm.GenNumber <= 2 && (info.EncounterMatch as IGeneration)?.Generation == 1)
return parseMovesGen1(pkm, Moves, info);

View File

@@ -542,6 +542,8 @@ public static bool IsCompatible4(this PIDType val, IEncounterable encounter)
return s.Shiny == true ? val == PIDType.ChainShiny : val == PIDType.Method_1;
case EncounterSlot _:
return val == PIDType.Method_1;
case PGT g: // manaphy
return val == PIDType.Method_1 || val == PIDType.None; // regular && antishiny
default:
return val == PIDType.None;
}

View File

@@ -460,6 +460,8 @@ private void OpenQuick(string path, bool force = false)
string ext = Path.GetExtension(path);
FileInfo fi = new FileInfo(path);
if (!fi.Exists)
return;
if (fi.Length > 0x10009C && fi.Length != 0x380000 && ! SAV3GCMemoryCard.IsMemoryCardSize(fi.Length))
WinFormsUtil.Error("Input file is too large." + Environment.NewLine + $"Size: {fi.Length} bytes", path);
else if (fi.Length < 32)