mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 21:38:40 +00:00
Add another vc nature checks
transfer level exp and current exp not being different enough, which limits the amount of natures possible. Could handle the 100&<=2 cases the same way, but keep the branches for faster cases. fix bad test cases
This commit is contained in:
parent
b5b4b67263
commit
b51bdc9230
6 changed files with 23 additions and 4 deletions
|
@ -31,19 +31,38 @@ namespace PKHeX.Core
|
|||
var nature = Experience.GetNatureVC(pkm.EXP);
|
||||
if (nature != pkm.Nature)
|
||||
data.AddLine(GetInvalid(LTransferNature));
|
||||
return;
|
||||
}
|
||||
if (met <= 2) // Not enough EXP to have every nature -- check for exclusions!
|
||||
else
|
||||
{
|
||||
var pi = pkm.PersonalInfo;
|
||||
var growth = pi.EXPGrowth;
|
||||
var nature = pkm.Nature;
|
||||
bool valid = VerifyVCNature(growth, nature);
|
||||
if (!valid)
|
||||
if (met <= 2) // Not enough EXP to have every nature -- check for exclusions!
|
||||
{
|
||||
bool valid = VerifyVCNature(growth, nature);
|
||||
if (!valid)
|
||||
data.AddLine(GetInvalid(LTransferNature));
|
||||
}
|
||||
var currentEXP = pkm.EXP;
|
||||
var thresholdEXP = Experience.GetEXP(met, growth);
|
||||
var delta = currentEXP - thresholdEXP;
|
||||
if (delta < 25 && !VerifyVCNature(currentEXP, thresholdEXP, nature)) // check for precise match with current level thresholds
|
||||
data.AddLine(GetInvalid(LTransferNature));
|
||||
}
|
||||
}
|
||||
|
||||
private static bool VerifyVCNature(uint currentEXP, uint thresholdEXP, int nature)
|
||||
{
|
||||
// exp % 25 with a limited amount of EXP does not allow for every nature
|
||||
do
|
||||
{
|
||||
var vcnature = Experience.GetNatureVC(currentEXP);
|
||||
if (vcnature == nature)
|
||||
return true;
|
||||
} while (currentEXP-- != thresholdEXP);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool VerifyVCNature(int growth, int nature)
|
||||
{
|
||||
// exp % 25 with a limited amount of EXP does not allow for every nature
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue