summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-04 22:10:04 +0200
committerWuzzy <almikes@aol.com>2016-08-04 22:10:04 +0200
commit8afc78dfd79075ca017429b47087fc282ef74c04 (patch)
tree50422310fa19f1ad8afbe76384de597afde3e797 /init.lua
parent7fcb8f0df214626cb849c4e8ce332b08a131f828 (diff)
Cap very small drop probabilities (rarity>200)
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua17
1 files changed, 11 insertions, 6 deletions
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