How is combat damage determined in Old School RuneScape?

In Old School RuneScape, what determines how much damage I'll deal each hit?

What's the (quantitative) effect of each of the various factors affecting combat, such as gear, combat stat levels, special attacks, and prayers?


Strength defines how much you will hit. Attack defines how accurate you will hit.

That is, a higher attack will make sure you land more hits (instead of missing, i.e. hitting 0). A higher strength will make you hit higher values.

You can use this combat calculator to calculate your max hit. Also, this thread displays the combat formulas at code level.

Here is a copy of the formulas from the thread:

public static double combatFormula(int attack, int strength, int defence, int hitpoints, int prayer, int ranged, int magic, int summoning)

    {

        double combatLevel = (defence + hitpoints + Math.floor(prayer / 2) + Math.floor(summoning / 2)) * 0.25;



        double warrior = (attack + strength) * 0.325;

        double ranger = ranged * 0.4875;

        double mage = magic * 0.4875;



        return combatLevel + Math.max(warrior, Math.max(ranger, mage));

    }
public static int meleeMaxHit(int strengthBase, int strengthCurrent, int strengthBonus, StrengthPrayers prayer, FightingStyles fightStyle, SpecialAttacks special, Effects effect, ItemSets itemSet, int hpBase, int hpCurrent, Websites website) throws Exception

    {

        // Check for invalid input

        if (itemSet == ItemSets.Dharok && special != SpecialAttacks.None)

        {

            throw new Exception("Dharok's set effect cannot be used in conjuction with a special attack as all special attacks require a weapon other than Dharok's greataxe to be wielded.");

        }



        if (itemSet != ItemSets.None && (effect == Effects.BlackMask || effect == Effects.SlayerHelmet))

        {

            throw new Exception("No item set can be used in conjuction with the black mask or slayer helmet as only one helmet can be worn at once and helmets cannot be worn in Castle Wars.");

        }



        if (itemSet == ItemSets.Dharok && hpCurrent == 0)

        {

            throw new Exception("Dharok's set effect cannot be used with a current hitpoints level of zero as you would be dead and could not attack.");

        }



        if (itemSet == ItemSets.Dharok && hpBase > MAX_LEVEL)

        {

            throw new Exception("You cannot have a base hitpoints level greater than " + MAX_LEVEL + ".");

        }



        if (special == SpecialAttacks.Keris && !(effect == Effects.None || effect == Effects.BlackMask || effect == Effects.SlayerHelmet))

        {

            throw new Exception("Keris can only be used with the black mask / slayer helmet effect. Keris can only be used on Kalphites, so the other effects are nonexistant.");

        }



        // Calculate according to each website's current formula...



        // Criticisms: Follows an unusual formula with no real background; very accurate in certain areas but far off in others.

        if (website == Websites.RuneUniverse)

        {

            double dharokMultiplier = ((1 - ((float)hpCurrent / (float)hpBase)) * 0.95) + 1;

            double baseStrength = ((strengthCurrent + fightStyle.getStrengthBoost()) * (1 + prayer.getBoost() + effect.getBoost()));

            double bonusMultiplier = (strengthBonus * 0.00175) + 0.1;

            double maxHit = (baseStrength * bonusMultiplier) + 1.3;



            if (itemSet == ItemSets.Dharok)

            {

                maxHit *= dharokMultiplier;

            }

            else if (itemSet == ItemSets.None)

            {

                maxHit *= special.getMultiplier();

            }

            else

            {

                maxHit *= itemSet.getMultiplier();

            }



            return (int)Math.floor(maxHit);

        }

        // Criticisms:

        //  Assumes special attacks increase strength bonus, whereas Jagex states they increase damage (e.g. max hit).

        //  Assumes that the Saradomin and Zamorak godsword special attacks increase max hit by 5% when there is NO evidence for this, plus the KB specifically says that the SGS "inflicts normal damage". No mention at all, of extra damage is made in the KB for the ZGS either.

        //  Uses potions as a multiplier (e.g. Super strength potion makes a multiplier of 1.2 whereas ALL potions do is increase your strength LEVEL by a set amount derived by a formula.

        // I've modified the formula so that potions are used correctly; sections changed are commented out.

        else if (website == Websites.TipIt)

        {

            /* Not needed because this is incorrect

            double potion = 0;

            1 = None

            1.125 = Strength

            1.2 = Super Strength

            1.15 = Zamorak

            */



            double multiplier = 1;

            double maxHit = 0;

            double strengthBonus2 = strengthBonus;



            if (special == SpecialAttacks.DragonDagger)

            {

                strengthBonus += 20;

            }

            else if (special == SpecialAttacks.DragonLongsword)

            {

                strengthBonus += 30;

            }

            else if (special == SpecialAttacks.DragonMace)

            {

                strengthBonus += 60;

            }

            else if (special == SpecialAttacks.BandosGodsword)

            {

                multiplier += 0.1;

            }

            else if (special == SpecialAttacks.ArmadylGodsword)

            {

                multiplier += 0.25;

            }

            else if (special == SpecialAttacks.SaradominGodsword || special == SpecialAttacks.ZamorakGodsword)

            {

                multiplier += 0.05;

            }

            else if (itemSet == ItemSets.Dharok)

            {

                strengthBonus2 = (strengthBonus * (((float)(hpBase - hpCurrent) / 99) + 1));

            }

            else if (itemSet == ItemSets.VoidKnight)

            {

                multiplier += 0.1;

            }

            else if (special == SpecialAttacks.BerserkerNecklace)

            {

                multiplier += 0.2;

            }

            else

            {

                throw new Exception("Tip.It's formula does not support this special attack or item set.");

            }



            strengthCurrent += (int)Math.floor(strengthCurrent * effect.getBoost());



            /* Not needed because this is incorrect

            if (special == SpecialAttacks.Rampage)

            {

                potion = 1.2;      

            }

            */



            // strengthCurrent was previously: Math.floor(strengthBase * potion)

            maxHit = (((strengthCurrent + Math.floor(strengthCurrent * prayer.getBoost()) + fightStyle.getStrengthBoost()) * ((strengthBonus2 * 0.00175) + 0.1) + 1.05) * multiplier);



            if (maxHit < 1.5)

            {

                maxHit = 1;

            }

            else

            {

                maxHit = Math.ceil(maxHit);

            }



            return (int)maxHit;

        }

        // Criticisms: Like most of the others, is horrible at calculating Dharok max hits. On a positive note, it almost handles potions correctly (it factors in the fight style strength addition before the potion, where the potion should be first).

        else if (website == Websites.RuneHQ)

        {

            // NOTE: Due to the way RuneHQ's formula uses potions, the following two lines MAY cause an inaccuracy of 1 strength level due to the way it had to be converted to be used in this system

            double postMultiplier = ((float)(strengthCurrent - strengthBase) / strengthBase) + 1;

            strengthCurrent = (int)Math.ceil((strengthBase + fightStyle.getStrengthBoost()) * postMultiplier);



            double dharokMultiplier = ((1 - ((float)hpCurrent / (float)hpBase)) * ((float)2 / (float)3)) + 1;

            double baseStrength = strengthCurrent * (1 + prayer.getBoost() + effect.getBoost());

            double maxHit = 1 + ((float)strengthBonus / 100) + (((float)strengthBonus / 925) * Math.log(baseStrength));

            double maxHit2 = ((baseStrength + 13) * maxHit) / 10;



            if (special == SpecialAttacks.DragonHalberd)

            {

                maxHit2 *= 1.1;

            }

            else if (itemSet == ItemSets.Dharok)

            {

                maxHit2 *= dharokMultiplier;

            }

            else if (special == SpecialAttacks.Keris)

            {

                maxHit2 = Math.floor(maxHit2) * special.getMultiplier();

            }

            else

            {

                maxHit2 *= special.getMultiplier();

            }



            return (int)Math.floor(maxHit2);

        }

        // Criticisms: Same as Tip.It's formula in terms of potions.

        // I've also modified this one to use potions properly.

        else if (website == Websites.RuneScapeWikia)

        {

            if (itemSet != ItemSets.None)

            {

                throw new Exception("RuneScape Wikia formula does not support item sets.");

            }



            if (special != SpecialAttacks.None)

            {

                throw new Exception("RuneScape Wikia formula does not support item sets.");

            }



            if (effect != Effects.None)

            {

                throw new Exception("RuneScape Wikia does not support special effects.");

            }



            // Was previously: (strengthBase * (1 + potion + prayer.getBoost()...

            double baseStrength = (strengthCurrent * (1 + prayer.getBoost())) + fightStyle.getStrengthBoost();

            double strengthMultiplier = (strengthBonus * 0.00175) + 0.1;

            double maxHit = (baseStrength * strengthMultiplier) + 1.05;



            return (int)Math.floor(maxHit);

        }

        // Criticisms: Outdated and same potion problem as Tip.It and RS Wikia, but seems very accurate and simple and is the most logical to use as a base for new formulas.

        // Corrected potion error here also.

        else if (website == Websites.OldRSCWebsites)

        {

            if (itemSet != ItemSets.None)

            {

                throw new Exception("Old RSC formula does not support item sets.");

            }



            if (special != SpecialAttacks.None)

            {

                throw new Exception("Old RSC formula does not support item sets.");

            }



            if (effect != Effects.None)

            {

                throw new Exception("Old RSC formula does not support special effects.");

            }



            // strengthCurrent was previously (strength * potion)

            return (int)Math.floor(((strengthCurrent + (strengthBase * (1 * prayer.getBoost())) + fightStyle.getStrengthBoost()) * ((strengthBonus * 0.00175) + 0.1)) + 1.05);

        }

        // This is our research formula, the one that is hoped to become 100% accurate

        else if (website == Websites.Experimental)

        {

            if (itemSet == ItemSets.Dharok)

            {

                strengthCurrent += (hpBase - hpCurrent);

            }



            double finalStrength = strengthCurrent + fightStyle.getStrengthBoost() + (strengthBase * prayer.getBoost()) + (strengthBase * effect.getBoost()) + (itemSet == ItemSets.Dharok ? (hpBase - hpCurrent) : 0);

            double strengthMultiplier = (strengthBonus * 0.00175) + 0.1;

            double maxHit = (int)Math.floor((finalStrength * strengthMultiplier) + 1.05);



            return (int)Math.floor(Math.floor(Math.floor(maxHit) * itemSet.getMultiplier()) * special.getMultiplier());

        }

        else

        {

            throw new Exception("Parameter 'website' must be a valid constant in the 'Websites' enumeration.");

        }

    }

I'll take a crack at this...

Runescape's numbers are determined by a random number generator (RNG) and all of your stats and armor bonuses play a factor. So your stats may put you into a percentile that allows you to hit a max of 40 with a weapon and when you add on a ring or ammy, you now are in a percentile that allows you to hit 42. This isn't to say you will always hit 42 but you CAN if the rng lands on it.

Think of it as a dice and your attack stats and accuracy bonuses determine how many of a number are on that dice. The same thing goes for your strength and strength bonuses.

It's all pretty complicated when you get into the nitty gritty of the algorithms and logic they have built in but from a far, this is my take on it.

Hope this helped!