Module:ModuleCalculateCost

From The First Descendant Wiki
Revision as of 00:35, 8 June 2024 by Software2 (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 modifier = 1
    if exclusiveCategory == "Sub Module" or exclusiveCategory == "Skill" then
        modifier = -1
    end
    return baseCost + (enhancementLevel * modifier)
end

return p