Revert dexlevel evotree fetch + re-implement fix

check requireslevelup during evolution validity check, not during tree
generation as movepool fetch treats the 'level' as the max possible
level it was at (not the level it was encountered).

fix dropping pkm from external source causing exception (final return
false caused it to proceed with regular dragdrop operation from source
slot).

#1163
This commit is contained in:
Kurt 2017-05-23 18:35:32 -07:00
parent a98c904168
commit 7e30d863b0
3 changed files with 14 additions and 11 deletions

View file

@ -2612,8 +2612,9 @@ namespace PKHeX.Core
var evos = Legal.getValidPreEvolutions(pkm);
var matchEvo = evos.FirstOrDefault(z => z.Species == match.Species);
bool IsValid = matchEvo == null || matchEvo.Level >= match.LevelMin;
return IsValid;
return matchEvo == null || matchEvo.RequiresLvlUp
? matchEvo.Level > match.LevelMin
: matchEvo.Level >= match.LevelMin;
}
private void verifyVersionEvolution()
{

View file

@ -626,9 +626,9 @@ namespace PKHeX.Core
if (evo.Species > maxSpeciesTree)
species = pkm.Species - Chain.Count + i;
dl.Add(evo.GetDexLevel(species, lvl));
if (evo.RequiresLevelUp)
lvl--;
dl.Add(evo.GetDexLevel(species, lvl));
break;
}
if (!oneValid)

View file

@ -199,24 +199,27 @@ namespace PKHeX.WinForms.Controls
WinFormsUtil.Alert("Unable to set to locked slot.");
return;
}
if (DragInfo.Source.Offset < 0 && TryLoadFiles(files)) // file
if (DragInfo.Source.Offset < 0) // external source
{
TryLoadFiles(files);
return;
}
TrySetPKMDestination(sender, e, overwrite, clone);
if (DragInfo.Source.Parent == null) // internal file
DragInfo.Reset();
}
private bool TryLoadFiles(string[] files)
private void TryLoadFiles(string[] files)
{
if (files.Length <= 0)
return true;
return;
string file = files[0];
FileInfo fi = new FileInfo(file);
if (!PKX.getIsPKM(fi.Length) && !MysteryGift.getIsMysteryGift(fi.Length))
{
SE.ParentForm.DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { file }), DragDropEffects.Move);
return true;
SE.ParentForm?.DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { file }), DragDropEffects.Move);
return;
}
byte[] data = File.ReadAllBytes(file);
@ -229,7 +232,7 @@ namespace PKHeX.WinForms.Controls
{
WinFormsUtil.Error(c);
Console.WriteLine(c);
return true;
return;
}
string[] errata = SAV.IsPKMCompatible(pk);
@ -240,13 +243,12 @@ namespace PKHeX.WinForms.Controls
{
Console.WriteLine(c);
Console.WriteLine(concat);
return true;
return;
}
}
SetPKM(pk, false, Resources.slotSet);
Console.WriteLine(c);
return false;
}
private void TrySetPKMDestination(object sender, DragEventArgs e, bool overwrite, bool clone)
{