sonic-radiance/sonic-radiance.love/scenes/battlesystem/utils.lua

27 lines
547 B
Lua
Raw Normal View History

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()
2020-08-05 12:03:31 +02:00
local aspeed = astats.speed / (3 ^ (a.number-1))
local bspeed = bstats.speed / (3 ^ (b.number-1))
if (aspeed == bspeed) then
if (a.fighter.isHero == b.fighter.isHero) then
2020-08-05 11:54:39 +02:00
return (a.fighter.id < b.fighter.id)
else
return a.fighter.isHero
end
else
return (aspeed > bspeed)
end
end
return maputils