Ajout des derniers développement #1

Merged
kazhnuz merged 68 commits from chronicles-cbs into master 2020-08-02 11:14:18 +02:00
2 changed files with 16 additions and 2 deletions
Showing only changes of commit 1acada1b51 - Show all commits

View file

@ -36,7 +36,7 @@ function TurnController:startBattle()
end end
function TurnController:finishBattle() function TurnController:finishBattle()
self.isBattleActive = false self.isActive = false
self.actionlist = {} self.actionlist = {}
self.hud:movePlayerHUD(false) self.hud:movePlayerHUD(false)
self.scene:finishBattle() self.scene:finishBattle()
@ -90,7 +90,10 @@ function TurnController:removeAllActionsFromFighter(fighterToRemove)
end end
function TurnController:applyDeath() function TurnController:applyDeath()
self.ennemies:applyDeath() local ennemiesAlive = self.ennemies:applyDeath()
if (ennemiesAlive == 0) then
self:finishBattle()
end
self.player:applyDeath() self.player:applyDeath()
end end

View file

@ -18,6 +18,16 @@ function FighterControllerParent:count()
return #self.list return #self.list
end end
function FighterControllerParent:countAlive()
local aliveCount = 0
for i, fighter in ipairs(self.list) do
if (fighter:canFight()) then
aliveCount = aliveCount + 1
end
end
return aliveCount
end
function FighterControllerParent:getTargets(onlyAlive) function FighterControllerParent:getTargets(onlyAlive)
local targetList = {} local targetList = {}
for i, fighter in ipairs(self.list) do for i, fighter in ipairs(self.list) do
@ -32,6 +42,7 @@ function FighterControllerParent:applyDeath()
for i, fighter in ipairs(self.list) do for i, fighter in ipairs(self.list) do
fighter:applyDeath() fighter:applyDeath()
end end
return self:countAlive()
end end
function FighterControllerParent:setActive(activeActor) function FighterControllerParent:setActive(activeActor)