a : The target AC
r : Roll required to confirm critical hit (low end of weapon critical range)
b : Bonus damage
m : Critical multiplier
h : Bonus to hit, including base attack bonus and all applicable modifiers
p : Amount of power attack taken from
h
{\displaystyle h}
The roll required to hit is the AC of the target minus the players hit bonus, or
R
=
a
−
h
{\displaystyle \,R=a-h}
. If R is greater than 20, the chance to hit normally 0%. But, it's still possible to hit on a roll of 20, if the player can hit the AC with an assumed roll of 30. If R is less than 1, then any roll other than a 1 will hit. If the required roll is 19, then two values on the die can hit. If it is 15, then 6 values can hit. This can be expressed as:
c
h
i
t
=
1
20
{
0
if
R
>
30
1
if
30
≥
R
>
20
21
−
R
if
20
≥
R
>
1
19
if
1
≥
R
=
1
20
{
0
if
a
−
h
>
30
1
if
30
≥
a
−
h
>
20
21
−
a
+
h
if
20
≥
a
−
h
>
1
19
if
1
≥
a
−
h
{\displaystyle {\begin{aligned}c_{hit}&={\frac {1}{20}}{\begin{cases}0&{\mbox{if }}R>30\\1&{\mbox{if }}30\geq R>20\\21-R&{\mbox{if }}20\geq R>1\\19&{\mbox{if }}1\geq R\end{cases}}\\&={\frac {1}{20}}{\begin{cases}0&{\mbox{if }}a-h>30\\1&{\mbox{if }}30\geq a-h>20\\21-a+h&{\mbox{if }}20\geq a-h>1\\19&{\mbox{if }}1\geq a-h\end{cases}}\end{aligned}}}
c
h
i
t
{\displaystyle \,c_{hit}}
exists on the interval
[
0.0
,
0.95
]
{\displaystyle \left[0.0,\,0.95\right]}
.
Chance of a critical hit
edit
In order to get a critical hit, you first have to hit with a die roll greater than or equal to r . To confirm the critical, you just have to hit.
c
p
o
s
s
c
r
i
t
=
1
20
{
0
if
a
−
h
>
30
1
if
30
≥
a
−
h
>
20
21
−
a
+
h
if
20
≥
a
−
h
≥
r
21
−
r
if
20
≥
r
>
a
−
h
c
c
o
n
f
c
r
i
t
=
c
h
i
t
c
c
r
i
t
=
(
c
p
o
s
s
c
r
i
t
)
(
c
c
o
n
f
c
r
i
t
)
c
c
r
i
t
=
(
1
20
{
0
if
a
−
h
>
30
1
if
30
≥
a
−
h
>
20
21
−
a
+
h
if
20
≥
a
−
h
≥
r
21
−
r
if
20
≥
r
>
a
−
h
)
(
c
h
i
t
)
{\displaystyle {\begin{aligned}c_{poss\,crit}&={\frac {1}{20}}{\begin{cases}0&{\mbox{if }}a-h>30\\1&{\mbox{if }}30\geq a-h>20\\21-a+h&{\mbox{if }}20\geq a-h\geq r\\21-r&{\mbox{if }}20\geq r>a-h\\\end{cases}}\\c_{conf\,crit}&=c_{hit}\\c_{crit}&=\left(c_{poss\,crit}\right)\,\left(c_{conf\,crit}\right)\\c_{crit}&=\left({\frac {1}{20}}{\begin{cases}0&{\mbox{if }}a-h>30\\1&{\mbox{if }}30\geq a-h>20\\21-a+h&{\mbox{if }}20\geq a-h\geq r\\21-r&{\mbox{if }}20\geq r>a-h\\\end{cases}}\right)\left(c_{hit}\right)\end{aligned}}}
The expected damage from hitting is defined as
d
h
i
t
=
b
c
h
i
t
{\displaystyle d_{hit}=b\,c_{hit}}
.
The expected damage from critting is defined as
d
c
r
i
t
=
b
m
c
c
r
i
t
{\displaystyle d_{crit}=b\,m\,c_{crit}}
.
The expected total damage from an attack is defined as:
d
t
=
d
h
+
d
c
=
b
c
h
i
t
+
b
m
c
c
r
i
t
{\displaystyle {\begin{aligned}d_{t}&=d_{h}+d_{c}\\&=b\,c_{hit}+b\,m\,c_{crit}\\\end{aligned}}}