mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Sanity check ability index on transfer
Passing an entity with AbilityNumber of 7 no longer throws an exception on transfer logic
This commit is contained in:
parent
d138755ed0
commit
9f21f45f25
|
|
@ -201,7 +201,10 @@ private void PopulateFromCore(PKH pkh)
|
|||
var pi = PersonalTable.LA.GetFormEntry(pkh.Species, pkh.Form);
|
||||
HeightAbsolute = PA8.GetHeightAbsolute(pi, pkh.HeightScalar);
|
||||
WeightAbsolute = PA8.GetWeightAbsolute(pi, pkh.HeightScalar, pkh.WeightScalar);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
|
||||
var level = Experience.GetLevel(pkh.EXP, pi.EXPGrowth);
|
||||
this.ResetMoves(pkh.Species, pkh.Form, level, LearnSource8LA.Instance, EntityContext.Gen8a);
|
||||
|
|
|
|||
|
|
@ -273,7 +273,10 @@ private void PopulateFromCore(PKH pkh)
|
|||
Obedience_Level = pkh.MetLevel;
|
||||
|
||||
var pi = PersonalTable.ZA.GetFormEntry(pkh.Species, pkh.Form);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
|
||||
var level = Experience.GetLevel(pkh.EXP, pi.EXPGrowth);
|
||||
this.ResetMoves(pkh.Species, pkh.Form, level, LearnSource9ZA.Instance, EntityContext.Gen9);
|
||||
|
|
|
|||
|
|
@ -203,7 +203,10 @@ private void PopulateFromCore(PKH pkh)
|
|||
var pi = PersonalTable.GG.GetFormEntry(pkh.Species, pkh.Form);
|
||||
HeightAbsolute = PB7.GetHeightAbsolute(pi, pkh.HeightScalar);
|
||||
WeightAbsolute = PB7.GetWeightAbsolute(pi, pkh.HeightScalar, pkh.WeightScalar);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
}
|
||||
|
||||
private static IGameDataSide? GetNearestNeighbor(PKH pkh) => pkh.DataPK9 as IGameDataSide
|
||||
|
|
|
|||
|
|
@ -126,7 +126,10 @@ public void InitializeFrom(IGameDataSide side, PKH pkh)
|
|||
private void PopulateFromCore(PKH pkh)
|
||||
{
|
||||
var pi = PersonalTable.BDSP.GetFormEntry(pkh.Species, pkh.Form);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
|
||||
var level = Experience.GetLevel(pkh.EXP, pi.EXPGrowth);
|
||||
this.ResetMoves(pkh.Species, pkh.Form, level, LearnSource8BDSP.Instance, EntityContext.Gen8b);
|
||||
|
|
|
|||
|
|
@ -201,7 +201,10 @@ public void InitializeFrom(IGameDataSide side, PKH pkh)
|
|||
private void PopulateFromCore(PKH pkh)
|
||||
{
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(pkh.Species, pkh.Form);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
}
|
||||
|
||||
private static void RemapMetEgg(GameVersion version, ref ushort met, ref ushort egg)
|
||||
|
|
|
|||
|
|
@ -208,7 +208,10 @@ private void PopulateFromCore(PKH pkh)
|
|||
Obedience_Level = pkh.MetLevel;
|
||||
|
||||
var pi = PersonalTable.SV.GetFormEntry(pkh.Species, pkh.Form);
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(AbilityNumber >> 1);
|
||||
var index = AbilityNumber >> 1;
|
||||
if (index >= pi.AbilityCount)
|
||||
index = 0;
|
||||
Ability = (ushort)pi.GetAbilityAtIndex(index);
|
||||
TeraTypeOriginal = TeraTypeOverride = TeraTypeUtil.GetTeraTypeImport(pi.Type1, pi.Type2);
|
||||
|
||||
var level = Experience.GetLevel(pkh.EXP, pi.EXPGrowth);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user