Add Yamask-1 max hp calc for formArg compare

Closes #2632 ty @CanoeHope
This commit is contained in:
Kurt 2020-01-12 16:22:56 -08:00
parent d5948b9dbe
commit a8c28369b6

View file

@ -285,6 +285,20 @@ namespace PKHeX.Core
return GetInvalid(LFormArgumentNotAllowed);
break;
}
case (int)Species.Yamask when pkm.AltForm == 1:
{
if (pkm.IsEgg)
{
if (f.FormArgument != 0)
return GetInvalid(LFormArgumentNotAllowed);
break;
}
var hp_max = GetYamask1MaxHP(pkm);
if (f.FormArgument > hp_max)
return GetInvalid(LFormArgumentHigh);
break;
}
case (int)Species.Runerigus:
{
if (data.EncounterMatch.Species == (int)Species.Runerigus)
@ -296,7 +310,8 @@ namespace PKHeX.Core
{
if (f.FormArgument < 49)
return GetInvalid(LFormArgumentLow);
if (f.FormArgument > 320) // calculate Yamask HP maximum? Arbitrary bound check.
var hp_max = GetYamask1MaxHP(pkm);
if (f.FormArgument > hp_max)
return GetInvalid(LFormArgumentHigh);
}
break;
@ -320,5 +335,16 @@ namespace PKHeX.Core
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;
}
}
}