572
edits
No edit summary |
(Add land cost functions) |
||
Line 600: | Line 600: | ||
return table.concat(ret) | return table.concat(ret) | ||
end | |||
-- Gets the cost of the current price of land | |||
-- Taken from township.js -> Township.getNextSectionCost | |||
function p.GetLandCost(previouslyUnlockedCount) | |||
-- First 32 plots of land are free | |||
if previouslyUnlockedCount < 32 then | |||
return 0 | |||
end | |||
return math.floor(15^(0.0100661358978 * ((previouslyUnlockedCount + 1) / 32) + ((previouslyUnlockedCount + 1) / 32)^0.42)) | |||
end | |||
-- Gets the cost to buy land until you have X amount of available land | |||
-- Currently the max is 2048 land | |||
function p.GetCumulativeLandCost(totalLand) | |||
local cost = 0 | |||
while totalLand > 32 do | |||
totalLand = totalLand - 1 | |||
cost = cost + p.GetLandCost(totalLand) | |||
end | |||
return cost | |||
end | end | ||
return p | return p |
edits