erratum/bestiaire/classes/dataholders/boostholder.lua
Kazhnuz fcea7f2e4b
All checks were successful
continuous-integration/drone/push Build is passing
fix: utilisation des rangs plutôt que des niveaux
2024-09-02 15:51:37 +02:00

31 lines
No EOL
664 B
Lua

local BoostHolder = Object:extend()
function BoostHolder:new(list)
self.parent = list
self.table = {}
end
function BoostHolder:add(name, val)
if (self.table[name] == nil) then
self.table[name] = val
else
self.table[name] = self.table[name] + val
end
end
function BoostHolder:getValue(name, val)
if (name == "pv" or name == "pe") then
return val * 3
else
return val * 5
end
end
function BoostHolder:apply()
for key, value in pairs(self.table) do
-- TODO : a changer entièrement
self.parent:addToHolder(key, "lvl", self:getValue(key, value * 2))
end
end
return BoostHolder