Add better contest stat checks

A pokemon from XY that has never been traded cannot have contest stats
other than 0.

Milotic cannot be Beauty-LevelUp evolved in XY as an untraded mon.
This commit is contained in:
Kaphotics 2016-04-03 21:46:05 -07:00
parent 09811c32e4
commit 12c9636a09
2 changed files with 3 additions and 0 deletions

View file

@ -520,6 +520,8 @@ namespace PKHeX
return new LegalityCheck(Severity.Invalid, "Untraded -- Handling Trainer Friendship should be zero.");
if (pk6.HT_Affection != 0)
return new LegalityCheck(Severity.Invalid, "Untraded -- Handling Trainer Affection should be zero.");
if (pk6.XY && pk6.CNTs.Any(stat => stat > 0))
return new LegalityCheck(Severity.Invalid, "Untraded -- Contest stats on XY should be zero.");
// We know it is untraded (HT is empty), if it must be trade evolved flag it.
if (Legal.getHasTradeEvolved(pk6))

View file

@ -417,6 +417,7 @@ namespace PKHeX
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5]; } }
public int[] EVs => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD };
public int[] CNTs => new[] { CNT_Cool, CNT_Beauty, CNT_Cute, CNT_Smart, CNT_Tough, CNT_Sheen };
public int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 4);
public int TSV => (TID ^ SID) >> 4;
public bool IsShiny => TSV == PSV;