Example #1
0
    /// <summary>
    /// Mutate the nature amp indexes to match the request
    /// </summary>
    /// <param name="type">Request type to modify the provided <see cref="statIndex"/></param>
    /// <param name="statIndex">Stat Index to mutate</param>
    /// <param name="currentNature">Current nature to derive the current amps from</param>
    /// <returns>New nature value</returns>
    public static int GetNewNature(this NatureAmpRequest type, int statIndex, int currentNature)
    {
        if (currentNature > (int)Nature.Quirky)
        {
            return(-1);
        }

        var(up, dn) = GetNatureModification(currentNature);

        return(GetNewNature(type, statIndex, up, dn));
    }
Example #2
0
    /// <inheritdoc cref="GetNewNature(PKHeX.Core.NatureAmpRequest,int,int)"/>
    public static int GetNewNature(NatureAmpRequest type, int statIndex, int up, int dn)
    {
        //
        switch (type)
        {
        case Increase when up != statIndex:
            up = statIndex;
            break;

        case Decrease when dn != statIndex:
            dn = statIndex;
            break;

        case Neutral when up != statIndex && dn != statIndex:
            up = dn = statIndex;
            break;

        default:
            return(-1);    // failure
        }

        return(CreateNatureFromAmps(up, dn));
    }