From 8afc78dfd79075ca017429b47087fc282ef74c04 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 4 Aug 2016 22:10:04 +0200 Subject: Cap very small drop probabilities (rarity>200) --- init.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 51e6ca9..f235601 100644 --- a/init.lua +++ b/init.lua @@ -427,13 +427,18 @@ doc.new_category("nodes", { end end local chance = (1/rarity)*100 - -- Add circa indicator for percentages with decimal point - local ca = "" - -- FIXME: Does this actually reliable? - if math.fmod(chance, 1) > 0 then - ca = "ca. " + if rarity > 200 then -- <0.5% + -- For very low percentages + formstring = formstring .. " (<0.5%)" + else + -- Add circa indicator for percentages with decimal point + local ca = "" + -- FIXME: Does this actually reliable? + if math.fmod(chance, 1) > 0 then + ca = "ca. " + end + formstring = formstring .. string.format(" (%s%.0f%%)", ca, chance) end - formstring = formstring .. string.format(" (%s%.0f%%)", ca, chance) if max ~= nil then remaining_rarity = 1/(1/remaining_rarity - 1/rarity) end -- cgit v1.2.3