(Created page with "----------------------------------------------------------- -- Most modules go up in cost by 1 for every enhancement level -- Except for sub modules and descendant skills. Those go down in cost. -- Because this game rule is referenced in multiple lua modules -- this was broken into its own lua module. local p = {} function p.calculate_module_cost(baseCost, enhancementLevel, exclusiveCategory) local modifier = 1 if exclusiveCategory == "Sub Module" or exclusiveC...") |
No edit summary |
||
| Line 8: | Line 8: | ||
function p.calculate_module_cost(baseCost, enhancementLevel, exclusiveCategory) | function p.calculate_module_cost(baseCost, enhancementLevel, exclusiveCategory) | ||
local cost = tonumber(baseCost) | |||
local level = tonumber(enhancementLevel) | |||
if cost == nil or level == nil then | |||
return "?" | |||
end | |||
local modifier = 1 | local modifier = 1 | ||
if exclusiveCategory == "Sub Module" or exclusiveCategory == "Skill" then | if exclusiveCategory == "Sub Module" or exclusiveCategory == "Skill" then | ||
Latest revision as of 00:43, 8 June 2024
Documentation for this module may be created at Module:ModuleCalculateCost/doc
-----------------------------------------------------------
-- Most modules go up in cost by 1 for every enhancement level
-- Except for sub modules and descendant skills. Those go down in cost.
-- Because this game rule is referenced in multiple lua modules
-- this was broken into its own lua module.
local p = {}
function p.calculate_module_cost(baseCost, enhancementLevel, exclusiveCategory)
local cost = tonumber(baseCost)
local level = tonumber(enhancementLevel)
if cost == nil or level == nil then
return "?"
end
local modifier = 1
if exclusiveCategory == "Sub Module" or exclusiveCategory == "Skill" then
modifier = -1
end
return baseCost + (enhancementLevel * modifier)
end
return p