Stealth
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,
stealthis 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,
stealthTimerwill 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) beforestealthbegins 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
stealthreaches 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
stealthreaches 0.[4] - NPCs will not attempt to "talk" to (i.e. show emotes to) a player if their
stealthstat 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
stealthreaches 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(Desktop, Console and Mobile versions) |
|
|
| |
| Shroomite armor(Set Bonus) |
|
|
| |
| Vortex armor(Desktop, Console and Mobile versions)(Set Bonus) |
|
n/a |
| |
Notes
- Teleport effects (Teleporter, Magic Mirror, Rod of Discord, etc.) and using hooks will not deactivate stealth.
References
- ↑ Information taken from the
Desktop 1.4.4.9 source code, field stealthinTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, field stealthTimerinTerraria.Player.cs. - ↑ 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.
- ↑ Information taken from the
Desktop 1.4.4.9 source code, methods AI_003_Fighters()inTerraria.NPC.csandAI_005_EaterOfSouls()inTerraria.NPC.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, property CanBeTalkedToinTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, method DrawInterface_14_EntityHealthBars()inTerraria.Main.cs. - ↑ 7.0 7.1 7.2 7.3 7.4 Information taken from the
Desktop 1.4.4.9 source code, method Update()inTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, methods Update()inTerraria.Player.cs,GetWeaponKnockback()inTerraria.Player.cs, andItemCheck_OwnerOnlyCode()inTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, methods ApplyNPCOnHitEffects()inTerraria.Player.csandItemCheck_MeleeHitPVP()inTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, method Hurt()inTerraria.Player.cs. - ↑ Information taken from the
Desktop 1.4.4.9 source code, method DashMovement()inTerraria.Player.cs.