Compare commits
No commits in common. "4f436a3d3ff216f28bfea486932b6b4c8f3b3324" and "ec290eb18b0456064909c2d3acdc3755ffefb2e7" have entirely different histories.
4f436a3d3f
...
ec290eb18b
@ -40,7 +40,6 @@ end
|
|||||||
function level:update(dt)
|
function level:update(dt)
|
||||||
utils.each(self.deadIds, function(id)
|
utils.each(self.deadIds, function(id)
|
||||||
self.characters[id] = nil
|
self.characters[id] = nil
|
||||||
self.turnOrder:remove(id)
|
|
||||||
end)
|
end)
|
||||||
self.deadIds = {}
|
self.deadIds = {}
|
||||||
|
|
||||||
|
|||||||
@ -108,29 +108,4 @@ function turnOrder:add(id)
|
|||||||
self.actedQueue:insert(id) -- новые персонажи по умолчанию попадают в очередь следующего хода
|
self.actedQueue:insert(id) -- новые персонажи по умолчанию попадают в очередь следующего хода
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Удалить персонажа из очереди хода (например, при смерти)
|
|
||||||
--- @param id Id
|
|
||||||
function turnOrder:remove(id)
|
|
||||||
if self.current == id then
|
|
||||||
self.current = self.pendingQueue:pop()
|
|
||||||
if not self.current then
|
|
||||||
self:endRound()
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local function filterQueue(q, targetId)
|
|
||||||
local newQ = PriorityQueue.new(initiativeComparator)
|
|
||||||
for _, val in ipairs(q.data) do
|
|
||||||
if val ~= targetId then
|
|
||||||
newQ:insert(val)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return newQ
|
|
||||||
end
|
|
||||||
|
|
||||||
self.actedQueue = filterQueue(self.actedQueue, id)
|
|
||||||
self.pendingQueue = filterQueue(self.pendingQueue, id)
|
|
||||||
end
|
|
||||||
|
|
||||||
return { new = new }
|
return { new = new }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user