This page underwent a massive overhaul after being made aware of some inaccuracies.
% Life Stolen per Hit and % Mana Stolen per Hit (leech) can overflow depending on specific situations.
Bitlife and bitmana (for lack of previously defined terms) are what life and mana are measured in under the hood. All life, mana, damage, and stamina values are represented in 1/256ths. When an item gives you 2 life, it’s more literally giving you 512 bitlife. When something does 10 damage, it’s applying 2560 damage to bitlife. Additionally, leech has extra precision as well (represented by 1/64).
However, under the condition that damage (in bit) multiplied by % leech (in a different bit) goes over 2^31-1 (2147483647), the life stolen overflows. However, there are two different ways Blizzard handles this. If damage (in bit) is <= 2^20 (1048576), then the multiplication will happen without change. If the damage (in bit) is > 2^20, then damage (in bit) is converted to a 64 bit signed integer before multiplication. A division occurs after the multiplication step, which casts the result back to a 32 bit signed integer, which still causes overflows.
It’s important to note that difficulty penalty applies directly to leech after it receives its extra precision and before everything else. The penalty is 1/2 in Nightmare and 1/3 in Hell.
If the final life stolen (in bits) is less than 0, it is set to 0, so you will never lose life or mana due to leech.
Other steps occur within the formula, but irrelevant information has been left out (ie mercenaries and unit modifiers, skill damage modifiers (ie Multiple Shot’s 3/4th damage), and monster leech effectiveness).
The example given below is for an Assassin, but this issue applies to every character. She just hits it very easily. The only other build that I know can reach this in “normal gameplay” is a Werewolf.
Maybe another character or some other configuration can be impacted by this issue, but it’s fairly difficult.
Here’s a video demonstrating it:
666-667 Normal Attack damage and 2315-2316 Dragon Flight damage. I modified Suwayyah to do 40-40 damage and Boots to do 100-100 damage. I set Strength and Dexterity each to 10 so that my base kick damage was 0 (to avoid large damage range) so that only my boots contributed to my damage. I set the Strength Bonus to 100% (normally 120%) for easier calculations and rounding. All of my skills are level 20. Claw Mastery (for the Normal Attack) gives 144% Enhanced Damage. Tiger Strike 3 gives 1440% Enhanced Damage. Dragon Flight gives 765% Enhanced Damage. Cobra Strike 3 gives 270% Life and Mana Stolen per Hit. The Brute has 0% Physical Resistance and a life pool comparable to a Uber boss.
When I use the Suwayyah, I steal life and mana exactly as expected (due note that the amounts are relatively low because Hell difficulty reduces the amount of life and mana received from steals by 1/3rd. The Brute has 100% drain effectiveness). When I swap to Dragon Flight, I no longer steal any life, despite the monster visibly taking damage.
Here is a calculator that is accurate for every scenario I tested:
https://warren1001.github.io/Leech_Overflow/
Please do not turn this thread into a debate on whether or not the Assassin should be able to steal that much life or mana. General Discussion is better suited for that discussion.