2019-08-14 16:26:23 +02:00
|
|
|
local maputils = {}
|
|
|
|
|
|
|
|
maputils.CONST = {}
|
|
|
|
|
|
|
|
maputils.CONST.STARTX = -8
|
|
|
|
maputils.CONST.STARTY = 90
|
|
|
|
|
|
|
|
function maputils.sortBattlers(a, b)
|
2020-07-19 16:57:38 +02:00
|
|
|
local astats = a.fighter:getStats()
|
|
|
|
local bstats = b.fighter:getStats()
|
2019-08-14 16:26:23 +02:00
|
|
|
local aspeed = astats.speed / 1.5 * a.number
|
|
|
|
local bspeed = bstats.speed / 1.5 * b.number
|
|
|
|
|
|
|
|
|
|
|
|
if (aspeed == bspeed) then
|
2020-07-19 16:57:38 +02:00
|
|
|
if (a.fighter.isHero == b.fighter.isHero) then
|
|
|
|
return (a.fighter.id > b.fighter.id)
|
2019-08-14 16:26:23 +02:00
|
|
|
else
|
2020-07-19 16:57:38 +02:00
|
|
|
return a.fighter.isHero
|
2019-08-14 16:26:23 +02:00
|
|
|
end
|
|
|
|
else
|
|
|
|
return (aspeed > bspeed)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return maputils
|