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()
|
2020-08-05 12:03:31 +02:00
|
|
|
local aspeed = astats.speed / (3 ^ (a.number-1))
|
|
|
|
local bspeed = bstats.speed / (3 ^ (b.number-1))
|
|
|
|
|
2019-08-14 16:26:23 +02:00
|
|
|
|
|
|
|
if (aspeed == bspeed) then
|
2020-07-19 16:57:38 +02:00
|
|
|
if (a.fighter.isHero == b.fighter.isHero) then
|
2020-08-05 11:54:39 +02:00
|
|
|
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
|