Where X is the opponent's stamina levels, P is their attack force and the function round rounds to the nearest integer.
It is (I think) theoretically possible to turn this from an iterative calculation into a non-iterative one (for a given start value) but the math is beyond me.