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;
namespace PKHeX.Core;
@ -25,7 +25,7 @@ public static class NatureAmp
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)
{
//
@ -65,8 +65,8 @@ public static class NatureAmp
/// </summary>
public static (int up, int dn) GetNatureModification(int nature)
{
var up = (nature / 5) + 1;
var dn = (nature % 5) + 1;
var up = (nature / 5);
var dn = (nature % 5);
return (up, dn);
}
@ -99,8 +99,8 @@ public static class NatureAmp
var (up, dn) = GetNatureModification(nature);
if (IsNeutralOrInvalid(nature, up, dn))
return;
stats[up] *= 11; stats[up] /= 10;
stats[dn] *= 9; stats[dn] /= 10;
stats[up + 1] *= 11; stats[up + 1] /= 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))
return "-/-";
var incr = L_Stats[up];
var decr = L_Stats[dn];
var incr = L_Stats[up + 1];
var decr = L_Stats[dn + 1];
incr.ForeColor = StatIncreased;
decr.ForeColor = StatDecreased;
return $"+{incr.Text} / -{decr.Text}".Replace(":", "");