sonic-radiance/sonic-radiance.love/game/abstractmobs/ennemy/statmanager.lua

31 lines
823 B
Lua
Raw Permalink Normal View History

2021-07-03 10:12:56 +02:00
local StatManager = require "game.abstractmobs.statmanager"
local EnnemyStatManager = StatManager:extend()
function EnnemyStatManager:new(owner)
2021-07-03 12:56:32 +02:00
EnnemyStatManager.super.new(self, owner, "ENNEMI")
2021-07-03 10:12:56 +02:00
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]
2021-07-03 12:56:32 +02:00
if (self:isBattleStat(statname)) then
return self:getBattleStat(statname)
end
2021-07-03 10:12:56 +02:00
if statname == EnnemyStatManager.HPMAX then
return stat * self.pvFactor
elseif (statname ~= EnnemyStatManager.PPMAX) then
return stat * self.statFactor
2021-07-03 12:56:32 +02:00
else
return stat
2021-07-03 10:12:56 +02:00
end
end
return EnnemyStatManager