From 12c9636a0981330f0fd18ad4ed04ef86a19472bc Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 3 Apr 2016 21:46:05 -0700 Subject: [PATCH] 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. --- Legality/Checks.cs | 2 ++ Misc/PK6.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/Legality/Checks.cs b/Legality/Checks.cs index f3c1265b5..75a2fdf82 100644 --- a/Legality/Checks.cs +++ b/Legality/Checks.cs @@ -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)) diff --git a/Misc/PK6.cs b/Misc/PK6.cs index 7cc174e61..c46c8c3a7 100644 --- a/Misc/PK6.cs +++ b/Misc/PK6.cs @@ -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;