mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 14:00:21 +00:00
Add forme range check method to personalinfo
relocates logic to better location
This commit is contained in:
parent
b2b6df7808
commit
f25b4fea9c
3 changed files with 10 additions and 4 deletions
|
@ -1857,7 +1857,7 @@ namespace PKHeX.Core
|
|||
if (count <= 1 && pkm.AltForm == 0)
|
||||
return; // no forms to check
|
||||
|
||||
if (pkm.AltForm >= count && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, Info.Generation))
|
||||
if (!PersonalInfo.IsFormeWithinRange(pkm.AltForm) && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, Info.Generation))
|
||||
{
|
||||
AddLine(Severity.Invalid, string.Format(V304, count-1, pkm.AltForm), CheckIdentifier.Form);
|
||||
return;
|
||||
|
|
|
@ -117,5 +117,12 @@
|
|||
}
|
||||
public bool HasFormes => FormeCount > 1;
|
||||
public int BST => HP + ATK + DEF + SPE + SPA + SPD;
|
||||
|
||||
public bool IsFormeWithinRange(int forme)
|
||||
{
|
||||
if (forme == 0)
|
||||
return true;
|
||||
return forme < FormeCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,9 +170,8 @@ namespace PKHeX.WinForms
|
|||
else if (SAV.MaxSpeciesID < pkm.Species)
|
||||
errata.Add($"Game can't obtain species: {GameInfo.Strings.specieslist[pkm.Species]}");
|
||||
|
||||
int count = SAV.Personal[pkm.Species].FormeCount;
|
||||
if (pkm.AltForm >= SAV.Personal[pkm.Species].FormeCount && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
|
||||
errata.Add(string.Format(LegalityCheckStrings.V304, count - 1, pkm.AltForm));
|
||||
if (!SAV.Personal[pkm.Species].IsFormeWithinRange(pkm.AltForm) && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
|
||||
errata.Add(string.Format(LegalityCheckStrings.V304, Math.Max(0, SAV.Personal[pkm.Species].FormeCount - 1), pkm.AltForm));
|
||||
|
||||
if (pkm.Moves.Any(m => m > GameInfo.Strings.movelist.Length))
|
||||
errata.Add($"Item Index beyond range: {string.Join(", ", pkm.Moves.Where(m => m > GameInfo.Strings.movelist.Length).Select(m => m.ToString()))}");
|
||||
|
|
Loading…
Reference in a new issue