sonic-radiance/sonic-radiance.love/game/abstractmobs/ennemy/statmanager.lua
2021-07-03 10:12:56 +02:00

25 lines
No EOL
689 B
Lua

local StatManager = require "game.abstractmobs.statmanager"
local EnnemyStatManager = StatManager:extend()
function EnnemyStatManager:new(owner)
EnnemyStatManager.super.new(self, owner)
self.pvFactor = 1
self.statFactor = 1
end
function EnnemyStatManager:setBonus(pvFactor, statFactor)
self.pvFactor = pvFactor or 1
self.statFactor = statFactor or 1
end
function EnnemyStatManager:computeStat(statname)
local stat = self.owner.data.stats[statname]
if statname == EnnemyStatManager.HPMAX then
return stat * self.pvFactor
elseif (statname ~= EnnemyStatManager.PPMAX) then
return stat * self.statFactor
end
end
return EnnemyStatManager