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

36 lines
926 B
Lua
Raw Normal View History

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
2021-07-03 12:56:32 +02:00
function StatManager:new(owner, battleStatType)
local battleStatType = battleStatType or "HERO"
2021-07-03 09:49:11 +02:00
self.owner = owner
2021-07-03 12:56:32 +02:00
self.battleStats = CONST.BATTLESTAT[battleStatType]
2021-07-03 09:49:11 +02:00
end
function StatManager:get(statname)
return self:computeStat(statname)
end
function StatManager:computeStat(statname)
return self.list[statname]
2021-07-03 09:49:11 +02:00
end
2021-07-03 12:56:32 +02:00
function StatManager:isBattleStat(statname)
return utils.table.contain(CONST.BATTLELIST, statname)
end
function StatManager:getBattleStat(statname)
return self.battleStats[statname]
end
2021-07-03 09:49:11 +02:00
return StatManager