PGRData/Resources/Scripts/XEntity/XReform/Buff/XReformBuffGroup.lua
2022-12-26 14:06:01 +05:30

43 lines
No EOL
1.1 KiB
Lua

local XReformBuff = require("XEntity/XReform/Buff/XReformBuff")
local XReformBuffGroup = XClass(nil, "XReformBuffGroup")
-- config : XReformConfigs.BuffGroupConfig
function XReformBuffGroup:Ctor(config)
self.Config = config
-- XReformBuff
self.Buffs = {}
-- key : id, value : XReformBuff
self.BuffDic = {}
self:InitBuffs()
end
-- 所有加成数据
function XReformBuffGroup:GetBuffs()
return self.Buffs
end
function XReformBuffGroup:GetBuffById(id)
return self.BuffDic[id]
end
function XReformBuffGroup:GetName()
return CS.XTextManager.GetText("ReformEvolvableBuffNameText")
end
--######################## 私有方法 ########################
function XReformBuffGroup:InitBuffs()
local config = nil
local data = nil
for _, id in ipairs(self.Config.SubId) do
config = XReformConfigs.GetBuffConfig(id)
if config then
data = XReformBuff.New(config)
table.insert(self.Buffs, data)
self.BuffDic[data:GetId()] = data
end
end
end
return XReformBuffGroup