mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Add Yamask-1 max hp calc for formArg compare
Closes #2632 ty @CanoeHope
This commit is contained in:
parent
d5948b9dbe
commit
a8c28369b6
1 changed files with 27 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue