Alright, fine. I'm pretty sure the function in question is test_hit in attack.c (though it relies on a "chance" variable that's calculated elsewhere)
First, there's a flat 12% hit chance and 5% miss chance, regardless of everything else.
Next, if the target is not visible, then your chance value is halved, and if chance is less than 9, then it is set to 9. Finally, if 1d(chance) >= (target AC * 2/3), then you hit.
So where does chance come from? It's calculated in py_attack_hit_chance. First you calculate a bonus, which is the sum of all to-hit bonuses on gear (and stat bonuses as well, I think). This is multiplied by 3, and then added to your melee skill (which is determined by your race, class, and level). And that's your chance.
So, assuming you can see your target, and that we're ignoring the flat 12%/5% hit/miss rates (and assuming I read all this correctly), your chance to hit is given as 1d (sum of to-hit bonuses * 3 + melee skill) >= (target AC * 2/3).
So say you have a skill of 10, to-hit of 0, and you're fighting a monster with an AC of 5. Then your chance to hit is 50% (5 in 10). If you get +1 to-hit, then your chance goes up to 61% (8 in 13); +2 takes you to 69% (11 in 16); +3 to 74% (14 in 19); +4 to 77% (17 in 22). So I was right, it's a nonlinear improvement in your percentile chance to hit.
First, there's a flat 12% hit chance and 5% miss chance, regardless of everything else.
Next, if the target is not visible, then your chance value is halved, and if chance is less than 9, then it is set to 9. Finally, if 1d(chance) >= (target AC * 2/3), then you hit.
So where does chance come from? It's calculated in py_attack_hit_chance. First you calculate a bonus, which is the sum of all to-hit bonuses on gear (and stat bonuses as well, I think). This is multiplied by 3, and then added to your melee skill (which is determined by your race, class, and level). And that's your chance.
So, assuming you can see your target, and that we're ignoring the flat 12%/5% hit/miss rates (and assuming I read all this correctly), your chance to hit is given as 1d (sum of to-hit bonuses * 3 + melee skill) >= (target AC * 2/3).
So say you have a skill of 10, to-hit of 0, and you're fighting a monster with an AC of 5. Then your chance to hit is 50% (5 in 10). If you get +1 to-hit, then your chance goes up to 61% (8 in 13); +2 takes you to 69% (11 in 16); +3 to 74% (14 in 19); +4 to 77% (17 in 22). So I was right, it's a nonlinear improvement in your percentile chance to hit.
Comment