Add ingame trade checks

There's memories associated, IVs, EVs, whatever; best to check them in
the individual legality check methods.
This commit is contained in:
Kaphotics 2016-03-17 17:25:21 -07:00
parent 0fc4da3431
commit d986b3bb86
3 changed files with 24 additions and 5 deletions

View file

@ -7,6 +7,7 @@ namespace PKHeX
{
private readonly PK6 pk6;
private WC6 MatchedWC6;
private object EncounterMatch;
private LegalityCheck ECPID, Nickname, IDs, IVs, EVs, Encounter;
public bool Valid = true;
@ -39,12 +40,12 @@ namespace PKHeX
private void updateChecks()
{
Encounter = verifyEncounter();
ECPID = verifyECPID();
Nickname = verifyNickname();
IDs = verifyID();
IVs = verifyIVs();
EVs = verifyEVs();
Encounter = verifyEncounter();
SecondaryChecked = true;
}
private string getLegalityReport()

View file

@ -212,8 +212,7 @@ namespace PKHeX
return new LegalityCheck(Severity.Valid, "Valid friend safari encounter.");
}
// Not Implemented: In-Game Trades
if (Legal.getDexNavValid(pk6))
return new LegalityCheck(Severity.Valid, "Valid (DexNav) encounter at location.");
if (Legal.getWildEncounterValid(pk6))
@ -222,6 +221,12 @@ namespace PKHeX
? new LegalityCheck(Severity.Valid, "Valid encounter at location.")
: new LegalityCheck(Severity.Invalid, "Hidden ability on valid encounter.");
}
EncounterTrade t = Legal.getIngameTrade(pk6);
if (t != null)
{
EncounterMatch = t; // Check in individual methods
return new LegalityCheck(Severity.Valid, "Valid ingame trade.");
}
return new LegalityCheck(Severity.Invalid, "Not a valid encounter.");
}
private LegalityCheck[] verifyMoves()

View file

@ -494,11 +494,24 @@ namespace PKHeX
#region Static Encounter/Gift Tables
private static readonly EncounterTrade[] TradeGift_XY =
{
new EncounterTrade { Species = 296, Ability = 2, Gender = 0, TID = 30724, Nature = Nature.Brave, },
new EncounterTrade { Species = 129, Level = 5, Ability = 1, Gender = 0, TID = 44285, Nature = Nature.Adamant, }, // Magikarp
new EncounterTrade { Species = 133, Level = 5, Ability = 1, Gender = 1, TID = 29294, Nature = Nature.Docile, }, // Eevee
new EncounterTrade { Species = 83, Level = 10, Ability = 1, Gender = 0, TID = 00185, Nature = Nature.Jolly, IVs = new[] {-1, -1, -1, 31, -1, -1}, }, // Farfetch'd
new EncounterTrade { Species = 208, Level = 20, Ability = 1, Gender = 1, TID = 19250, Nature = Nature.Impish, IVs = new[] {-1, -1, 31, -1, -1, -1}, }, // Steelix
new EncounterTrade { Species = 625, Level = 50, Ability = 1, Gender = 0, TID = 03447, Nature = Nature.Adamant, IVs = new[] {-1, 31, -1, -1, -1, -1}, }, // Bisharp
new EncounterTrade { Species = 656, Level = 5, Ability = 1, Gender = 0, TID = 00037, Nature = Nature.Jolly, IVs = new[] {20, 20, 20, 31, 20, 20}, }, // Froakie
new EncounterTrade { Species = 650, Level = 5, Ability = 1, Gender = 0, TID = 00037, Nature = Nature.Adamant, IVs = new[] {20, 31, 20, 20, 20, 20}, }, // Chespin
new EncounterTrade { Species = 653, Level = 5, Ability = 1, Gender = 0, TID = 00037, Nature = Nature.Modest, IVs = new[] {20, 20, 20, 20, 31, 20}, }, // Fennekin
new EncounterTrade { Species = 280, Level = 5, Ability = 1, Gender = 1, TID = 37110, Nature = Nature.Modest, IVs = new[] {20, 20, 20, 31, 31, 20}, }, // Ralts
};
private static readonly EncounterTrade[] TradeGift_AO =
{
new EncounterTrade { Species = 296, Ability = 2, Gender = 0, TID = 30724, Nature = Nature.Brave, },
new EncounterTrade { Species = 296, Level = 9, Ability = 2, Gender = 0, TID = 30724, Nature = Nature.Brave, IVs = new[] {-1, 31, -1, -1, -1, -1}, }, // Makuhita
new EncounterTrade { Species = 300, Level = 25, Ability = 1, Gender = 1, TID = 03239, Nature = Nature.Naughty, IVs = new[] {-1, -1, -1, 31, -1, -1}, }, // Skitty
new EncounterTrade { Species = 222, Level = 50, Ability = 4, Gender = 1, TID = 00325, Nature = Nature.Calm, IVs = new[] {31, -1, -1, -1, -1, 31}, }, // Corsola
};
#endregion
}