fix: readd fighter removal
This commit is contained in:
parent
8512ab3c26
commit
5e1ee752ac
2 changed files with 21 additions and 0 deletions
|
@ -82,6 +82,14 @@ function TurnController:calculateTurn()
|
|||
table.sort(self.actionList, maputils.sortBattlers)
|
||||
end
|
||||
|
||||
function TurnController:removeAllActionsFromFighter(fighterToRemove)
|
||||
for i, action in ipairs(self.actionlist) do
|
||||
if action.fighter == fighterToRemove then
|
||||
table.remove(self.actionlist, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TurnController:startAction()
|
||||
core.debug:print("cbs/turns", "Starting action " .. self.turns.current)
|
||||
local nextAction = self.actionList[self.turns.current]
|
||||
|
|
|
@ -48,5 +48,18 @@ function FighterControllerParent:draw()
|
|||
--Aucun dessin par defaut, ils sont géré différements
|
||||
end
|
||||
|
||||
function FighterControllerParent:removeFighter(fighterToRemove)
|
||||
-- remove the actor from the battler liste
|
||||
for i, fighter in ipairs(self.list) do
|
||||
if fighter == fighterToRemove then
|
||||
table.remove(self.list, i)
|
||||
end
|
||||
end
|
||||
|
||||
-- Also remove all actions related to the actor
|
||||
self.turnSystem:removeAllActionsFromFighter(fighterToRemove)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return FighterControllerParent
|
||||
|
|
Loading…
Reference in a new issue