Damage

Damage types are categorized into melee, ranged, magic weapons and since 1.2, summoning weapons. Different armor types and consumables provide bonuses for different types of weapons, summarized below.

Melee
Melee is a type of close ranged attacks. All melee weapons have no usable ammo. All melee weapons (with the exception of throw/spin weapon types) attack with the player fairly close to the target.

Ranged
Ranged is a type of far ranged attacks. All ranged weapons (with the exception of the harpoon and the Piranha gun) have usable ammo. All ranged weapons attack with the player far away from the target.

Consumable Weapon Type
Consumable weapon types are a closer form of ranged weapons. They are usually a thrown weapon type that don't go as far as bullets

Magic
Magic is a special weapon type that has multiple different magical effects. Magic weapons require mana to be used. Some, such as the Rainbow Rod cast a controllable projectile. Others cast a spread of projectiles.

Summon
Summon is a relatively new type of damage dealt by summoning weapons such as the Pygmy Staff, Hydra Staff, Slime Staff, and Raven Staff. Summoning damage was introduced with the advent of the 1.2 update. The emergent nature of Summon damage makes it rather quirky compared to all the other damage types; The damage comes specifically from summoned creatures (minions) which function like pets but are able to deal damage and often have knockback. An item that increases summoned creature damage will benefit these items. Unlike the other damage types, this style is still fairly underdeveloped, and therefore subject to lack of support; for example, there isn't an emblem dedicated specifically to Summoning (though the Hercules Beetle gives the same damage benefits as well as increased knockback), and there are only four sets of armor that affect Summon damage, including Bee Armor, Spider Armor, Tiki Armor, and Spooky Armor.

Calculation
Weapon Damage is determined cumulatively such as:

Base damage * [1 + Weapon modifier/100 + (Head + Chest + Legs + Set bonus)/100 + (Accessory1 + Accessory2 + Acessory3 + Accessory4 + Accessory5 + AccMod1 + AccMod2 + AccMod3 + AccMod4 + AccMod5)/100]

For example, Godly Dao of Pow with Turtle Armor, Menacing Warrior emblem, Menacing Avenger emblem, Menacing Destroyer Emblem, Menacing Mechanical Glove and Menacing Celestial Stone equipped:

50 * [1 + 15/100 + (6+8+0+0)/100 + 15+12+10+9+10+4+4+4+4+4)/100]  = 50 * [1 + 15/100 + 14/100 + 76/100]   = 50 * [1 + .15 + .14 + .76]   = 50 * 2.05  ~= 102

Note: Damage always rounds to the nearest whole number, which alters modifiers' percentages accordingly. It rounds down for .5 damage or less and up for anything above .5 damage.