77 lines
2.0 KiB
Lua
77 lines
2.0 KiB
Lua
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
local ____exports = {}
|
|
function ____exports.getRarityBaseStatCount(self, rarity)
|
|
repeat
|
|
local ____switch3 = rarity
|
|
local ____cond3 = ____switch3 == "uncommon"
|
|
if ____cond3 then
|
|
return 1
|
|
end
|
|
____cond3 = ____cond3 or ____switch3 == "rare"
|
|
if ____cond3 then
|
|
return 2
|
|
end
|
|
____cond3 = ____cond3 or ____switch3 == "epic"
|
|
if ____cond3 then
|
|
return 3
|
|
end
|
|
____cond3 = ____cond3 or ____switch3 == "legendary"
|
|
if ____cond3 then
|
|
return 4
|
|
end
|
|
do
|
|
return 1
|
|
end
|
|
until true
|
|
end
|
|
function ____exports.getUpgradeCostByStage(self, rarity, upgradeStage)
|
|
local baseByRarity = {uncommon = 50, rare = 120, epic = 260, legendary = 500}
|
|
local multipliers = {
|
|
1,
|
|
1.6,
|
|
2.4,
|
|
3.5,
|
|
5
|
|
}
|
|
local stage = math.max(
|
|
0,
|
|
math.min(
|
|
4,
|
|
math.floor(upgradeStage)
|
|
)
|
|
)
|
|
return math.floor(baseByRarity[rarity] * multipliers[stage + 1])
|
|
end
|
|
function ____exports.getDifficultyBaseRarity(self, diff)
|
|
repeat
|
|
local ____switch6 = diff
|
|
local ____cond6 = ____switch6 == "easy"
|
|
if ____cond6 then
|
|
return "uncommon"
|
|
end
|
|
____cond6 = ____cond6 or ____switch6 == "hard"
|
|
if ____cond6 then
|
|
return "epic"
|
|
end
|
|
____cond6 = ____cond6 or ____switch6 == "impossible"
|
|
if ____cond6 then
|
|
return "epic"
|
|
end
|
|
____cond6 = ____cond6 or ____switch6 == "normal"
|
|
do
|
|
return "rare"
|
|
end
|
|
until true
|
|
end
|
|
function ____exports.maybeUpgradeRarityAtDrop(self, baseRarity, diff)
|
|
if diff ~= "impossible" then
|
|
return baseRarity
|
|
end
|
|
local roll = RandomInt(1, 100)
|
|
if roll <= 35 then
|
|
return "legendary"
|
|
end
|
|
return baseRarity
|
|
end
|
|
return ____exports
|