Luck

Luck is a hidden statistic that influences the random nature of various activities in Terraria. There are various ways to increase and decrease this statistic, such as Buff potions and Torch placement. Players can estimate their luck value by teleporting the Wizard to the position in question and speaking to him.

Luck influences many of Terraria's randomly-chosen items and events, such as the chances of valuable and unique item drops, rare enemy spawns, NPC's first appearances (like the Goblin Tinkerer and Wizard), Fairy spawns, and rarer Traveling Merchant inventory items. See below, Items affected by luck, for a full list.

Influences
Luck is impacted by Ladybugs, the placement of Torches, Lucky (buff), Lantern Nights, and Garden Gnomes. Luck is computed using as the sum of following values:

Ladybug Luck
(Maximum: +0.4 / Minimum: -0.4)

Ladybug luck relates to interactions with, as well as a few other NPCs.
 * If the player touches a naturally spawning ladybug (intersecting hitboxes) that has not been released by a player, then they will receive "good ladybug luck" for 12 minutes. This duration is doubled for golden ladybugs.
 * If the player touches the ladybug from more than 30 pixels away, it is possible that the number will be slightly reduced, but the difference is barely noticeable.
 * If a player kills a ladybug, they will receive "bad ladybug luck" for 3 minutes. This duration is doubled for golden ladybugs.
 * Regardless of whether it is golden or not, there is also an increased chance of rain for the next 30 seconds.
 * Fishing with a Ladybug/Golden Ladybug as bait is the same as killing it and will trigger all the same effects.
 * If the player kills the Guide, and they don't have "bad ladybug luck", they receive "good ladybug luck" for 4 minutes (if they don't already have a longer good ladybug luck duration). However, killing any other Town NPC (except for the Clothier) will activate "bad ladybug luck" for the next minute (if they don't already have a longer bad ladybug luck duration).
 * Due to the shorter duration, and ladybug luck being scaled by remaining time, this will have a very small impact on overall luck.
 * Since the luck bonus is not stored as a buff on the character, it dissipates as soon as the player leaves the world.

"Good ladybug luck" adds 0.2 to the final luck score, and "bad ladybug luck" subtracts 0.2. That number is 0.4 for golden ladybugs instead. As the buff time wears off, the ladybug luck becomes less effective with a linear speed, disappearing completely after the timer reaches zero.

Luck Potions
(Maximum: +0.3 / Minimum: 0)

The Lucky (buff) increases luck based on how much time there is left. The values do not stack, so using a will yield +0.3 luck for 5 minutes, then +0.2 luck for 2 minutes, and finally +0.1 luck for 3 minutes.

Lantern Nights
(Maximum: +0.3 / Minimum: 0)

A Lantern Night increases luck by a flat rate of 0.3. This is active everywhere in the world, even underground. However, they will not start if there is a Blood Moon, Pumpkin Moon, Frost Moon, any boss or invasion active, or if Moon Lord is being summoned.

Garden Gnomes
(Maximum: +0.2 / Minimum: 0)

If the player has a garden gnome nearby, luck will be increased by a flat rate of 0.2. This effect does not stack with multiple gnomes. The range is estimated to be similar to that of Banners and Campfires (175 by 125 rectangular area centered on the garden gnome).

Final Calculation
The formula used by the game is below: luck = ladybugLuck + torchLuck; luck = luck + (luckPotionAmount * 0.1); if (lanternNight) { luck = luck + 0.3; } if (hasGardenGnomeNearby) { luck = luck + 0.2; }

Luck is recomputed each frame. Starting at 0, the ladybug luck is added to the torch luck. Then the luck potion value is added, and if there is a lantern night, add 0.3 and if there is a Garden Gnome, add 0.2.

Players can max out their luck at 1, but their luck cannot go below -0.4, so bad luck is harder to achieve than good luck. The technical negative limit for luck is -0.7, but it is not possible to reach this as of.

Impact
Luck has a significant impact on multiple random chances throughout the game. Whenever a random chance is rolled in one of the ways listed below, an additional modifier is applied to the chance that the roll has a positive result:
 * If the player's luck is greater than 0, then there is a (100 * luck)% chance that the chance is increased.
 * The exact increase is itself randomized: if the base chance is 1 in X, the chance will become 1 in Y, where Y is a uniformly-distributed random number between X/2 and X-1 (inclusive). Therefore, an event occuring with a base chance of 1 in X will, on average, become a 1 in (3X-2)/4, with probability (100 * luck)% chance.
 * If the player's luck is less than 0, then there is a (-100 * luck)% chance that the chance is decreased.
 * Similarly to the above, the decrease is randomized: if the base chance is 1 in X, the chance will become 1 in Y, where Y is a random number between X and X*2-1 (inclusive).
 * If the player's luck is 0, the chance will be the base value.

For example, if the base probability of an event is 10%, then:
 * If the player's luck is 1.0, there is a 100% chance that the probability will become something between 1 in 5 and 1 in 9, leading to an average final probability of approximately 14.9%.
 * If the player's luck is 0.5, there is a 50% chance that the probability is increased, leading to an average final probability of approximately 12.5%.
 * If the player's luck is 0.0, the final probability is equal to the base probability, 10%.
 * If the player's luck is -0.2, there is a 20% chance that the probability will become something between 1 in 10 and 1 in 19, leading to an average final probability of approximately 9.44%.
 * If the player's luck is -0.4, there is a 40% chance that the probability will be decreased, leading to an average final probability of approximately 8.88%.

As an example, for a drop that has a chance of 2% on killing an enemy, if you kill that enemy 1000 times you would expect 20 of that drop:


 * After killing a ladybug, you would instead get 18 (rounding down) of that drop. If it took an hour to farm for this drop, it now would take an additional 7 minutes. Note that the bad ladybug luck would wear out by then.
 * In an Underground Jungle biome with a single Jungle Torch, a garden gnome, with a luck potion with 5 mins duration remaining, on a Lantern Night, you would get 28 of that drop. If it took an hour to farm for this drop, it now would take approximately 17 fewer minutes.

Items affected by luck
In most cases, the player performing the roll influences the luck, however there are some cases (such as shaking trees) that use the closest player's luck.


 * All material drop rates, such as Ichor.
 * Crates, Oysters, and other grab bags are not affected by luck.
 * While fishing, positive luck gives a (100 * luck)% chance of silently multiplying your fishing power by a random number between 110% and 140%.
 * Inversely, negative luck gives a (-100 * luck)% chance of silently multiplying your fishing power by a random number between 60% and 90%.
 * Actual fishing rewards are not influenced by luck beyond fishing power.
 * All rare item drop rates, such as the Ancient Horn or Slimy Saddle.
 * Chances of items appearing in the Traveling Merchant inventory.
 * The player with the highest luck will be chosen to influence the inventory.
 * Chances of Coin Portals appearing from Pots.
 * Chances of Gold Critters replacing a regular critter spawn.
 * Chances of spawning a Dungeon Spirit.
 * Chances of enemies dropping Hearts and Mana Stars.
 * Chances of some event enemies dropping more than one heart (Zombie Elf, Scarecrow, Hellhound, Poltergeist).
 * Chances of Food dropping from enemies.
 * Chances of the Bound Wizard and Bound Goblin appearing underground.
 * Chances of Enchanted Nightcrawlers spawning during meteor shower.
 * Chances of a Hardmode Dungeon enemy spawning on the wrong wall type (e.g. Skeleton Commando spawning on Slab Wall).
 * Chances of a Dungeon Slime spawning.
 * Chances of Fairies spawning underground.
 * Chances of Gnomes spawning while the Player is in a Living Tree or in front of "unsafe" Dirt Wall.
 * Chances of Biome Mimics spawning.
 * Chances of Doctor Bones spawning.
 * Chances of Ice Golem spawning.
 * Chances of Pinky spawning in place of a Blue Slime.
 * Damage calculations in many situations are influenced by luck; positive luck will be favorable to the player. Projectiles are influenced by luck, as is enemy melee damage (i.e. touching a Zombie). Player weapons also take luck into account. Thorns Potions do not appear to use luck.
 * The following steps are taken to incorporate luck into a player's damage:
 * The initial damage value is generated.
 * The game checks if the player has > 0 luck, and if so, generates a random number from 0.0 to 1.0. If the random number is less than the player's luck, a second damage value is generated, and the higher of the two numbers is dealt.
 * If the player has < 0 luck, a random number is generated from 0.0 to 1.0. If the random number is less than the absolute value of the player's luck, a second damage value is generated, and the lower of the two numbers is dealt.
 * This is up to a 5% increase/decrease in average damage before defense.
 * Luck affects PvP the same way it affects regular enemies.
 * It is currently unknown whether or not Luck influences ingredient preservation chance at an Alchemy Table.
 * Players with high luck have better coin drop rates in the same way as damage, for around a 15% increase/decrease at 100% good/bad luck.
 * A list of boss drops that do not scale with luck is listed below:

Wizard Luck status
The Wizard will occasionally give the player a general idea of where their luck value is, in place of his regular dialogue.


 * If Luck is ≥ 0.75


 * If Luck is ≥ 0.5


 * If Luck is ≥ 0.25


 * If Luck is > 0.1


 * If Luck is < 0


 * If Luck is < -0.2


 * If Luck is < -0.4


 * If Luck is < -0.6 (impossible to access)

Trivia

 * In, mismatched biome torches caused a luck penalty. This was removed in after a Reddit post criticizing the mechanic went viral, causing a large community backlash. This change seems to have caused the wizard's messages below -0.6 luck to become impossible to see in-game.
 * A Wizard dialogue when having a luck value less than -0.2, "...You DID forward that letter, right?" is a reference to the phenomenon of chain letters, specifically those that promise bad luck if the sender did not "copy" or "forward" to the next person(s) in the chain.