sonic-radiance/sonic-radiance.love/scenes/battlesystem/controllers/fighters/parent.lua

77 lines
1.3 KiB
Lua

local FighterParent = Object:extend()
local counter = 0
function FighterParent:new(owner, isHero, id)
self.owner = owner
self.turnSystem = owner.turnSystem
self.world = owner.world
self.isHero = isHero
-- Note : l'ID est ici relatif à chaque quand, il n'est donc pas unique,
-- ce qui est unique étant le combo id + isHero
self.id = id
self.abstract = self:getAbstract()
self.actor = self:createActor()
self.isActive = false
end
function FighterParent:getAbstract()
return {}
end
function FighterParent:createActor()
return {}
end
function FighterParent:update(dt)
counter = counter + dt
if (counter > 5) then
counter = 0
self:setInactive()
end
end
function FighterParent:setActive()
counter = 0
self.isActive = true
self:startAction()
end
function FighterParent:setInactive()
self.isActive = false
self.turnSystem:nextAction()
end
function FighterParent:getNbrActionPerTurn()
return self.abstract.turns
end
function FighterParent:getStats()
return self.abstract:getStats()
end
function FighterParent:startAction()
end
function FighterParent:getUniqueIdentificator()
local side = 1
if (isHero == false) then
side = -1
end
return self.id * side
end
function FighterParent:getNonUniqueIdentificator()
return self.id
end
function FighterParent:canFight()
return true
end
return FighterParent