mirror of
https://github.com/veden/Rampant.git
synced 2024-12-28 21:08:22 +02:00
54 lines
1.6 KiB
Lua
54 lines
1.6 KiB
Lua
|
local unitUtils = {}
|
||
|
|
||
|
-- imports
|
||
|
|
||
|
local constants = require("Constants")
|
||
|
|
||
|
-- constants
|
||
|
|
||
|
local ENERGY_THIEF_DRAIN_CRYSTALS = constants.ENERGY_THIEF_DRAIN_CRYSTALS
|
||
|
|
||
|
-- imported functions
|
||
|
|
||
|
-- module code
|
||
|
|
||
|
function unitUtils.convertTypeToDrainCrystal(evolutionFactor, entity)
|
||
|
if (entity == "pole") then
|
||
|
return "crystal-drain-pole-rampant"
|
||
|
else
|
||
|
if (entity == "smallUnit") then
|
||
|
if (evolutionFactor < 0.25) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[1]
|
||
|
elseif (evolutionFactor < 0.50) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[2]
|
||
|
elseif (evolutionFactor < 0.75) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[3]
|
||
|
else
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[4]
|
||
|
end
|
||
|
elseif (entity == "unit") then
|
||
|
if (evolutionFactor < 0.25) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[4]
|
||
|
elseif (evolutionFactor < 0.50) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[5]
|
||
|
elseif (evolutionFactor < 0.75) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[6]
|
||
|
else
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[7]
|
||
|
end
|
||
|
else
|
||
|
if (evolutionFactor < 0.25) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[7]
|
||
|
elseif (evolutionFactor < 0.50) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[8]
|
||
|
elseif (evolutionFactor < 0.75) then
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[9]
|
||
|
else
|
||
|
return ENERGY_THIEF_DRAIN_CRYSTALS[10]
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return unitUtils
|