Damage

From Terraria Wiki
Revision as of 05:00, 10 July 2022 by AmsterWikis (talk | contribs) (Appears to be correct.)
Jump to navigation Jump to search

Damage is the number of health points subtracted from an entity's current health. It can be inflicted by a multitude of entities, most prominently weapons, enemies, and NPCs (and all related projectiles). Furthermore, it can be caused by environmental hazards (such as thorny bushes, traps, or lava) and game mechanics (such as fall damage, drowning, or debuffs). Damage can generally only be inflicted on entities with a health statistic, i.e., players, most enemies, and NPCs. Most damage sources additionally inflict knockback on the damaged entity.

When an entity receives damage, several calculations increasing or decreasing the amount of damage (depending on several factors; see below) are performed before the actual damage is applied to the entity. Therefore, the damage statistic of any damaging entity is usually only the average damage it inflicts. Most hits' damage deviates from this average number.

Damage inflicted by player-wielded weapons is categorized into four different types: melee, ranged, magic, and summon. Accessories, buffs, and other damage-boosting or damage-decreasing effects often only affect one of these damage types. A few weapons as well as all other damaging entities are not categorized into any of the four types.

Damage types

Melee

Melee weapons are used in close- to medium-ranged combat. Their defining trait is the fact that they do not consume ammunition or mana upon use. They are roughly categorized into swords, spears, flails, boomerangs, and yoyos(Desktop, Console and Mobile versions). There are several other melee weapons not fitting any of these types.

In total, there are currently 189 unique melee weapons.

Ranged

Ranged weapons are used in long-ranged combat. Their defining trait is the requirement of ammunition in order for the weapon to operate. They are roughly categorized into bows, repeaters, guns, and launchers. Although boomerangs are thrown, Terraria classifies them as melee weapons. In the no version, all consumable weapons are classified ranged weapons. However, in the no version, they are classified as throwing weapons.

In total, there are currently 113 unique ranged weapons.

Magic

Magic weapons are used in medium- to long-ranged combat. Their defining trait is the consumption of mana upon every use. Due to their unusual and unique forms of attack, the majority of magic weapons can hardly be categorized into distinct types.

In total, there are currently 77 unique magic weapons.

Summon

Summoning weapons include summon staffs and whips(Desktop, Console and Mobile versions). Using a summon staff spawns a secondary character which will aid the player in battle by automatically attacking enemies. The summoned character is either mobile, i.e. following the player around (minion), or stationary, i.e. remaining at the location it was summoned at (sentry). Whips are close- to mid-range weapons which boost minion damage on hit enemies as well as marking them, making minions focus on those enemies.

Mounts that do damage, like the Slime Mount, deal summon damage.

In total, there are currently 47 unique summon weapons, 9 of which are whips.

Invincibility frames and piercing

Player invincibility

After being damaged, the player gets a period of time called an "invincibility frame" during which they cannot be damaged again. By default this is 2/3 of a second (40 ticks[1]), but various equipment can extend this:

  • Use of a Cross Necklace or any of its upgrades will add another 2/3 of a second (40 ticks) after receiving any attack. (The Cross Necklace does not stack with its upgrades.)
  • If a Black Belt (or its upgrade the Master Ninja Gear, but the two do not stack) is worn, a successful dodge (10% chance) will trigger an invincibility frame and add another 2/3 seconds (40 ticks) to it. It also prevents damage from the attack. If combined with the Cross Necklace, this extends the invincibility to a full 2 seconds (120 ticks).
  • Hallowed armor similarly provides the Holy Protection buff; this is triggered by attacking an enemy, and when active, the next time the player would have taken damage, they instead get 2 seconds (120 ticks) of invincibility. This also stacks with the effects of the Cross Necklace and Black Belt, potentially granting 3 and 1/3 seconds (200 ticks) of invincibility.
  • Taking damage in PvP or from one's own weapon will only grant 8 ticks of invincibility.

Piercing attacks against enemies

Enemies get a similar but more limited effect from "piercing" and continuous attacks: Any damage source that can strike an enemy, and then remain able to cause damage afterwards.

After being struck by such an attack, the enemy cannot take damage from another such attack for a brief period, usually 1/6 of a second (10 ticks[1]). Thus, when in lava or when pierced by a persistent weapon such as a Vilethorn, they can take damage at most 6 times a second. However, for multi-segmented enemies (usually worm types), this resistance applies to each segment separately, so such attacks can still strike multiple segments of a single enemy. (Note that worm-type enemies are immune to lava in any case.)

On the Old-gen console version Old-gen console version and Nintendo 3DSNintendo 3DS version versionVerify, this also applies to almost any missile, beam, or other projectile that continues to exist after striking an enemy. This can sharply limit the effects of other piercing weapons used against the same target, as well as weapons that fire multiple piercing projectiles such as the Poison Staff. Most minions are considered to have piercing attacks, which can also hinder the efficiency of piercing weapons used alongside them. This problem is remarkably present with the Spider Staff and the Stardust Dragon Staff.

On the Desktop version Desktop version, Console version Console version, and Mobile version Mobile version, summons do not hinder other piercing weapons, but piercing weapons may still hinder the effectiveness of summons.

A few advanced weapons have special behavior:

Calculations

The damage that a player-wielded weapon deals upon hit is determined cumulatively[2]:

  • Step 1: Calculate the damage boost from the weapon's modifier. The result is rounded to the nearest integer.
Weapon damage = round[Base damage × (1 + Weapon modifier boost)]
  • Step 2: Calculate the damage boost separately for each damage type (from armor, accessories, modifiers from items, buffs, etc.). For ranged weapons, the damage boost calculated here does not include boosts that affect a specific ammo type (see "Step 2" for details).
Damage boost = [(Head + Chest + Legs + Set bonus) + (Accessories boost + Accessory modifiers boost) + Buff boost]×100%
  • Step 3: Apply the damage boost to damage, calculated with the following formula:
Final damage = Weapon damage × (1 + Damage boost)
  • For ranged weapons, the damage is calculated with the following formula. The "ammo type boost" includes boosts from the Magic Quiver and its upgrades, and the different headpieces of the Shroomite armor.
Final damage = Weapon damage × (1 + Ranged damage boost) × (1 + Ammo type boost) + Ammo's damage × (1 + Ranged damage boost)
  • Then, if the Molten Quiver(Desktop, Console and Mobile versions) is equipped, and/or the Archery buff is active:
Final damage = [Final damage + 2 (from Molten Quiver)] × 1.2 (from Archery buff)

For example, the damage of a Godly Meowmere(Desktop, Console and Mobile versions) with Turtle Armor, Menacing Warrior Emblem, Menacing Avenger Emblem, Menacing Destroyer Emblem, Menacing Mechanical Glove and Menacing Celestial Stone equipped, Well Fed active is calculated as follow:

  • Weapon damage = 200 × (1 + 15%) = 230
  • Damage boost = [(6+8+0+0) + (15+12+10+12+1+4+4+4+4+4) + (5)]×100% = 98%
  • Final damage = 230 × (1+98%) = 455

Damage done to an enemy is depending on the enemies defense and whether there is a related banner nearby.

EnemyDamageReduction = ⌈EnemyDefense/2⌉

So,

DamageDealtToEnemy = WeaponDamage − EnemyDamageReduction without a banner;
And DamageDealtToEnemy = 1.5 × WeaponDamage-EnemyDamageReduction with a banner in normal mode,
Or DamageDealtToEnemy = 2 × WeaponDamage-EnemyDamageReduction with a banner in Expert Mode,

Damage dealt is always at least 1.

In addition the outgoing damage is modified by a random factor, 0.85~1.15, (but some types of damage, like the Slime Mount, will not be affected by this). The damage is rounded to the nearest whole number. So you can compute the minimal and maximal damage dealt to an enemy with your weapon:

MinDamage = round(WeaponDamage × 0.85 − EnemyDamageReduction)
MaxDamage = round(WeaponDamage × 1.15 − EnemyDamageReduction)

At critical hits you are dealing double damage

CriticalMinDamage = MinDamage × 2
CriticalMaxDamage = MaxDamage × 2

Footnotes

  1. 1.0 1.1 A tick is a time unit countable by the software. Most of Terraria's updating logic happens every tick. A tick has the length of 1/60th of a second, hence there are 60 ticks in a second and 3600 ticks in a minute.
  2. Information taken from the Desktop version Desktop 1.4.3.6 source code, methods GetWeaponDamage() in Terraria.Player.cs and PickAmmo() in Terraria.Player.cs. There may be inaccuracies, as the current Desktop version Desktop version is 1.4.4.9.