User:4e696e6a6f795844/Sandbox3

Luck is an invisible statistic that influences the random nature of various activities in Terraria. There are various ways to increase and decrease this statistic, ranging from Buff potions to Torch placement.

For many random chances in the game, the chance is represented in the code in a 1/x format. When this is combined with luck, there are two possibilities for players with non-zero luck:
 * If the player's luck is > 0, there is a luck/1 chance that 1/x will become 1/(x/2); i.e. the rate doubles.
 * If the player's luck is < 0, there is a -luck/1 chance that 1/x will become 1/(x*2); i.e. the rate halves.

Players can max out their luck at 1, but their luck cannot go below -0.7.

Influence
Luck is impacted by Ladybugs, the placement of Torches, Lucky (buff), Lantern Nights, and Garden Gnomes.

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

The player has a ladybug luck timer which always decreases to 0. It mostly relates to interactions with, as well as a few other NPCs.
 * If the player touches a ladybug that has been released by a player (intersecting hitboxes), then they will receive "good ladybug luck" for 12 minutes. This 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 is doubled to 6 minutes if the ladybug was golden.
 * Regardless of whether it is golden or not, there is also an increased chance of rain for the next 30 seconds.
 * If the player kills the Guide, their "good ladybug luck" is active for the next 12 minutes. Conversely, killing any other Town NPC (except for the Clothier) will activate bad ladybug luck for the next 3 minutes.
 * There is no counter stopping players from swapping their luck back and forth, so as long as the player releases and touches a ladybug after killing one, their luck will become good again.

Torch Luck
(Maximum: +0.2 / Minimum: -0.3)

By placing Torches in the correct locations, Players can increase their luck. With a few exceptions, torches placed in the Preffered Biome will yeild the positive score, and if placed in any other location, will yeild a negative score.

Torch luck seems to probe for torches in a ~20 tile radius.

Note that holding a torch in the correct biome also counts as being near it, so players can increase their luck by just holding a correct torch, even if surrounded by incorrect ones.

Torch Luck does not apply in the Dungeon or Lihzahrd Temple.


 * Torches do not yeild luck bonuses, and instead will increase negative score by +0.5 if placed in the Desert, Corruption, Crimson, or Hallow. If placed in the Snow biome they increase negative score by 2.
 * Coral Torches will have a score of -1 if not placed in water.
 * More than one of the same type of torch does not affect the score.

After tallying up all torch types around the player, the Torch Luck is determined.
 * If the positive score is ≥ 1, torch luck increases by 1. If otherwise > 0, increase by 0.5.
 * If the negative score is > 0, decrease torch luck by 0.5. If otherwise ≥ 1, decrease by 1, and if ≥ 2, decrease by -2.

Therefore, to maximize luck, players should try to use biome torches whenever possible, as well as avoid using said biome torches in the wrong biomes. If the player is out of said torches, they should aim to use Bone torches or any torch not listed above (e.g. Ultrabright Torches, Gem Torches) to avoid bad luck. Above all, players should avoid using regular Torches in the Snow biome as that reduces luck the most.

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 yeild +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)

Lantern Nights increase 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. The range is estimated to be similar to that of Banners and Campfires.

Impact
all foodstuffs

Ale, Bowl of Soup, Pumpkin Pie, Christmas Pudding, Eggnog, Sugar Cookie, Gingerbread Cookie, Sake, Pad Thai, Pho, Cooked Fish, Cooked Shrimp, Sashimi, Grub Soup, Bacon (major ?m), Apple, Apple Pie Slice, Apple Pie, Banana Split, BBQ Ribs, Bunny Stew, Burger, Chicken Nugget, Chocolate Chip Cookie, Cream Soda, Escargot, Fried Egg, Fries, Golden Delight, Grapes, Grilled Squirrel, Hotdog, Ice Cream, Milkshake, Nachos, Pizza, Potato Chips, Roasted Bird, Roasted Duck, Sauteed Frog Legs, Seafood Dinner, Shrimp Po' Boy, Spaghetti, Steak, Marshmallow, Cooked Marshmallow, Apricot, Banana, Blackcurrant, Blood Orange, Cherry, Coconut, Dragon Fruit, Elderberry, Grapefruit, Lemon, Mango, Peach, Pineapple, Plum, Rambutan, Star Fruit, Lobster Tail, Shucked Oyster, Apple Juice, Grape Juice, Lemonade, Frozen Banana Daiquiri, Peach Sangria, Pina Colada, Tropical Smoothie, Bloody Moscato, Smoothie of Darkness, Prismatic Punch, Fruit Juice, Fruit Salad, Teacup, Coffee, Carton of Milk

looks like

are unimplemented