diff options
author | Wuzzy <almikes@aol.com> | 2016-08-04 22:10:04 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-04 22:10:04 +0200 |
commit | 8afc78dfd79075ca017429b47087fc282ef74c04 (patch) | |
tree | 50422310fa19f1ad8afbe76384de597afde3e797 /init.lua | |
parent | 7fcb8f0df214626cb849c4e8ce332b08a131f828 (diff) |
Cap very small drop probabilities (rarity>200)
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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 |