Elemental and Bonus weapon damage

From this Darkpaw forum post by niente, EQ Developer.

Elemental damage works like so:


 * 1) Accumulate all the elemental damage on a weapon and its augments.
 * 2) For each resist type, if the NPC has 200 or less of that resist, do a roll
 * 3) Roll from 0 to 200
 * 4) Subtract the NPCs resist of that element type from the roll
 * 5) If the remaining value is less than 100
 * 6) Multiply the elemental damage by our remaining roll and divide by 100 (integer division)
 * 7) Otherwise add 0 damage

Short example - a weapon has 10 fire damage and an NPC with 100 fire resist.

If we roll 150, subtract 100 FR, our result is 50, we multiply our damage by 50 / 100 and get 5 bonus fire damage on the swing.

There are a few interesting things to draw from this which should probably be updated:


 * If we have only 1 elemental damage, our max roll is 99/100 of the value and 99 / 100 (int) is 0 so it does nothing.
 * We do these rolls for each swing of a weapon if they have that type of elemental damage (i.e. if you have a weapon that does fire damage and an aug with cold damage it will roll twice for every swing).

I considered adding damage bonus to the ratio when working on this previously but didn't because the damage bonus would add a type of invisible complexity and it's also fairly static for players. Here is the damage bonus equation which I think players have figured out already probably:


 * 1) If you are at least level 28
 * 2) If you are using a 1H your modifier is 0.8, if you are using a 2H it is 1.1
 * 3) If your PC level (PCLevel) is greater than the damage on the weapon (WepDamage), use PCLevel, otherwise use WepDamage
 * 4) Multiply the 1H/2H modifier from step 2 by PCLevel or WepDamage from step 3, multiply that by:
 * 5) Divide weapon delay (capped at 50) by 40.0
 * 6) Multiply by PCLevel divided by 100.0

Since I didn't write that out very well here is the equation:

As an example here's my 115 rogue using the 2.0:

Damage Bonus = 0.8 (1H modifier) * 115 (PCLevel) * 19(Delay) / 40.0 * 115 (Level) / 100.0 = 50.255 ~= 50

Your damage bonus in the item display window is used in combat as your "minimum weapon damage" and a handful of other things are added to it after the fact. I think it's easiest to think of it as, actually, a damage bonus applied to each hit.

Edit: A player corrected me on a mistake with the elemental damage roll; if NPC resist is very low we don't do a roll at all and the full elemental damage is used. Sorry for the mistake!