Combat Accuracy - Let's discuss!
Hey there! So, recently there has been some discussion going on about the incorrect accuracy of combat (more specifically PvP combat). That's why we decided to dive into the code responsible for handling and calculating accuracy. Since these formulas/calculations are basically unknown to the players, we decided to publicly write something about them. Give the player base some insight and explain how the calculations work, and how they decide the accuracy percentage.
So lets hop into it. This might be a bit math-heavy, but I'll try my best.
A defence-roll and an attack-roll are calculated. One is done by checking the attacker (the attack-roll) and one is by the player that is getting attacked (defence-roll). These two are later compared, but keep those in mind.
These 'rolls' are both calculated by the following formula:
ATTACK_ROLL / DEFENCE_ROLL = EFFECTIVE_LEVEL x (EQUIPMENT_BONUS + 64.0)
The 'EQUIPMENT_BONUS' is simply the bonus of the equipment (either in attack or defence).
The only notable thing here is that if the rolls are PvP-based, the adjusted bonusses will be used (so custom whips and capes act like regular variants).
The 'EFFECTIVE_LEVEL' can be calculated by following the next few steps:
- Get the current skill-level (so including level boosts).
- Multiply it by the world stat boost (exclusive to Honor-accounts).
- Multiply by the % bonusses prayers offer.
- Round value's decimal up.
- If it is PvP combat AND the player is using turmoil, add 15% of the other player's level (in both attack-roll and defence-roll).
- Add in attack style bonus (accurate gives +3, controlled +1 / defensive gives +3, controlled +1 and long range +3).
- Add 8.0.
- If attack-roll, multiply by 'void-bonus' (Strange name, I know, see info below).
- Round value's decimal down.
Calculating the void-bonus:
Spoiler: show
Next, depending on what style and offensive/defensiveness, each style checks for a few items and/or cases:
Ranged / ATTACK_ROLL:
- If player is wearing Slayer helmet and monster is (slayer assignment OR npc dummy), add the Slayer helmet % accuracy bonus.
Melee / ATTACK_ROLL:
- Multiply by the special attack accuracy.
- If player is wearing Slayer helmet and monster is (slayer assignment OR npc dummy), add the Slayer helmet % accuracy bonus.
- If monster is (demonic OR npc dummy) and...
- ... player is wearing Silverlight, add +40% accuracy.
- ... player is wearing Darklight, add +50% accuracy.
- ... player is wearing Arclight, add +70% accuracy.
- If player is wearing Dragon hunter lance and monster is (draconic OR npc dummy), add +20% accuracy.
- If player is wearing Korasi's sword and monster is Pest Control monster, add +30% accuracy.
- If player is wearing Berserker necklace and monster is TzHaar monster, add +20% accuracy.
- Apply Dharok's accuracy set bonus.
Magic / ATTACK_ROLL:
- If player is wearing Slayer helmet and monster is (slayer assignment OR npc dummy), add the Slayer helmet % bonus.
- If player is fighting Verzik Vitur and wearing Dawnbringer, set to max accuracy.
Ranged / DEFENCE_ROLL:
- Multiply by the special attack accuracy.
- If it is PvP combat, subtract 35% of the calculated defence.
Melee / DEFENCE_ROLL:
- If it is PvP combat, subtract 35% of the calculated defence.
Magic / DEFENCE_ROLL:
- If opponent is wearing Brimstone ring in 1/4th of the cases, subtract 10% accuracy.
NOTE:
If calculating the magic DEFENCE_ROLL, the EFFECTIVE_LEVEL will exist for 30% of defence level and 70% of magic level. This is done by calculating both, and then multiplying the defence value by 0.3, and the magic value by 0.7.
Now we have an ATTACK_ROLL and a DEFENCE_ROLL. One of the two rolls will be a larger number than the other, and we can now calculate the accuracy %:
If the attack roll is bigger...
Accuracy = 1 - [(DEFENCE_ROLL + 2.0) / 2.0 x (ATTACK_ROLL + 1.0))]
If the defence roll is bigger...
Accuracy = ATTACK_ROLL / (2.0 x (DEFENCE_ROLL + 1.0))
Accuracy = 1 - [(DEFENCE_ROLL + 2.0) / 2.0 x (ATTACK_ROLL + 1.0))]
If the defence roll is bigger...
Accuracy = ATTACK_ROLL / (2.0 x (DEFENCE_ROLL + 1.0))
Filling in the formula will give a probability between 0 and 1. Multiply this by 100.0 to get your %-value! Voilá, that's your % chance of hitting.
So, I hope that was informative. Feel free to calculate the accuracy % of your favorite equipment
Okay so, funny thing is. The accuracy formulas are perfect. 100% the same as OSRS' formula. Like, I tested it against all formulas I was able to find, but they're just the same. Every multiplication, every check, every addition. They all give exactly the same results. I even went ahead and used DPS calculators to get accuracy % and compared those with our %.
So the inaccuracy most likely has to do with everyone being level 99 defence, boosted to 125, swimming in defensive equipment. But at the end of the day, the formula's are 100% like they should be. Well, almost like they should be. As a sharp few of you might've noticed, there's only 1 difference: we subtract 35% of the melee and ranged defence in PvP combat (coloured 'em for ya).
Why, you ask? Well, this is something that was changed around by Mike because the community felt like they were too inaccurate. Mage doesn't get this reduction, so that explains why so many players were experiencing inaccurate magic spells. However, 'fixing' the combat formula would mean we would only hit more 0's.
So this is primarely a call to the PvP-community on what to do. Add the reduction to mage aswell? Remove the reductions? What do you think?
I'd love to hear about it! So feel free to let me know what you think.