Lifesteal

Lifesteal is a mechanic utilized by some weapons and other items which causes the player to be healed upon damaging an enemy. This is done via direct healing when the attack hits, the spawning of a healing projectile which heals the player on touch, or the spawning of Hearts.

Lifesteal cooldown
There is a hidden lifesteal cooldown variable in Terraria which is constantly increasing every frame, up to a maximum which varies depending on the current difficulty mode. Whenever a player is healed with a lifesteal effect, the cooldown variable is decreased by a certain amount that is typically proportional to damage. Several lifesteal effects will fail to heal the player if the cooldown variable is at or below 0, preventing the player from abusing lifesteal to keep themselves alive for longer than intended.

The maximum amount is. The variable increases by instead of  in vanilla.

canGhostHeal
  is an internal Boolean variable that pertains to whether or not the player can steal life from enemies. The variable is defined in the files of certain NPCs, and checked for in the files of many lifestealing items and projectiles. If the item or projectile checks for  in the hit enemy's file and finds that it's set to , then the player will be healed. If it's set to, the player will not be healed. is set to  by default in all enemy files, though some enemies have it directly set to.

Note that not all lifestealing items and projectiles check for. If they bypass the check, they can heal the player regardless of what the hit enemy has it set to.

Lifestealing Items
Below is a list of all items in the Calamity Mod which have the ability to steal life from enemies. Also listed is their healing amount, method of healing, as well as whether or not they bypass  or the lifesteal cooldown.

canGhostHeal=False NPCs
Below is a list of all NPCs in the Calamity Mod which have  set to , meaning that the player cannot heal from hitting them with lifestealing attacks that check for the variable. Vanilla NPCs listed here only have  set to   in Revengeance Mode.

Trivia

 * The name for  is in reference to Spectre armor's healing effect while wearing the Spectre Hood. The variable was later used for many other items which had lifesteal effects.
 * Exoblade, Grand Guardian, Earth, and Bloodsoaked Crasher are the only weapons with two distinct lifesteal effects each. Auric Tesla armor's set bonus while wearing Auric Tesla Wire-Hemmed Visage has five distinct lifesteal effects.