add loot count 'min' and 'max'

This commit is contained in:
MihailRis 2024-12-29 09:04:10 +03:00
parent ebea9af380
commit f744c87c8e

View File

@ -20,8 +20,15 @@ local function calc_loot(loot_table)
local roll = math.random()
if roll < chance then
if loot.min and loot.max then
count = math.random(loot.min, loot.max)
end
if count == 0 then
goto continue
end
table.insert(results, {item=item.index(loot.item), count=count})
end
::continue::
end
return results
end