Combat
Combat is one of the most essential parts of this game. There are 4 different combat classes, they are: Melee, Ranged, Magic, and Summoning.
The Melee class has the greatest amount of defense. The Ranger class can deal damage at distances, but needs to stock Ammo. The Mage class can deal damage on normal distances. The Summoner class can deal damage when not attacking, through the summoned minions, but has the least amount of defense.
Other game items can deal damage: Explosives and one-use Weapons. Stat buffs include: damage, critical strike chance and attack speed. You can buff these stats by using consumables and trinkets.
Note: the Player is considered "In Combat" when they are either dealing, or are being dealt damage from a Hostile monster.
Damage done from the environment, or to breakables is not considered "In Combat" for the purposes of some effects, such as the speed boost provided by the Traveler Cloak.
A player leaves combat after not taking damage or attacking for 5 seconds
A Training Dummy or Snowman can be used to measure damage per second but it can be misleading since it does not include armor.
There are many steps for damage calculation but it roughly is as follows:
Start with the damage after modifiers.
Damage reduction is (armor - armor penetration) * 0.5.
Pick the larger value between 0 and damage - damage reduction.
If the attack is a crit, multiply by the crit damage. This is 2 at base value.
Multiply by a random number between 0.8 and 1.2
Pick the larger value between 1 and the randomized damage.
This means armor reduces the damage taken by half its value.
Since crits are calculated after armor, armor has a larger impact on crit damage than regular damage.
The minimum damage possible is 1.
This can be used to estimate an average dps with armor.
As long as the crit chance is expressed as decimal between 0 and 1 and the final damage is more than 1, the following calculation can be used:
(Damage - (armor - armor penetration) * 0.5) * (1 + (crit damage - 1) * crit chance) * attack speed
Although attack speed is meant to be the attacks per second, the actual attack speed is slightly lower than the displayed value. This value is still good enough for most calculations as it only has a noticeable impact on weapons with very high attack speeds
EXAMPLE
If a player has a masterful Wood Bow shooting Stone Arrows and has a blunt Range Foci, Bone Hilt, Lucky Cape, Frozen Wave and Leather Glove as trinkets. The damage and dps for Evil's Protector will be as follows:
The Wood Bow does 12 damage normally. With the 15% damage buff from the masterful enchant that becomes 12*1.15 = 30.8 damage. The Range Foci adds 20% damage because it's a ranged weapon but the blunt enchant subtracts 4% damage, these add up to 16%. 30.8*1.16 = 16.008 damage. This is why the bow will say it does 16 damage.
The Stone Arrow does 5 damage and this only gets affected by the 16% damage buff from the trinket and its enchant. It ignores the weapon enchant. 5*1.16 = 5.8. The bow will do 16.008+5.8=21.808 damage in total.
Evil's Protector has 10 armor. Bone Hilt has 20 armor penetration. 10-20 = -10 armor. Since every armor point blocks 0.5 damage, this means each hit blocks -5 damage. This is subtracted so 21.808-(-10*0.5)=26.808 damage.
The Lucky Cape adds 10% crit chance so 10% of the time, it will deal more damage. Frozen Wave adds 25% crit damage so instead of dealing double damage, it deals 2.25 damage. This means a crit could do 26.808*2.25=60.318 damage. This number is then multiplied by a random number from 0.8 to 1.2.
When calculating average damage, the damage increase from a crit is used so 26.808*1.25 = 33.51. This number is then multiplied by the crit chance and added to the damage. 26.808+0.1*33.51=30.159 damage per hit on average. The damage is then rounded down to 26, 60 or 30 damage respectively depending on if you are calculating regular damage, crit damage or average damage per hit.
If the damage is less than 1 here, it becomes 1 so it is impossible to do 0 damage.
To factor in attack speed, attack speed is meant to be attacks per second. Wood bow has an attack speed of 1.25 which rounds to 1.3 when viewed ingame. The masterful enchant increases the attack speed by 10% so the bow has an attack speed of 1.25*1.1=1.375 attacks/s. The leather gloves give an aditional 10% attack speed buff so the bow has an attack speed of 1.375*1.1=1.5125 attacks/s.
The average dps is then 30 * 1.5125 = 45.375 dps
There currently is a bug with how the game handles attack speed meaning the actual attack speed tends to be slightly lower than what is expected and this also means the actual dps is slightly slower. This means these calculations are only an estimate and need to be tested ingame for proper results. This is more apparent with high attack speed weapons such as Spider Claw which should deal 160 dps without and buffs
Special cases
The attack speed is based off the animation time of the weapon. This means that weapons that charge up like greatswords and greatbow have a much higher attack speed because it does not include the time to charge the weapon. Greatswords often have an animation time of 200ms which means an attack speed of 5 but the charge levels are at 500, 600 and 700ms meaning it will be a total of 700, 800 and 900ms between attacks. Ravenwing Greatsword takes 150, 300 and 450ms to charge which means 250, 500 and 650ms between attacks.
Grizzbolt has 4 times the base damage shown. This is reduced by 25% to get the value shown when calculating the final damage dealt. This means armor can be treated as being 25% of its value.
Lightning from Perfect Storm takes the damage after armor and before crit from the sword as the base damage. This means all damage modifications are essentially squared