mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-27 14:24:35 -05:00
Pull out stat modification logic
This commit is contained in:
@@ -730,10 +730,7 @@ public virtual ushort[] GetStats(PersonalInfo p)
|
||||
Stats[3] = (ushort)(((HT_SPE ? 31 : IV_SPE) + 2 * p.SPE + EV_SPE / 4) * level / 100 + 5);
|
||||
|
||||
// Account for nature
|
||||
if (PKX.GetNatureModification(Nature, out int incr, out int decr))
|
||||
return Stats;
|
||||
Stats[incr] *= 11; Stats[incr] /= 10;
|
||||
Stats[decr] *= 9; Stats[decr] /= 10;
|
||||
PKX.ModifyStatsForNature(Stats, Nature);
|
||||
return Stats;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -367,6 +367,19 @@ public static bool GetNatureModification(int nature, out int incr, out int decr)
|
||||
decr = nature % 5 + 1;
|
||||
return incr == decr || nature >= 25; // invalid
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates stats according to the specified nature.
|
||||
/// </summary>
|
||||
/// <param name="Stats">Current stats to amplify if appropriate</param>
|
||||
/// <param name="nature">Nature</param>
|
||||
public static void ModifyStatsForNature(ushort[] Stats, int nature)
|
||||
{
|
||||
if (GetNatureModification(nature, out int incr, out int decr))
|
||||
return;
|
||||
Stats[incr] *= 11; Stats[incr] /= 10;
|
||||
Stats[decr] *= 9; Stats[decr] /= 10;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Positions for shuffling.
|
||||
|
||||
Reference in New Issue
Block a user