More recognition for gen3 legality

Egg levels, ingame trade recognition

Noticed that the levelup tables for gen3/4 are missing their last move
(truncated to 0xFFFF), will have to fix later
This commit is contained in:
Kurt 2017-03-19 18:13:21 -07:00
parent d112f98ab5
commit b638f079df
4 changed files with 13 additions and 11 deletions

View File

@ -2119,15 +2119,6 @@ private CheckResult[] verifyRelearn()
GameVersion[] Games = {};
switch (pkm.GenNumber)
{
case 3:
Games = new[] {GameVersion.RS, GameVersion.E, GameVersion.FRLG};
break;
case 4:
Games = new[] {GameVersion.DP, GameVersion.Pt, GameVersion.HGSS};
break;
case 5:
Games = new[] {GameVersion.BW, GameVersion.B2W2};
break;
case 6:
Games = new[] {GameVersion.XY, GameVersion.ORAS};
break;

View File

@ -650,7 +650,12 @@ internal static EncounterTrade getValidIngameTrade(PKM pkm, GameVersion gameSour
{
if (z.Location != pkm.Met_Location)
return null;
if (z.Level != lvl)
if (pkm.Format < 5)
{
if (z.Level > lvl)
return null;
}
else if (z.Level != lvl)
return null;
}
else
@ -1859,7 +1864,7 @@ private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, IRea
for (int gen = pkm.GenNumber; gen <= pkm.Format; gen++)
if (vs[gen].Any())
r.AddRange(getValidMoves(pkm, Version, vs[gen], gen, LVL, Tutor, Machine, MoveReminder));
r.AddRange(getValidMoves(pkm, Version, vs[gen], gen, LVL: LVL, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder));
return r.Distinct().ToArray();
}

View File

@ -21,4 +21,9 @@ public class EncounterTrade : IEncounterable
public string Name => "In-game Trade";
}
public class EncounterTradePID : EncounterTrade
{
public uint PID;
}
}

View File

@ -162,6 +162,7 @@ public PK3(byte[] decryptedData = null, string ident = null)
public bool Japanese => IsEgg || Language == 1;
public override bool WasEgg => Met_Level == 0;
public override bool WasEvent => Met_Location == 255; // Fateful
public override bool WasIngameTrade => Met_Location == 254; // Trade
public override bool WasEventEgg => Met_Location == 253; // Gift Egg
public override byte[] Encrypt()