Stealth

From Terraria Wiki
Jump to navigation Jump to search
For the potion that turns the player invisible, see Invisibility Potion. For other effects that turn something invisible, see Invisibility (disambiguation).

Stealth is an ability which, when fully entered, turns the player almost invisible and prevents certain enemies from targeting the player. It additionally grants the player some offensive stats, like damage and critical strike chance bonuses. Usually, a short period of time is required for the player to fully enter stealth. The player cannot enter stealth when riding a mount.

There are 3 items that grant this ability.

Details

Internally, the effect of stealth is controlled by two variables: stealth[1] and stealthTimer[2].

stealth is used as the progression of entering stealth. By default, the player has a stealth value of 1. When a stealth ability is triggered by the player, their stealth begins decreasing a fixed amount per tick[3]. When stealth reaches 0, the player is considered to be fully entered stealth. The stat changes from stealth ability also scales with the value of stealth, calculated by the following formula:

[math]\displaystyle{ \text{Actual stat change} = \text{Stat change}\times(1-\mathit{stealth}) }[/math]

This means that during the process of entering stealth, the stat changes will linearly increase from 0 to the maximum value (stated in list of items below).

  • For example, when the player remains stationary with the Psycho Knife, stealth is decreased by 0.02 per tick. As a result, the player will enter stealth after 50 ticks (0.83 seconds). When fully entered, the stealth from the Psycho Knife grants the player +300% melee damage; during the transition, this bonus would be [math]\displaystyle{ 300\%\times(1-0.5)=150\% }[/math] after 25 ticks (0.42 seconds) after starting to enter stealth.

stealthTimer acts as the cooldown for entering stealth. By default, stealthTimer has a value of 0. If it is greater than 0, it is decreased by 1 per tick, and the player's stealth stat will not decrease before stealthTimer reaches 0 again. This stat is used by Psycho Knife and Shroomite armor's stealth, pausing the stealth process for a brief period of time if the player uses an item when entering stealth.

  • For example, when the player equips the Shroomite armor, and uses an item before stealth is fully entered, stealthTimer will be set to 5 as long as the item's use animation does not end. This means that after the item's use animation ends, the player has to wait 5 ticks (0.08 seconds) before stealth begins decreasing again.

Effects

Stealth grants the following effects:

  • Certain stat changes (based on the source of stealth effect) that reaches maximum effect when the player's stealth reaches 0.
  • Fighter AI and Flying AI enemies will not fire projectiles at the player if they are not using any item when the player's stealth reaches 0.[4]
  • NPCs will not attempt to "talk" to (i.e. show emotes to) a player if their stealth stat is not 1.[5]
  • In multiplayer, stealth changes the opacity of the player's health bar. The health bar becomes invisible when the player's stealth reaches 0.[6]

Items

The Psycho Knife's stealth takes precedence over the armors' stealth. If using the Psycho Knife and one of the armor at the same time, after entering stealth, the player will only receive stat changes from the Psycho Knife's stealth (the only exception is the knockback bonus: knockback bonus from both items will be received).

Item stealth change conditions[7] stealthTimer change conditions[7] Stat change[8][a]
Psycho Knife Psycho Knife(Desktop, Console and Mobile versions)
  • Player is stationary[b] and not using any items: -0.02 stealth/tick
    • This means stealth is fully entered in 0.83 seconds.
  • Before stealth reaches 0, and player is moving or using any item: +0.1 stealth/tick
  • While in stealth, stealth is immediately set to 1 when any of the following happens:
    • The weapon hits a target.[9]
    • The player switches to other items.
    • The player summons a mount.[7]
    • The player takes any damage.[10]
  • After hitting a target in stealth:
    stealthTimer is set to 15 (0.25 seconds)
Shroomite armor Shroomite armor(Set Bonus)
  • Player is stationary[b] and not using any items: -0.015 stealth/tick
    • This means stealth is fully entered in 1.11 seconds.
  • Player is moving: [math]\displaystyle{ +0.075\times(\text{Horizontal speed}+\text{Vertical speed}) }[/math] stealth/tick
    • The horizontal and vertical speed are both measured in pixels/tick.
  • While in stealth, stealth is immediately set to 1 when any of the following happens:
    • The Set Bonus is no longer active.
    • The player summons a mount.[7]
    • The player takes any damage.
  • When using an item before stealth is fully entered:
    stealthTimer is set to 5 (0.08 seconds)
  • +60% ranged damage
  • +10% ranged critical strike chance
  • −750 aggro
  • +50% ranged knockback
Vortex armor Vortex armor(Desktop, Console and Mobile versions)(Set Bonus)
  • Stealth mode is triggered: ±0.04 stealth/tick
    • This means stealth is fully entered or exited in 0.42 seconds.
  • While in stealth, stealth is immediately set to 1 when any of the following happens:
    • The Set Bonus is no longer active.
    • The player takes any damage.
  • Stealth is immediately deactivated when any of the following happens:
n/a
  • +80% ranged damage
  • +20% ranged critical strike chance
  • −1200 aggro
  • +50% ranged knockback
  • ×0.3 movement speed; this multiplier is fixed and is not affected by stealth[c]

Notes

References

  1. Information taken from the Desktop version Desktop 1.4.4.9 source code, field stealth in Terraria.Player.cs.
  2. Information taken from the Desktop version Desktop 1.4.4.9 source code, field stealthTimer in Terraria.Player.cs.
  3. 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.
  4. Information taken from the Desktop version Desktop 1.4.4.9 source code, methods AI_003_Fighters() in Terraria.NPC.cs and AI_005_EaterOfSouls() in Terraria.NPC.cs.
  5. Information taken from the Desktop version Desktop 1.4.4.9 source code, property CanBeTalkedTo in Terraria.Player.cs.
  6. Information taken from the Desktop version Desktop 1.4.4.9 source code, method DrawInterface_14_EntityHealthBars() in Terraria.Main.cs.
  7. 7.0 7.1 7.2 7.3 7.4 Information taken from the Desktop version Desktop 1.4.4.9 source code, method Update() in Terraria.Player.cs.
  8. Information taken from the Desktop version Desktop 1.4.4.9 source code, methods Update() in Terraria.Player.cs, GetWeaponKnockback() in Terraria.Player.cs, and ItemCheck_OwnerOnlyCode() in Terraria.Player.cs.
  9. Information taken from the Desktop version Desktop 1.4.4.9 source code, methods ApplyNPCOnHitEffects() in Terraria.Player.cs and ItemCheck_MeleeHitPVP() in Terraria.Player.cs.
  10. Information taken from the Desktop version Desktop 1.4.4.9 source code, method Hurt() in Terraria.Player.cs.
  11. Information taken from the Desktop version Desktop 1.4.4.9 source code, method DashMovement() in Terraria.Player.cs.
  1. The values here represent stat changes when stealth reaches 0.
  2. 2.0 2.1 The actual condition for "stationary" is the player's horizontal and vertical speed are both less than 0.1 pixels/tick.
  3. Both move speed and sprint speed are affected.