sonic-radiance/sonic-radiance.love/scenes/battlesystem/utils.lua
2020-07-19 17:02:00 +02:00

26 lines
539 B
Lua

local maputils = {}
maputils.CONST = {}
maputils.CONST.STARTX = -8
maputils.CONST.STARTY = 90
function maputils.sortBattlers(a, b)
local astats = a.fighter:getStats()
local bstats = b.fighter:getStats()
local aspeed = astats.speed / 1.5 * a.number
local bspeed = bstats.speed / 1.5 * b.number
if (aspeed == bspeed) then
if (a.fighter.isHero == b.fighter.isHero) then
return (a.fighter.id > b.fighter.id)
else
return a.fighter.isHero
end
else
return (aspeed > bspeed)
end
end
return maputils