mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
Merge pull request #110 from Eskuero/master
Checks for PKM Center memories
This commit is contained in:
commit
ab687288f5
2 changed files with 52 additions and 0 deletions
|
@ -639,15 +639,18 @@ namespace PKHeX
|
|||
private LegalityCheck verifyCommonMemory(int handler)
|
||||
{
|
||||
int m = 0;
|
||||
int t = 0;
|
||||
string resultPrefix = "";
|
||||
switch (handler)
|
||||
{
|
||||
case 0:
|
||||
m = pk6.OT_Memory;
|
||||
t = pk6.OT_TextVar;
|
||||
resultPrefix = "OT ";
|
||||
break;
|
||||
case 1:
|
||||
m = pk6.HT_Memory;
|
||||
t = pk6.HT_TextVar;
|
||||
resultPrefix = "HT ";
|
||||
break;
|
||||
}
|
||||
|
@ -656,6 +659,10 @@ namespace PKHeX
|
|||
{
|
||||
return new LegalityCheck(Severity.Invalid, resultPrefix + "Memory: Species cannot learn this move.");
|
||||
}
|
||||
if (m == 6 && !Legal.LocationsWithPKCenter[0].Contains(t))
|
||||
{
|
||||
return new LegalityCheck(Severity.Invalid, resultPrefix + "Memory: Location doesn't have a Pokemon Center.");
|
||||
}
|
||||
return new LegalityCheck(Severity.Valid, resultPrefix + "Memory is valid.");
|
||||
}
|
||||
private LegalityCheck verifyOTMemory()
|
||||
|
@ -678,6 +685,13 @@ namespace PKHeX
|
|||
{
|
||||
case 4: // {0} became {1}’s friend when it arrived via Link Trade at... {2}. {4} that {3}.
|
||||
return new LegalityCheck(Severity.Invalid, "OT Memory: Link Trade is not a valid first memory.");
|
||||
case 6: // {0} went to the Pokémon Center in {2} with {1} and had its tired body healed there. {4} that {3}.
|
||||
int matchingOriginGame = Array.IndexOf(Legal.LocationsWithPKCenter[0], pk6.OT_TextVar);
|
||||
if (matchingOriginGame != -1) {
|
||||
if ((Legal.LocationsWithPKCenter[1][matchingOriginGame] == 1 && pk6.XY) || ((Legal.LocationsWithPKCenter[1][matchingOriginGame] == 0 && pk6.AO)))
|
||||
return new LegalityCheck(Severity.Invalid, "OT Memory: Location doesn't exist on Origin Game region.");
|
||||
}
|
||||
return verifyCommonMemory(0);
|
||||
case 14:
|
||||
if (!Legal.getCanBeCaptured(pk6.OT_TextVar, pk6.Version))
|
||||
return new LegalityCheck(Severity.Invalid, "OT Memory: Captured Species can not be captured in game.");
|
||||
|
|
|
@ -914,6 +914,44 @@
|
|||
},
|
||||
new[] { 57, 19, 70, 15, 249, 127, 291}, // Move IDs
|
||||
};
|
||||
internal static readonly int[][] LocationsWithPKCenter =
|
||||
{
|
||||
new[] {
|
||||
// Kalos locations with a PKMN CENTER
|
||||
18, // Santalune City
|
||||
22, // Lumiose City
|
||||
30, // Camphrier Town
|
||||
40, // Cyllage City
|
||||
44, // Ambrette Town
|
||||
52, // Geosenge Towny
|
||||
58, // Shalour City
|
||||
64, // Coumarine City
|
||||
70, // Laverre City
|
||||
76, // Dendemille Town
|
||||
86, // Anistar City
|
||||
90, // Couriway Town
|
||||
94, // Snowbelle City
|
||||
106, // Pokémon League (X/Y)
|
||||
// Hoenn locations with a PKMN CENTER
|
||||
172, // Oldale Town
|
||||
174, // Dewford Town
|
||||
176, // Lavaridge Town
|
||||
178, // Fallarbor Town
|
||||
180, // Verdanturf Town
|
||||
182, // Pacifidlog Town
|
||||
184, // Petalburg City
|
||||
186, // Slateport City
|
||||
188, // Mauville City
|
||||
190, // Rustboro City
|
||||
192, // Fortree City
|
||||
194, // Lilycove City
|
||||
196, // Mossdeep City
|
||||
198, // Sootopolis City
|
||||
200, // Ever Grande City
|
||||
202, // Pokémon League (OR/AS)
|
||||
},
|
||||
new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // Region matching
|
||||
};
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue