Rearrange logic for Location

Get game ID once, check pk6 game first. Will be easy to insert a third
case if/when the time comes.
This commit is contained in:
Kaphotics
2016-05-09 17:51:35 -07:00
parent ab687288f5
commit 5a21b70d11

View File

@@ -687,10 +687,12 @@ private LegalityCheck verifyOTMemory()
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)))
if (matchingOriginGame != -1)
{
int gameID = Legal.LocationsWithPKCenter[1][matchingOriginGame];
if (pk6.XY && gameID != 0 || pk6.AO && gameID != 1)
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))