Melee Damage

The Formula
The damage is calculated in many steps. And in the end the game puts together the pieces and outputs your damage. For this formulas we use the following syntax:
 * [x] = indicates a round down on x. [1.99] = 1
 * MIN(x, y) = the smaller value. MIN(1, 10) = 1
 * x% = percent values are used as real values. 20% haste = 0.2
 * SPEC = WEAPON_SPEC + RR_BONUS + ITEM_BONUS
 * RANDOM(x) = generates a random integer number 0 to x but is never equal to x. RANDOM(3) = 0, 1 or 2

Damage Modifier
There are 3 different type of weapons out there. Each has it's own STATS calculation.

Strength weapons: (Slash, Crush, ...) STATS = [STRENGTH / 2]

Dexterity weapons: (Staff, Crossbow, ...) STATS = [DEXTERITY / 2]

Strength + Dexterity weapons: (Thrust, Flexible, ...) STATS = [([STRENGTH / 2] + [DEXTERITY / 2]) / 2]

Your enemies armor piece that is going to be hit. ENEMY_ARMOR = (20 + (ITEM_USEABLE_AF + (ENEMY_SPEC_AF_BONUS / 5) + (ENEMY_TOA_AF_BONUS / 5))            * ITEM_QUALITY             * ITEM_CONDITION) / (1 - ITEM_ABSORB)

And finally: DAMAGE_MODIFIER = LEVEL * DAMAGE_TABLE / 10 * (1 + 0.01 * STATS) * (0.9 + 0.1 * MAX(1, STRENGTH_RELIC_COUNT)) * (0.75 + 0.5 * MIN(ENEMY_LEVEL + 1, SPEC - 1) / (ENEMY_LEVEL + 1) + 0.01 * RANDOM(50)) / ENEMY_ARMOR * (1 - ENEMY_BUFFED_ABSORB) * (1 - ENEMY_RESISTANCE)

If DAMAGE_MODIFIER is greater then 3 it's caped down to 3.

RANDOM(50) can be 0, 1, 2, ..., 49 it is randomly selected with each swing.

DPS
TWOHANDBONUS = 1.10 + 0.005 * SPEC or = 1.00 if it's no two handed weapon at all.

DPS = [[[[[WEAPON_DPS * WEAPON_SPEED * 10]    * (0.94 + WEAPON_SPEED * 0.03)]     * (1 + 0.01 * MYTHICALDPS)]     * TWOHANDBONUS]     * (1 + 0.01 * TOA_MELEE_DAMAGE] / 10

Banespike will increase the DPS * 1.15.

Swing Speed
SWING_SPEED = [[[WEAPON_SPEED * 100             * (1 – (MIN(250, QUICKNESS) – 50) / 500)]             * (1 – HASTE – CELERITY)]             * (1 – TOA_MELEE_SPEED)]             / 100

If SWING_SPEED smaller then 1.5 then it's caped to 1.5.

Base Damage
equals to unstyled damage BASE_DAMAGE = DAMAGE_MODIFIER * DPS

Style Damage
STYLE_DAMAGE = (STYLE_BASE + (SPEC - STYLE_LEVEL) * STYLE_GROWTH) * SWING_SPEED * DAMAGE_MODIFIER / 10 + BASE_DAMAGE * TOA_STYLE_BONUS

Where STYLE_BASE, STYLE_LEVEL and STYLE_GROWTH are taken from the style.

Total Damage
TOTAL_DAMAGE = BASE_DAMAGE + STYLE_DAMAGE

Chance To Hit Armor Piece
40% Body 25% Legs 15% Arms 10% Head 5% Feet 5% Hand

Displayed Armor Factor
ARMOR_LEVEL = USEABLE_ITEM_LEVEL_BODY * CHANCE_TO_HIT_BODY + USEABLE_ITEM_LEVEL_LEGS * CHANCE_TO_HIT_LEGS + USEABLE_ITEM_LEVEL_ARMS * CHANCE_TO_HIT_ARMS + USEABLE_ITEM_LEVEL_HEAD * CHANCE_TO_HIT_HEAD + USEABLE_ITEM_LEVEL_FEET * CHANCE_TO_HIT_FEET + USEABLE_ITEM_LEVEL_HAND * CHANCE_TO_HIT_HAND

ARMOR_ABSORB = ITEM_ABSORB_BODY * CHANCE_TO_HIT_BODY + ITEM_ABSORB_LEGS * CHANCE_TO_HIT_LEGS + ITEM_ABSORB_ARMS * CHANCE_TO_HIT_ARMS + ITEM_ABSORB_HEAD * CHANCE_TO_HIT_HEAD + ITEM_ABSORB_FEET * CHANCE_TO_HIT_FEET + ITEM_ABSORB_HAND * CHANCE_TO_HIT_HAND

ARMOR_FACT = 10 * ARMOR_LEVEL * (1 + ARMOR_ABSORB)

Mythical Item Select
There is a big difference between how mythical DPS and Strength are granting you extra damage. DPS is giving you this damage bonus on unstyled damage in any case, while Strength will only give you this bonus if you do not already hit for cap damage!

If you use styles, things are getting a bit more complicated. That is because mythical DPS and Strength are applied to different parts of the damage calculation that have a different impact on style damage.

Mythical DPS: Is only increasing the style damage obtained by "TOA Style Damage" bonus.

Mythical Strength: Is increasing both the style damage gained by growth rate and "TOA Style Damage". However this only happens if you do not already hit for cap damage!

For example, if your character uses a weapon with 4.0 speed and has a strength value (same for dexterity based weapons with dexterity) of 400. Then equipping a +2DPS Myth will grant you 2.86% extra unstyled damage, while equipping a +8 strength Myth will only give you 1.33% extra unstyled damage.

Questions
Why do this formulas do not match the ingame values exactly? There are simply to many ways to do math calculations within computer programs. The round down and float / double values nearly make it impossible to figure them out correctly. An easy example on the float / double stuff: [0.57 * 100] / 100 = 0.56 this looks like an math error, but this is how it's done. And every single multiplication can be infected by such an error. The result is that this formulas only get very close to the real result, but do not match the exact round down and floor / double transformations.

'''Sometimes there are very high resistance and or style damage values. Why?''' The game itself does not apply any caps to the display of (+Style Damage) and (-Resistance). It's for example calculating with a weapon that has 1.0 sec swing speed. Same for the Cap of 3 for the DAMAGE_MODIFIER, all caps are only applied to the total damage display.