Misc legality checks (gen5-7) (#1020)

* Add Flabebe and Pumkaboo altform HA legality check

Fix issue #999
The derived value SpecForm can use for other legality checks

* Add N's pkm and Hidden Grotto shiny legality checks

-fix early return in verifyMisc
-add N's pkm legality check: IVs, OT Name, TID, SID, Shiny
-add Hidden Grotto shiny check

* Fix spelling

* More edge cases for gen6 ball checks

Ban several altform hidden ability with gen3 ball

* Fix gen4 Formcount for altform

Manually fix several bytes (http://i.imgur.com/l0Amuto.png)
This commit is contained in:
wwwwwwzx 2017-04-02 06:39:39 -07:00 committed by Kurt
parent 32b2abf7a9
commit ef7ca4f65c
9 changed files with 103 additions and 17 deletions

View file

@ -122,6 +122,14 @@ namespace PKHeX.Core
return;
}
}
if (EncounterType == typeof(EncounterSlot[]))
{
if (pkm.IsShiny && (EncounterMatch as EncounterSlot[]).All(slot => slot.Type == SlotType.HiddenGrotto))
{
AddLine(Severity.Invalid, V221, CheckIdentifier.Shiny);
return;
}
}
int wIndex = Array.IndexOf(Legal.WurmpleEvolutions, pkm.Species);
if (pkm.GenNumber >= 6)
@ -1247,6 +1255,11 @@ namespace PKHeX.Core
return;
}
}
if (Legal.Ban_NoHidden6.Contains(pkm.SpecForm) && pkm.AbilityNumber == 4)
{
AddLine(Severity.Invalid, V112, CheckIdentifier.Ability);
return;
}
}
if (pkm.GenNumber == 7)
{
@ -1276,7 +1289,7 @@ namespace PKHeX.Core
return;
}
}
if (Legal.Ban_NoHidden7.Contains(pkm.Species) && pkm.AbilityNumber == 4)
if (Legal.Ban_NoHidden7.Contains(pkm.SpecForm) && pkm.AbilityNumber == 4)
{
AddLine(Severity.Invalid, V112, CheckIdentifier.Ability);
return;
@ -1491,7 +1504,7 @@ namespace PKHeX.Core
{
if (Legal.Ban_Gen3Ball.Contains(pkm.Species))
AddLine(Severity.Invalid, V121, CheckIdentifier.Ball);
else if (pkm.AbilityNumber == 4 && 152 <= pkm.Species && pkm.Species <= 160)
else if (pkm.AbilityNumber == 4 && Legal.Ban_Gen3BallHidden.Contains(pkm.SpecForm))
AddLine(Severity.Invalid, V122, CheckIdentifier.Ball);
else
AddLine(Severity.Valid, V123, CheckIdentifier.Ball);
@ -2208,20 +2221,31 @@ namespace PKHeX.Core
}
else if (pkm.FatefulEncounter)
AddLine(Severity.Invalid, V325, CheckIdentifier.Fateful);
return;
}
if (pkm.FatefulEncounter)
else if (pkm.FatefulEncounter)
AddLine(Severity.Invalid, V325, CheckIdentifier.Fateful);
if (pkm.Format == 5)
if (pkm.GenNumber == 5)
{
var enc = EncounterMatch as EncounterStatic;
bool req = enc?.NSparkle ?? false;
bool has = ((PK5) pkm).NPokémon;
if (req && !has)
AddLine(Severity.Invalid, V326, CheckIdentifier.Fateful);
if (!req && has)
AddLine(Severity.Invalid, V327, CheckIdentifier.Fateful);
if (pkm.Format == 5)
{
bool has = ((PK5)pkm).NPokémon;
if (req && !has)
AddLine(Severity.Invalid, V326, CheckIdentifier.Fateful);
if (!req && has)
AddLine(Severity.Invalid, V327, CheckIdentifier.Fateful);
}
if (req)
{
if (pkm.IVs.Any(iv => iv != 30))
AddLine(Severity.Invalid, V218, CheckIdentifier.IVs);
if (pkm.OT_Name != "N" || pkm.TID != 00002 || pkm.SID != 00000)
AddLine(Severity.Invalid, V219, CheckIdentifier.Trainer);
if (pkm.IsShiny)
AddLine(Severity.Invalid, V220, CheckIdentifier.Shiny);
}
}
}
}

View file

@ -85,6 +85,8 @@ namespace PKHeX.Core
public static string V214 {get; set;} = "Cascoon";
public static string V215 {get; set;} = "PID should be equal to EC [with top bit flipped]!";
public static string V216 {get; set;} = "PID should be equal to EC!";
public static string V220 {get; set;} = "N's Pokemon cannot be shiny.";
public static string V221 {get; set;} = "Hidden Grotto captures cannot be shiny.";
public static string V14 {get; set;} = "Egg matches language Egg name."; // Valid
public static string V17 {get; set;} = "Nickname does not match another species name."; // Valid
@ -116,6 +118,7 @@ namespace PKHeX.Core
public static string V27 {get; set;} = "EVs are all equal."; // Fishy
public static string V31 {get; set;} = "All IVs are 0."; // Fishy
public static string V32 {get; set;} = "All IVs are equal."; // Fishy
public static string V218 {get; set;} = "All IVs of N's Pokemon should be 30."; // Invalid
public static string V28 {get; set;} = "Should have at least {0} IVs = 31."; // Invalid
public static string V29 {get; set;} = "Friend Safari captures should have at least 2 IVs = 31."; // Invalid
@ -124,6 +127,7 @@ namespace PKHeX.Core
public static string V38 {get; set;} = "OT Name too long."; // Invalid
public static string V39 {get; set;} = "Incorrect RBY event OT Name."; // Invalid
public static string V34 {get; set;} = "SID should be 0."; // Invalid
public static string V219 {get; set;} = "The Name/TID/SID of N is incorrect."; // Invalid
public static string V33 {get; set;} = "TID and SID are 0."; // Fishy
public static string V35 {get; set;} = "TID and SID are equal."; // Fishy
public static string V36 {get; set;} = "TID is zero."; // Fishy

View file

@ -1003,22 +1003,22 @@ namespace PKHeX.Core
private static int[] TrophyDP = {035, 039, 052, 113, 133, 137, 173, 174, 183, 298, 311, 312, 351, 438, 439, 440}; // Porygon
private static int[] TrophyPt = {035, 039, 052, 113, 133, 132, 173, 174, 183, 298, 311, 312, 351, 438, 439, 440}; // Ditto
private static readonly int[] DP_GreatMarshAlt_Speices =
private static readonly int[] DP_GreatMarshAlt_Species =
{
// Daily changing Pokemon are not in the raw data http://bulbapedia.bulbagarden.net/wiki/Great_Marsh
055,315,397,451,453,455,
183,194,195,298,399,400, // Pre-National Pokédex
046,102,115,193,285,316,452,454 // Post-National Pokédex
};
private static readonly EncounterArea[] DP_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(DP_GreatMarshAlt_Speices, new[] { 22, 22, 24, 24, 26, 26 }, 52, SlotType.Grass_Safari);
private static readonly EncounterArea[] DP_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(DP_GreatMarshAlt_Species, new[] { 22, 22, 24, 24, 26, 26 }, 52, SlotType.Grass_Safari);
private static readonly int[] Pt_GreatMarshAlt_Speices =
private static readonly int[] Pt_GreatMarshAlt_Species =
{
114,193,195,357,451,453,455,
194, // Pre-National Pokédex
046,102,115,285,316,352,452,454 // Post-National Pokédex
};
private static readonly EncounterArea[] Pt_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(Pt_GreatMarshAlt_Speices, new[] { 27, 30 }, 52, SlotType.Grass_Safari);
private static readonly EncounterArea[] Pt_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(Pt_GreatMarshAlt_Species, new[] { 27, 30 }, 52, SlotType.Grass_Safari);
private static readonly int[] Shellos_EastSeaLocation_DP =
{

View file

@ -569,6 +569,22 @@ namespace PKHeX.Core
};
#endregion
internal static readonly int[] Ban_NoHidden6 =
{
//Not avaliable at Friend Safari or Horde Encounter
669 + (2 << 11), //Flabébé-Orange
670 + (2 << 11), //Floette-Orange
671 + (2 << 11), //Florges-Orange
669 + (4 << 11), //Flabébé-White
670 + (4 << 11), //Floette-White
671 + (4 << 11), //Florges-White
710 + (1 << 11), //Pumpkaboo-Small
711 + (1 << 11), //Gourgeist-Small
710 + (2 << 11), //Pumpkaboo-Large
711 + (2 << 11), //Gourgeist-Large
//Super Size can be obtained as a Pumpkaboo from event distributions
};
#region Ball Table
internal static readonly int[] Inherit_Sport =
{
@ -651,6 +667,21 @@ namespace PKHeX.Core
497, 500, 503, //3
566, 567, 696, 697, 698, 699 // Fossil Only obtain
};
internal static readonly int[] Ban_Gen3BallHidden =
{
// can have HA and can be in gen 3 ball as eggs but can not at same time.
152, 155, 158, //1 - Gen2 Starters
153, 156, 159, //2
154, 157, 160, //3
585 + (1 << 11), //Deerling-Summer
586 + (1 << 11), //Sawsbuck-Summer
585 + (2 << 11), //Deerling-Autumn
586 + (2 << 11), //Sawsbuck-Autumn
585 + (3 << 11), //Deerling-Winter
586 + (3 << 11), //Sawsbuck-Winter
710 + (3 << 11), //Pumpkaboo-Super
711 + (3 << 11), //Gourgeist-Super
};
internal static readonly int[] Ban_Gen4Ball_6 =
{
152, 155, 158, //1 - Chikorita, Cyndaquil, Totodile

View file

@ -565,6 +565,19 @@ namespace PKHeX.Core
729, // Brionne
730, // Primarina
774, // Minior
//Pre-Gen
669 + (2 << 11), //Flabébé-Orange
670 + (2 << 11), //Floette-Orange
671 + (2 << 11), //Florges-Orange
669 + (4 << 11), //Flabébé-White
670 + (4 << 11), //Floette-White
671 + (4 << 11), //Florges-White
710 + (1 << 11), //Pumpkaboo-Small
711 + (1 << 11), //Gourgeist-Small
710 + (2 << 11), //Pumpkaboo-Large
711 + (2 << 11), //Gourgeist-Large
};
#region Pre-Bank Illegality
internal static readonly int[] Bank_NoHidden7 =

View file

@ -256,6 +256,7 @@ namespace PKHeX.Core
public abstract int CurrentHandler { get; set; }
// Derived
public int SpecForm { get { return Species + (AltForm << 11); } set { Species = value & 0x7FF; AltForm = value >> 11; } }
public virtual int SpriteItem => HeldItem;
public virtual bool IsShiny => TSV == PSV;
public virtual bool Locked { get { return false; } set { } }

Binary file not shown.

View file

@ -45,6 +45,8 @@ V213 = Silcoon
V214 = Cascoon
V215 = PID should be equal to EC [with top bit flipped]!
V216 = PID should be equal to EC!
V220 = N's Pokemon cannot be shiny.
V221 = Hidden Grotto captures cannot be shiny.
V14 = Egg matches language Egg name.
V17 = Nickname does not match another species name.
V18 = Nickname matches species name.
@ -73,12 +75,14 @@ V26 = EVs cannot go above 252.
V27 = EVs are all equal.
V31 = All IVs are 0.
V32 = All IVs are equal.
V218 = All IVs of N's Pokemon should be 30.
V28 = Should have at least {0} IVs = 31.
V29 = Friend Safari captures should have at least 2 IVs = 31.
V30 = IVs do not match Mystery Gift Data.
V38 = OT Name too long.
V39 = Incorrect RBY event OT Name.
V34 = SID should be 0.
V219 = The Name/TID/SID of N is incorrect.
V33 = TID and SID are 0.
V35 = TID and SID are equal.
V36 = TID is zero.
@ -280,5 +284,4 @@ V354 = Non Platinum Shaymin from Flower Paradise. Unreleased event.
V357 = Only one Ninjask move allowed.
V358 = Inherited move learned by Level-up. Incompatible with event egg moves.
V359 = Unable to match a gift egg encounter from origin game.
V360 = Unable to match an event egg encounter from origin game.
V360 = Unable to match an event egg encounter from origin game.

View file

@ -27,6 +27,8 @@ V344 = 遗传了蛋招式。
V345 = 遗传了升级招式。
V346 = 遗传了教学招式。
V349 = 遗传了TM/HM招式。
V355 = 通过土居忍士进化为铁面忍者习得。
V356 = 通过土居忍士在第{0}世代进化为铁面忍者习得。
V203 = 无性别宝可梦不能有性别。
V201 = 未设置加密常数。
V204 = 持有物未解禁。
@ -43,6 +45,8 @@ V213 = 甲壳茧
V214 = 盾甲茧
V215 = PID应与加密常数相等[第一位反转]!
V216 = PID应与加密常数相等!
V220 = N的宝可梦不能为闪。
V221 = 在隐藏洞穴捕获的宝可梦不能为闪。
V14 = 蛋名称与语言一致。
V17 = 昵称不与另一种类名一致。
V18 = 昵称与种类名一致。
@ -71,12 +75,14 @@ V26 = 单项努力值不能超过252。
V27 = 所有努力值相等。
V31 = 所有个体为0。
V32 = 所有个体值相等。
V218 = N的宝可梦所有个体值应为30。
V28 = 至少有 {0} 项个体值 = 31。
V29 = 在朋友原野区捕获的宝可梦至少有两项个体 = 31。
V30 = 个体值与神秘礼物数据不一致。
V38 = 初训家名称太长。
V39 = 不正确初代四色配信初训家名。
V34 = 里ID应为 0。
V219 = N的初训家或表里ID不正确。
V33 = 表ID与里ID为 0。
V35 = 表里ID相等。
V36 = 表ID为0。
@ -274,4 +280,8 @@ V350 = 遗传了TM/HM招式。配信的蛋不应有。
V351 = 不合法遇见地点,应该为传送或王冠。
V352 = 来自初始之间的阿尔宙斯,未发布的配信。
V353 = 非日版来自边境的小岛的梦幻,未发布的配信。
V354 = 非白金版来自花之乐园的谢米,未发布的配信。
V354 = 非白金版来自花之乐园的谢米,未发布的配信。
V357 = 只能拥有一个铁面忍者的招式。
V358 = 遗传升级招式。与配信蛋招式冲突。
V359 = 无法在来源版本中匹配到相应的礼物蛋。
V360 = 无法在来源版本中匹配到相应的配信蛋。