Module:Skills/Agility: Difference between revisions

no edit summary
(Add function to calculate obstacle cost reduction)
No edit summary
Line 61: Line 61:
local item = Num.clamp((costReduction['Item'] or 0), 0, 100) / 100
local item = Num.clamp((costReduction['Item'] or 0), 0, 100) / 100
if itemCosts['GP'] then
if gp > 0 and itemCosts['GP'] then
itemCosts['GP'] = math.ceil(itemCosts['GP'] * (1 - gp))
itemCosts['GP'] = math.ceil(itemCosts['GP'] * (1 - gp))
end
end
if itemCosts['SC'] then
if sc > 0 and itemCosts['SC'] then
itemCosts['SC'] = math.ceil(itemCosts['SC'] * (1 - sc))
itemCosts['SC'] = math.ceil(itemCosts['SC'] * (1 - sc))
end
end
local items = itemCosts['Items']
local items = itemCosts['Items']
for k, v in pairs(items) do
if item > 0 then
items[k] = math.ceil(items[k] * (1 - item))
for k, v in pairs(items) do
items[k] = math.ceil(items[k] * (1 - item))
end
end
end
2,875

edits