by Darvin on Fri May 11, 2012 8:11 pm
Eh, you don't need calculus to figure it out if you ignore overflow and rounding.
N1 = number of hits to kill monster regularly
N2 = number of hits to kill monster w/ weakening
B = your base attack (before weakening)
A = your attack bonus
HP = monster's HP
What we are looking for is N2/N1, the ratio of how many attacks required to kill the monster with and without weakening respectively, and we want it expressed with respect to B, A, and HP.
First, we can trivially say that the monster's HP = N1 * A * B
To figure out the monster's HP with respect to N2, we must factor in the effect of weakening. Each attack lowers your base attack by 1 point. Hence you take -1 on the second attack, -2 on the third, -3 on the fourth, and so on. This is an arithmetic sequence whose total is equal to (N^2-N)/2. Hence HP = N2*A*B - A*(N2^2-N2)/2.
We're looking for N2/N1 expressed as a factor of HP, A, and B. This is easy for N1:
N1 = HP/(A*B)
More tricky for N2:
HP = N2*A*B - A*(N2^2-N2)/2
2*HP/A = N2*(2*B+1) - (N2^2)
N2 - (2*B+1)*N2 + 2*HP/A = 0
This is a quadratic equation, solve with the quadratic formula:
N2 = ((2*B+1) +- sqrt( (2*B+1)^2 - 8*HP/A )) / 2
This will produce two answers. However, the second answer is invalid because it actually represents the monster's HP increasing because your attack damage becomes negative. This makes no sense, so we only take the version that subtracts from the results of the square root (producing a lower value for N2, the number of attacks required to kill).
N2 = (B+1) - sqrt( B^2 + B + 1/4 - 2*HP/A )
N1 = HP/(B*A)
N2/N1 = (B*A)*((B+1) - sqrt(B^2+B+1/4 - 2*HP/A))/HP
And there you have it, a formula that will tell you, based on the monster's HP, your base attack, and attack bonus, how much relative durability the monster gains. Heck, probably wouldn't take too much more effort to whip up a spreadsheet and account for rounding and thresholds.