Revise natureamp clicks

now behaves correctly without off-by-1 behavior
This commit is contained in:
Kurt 2023-01-31 18:31:40 -08:00
parent 6bf3d4ce9f
commit 39fe454840
2 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
using System; using System;
using static PKHeX.Core.NatureAmpRequest; using static PKHeX.Core.NatureAmpRequest;
namespace PKHeX.Core; namespace PKHeX.Core;
@ -25,7 +25,7 @@ public static class NatureAmp
return GetNewNature(type, statIndex, up, dn); return GetNewNature(type, statIndex, up, dn);
} }
/// <inheritdoc cref="GetNewNature(PKHeX.Core.NatureAmpRequest,int,int)"/> /// <inheritdoc cref="GetNewNature(NatureAmpRequest,int,int)"/>
public static int GetNewNature(NatureAmpRequest type, int statIndex, int up, int dn) public static int GetNewNature(NatureAmpRequest type, int statIndex, int up, int dn)
{ {
// //
@ -65,8 +65,8 @@ public static class NatureAmp
/// </summary> /// </summary>
public static (int up, int dn) GetNatureModification(int nature) public static (int up, int dn) GetNatureModification(int nature)
{ {
var up = (nature / 5) + 1; var up = (nature / 5);
var dn = (nature % 5) + 1; var dn = (nature % 5);
return (up, dn); return (up, dn);
} }
@ -99,8 +99,8 @@ public static class NatureAmp
var (up, dn) = GetNatureModification(nature); var (up, dn) = GetNatureModification(nature);
if (IsNeutralOrInvalid(nature, up, dn)) if (IsNeutralOrInvalid(nature, up, dn))
return; return;
stats[up] *= 11; stats[up] /= 10; stats[up + 1] *= 11; stats[up + 1] /= 10;
stats[dn] *= 9; stats[dn] /= 10; stats[dn + 1] *= 9; stats[dn + 1] /= 10;
} }
} }

View file

@ -481,8 +481,8 @@ public partial class StatEditor : UserControl
if (NatureAmp.IsNeutralOrInvalid(nature, up, dn)) if (NatureAmp.IsNeutralOrInvalid(nature, up, dn))
return "-/-"; return "-/-";
var incr = L_Stats[up]; var incr = L_Stats[up + 1];
var decr = L_Stats[dn]; var decr = L_Stats[dn + 1];
incr.ForeColor = StatIncreased; incr.ForeColor = StatIncreased;
decr.ForeColor = StatDecreased; decr.ForeColor = StatDecreased;
return $"+{incr.Text} / -{decr.Text}".Replace(":", ""); return $"+{incr.Text} / -{decr.Text}".Replace(":", "");