fix yamask/runerigus form handling (#2669)

fixes #2668
This commit is contained in:
Archit Date 2020-01-30 08:11:56 +08:00 committed by GitHub
parent b35d53368f
commit c8a16a1f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,12 +298,7 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, in uint arg)
{
if (arg != 0)
return GetInvalid(LFormArgumentNotAllowed);
break;
}
var hp_max = GetYamask1MaxHP(pkm);
if (arg > hp_max)
return GetInvalid(LFormArgumentHigh);
break;
}
case (int)Species.Runerigus:
@ -317,9 +312,6 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, in uint arg)
{
if (arg < 49)
return GetInvalid(LFormArgumentLow);
var hp_max = GetYamask1MaxHP(pkm);
if (arg > hp_max)
return GetInvalid(LFormArgumentHigh);
}
break;
}
@ -342,16 +334,5 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, in uint arg)
return GetValid(LFormArgumentValid);
}
private static int GetYamask1MaxHP(PKM pkm)
{
var lvl = pkm.CurrentLevel; // assume it was evolved at the current level (no further level ups)
var iv_hp = pkm is IHyperTrain ht && ht.HT_HP ? 31 : pkm.IV_HP;
const int base_hp = 38;
const int ev_hp = 252; // account for full EVs then removed
// Manually calculate the stat of Galarian Yamask under the most favorable conditions
return ((iv_hp + (2 * base_hp) + (ev_hp / 4) + 100) * lvl / 100) + 10;
}
}
}