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 new, uncommon type of damage dealt by summoning weapons like 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, often have knockback, and can themselves critically strike. The items used to actually summon these monsters are all considered Magic weapons, which therefore benefit from magic-oriented modifiers such as Mythical and Adept. An item that increases summoned creature damage will benefit these items, and a modifier that works with magic items on a summoning weapon will bestow those benefits onto the summoned creatures, including critical strike chance. 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 two sets of armor that affect Summon damage, the Tiki armor and the 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.