User:Yodaj007/Sandbox

Definitions

 * 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$$

Chance of hitting
The roll required to hit is the AC of the target minus the players hit bonus, or $$\,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:

\begin{align} c_{hit} &= \frac{1}{20} \begin{cases} 0 & \mbox{if } R > 30 \\ 1 & \mbox{if } 30 \ge R > 20 \\ 21 - R & \mbox{if } 20 \ge R > 1 \\ 19 & \mbox{if } 1 \ge R \end{cases} \\ &= \frac{1}{20} \begin{cases} 0 & \mbox{if } a - h > 30 \\ 1 & \mbox{if } 30 \ge a-h > 20 \\ 21 - a+h & \mbox{if } 20 \ge a-h > 1 \\ 19 & \mbox{if } 1 \ge a-h \end{cases} \end{align} $$

$$\,c_{hit}$$ exists on the interval $$\left [0.0,\,0.95 \right ]$$.

Chance of a critical hit
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.

\begin{align} c_{poss\,crit} &= \frac{1}{20} \begin{cases} 0 & \mbox{if } a - h > 30 \\ 1 & \mbox{if } 30 \ge a-h > 20 \\ 21 - a+h & \mbox{if } 20 \ge a-h \ge r \\ 21 - r & \mbox{if } 20 \ge 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 \ge a-h > 20 \\ 21 - a+h & \mbox{if } 20 \ge a-h \ge r \\ 21 - r & \mbox{if } 20 \ge r > a-h \\ \end{cases} \right) \left(c_{hit}\right) \end{align}

$$

Damage
The expected damage from hitting is defined as $$d_{hit} = b\,c_{hit}$$.

The expected damage from critting is defined as $$d_{crit} = b\,m\,c_{crit}$$.

The expected total damage from an attack is defined as:

\begin{align} d_t &= d_h + d_c \\ &= b\,c_{hit} + b\,m\,c_{crit} \\ \end{align} $$