Damage is how much health is taken away upon a hit. If damage reduces a player/monster's health to zero or below, they are defeated.
Formula
Player Damage
weaponDamage is a random integer with upper and lower bounds equal to the weapon's damage range.
specialDamage is the amount of special damage the weapon does (ex. ice or fire damage)
playerAttackStat is the stat used by the weapon (Power, Range, Magic, Artillery)
enemyDefense is the defense of the enemy being attacked
statsFromEquips is the sum of the equipment's attack stat
PVE
floor(damageSpan * 2 /enemyDefense)
floor((attackStat + specialDamage)*(weaponDamage + statsFromEquips)/enemyDefense)
 If the attack is a critical (generate a random int between 1 and 300, if it equals or is less than Dexterity, it is a critical), then multiply the above number out by the player's critical multiplier and round down to an integer (up to 4.5).
 The no longer existing Rage multiplied damage by 1.35, Guild Rage multiplies damage by 1.25, and having both active multiplied damage by 1.6.
 Energy multiplies damage by anywhere between 1.2 (level 1) and 6 (level 21).
 Mage projectiles do 0.7 a weapon's damage, four projectiles inflict ×2.8 the weapon's original damage
Pet Damage
PVE
NOTE: the pet damage formula is still being fully calculated, and the below formula is probably not 100% accurate.
 Minimum damage:
floor(floor(0.075*petPower) * petPower / enemyDefense)
 Maximum damage:
floor(floor(0.125*petPower) * petPower / enemyDefense)
The above value is 100% damage. If the pet's mode makes it do more or less damage, multiply the 100% value (by 0.75, 1.25 and 1.5 for Quick attack, Power attack, and Extreme attack modes respectively) and round it down. Pets use their Dexterity score to hit critical hits the same way players do, and multiply their damage by 3 when they score a critical hit.
PVP
Against players in PvP, pet damage is the following (multiply by 3 if a critical hit):
max(0, (random integer from pet's power to pet's power * 1.6)  playerDefense)
Monster Damage
Against Players
Player Armor Defense is the defense from all equipment combined Defensive Output sqrt(Player Armor Defense * Defense)
(random integer from monster's power * 0.4 to monster's power * 0.7)  sqrt(Player Defense * Player Armor Defense)))
(random integer from monster's power * 0.4 to monster's power * 0.7) Defensive Output
 Monster damage is linear, unlike player damage. A random integer is generated; the lower bound is the monster's power * 0.4 and the upper bound is the monster's power * 0.7
Against Pets
Monster Power  Pet Defense)
 If the pet's defense is higher than the Monster's power, it will receive 0 damage
 Monster damage is lower against pets compared to players
