2021-07-03 09:49:11 +02:00
|
|
|
local StatManager = Object:extend()
|
|
|
|
local CONST = require "datas.consts.stats"
|
|
|
|
StatManager.CONST = CONST
|
|
|
|
|
|
|
|
StatManager.HPMAX = CONST.HPMAX
|
|
|
|
StatManager.PPMAX = CONST.PPMAX
|
|
|
|
StatManager.ATTACK = CONST.ATTACK
|
|
|
|
StatManager.POWER = CONST.POWER
|
|
|
|
StatManager.DEFENSE = CONST.DEFENSE
|
|
|
|
StatManager.MIND = CONST.MIND
|
|
|
|
StatManager.TECHNIC = CONST.TECHNIC
|
|
|
|
StatManager.SPEED = CONST.SPEED
|
|
|
|
|
|
|
|
function StatManager:new(owner)
|
|
|
|
self.owner = owner
|
|
|
|
end
|
|
|
|
|
|
|
|
function StatManager:setStats(stats)
|
2021-07-03 09:52:00 +02:00
|
|
|
self.list = {}
|
2021-07-03 09:49:11 +02:00
|
|
|
for key, value in pairs(stats) do
|
2021-07-03 09:52:00 +02:00
|
|
|
self.list[key] = value
|
2021-07-03 09:49:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function StatManager:get(statname)
|
|
|
|
return self:computeStat(statname)
|
|
|
|
end
|
|
|
|
|
|
|
|
function StatManager:computeStat(statname)
|
2021-07-03 09:52:00 +02:00
|
|
|
return self.list[statname]
|
2021-07-03 09:49:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return StatManager
|