Expected steps to eliminate a character? This came up in a game theory crafting exercise. 
Imagine a character has 195 hit points. 
You can shoot at them and there are three results:
Critical - 100 damage - 40% of shots
Body - 50 damage - 40%
Miss -0 damage - 20%
The gun shoots 1 bullet per second. 
Besides running through thousands of different simulations and averaging the result, is there a way to get the average time to kill using a formula? The point would be to compare hundreds of guns with different damage numbers and different hit percentages potentially. 
EDIT for solutions - I initially thought a weighted average damage per bullet (which is 60) would solve for this. But I was wrong.
 A: An easy algebraic way to solve this is to first consider all of the states the player could be in, and then calculate, from bottom up, the expected time until death. The more sophisticated approach in hardmath's answer can handle any healing effects with greater ease, but is not strictly necessary here.
In particular, observe that a player could only lose a multiple of $50$ HP, so their health is one of $0,\,45,\,95,\,145,\,195$. Let us define $T_{x}$ as the expected time until death given that the player has $x$ health now and that the gun will fire in $1$ second.
We start out by noting that $T_0=0$, since at that point the player is dead. Next, we have
$$T_{45}=(1\text{ second}) + (20\%)T_{45}+(80\%)T_0$$
since they will survive at least until the next shot, when they will be missed with probability $20\%$ (leaving them with $45$ health) and will otherwise be struck to $0$ health. Plugging in $T_0=0$ and solving gives
$$T_{45}=\frac{1\text{ second}}{1-20\%}=1.25\text{ seconds}.$$
Note that we treat $80\%=.8$, as is standard.
Then, we can proceed to $T_{95}$, writing
$$T_{95}=(1\text{ second})+(20\%)T_{95}+(40\%)T_{45}+(40\%)T_0$$
where again, we write out all the possible outcomes, along with their probabilities. We can substitute in $T_{45}=1.25\text{ seconds}$ and $T_0=0$ and solve to
$$T_{95}=\frac{(1\text{ second})+(40\%)(1.25 \text{ seconds})}{1-20\%}=1.875\text{ seconds}.$$
For $T_{145}$, we repeat this process to get
$$T_{145}=\frac{(1\text{ second})+(40\%)T_{95}+(40\%)T_{45}}{1-20\%}=2.8125\text{ seconds}$$
and for $T_{195}$ we get
$$T_{195}=\frac{(1\text{ second})+(40\%)T_{95}+(40\%)T_{45}}{1-20\%}=3.59375\text{ seconds}$$
where the algebra to reach these results is the same as before.
