Loading...   


static int32 calculateMNKACBonus(const uint8 pLevel, const uint32 pWeight) {

    int bonus = 0;
    float reduction = 0.0f;
    int hardCap = 0;
    int softCap = 0;

    if (pLevel <= 30) { hardCap = 32; softCap = 15; }
    else if (pLevel <= 45) { hardCap = 34; softCap = 16; }
    else if (pLevel <= 51) { hardCap = 36; softCap = 17; }
    else if (pLevel <= 55) { hardCap = 38; softCap = 18; }
    else if (pLevel <= 60) { hardCap = 40; softCap = 20; }
    else if (pLevel <= 62) { hardCap = 45; softCap = 24; }
    else if (pLevel <= 64) { hardCap = 47; softCap = 24; }
    else if (pLevel <= 65) { hardCap = 50; softCap = 24; }
    else if (pLevel <= 70) { hardCap = 53; softCap = 26; }
    else if (pLevel <= 75) { hardCap = 53; softCap = 28; }
    else if (pLevel <= 80) { hardCap = 53; softCap = 30; }
    else if (pLevel <= 85) { hardCap = 54; softCap = 31; }
    else if (pLevel <= 90) { hardCap = 55; softCap = 32; }
    else if (pLevel <= 95) { hardCap = 56; softCap = 33; }
    else if (pLevel < 100) { hardCap = 57; softCap = 34; }
    else { hardCap = 58; softCap = 35; }

    // Less than hard cap.
    if (pWeight < hardCap) {
        bonus = pLevel + 5;

        // Greater than soft cap.
        if (pWeight > softCap) {
            reduction = (pWeight - softCap) * 6.66667;
            if (reduction > 100.0f) reduction = 100.0f;
            reduction = (100 - reduction) / 100;
            bonus = bonus * reduction;
            if (bonus < 0) bonus = 0;

            bonus = (4 * bonus) / 3;
        }
    }
    // Greater than or equal to hard cap.
    else {
        uint32 penalty = pLevel + 5;
        float c = (pWeight - (hardCap - 10.0f)) / 100.0f;
        if (c > 1.0f) c = 1.0f;
        penalty = (4 * penalty) / 3;
        penalty = c * penalty;

        bonus = penalty;
    }

    return bonus;
}

Raw Paste Data