Improve ingame trade filtering

More strict.

Dunno about PID/EC values.
This commit is contained in:
Kaphotics 2016-03-21 21:51:36 -07:00
parent 8211509d99
commit 262abad921
2 changed files with 29 additions and 4 deletions

View file

@ -301,12 +301,37 @@ namespace PKHeX
// Get valid pre-evolutions
IEnumerable<DexLevel> p = getValidPreEvolutions(pk6);
EncounterTrade z = null;
if (pk6.XY)
return lang == 6 ? null : TradeGift_XY.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
z = lang == 6 ? null : TradeGift_XY.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
if (pk6.AO)
return lang == 6 ? null : TradeGift_AO.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
z = lang == 6 ? null : TradeGift_AO.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
return null;
if (z == null)
return null;
for (int i = 0; i < 6; i++)
if (z.IVs[i] != -1 && z.IVs[i] != pk6.IVs[i])
return null;
if (z.Shiny ^ pk6.IsShiny) // Are PIDs static?
return null;
if (z.TID != pk6.TID)
return null;
if (z.SID != pk6.SID)
return null;
if (z.Location != pk6.Met_Location)
return null;
if (z.Level != pk6.Met_Level)
return null;
if (z.Nature != Nature.Random && ((int)z.Nature != pk6.Nature))
return null;
if (z.Gender != pk6.Gender)
return null;
// if (z.Ability == 4 ^ pk6.AbilityNumber == 4) // defer to Ability
// return null;
return z;
}
private static IEnumerable<EncounterArea> getDexNavAreas(PK6 pk6)

View file

@ -166,7 +166,7 @@ namespace PKHeX
public int[] IVs = { -1, -1, -1, -1, -1, -1 };
public int[] Moves;
public int Form = 0;
public bool? Shiny = false;
public bool Shiny = false;
public int Gender = -1;
}
public enum Nature